Building Stable Off-chain Payment Networks

07/07/2021 ∙ by MohammadAmin Fazli, et al. ∙ 0

Payment channel is a protocol which allows cryptocurrency users to route multiple transactions through network without committing them to the main blockchain network (mainnet). This ability makes them the most prominent solution to blockchains' scalability problem. Each modification of payment channels requires a transaction on the mainnet and therefore, big transaction fees. In this paper, we assume that a set of payment transactions are given (batch or online) and we study the problem of scheduling modificiations on payment channels to route all of the transactions with minimum modification cost. We investigate two cost models for aforementioned problem: the step cost function in which every channel modification has a constant cost and the linear cost function in which modification costs are proportional to the amount of change. For the step cost function model, we prove impossibility results for both batch and online case. Moreover, some heuristic methods for the batch case are presented and compared. For the linear cost we propose a polynomial time algorithm using linear programming for the batch case.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Recently, blockchain-based decentralized cryptocurrencies like Bitcoin, Ethereum, and Zcash have got much popularity and attention. In these decentralized cryptocurrencies, transactions don’t need to be managed by third parties Zhou et al. (2020), but the problem with these currencies is their performance and scalability. Since their transaction throughput is bounded by maximum block size in the chain, they are not scalable for the high number of transactions Croman et al. (2016). For example, for bitcoin, the best known bound for average transaction throughput is seven transactions per second Georgiadis (2019). This value is an order of magnitude lesser than the transaction rate in everyday payments, such as Visa cards. Therefore, it will not be possible to use bitcoin in people’s daily life. Moreover, this low transaction rate has resulted in competition between users to finalize their transactions faster, which resulted in higher transaction fees.

Many solutions have been provided to solve the scalability problem in blockchain networks. Kim et al. Kim et al. (2018) and Zhou et al. Zhou et al. (2020) provide surveys on these solutions. Some of these solutions are on-chain methods, which try to solve the problem within the main blockchain, for example, by modifying some elements in the chain to increase the maximum block size. Other solutions are non-on-chain methods such as off-chain, side-chain, cross-chain, etc. These solutions use another network or chain to improve scalability outside the blockchain. One of these non-on-chain solutions, which was very promising in recent years, is payment channels. With this solution, some transactions will transfer to a temporary off-chain network to reduce the number of transactions on the main chain. Lightning network for Bitcoin and Raiden network for Ethereum are examples of such payment channel networks.

A payment channel is a cryptocurrency transaction on blockchain that deposits some money on the blockchain for exchange between two specific users Sivaraman et al. (2020). For instance, Alice can deposit 1 BTC into a multi-signature transaction (meaning that the signatures of both parties is needed for withdrawing) for sending to Bob. Setting up this transaction follows the common mechanism of transactions on blockchain and needs to be committed on main net. From now on, Alice can send money up to 1 BTC to Bob as many times as she wants by sending signed transctions from the deposit account. Bob can close payment channel by signing the last transaction and broadcasting it into the main net. This whole process just needs two commits on blockchain. The first one for setting up the payment channel and the second one for closing it.

However, payment channels can only handle transactions between two users. So, it won’t solve the scalability problem if everyone has to set up a payment channel to another user to provide fast payments to him. For this purpose, offchain networks of payment channels are proposed Poon and Dryja (2016). With these networks, This is where the Lightning Network comes up. With this network, every two users can make transactions if there is a path of payment channels between them.

In this paper, we target the problem of building stable payment networks. In this problem, every channel has a specific deposit. That means it can route transactions with values less than its deposit. We call this deposit channel capacity, and it decreases with routing every transaction. Also, we assume that every node in this network has a finite capital which means the sum of channels’ capacities sourcing from that node must be less than its capital. As a result, channels can’t have infinite capacity. Every change in channel capacities needs a transaction commit on the mainnet, and it is costly. In the target problem of this paper, a network of payment channels and a set of transactions on the network are given. Then, we want to schedule capacity changes on payment channels to minimize the cost of commitments on the mainnet.

To evaluate different scheduling algorithms, we investigate two cost models. The first one is the linear cost model. In this case, the change cost of a channel’s capacity is linearly dependent on the value of the change. The second one is the step cost model, which means the cost of capacity change is constant. Moreover, we check out two cases for transactions: the batch case and the online case. In the batch case, we assume that all the input transactions are given at time zero. In the online case, we suppose that at each time, we only know the next transaction. This paper proposes a polynomial-time algorithm to find the optimum solution for the linear cost model and the batch input case. For the step cost model and the batch input case, we prove the NP-completeness of the solution. For the step cost model and the online input case, we show no c-competitive algorithm such that , where is the maximum degree of nodes in our network. Finally, we propose some heuristic algorithms for the step cost model and the batch input case and compare their performance in a simulation.

This section will explain payment channels and the payment network concepts in more detail and then survey the literature. In the next section, we will propose the formal statement of our problem. After that, we will state the aforementioned theoretical results in finding optimum solutions. Next, we will present our report on heuristic algorithms and their performance. We will conclude this paper by reviewing the achievements made in this paper and the possible future works.

1.1 Payment channels

The Payment channel can be mono-directional or bi-directional. First, let’s see the mono-directional form. Imagine the case that Alice wants to open a payment channel with Bob with the capacity of 1 BTC. She has to deposit this money in a multi-signature address. All the transactions on this address need the signature of both Alice and Bob to be performed. If Alice wants to pay 0.1 BTC to Bob, she creates a transaction that gives 0.9 BTC from that specific address to Alice and gives 0.1 BTC to Bob. She signs this transaction and gives it to Bob. Sometime later, when Alice wants to pay another 0.2 BTC to Bob, she writes a transaction that gives 0.7 BTC to herself and gives 0.3 BTC to Bob. Again, she signs this transaction and gives it to Bob. Whenever Bob wants to withdraw his money, he can sign the transaction (complete the needed signatures), and then, this transaction will broadcast on the main blockchain and close the channel. Note that he can’t commit any other transaction after Bob has committed the last transaction. In Figure 1, you can see this scenario.

The problem here is that if Alice wants her 0.7 BTC, she depends on Bob’s action. Thus, there must be a deadline for Bob to withdraw the money; otherwise, all the money will turn back to Alice. A transaction that gives all the money to Alice after some time will do this aim. Before Alice funds the address, Bob will write and sign this transaction and gives it to Alice. Then, Alice will fund the channel.

However, mono-directional payment channels do not look promising because they only allow one-way payments. So there is a need for bi-directional channels. In a bi-directional channel, both Alice and Bob create guarantee transactions and give them to each other. After that, they both fund the channel, for example, by and values. Now, if Alice wants to pay Bob , she can create a transaction that gives herself and gives Bob , sign it and give it to Bob. Then, if Bob wants to give Alice , he can write a transaction which gives Alice and gives himself and so on.

Since these channels (both mono-directional and bi-directional) only need two transactions on the main blockchain (one for opening and one for closing), they look very promising for solving the scalability problem of blockchain-based payments.

Figure 1: The Payment Channel Mechanism

1.2 Payment Networks

Although payment channels need just two transactions on the blockchain, if everyone has to create a payment channel with another one, it doesn’t solve the scalability problem. Creating these many channels and closing them needs a lot of time and locks many coins only for future payments. Here the solution of payment networks comes up. Payment networks are graphs in which users are the nodes, and payment channels between them are edges. If some user Alice wants to pay some money to user Carol and there is a path between them in the graph, they can do their transaction only if the value of the transaction is less than the channels’ capacities in this path (See Figure 2).

Figure 2: A Payment Network; Alice wants to pay 0.2 bitcoin to Carol. This payment is impossible through the Alice-Will-Scarlet-Carol path because the channel between Scarlet and Carol has not enough capacity. However the Alice-Bob-Carlo path makes it possible. First, Alice pays 0.2 BTC to Bob through her channel to him. Then Bob pays this money to Carol through his channel to him.

One of the main problems with payment networks is how to incentivize intermediate nodes to route other nodes’ transactions. This problem can be solved by giving a routing fee to all users in the path. With routing fees, the users in the network tend to create more channels with higher capacities to achieve more fees.

Another problem with this network is that intermediate users can steal the routing coins. Hash-locked contracts can prevent this. Hash locked contracts are transactions that can only be finalized by providing a specific proof. For instance, assume Alice wants to pay Carol, and there is a path of length 2 (Alice-Bob-Carol) between them. First, Carol has to generate a private key and a public key and give the public key to Alice. Then, Alice makes a transaction with Bob, which needs the private key to be done. Also, Bob makes a similar transaction with Carol. Now Carol provides the private key and does the transaction between herself and Bob. After that, Bob will know the private key, and he can also give the private key and do the transaction between herself and Alice.

The Lightning Network is the payment channel network for bitcoin. The Raiden Network is the Ethereum version. It is very similar to the Lightning Network except that it supports different types of transactions while the lightning network supports only bitcoin transactions.

1.3 Related Work

Kim et al. Kim et al. (2018), and Zhou et al. Zhou et al. (2020) provide surveys on solutions to the scalability problem on blockchain-based payments. As one of the most promising solutions, researchers have proposed various payment channel protocols (networks) which present how to create a payment channel Avarikioti et al. (2020b); Decker and Wattenhofer (2015); Poon and Dryja (2016); Green and Miers (2017). However, the current work is independent of channel protocols and applies to all such solutions. The Lightning Network, which is the most famous payment channel, was first introduced in Poon and Dryja (2016).

Most of the optimization and algorithmic research works done by a team resided in the ETH university. Avarikioti et al. Avarikioti et al. (2018a) study the optimal structure of the channels’ network and the allocation of charges to them to maximize the profit of the payment service provider (PSP). In their other work Avarikioti et al. (2018b), proposes three optimization problems in the context of payment network design. All of those problems are variants of the General Network Design problem. In this problem, a set of transactions, a capital, and a profit are given. The problem asks to design a network and a strategy to route the transaction through the network. The first target problem gets a set of transactions and asks whether it is possible to route all of them from a single bidirectional channel between two users. The second problem gets a set of transactions and asks to return a graph with the minimum possible capital. The third problem receives a set of transactions, a graph, and a capital and asks whether there is a capital assignment to the graph’s edges that can route all the transactions. They present hardness results and approximation algorithms for the batch case of these three problems. For the online case, they give an impossibility result for the first problem and a competitive algorithm for the second problem.

The ETH team has also focused on some other aspects of payment channels. For example, in Avarikioti et al. (2020a)

, they explore the game theory of payment networks. They assume that the users in the network are selfish players, and they compete to earn more. Then study the Nash equilibrium of the network creation game, which are the topologies that emerge from their interactions. For investigating the topology, they consider betweenness and closeness centrality as the central concept. At last, they determine the social optima for the network topology.

There are some other works targetting payment channels and the Lightning Network. Most of these works are unrelated to this paper, but some of them are surveyed as examples. Sivaraman et al. Sivaraman et al. (2020) Claim that shortest-path routing is not a good idea for routing transactions on payment networks (because of the limited capacity of channels, some important channels may get exhausted, and the system will stop working). Then, it provides a new routing solution of transactions to achieve high throughput. Prihodko et al. Prihodko et al. (2016) provide another routing algorithm of transactions in the Lightning network called Flare. Seres et al. Seres et al. (2020) analyze the effects of the Lightning network’s topology on its security and its robustness against failures and attacks. Herrera et al. Herrera-Joancomartí et al. (2019) mention that the precise balance of the pair of nodes in payment networks has to be kept secret due to privacy problems. Then, they investigate the problem of hiding this balance and having working routing algorithms simultaneously and proposes an attack to reveal the balance of a channel.

2 The Problem Statement

Here we will go with the formal definition of our problem. We are given a payment network , Where V stands for a set of nodes that are cryptocurrency users (more precisely, addresses) and can have payment transactions between themselves. is the set of ’s payment channels. Each , is a directed pair . These channels can be used for money transfers. The capacity of each channel is defined by a function , where is the set of times. Without loss of generality, we can assume that times are positive integers from 1 to , which means: .

Definition 1.

For every channel in graph the capacity of channel at time is represented by , where is the capacity function and and is the number of time steps.

Now, suppose that a set of transactions is given. Without loss of generality we can assume that in each time we have exactly one input transaction . Thus, the number of input transactions is equal to n. Each transaction is defined like this: , where are the source and the destination of the transactions, is a path (an ordered set of channels) in between and and finally, is the value of transaction . In practical settings most of the times this path is the shortest path between and in (but sometimes it is not a good idea to use the shortest path, See Sivaraman et al. (2020)). The transaction can be executed in if:

.

In this paper, we want to schedule the modifications of ’s channels’ capacity in a way that can route all the input transactions with minimum cost. Each channel’s capacity is constrained by its connected nodes’ capital. We define the capital of each node as a function , where represents ’s capital at time .

Definition 2.

For every node in graph , the capital of node in time step is represented by , where is the capital function and and is the number of time steps.

We assume that no node can change its capital while processing payment transactions. Therefore, can only be increased or decreased by transactions. decreases when is the source of a transaction, i.e., wants to pay some amount of money to someone. In the same way, increases when is the destination of a transaction, i.e., someone wants to pay some money.

Lemma 1.

With set of transactions , the capital of node at time can be represented in this way:

Our desired scheduling plan consists of a scheme for each channel. The scheme for each channel is defined as a sequence of channel modifications , where is the number of modifications by our plan on channel , is the scheduled time for th modification (with ) and is the new amount which gets after this modification. Note that its initial value equals to the initial capcity of channel .

Definition 3.

A channels modification scheme for edge is defined in a way that is the value of capacity of channel between times and . We can represent this definition by this formula:

where is the path in reverse direction.

This paper defines the problem of designing a plan for scheduling the input payment transactions on a given payment network as an optimization problem with a set of constraints and an objective function. The constraints are defined based on the fact that each node must provide the capacity of its outgoing channels, and the sum of its outgoing channels capacities should be less than its capital. more formally: , where is the set of edges sourced by , i.e. .

For the optimization objective, we consider two different functions, the linear cost function, and the step cost function. The linear cost function measures the cost of each channel modification by its amount of change in its capital.

Definition 4.

For a given graph and a set of transactions and a channels modifications scheme , we can define the linear cost function of channels modifications as follows:

The step cost function computes the cost as the number of changes to the capacities.

Definition 5.

For given graph and set of transactions and channels modifications scheme , we can define the step cost function of the channels modifications as follows:

Finally, with these definitions, we can propose the formal statement of our problem.

Problem 1.

Scheduling capacity changes on payment networks with linear cost
Given a graph and a set of transactions , we want to propose for every in a way that minimizes and meets these constraints:

where is capacity function of edge , is capital function of node and is set of outgoing channels from .

Problem 2.

Scheduling capacity changes on payment network with step cost
Given a graph and a set of transactions , we want to propose for every in a way that minimizes and meets these constraints:

where is capacity function of edge , is capital function of node and is set of outgoing channels from .

We face these two problems with two types for , batch and online. In the batch form, all are given at first, But, in the online form in every time step we just have and we don’t know the future transactions.

3 Theoretical Results

In this section, we are going to investigate the optimal solution to the problems stated in Section 2. For the problem 1, which used the linear cost function, we propose a linear programming algorithm for scheduling modifications in polynomial time. For the problem 2, we investigate both batch and online cases. For the batch input case, we reduce a well-known fault caching problem to our problem. Moreover, as it is proved that fault caching is an NP-Complete algorithm, we can conclude that the problem 2 is NP-Complete either. For the online input case, we define the competitiveness, and then we prove that there are no c-competitive algorithms for our problem where and equals the maximum degree of nodes in the graph. For that purpose, for each algorithm, we devise a graph in which the cost of the algorithm will be greater than the optimal cost multiplied by .

3.1 Batch Input - Linear Cost

The following theorem shows that this case of the problem is solvable in polynomial time by a linear programming.

Theorem 1.

The problem 1 with batch input can be solved in polynomial time.

Proof.

The following LP can model the problem. The first condition ensures that the scheduling plan is executable at each time. The second condition guarantees changes will not set the capacity of edges to a negative value. The third constraint ensures that the payment network can route all the incoming transactions. Th final condition guarantees the validity of nodes’ capitals.

As all the constraints are met and the algorithm minimizes the cost function, it finds the optimal solution. This linear programming problem can be solved in polynomial time and gives the optimal solution.

3.2 Batch Input - Step Cost

In this subsection, we show that the problem of scheduling capacity changes on payment networks with the step cost function is NP-complete. To this aim, we use a reduction from another NP-complete problem called the Fault Caching problem (Chrobak et al. (2012)).

Problem 3.

Fault Caching problem
Assume that we are given set of pages with sizes . Assume that we have a cache of size . In each time we can store a set of pages in the cache if the sum of their sizes is less than . A series of page requests will come in an order where and is requested at time . If at time is not available in cache we say that a fault happens. The Fault Caching problem asks for a replacement policy that makes responding to s with at most faults.

Theorem 2.

The problem of scheduling capacity changes on payment networks with the step cost function is NP-complete.

Proof.

We want to make a reduction from the Fault Caching problem to our target problem. To this aim, consider the graph with and where all s are from to and . Now we construct transactions like this:

where gives index of the requested page.

We show that the answer to the Fault Caching problem is yes if and only if we can find a modification schedule for and with cost less than or equal to .

First, we prove the if part. Consider a solution of the Fault Caching problem like this: pages that are dropped in time and set of pages that are brought to the cache in time . Also set set of pages that are brought to the cache at time . we construct the solution in this way:

So the cost of this modification schedule is at most .

Secondly, we prove the only if part. Suppose we have solution for the scheduling problem. For each time step that e is not same as we change to if and remove from if . (we do this sequentially ordered by , starting from 1). The resulting schedule is valid and the sum of sizes of s is less than its value for original schedule.

Then, at each time step , starting from 1, we decrease to . The resulting schedule still satisfies the question and has a cost of at most .

Now we construct the solution of Fault Caching problem in this way:

and the reduction is complete. We know that the Fault Caching is NP-complete and it’s reduced to scheduling problem above in polynomial time, thus, we can infer that scheduling problem with Batch input and step cost is NP-complete. ∎

3.3 Online Input - Step Cost

In this subsection, we study the problem of scheduling capacity changes on payment network with the step cost function and online input. With this type of input, in every time step we just have and we don’t have any information about the future transactions. In this context, we deal with online algorithms and competetive analysis.

In competitive analysis, an online algorithm is compared to an optimal offline algorithm. An optimal offline algorithm knows the entire request sequence in advance and can serve it with minimum cost. Given a request sequence , let denote the cost incurred by and let denote the cost incurred by an optimal offline algorithm . The algorithm is called -competitive if there exists a constant such that:

for all request sequences . Here we assume that is a deterministic online algorithm. The factor is also called the competitive ratio of (Albers (1996)).

Theorem 3.

Given a graph and a set of online transactions . There is no deterministic -competitive online scheduling algorithm such that (maximum degree of nodes in ) for finding the minimum cost modification schedule with the step cost function :

Proof.

Let be the optimal batch solution. For each deterministic algorithm we devise a network and a series of transactions such that:

Consider a graph and where all s are edges from to . For algorithm we have:

We devise such that:

With this input for every we have in . Thus, for every time step we have at least one changes so:

but for optimal solution, , when we need an increase to at time step i we decrease such that . Thus, needs a change for every step. So:

4 Heuristic Algorithms

In previous sections, we approached the problem of finding the minimum cost modification schedule for a given payment network and set of transactions in four different cases: Batch input-linear cost, Batch input-step cost, Online input-step cost, Online input-linear cost.

For the batch input-step cost case, we proved that finding the optimum solution is NP-complete. This section will try some heuristic algorithms for this case, and we will compare their performances to find out the best heuristic. First of all, we will give a model of the problem of implementing heuristics for that. Then, we will introduce the heuristic algorithms we want to try. Finally, We will show empirical results and compare them.

4.1 Model

Suppose that we have a graph with channels and a set of transactions , over , with transactions. Again, according to the definition of the problem, each channel and node has a capacity. Node capacities cannot change, but channels’ capacity can change with cost for each modification. The sum of capacities of all channels of a specific node can’t be greater than the capacity of that node. Now, assume that we have found a solution for the problem.

The procedure of the algorithm will be in this way: At each step , will do some modifications on channels’ capacities, and the cost will increase by the number of modifications. Then, transaction of will be executed, and the capacity of channels in the path of , the capacity of the source node, and capacity of target node will decrease by the value of . If limits of capacities cannot route the transaction, the solution will get some penalty, and the cost will increase by that, and will be skipped. This procedure will repeat from to .

We want to use an array to represent solution and then try to change that array with heuristic algorithms to find better solutions. The first and the most straightforward way to represent is to use a 2D matrix. The number in row and column of the matrix will be the value of modification on channel in step . The cost of the solution will be the number of non-zero elements plus the penalty for the number of skipped transactions.

However, there are some problems with this way of solution modeling. One problem is that the number of parameters in the solution matrix array is , i.e., the number of channels times the number of transactions. This number of parameters will increase our heuristic algorithms’ time and complexity and increase randomness in our algorithms.

Another problem is the way we represent the numbers in the matrix. If the numbers are absolute values of increase or decrease to capacities, those values may depend on every capacity and transaction’s values. Also, these values have no bound and can change from minus infinity to plus infinity. These problems can make the progress of the algorithm hard and slow. However, if, in some way, we can use normalized coefficients from 0 to 1 instead of these absolute values, that can make our problem easier.

For finding a better way to represent a solution of an algorithm in an array, we will use some lemmas. Here we will discuss these lemmas.

Lemma 2.

Assume that in step we have transaction that uses path . Define the set of all nodes in path . If two nodes and are not in , there is no need to change capacity of edge between and , in step .

This lemma is quite intuitive because we can push changes to irrelevant edges to the next steps, and the resulting cost will be less than or equal to the first solution.

Lemma 3.

If a transaction in step has value and there is channel in path of and capacity of is greater than , there is no need to change the capacity of in step .

The intuition behind this lemma is just like before. We can push changes to edges that have enough capacity for now to the next steps.

Now we can provide another model for our solution . We will have an array of numbers between and to represent this solution. Every step a transaction needs to pass through a channel, we check that if the channel’s capacity is enough for that value, we let it go and do not change the channel capacity. But, if the channel’s capacity is not enough, there can be two states.

First, the source node’s capacity is enough, but the channel’s capacity is not enough. We increase the channel’s capacity as much as it can pass the transaction; then, we increase it by the amount that it can increase multiplied by a coefficient from the solution array.

Another state is when both the channel’s capacity and the source node’s capacity are not enough. In this state, we need to decrease the capacity of other channels connected to the source node so that its capacity will increase, and then we can act like before. Therefore, we go through all other channels connected to the source node and multiply them by a coefficient from the solution array. Whenever the node capacity is enough for the transaction to pass, we change the channel’s capacity like the former state.

There is a problem with this model, and that is the length of the array. If the array’s length is too long, then there would be some parameters that are not useful. If the length of the array is too short, then we lack some coefficients for our solution. To tackle this problem, we assumed that if we ran out of coefficients in the solution, we use 0 as the coefficient. Also, we consider the length of the solution array as a hyper-parameter to our heuristic model that can be tuned, and different values can be checked to find the best one.

4.2 Algorithms

After providing a model for our algorithm and its solution, we will test some heuristic algorithms to find the best solution and compare their performance. Here we’ll explain these algorithms.

  • Alg1

    . This algorithm is based on Genetic Algorithms

    Yang (2020). First, we create random solution arrays to the number of population. Then, in each generation, we calculate the fitness function for each solution and find the best ones as parents. Then we do a crossover between those selected solutions and do some random mutations on resulting arrays. The resulting arrays after crossover and mutation plus the parent arrays will form the next population. This process will repeat until the algorithm converges or the maximum number of generations exceeds.

  • Alg2. This algorithm is based on Random Hill Climbing. At each step, we move our solution to a new random state. That means we increase or decrease some random elements of our array by a constant step. After each move, we calculate the fitness function of our array, and if it has improved, we stay; otherwise, we step back to the previous solution. This process repeats until the maximum number of steps exceeds.

  • Alg3. This algorithm is based on Late Acceptance Hill-Climbing Burke and Bykov (2017). Researches have shown the superiority of this algorithm over other optimization methods in many application fields. It is similar to the previous algorithm, but it has a history array. After each step, it checks the solution’s fitness with the previous step and with fitness in specific steps before from our history array. For example, if we are in step 52 and the history array’s length is 30, our algorithm compares the fitness of the next step with the previous one and the number in the index of 22 in our history array. If it is better than any of them, it will move to the next step. Moreover, if new fitness is better than the fitness in our history, it will replace it in the history array. This process repeats until the maximum number of steps exceeds.

  • Alg4. This algorithm is based on the PSO algorithm Yang (2020). It initiates a population of swarms with a position in search space and a velocity. At each step, this algorithm updates the velocity of each particle using the PSO well-known formula depending on its current position, its best-known position, and the best-known position of the entire swarm. Then, it updates the particle’s position depending on this new velocity. If this new position’s fitness is better than this particle’s best-known position or the entire swarm’s best-known position, updates them. This process repeats until the algorithm converges or the maximum number of generations exceeds.

  • Alg5. This algorithm is based on Simulated Annealing Delahaye et al. (2019)

    . It initiates the algorithm with a state and a temperature. Each step moves the state (like movements we had in Alg3 or Alg2) and calculates its fitness. Then calculates the probability of acceptance of the new state with this formula:

    . Then, it compares acceptance probability with a random number, and if it is greater than that, it moves to the new state. After each step, the temperature decreases by being multiplied by a constant. This process repeats until the temperature goes below some specific number.

4.3 Empirical Results

In this subsection, we present the results of experimenting with the heuristics mentioned above on real-world data. For data of nodes and channels, we used https://github.com/fiatjaf (2020) API and crawled data from that. This data was massive, So for making it smaller, we sampled a connected graph from it.

There is no open dataset for transactions over the Lightning network. So we generated a random transaction dataset by choosing some random paths in our graph and some random values from the uniform distribution. We used the number of changes in channel capacities as our objective function. For each algorithm, some hyper-parameters must be tuned—for example, the length of the solution array or the coefficient of temperature in simulated annealing. We ran many simulations and tests on algorithms to find the best hyper-parameters for each one of them.

The result of growth and convergence of algorithms can be seen in Figure 3. From this simulation, these results can be concluded:

  • The best overall efficiency was obtained from Alg3, which is based on the Late Acceptance Hill Climbing, with the second-best being Alg4, which is based on the classic PSO algorithm. Late Acceptance Hill Climbing has shown to be very effective in many other applications.

  • Alg4 and Alg5 converge after few steps, but Alg1, Alg5, and Alg2 took much more time to converge.

  • Alg3 is not having improvements at the first steps, but it starts at the ending steps. Maybe it depends on the length of the history array in our Late Acceptance Hill climbing algorithm

  • All the algorithms were stable and converged.

Figure 3: Simulation results for the Stable network problem with 5 different algorithms.

5 Conclusion

We formalized the problem of capacity changes scheduling on payment networks while minimizing the cost of maintaining the network.

We have considered different types of this problem, depending on the input type of transactions and the cost function type. We proposed a polynomial-time algorithm for the batch input and the linear cost case for finding the optimal solution using linear programming. We proved the NP-completeness of finding the optimal modification scheme for the batch input and the step cost function. For the online input and step cost case, we proved no deterministic c-competitive online scheduling algorithm such that , where is the maximum degree of the nodes in our payment network.

After that, we proposed some heuristic algorithms for the batch input and step cost case. We ran some simulations on those algorithms and compared them in an empirical experiment. This paper’s results and algorithms can be used in all off-chain payment networks like the Lightning Network or the Raiden Network.

We have not addressed other cost functions. Moreover, we have not considered the general form of the problem, the problem in which a general function is assumed as a cost function.

For the heuristic part, we have not implemented heuristic algorithms for other cases, such as online input and step cost. Additionally, There are more heuristic algorithms we could investigate.

These are the problems that need to be addressed in the future.

References

  • S. Albers (1996) Competitive online algorithms. Computer Science Department, University of Aarhus. Cited by: §3.3.
  • G. Avarikioti, G. Janssen, Y. Wang, and R. Wattenhofer (2018a) Payment network design with fees. In Data Privacy Management, Cryptocurrencies and Blockchain Technology, pp. 76–84. Cited by: §1.3.
  • G. Avarikioti, Y. Wang, and R. Wattenhofer (2018b) Algorithmic blockchain channel design. arXiv preprint arXiv:1810.07603. Cited by: §1.3.
  • Z. Avarikioti, L. Heimbach, Y. Wang, and R. Wattenhofer (2020a) Ride the lightning: the game theory of payment channels. In Financial Cryptography, Cited by: §1.3.
  • Z. Avarikioti, O. S. T. Litos, and R. Wattenhofer (2020b) Cerberus channels: incentivizing watchtowers for bitcoin. In International Conference on Financial Cryptography and Data Security, pp. 346–366. Cited by: §1.3.
  • E. K. Burke and Y. Bykov (2017) The late acceptance hill-climbing heuristic. European Journal of Operational Research 258 (1), pp. 70–78. External Links: ISSN 0377-2217, Document, Link Cited by: item 3.
  • M. Chrobak, G. J. Woeginger, K. Makino, and H. Xu (2012) Caching is hard—even in the fault model. Algorithmica 63 (4), pp. 781–794. Cited by: §3.2.
  • K. Croman, C. Decker, I. Eyal, A. E. Gencer, A. Juels, A. Kosba, A. Miller, P. Saxena, E. Shi, E. G. Sirer, et al. (2016) On scaling decentralized blockchains. In International conference on financial cryptography and data security, pp. 106–125. Cited by: §1.
  • C. Decker and R. Wattenhofer (2015) A fast and scalable payment network with bitcoin duplex micropayment channels. In Symposium on Self-Stabilizing Systems, pp. 3–18. Cited by: §1.3.
  • D. Delahaye, S. Chaimatanan, and M. Mongeau (2019) Simulated annealing: from basics to applications. In Handbook of metaheuristics, pp. 1–35. Cited by: item 5.
  • E. Georgiadis (2019) How many transactions per second can bitcoin really handle ? theoretically.. Note: Cryptology ePrint Archive, Report 2019/416https://eprint.iacr.org/2019/416 Cited by: §1.
  • M. Green and I. Miers (2017) Bolt: anonymous payment channels for decentralized currencies. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 473–489. Cited by: §1.3.
  • J. Herrera-Joancomartí, G. Navarro-Arribas, A. Ranchal-Pedrosa, C. Pérez-Solà, and J. Garcia-Alfaro (2019) On the difficulty of hiding the balance of lightning network channels. In Proceedings of the 2019 ACM Asia Conference on Computer and Communications Security, Asia CCS ’19, New York, NY, USA, pp. 602–612. External Links: ISBN 9781450367523, Link, Document Cited by: §1.3.
  • https://github.com/fiatjaf (2020) Bigsun lightning network api. Note: https://ln.bigsun.xyz/[Online; accessed April-2020] Cited by: §4.3.
  • S. Kim, Y. Kwon, and S. Cho (2018) A survey of scalability solutions on blockchain. In 2018 International Conference on Information and Communication Technology Convergence (ICTC), Vol. , pp. 1204–1207. Cited by: §1.3, §1.
  • J. Poon and T. Dryja (2016) The bitcoin lightning network: scalable off-chain instant payments. Cited by: §1.3, §1.
  • P. Prihodko, S. Zhigulin, M. Sahno, A. Ostrovskiy, and O. Osuntokun (2016) Flare: an approach to routing in lightning network. White Paper. Cited by: §1.3.
  • I. A. Seres, L. Gulyás, D. A. Nagy, and P. Burcsi (2020) Topological analysis of bitcoin’s lightning network. In Mathematical Research for Blockchain Economy, pp. 1–12. Cited by: §1.3.
  • V. Sivaraman, S. B. Venkatakrishnan, K. Ruan, P. Negi, L. Yang, R. Mittal, G. Fanti, and M. Alizadeh (2020) High throughput cryptocurrency routing in payment channel networks. In 17th {USENIX} Symposium on Networked Systems Design and Implementation ({NSDI} 20), pp. 777–796. Cited by: §1.3, §1, §2.
  • X. Yang (2020) Nature-inspired optimization algorithms: challenges and open problems. Journal of Computational Science 46, pp. 101104. Cited by: item 1, item 4.
  • Q. Zhou, H. Huang, Z. Zheng, and J. Bian (2020) Solutions to scalability of blockchain: a survey. IEEE Access 8 (), pp. 16440–16455. Cited by: §1.3, §1, §1.