I Introduction
Bitcoin is firstly issued by a blockchain [1] and the most widely used valuable decentralized digital currency [2]. However, it faces a serious issue, i.e., the scalability problem. To solve this problem, a Layer2 system named Lightning Network (LN) [3] is introduced, which is an offchain payment solution for performing decentralized digital currency payment on top of a blockchain. Specifically, LN is something like the Virtual Private Network (VPN) which establishes a virtual peertopeer connection over the Internet. LN theoretically enables fast and secure mircopayments between participating nodes, which features an overlay system for making payments through a network without delegating custody of funds [3]. LN is constituted of numerous payment channels that allow the twoparty connect by a payment channel securely maintain and update its own ledger by RSMC (Recoverable Sequence Maturity Contract) [3]. To leverage the existing payment channels to perform endtoend payments, the payment channel network is introduced. Furthermore, HTLCs (Hashed Timelock Contracts) [3] is designed, which enables a payment acrosses two or more payment channels with security.
Benefiting from LN, any transaction between the two nodes among LN can be performed and updated rapidly (an payment takes about ms [4]) instead of confirming by blocks (a onchain payment should be confirmed by blocks and take about minutes on July 2018 [5]). As the scale of LN is growing, some limitations have been highlighted, such as sensitive information leakage issue [4, 6], payments concurrency issue [4], skewness issue [7], route scalability issue [8, 9] and so on. Meanwhile, several works have studied on these limitations [4, 6, 7, 8, 9, 10]. In addition, similar payment systems such as credit networks [11, 12] also offer some solutions for these analogous issues [13, 14, 15].
In LN, we observe a payment issue where a node has enough deposits to pay another node while there is no payment channel available to perform this payment. We call this shares issue, which appears commonly in the current Layer2 Network. In particular, the shares issue is illustrated in Fig. 1. Alice is willing to pay Bob bitcoin while Alice cannot find an available routing path to fulfill this payment. One naive solution is that Alice requires to close the three channels and withdraw all her deposits and then sets up a new payment channel to Bob to fulfill this payment, where the close and set up operations must be claimed to the blockchain for confirming. A node which sets up and closes a payment channel need pay extra fees [3]. In addition, the naive solution might also introduce a skewness issue [7] and payment value privacy issue [4]. Therefore, the shares issue not only consumes an extra time and consumes an extra money but also might introduce the other issue such as the skewness and privacy issues.
In this paper, we propose Rapido to address the shares issue, which is general and applicable to all payments among the Layer2 Network. Different from LN, a new routing algorithm that incents the nodes always online is proposed in Rapido. Besides, as a transaction is generated, the payment value can be split into several shares by the Value Distributing Problem (VDP) program and then respectively distributed to the other node through these discovered routing paths. With the VDP program, Rapido not only mitigates the skewness of nodes but also preserves the privacy of payment value through splitting the value into shares. In addition, we design DHTLC (DistributedHTLC) to guarantee these payments with security. The blue dash lines in Fig. 1 represent one instance of Rapido to resolve the shares issue.
To summarize, the contributions of our paper include the following.

We observe a payment issue, the shares issue, which might appear in the Layer2 Network and causes timeconsuming and moneycosts.

We design Rapido to mitigate the shares issue, which is equipped with DHTLC and inherently preserves the privacy of total payment value.

We prove that the VDP is NPhard.

The simulation demonstrates that Rapido not only mitigates the shares issue but also mitigates the skewness of nodes.
Ii Background AND PRELIMINARIES
In this section, we demonstrate the necessary background of our paper including the blockchain and LN.
Iia Blockchain
A blockchain is a growing list of records, calls blocks, which are linked using cryptography [1]. Blockchains which serve as the public transaction ledger of cryptocurrencies and are readable by the public of these cryptocurrencies, such as bitcoin [1] and ethereum [16]. Each block contains a cryptographic hash of the previous block, a timestamp and transaction data. By design, a blockchain is resistant to modification of the data. It is “an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way”. To use as a distributed ledger, a blockchain is typically managed by a peertopeer network collectively adhering to a protocol for internode communication and validating new blocks. Once recorded, the data in any given block cannot be altered retroactively, which requires a consensus of the network majority.
Bitcoin is a widely used cryptocurrency, a form of electronic cash [1]. Bitcoins can be paid among the peertopeer bitcoin network directly, without the need for intermediaries, though most transactions are made through a cryptocurrency exchange market. Transactions are verified by nodes through cryptography and recorded in a public distributed ledger (blockchain). However, it brings some serious issues, such as the bitcoin scalability problem. In the real world, the onchain transaction processing capacity maximum is estimated TPS, which is limited by the average block creation time (about minutes) and the block size limit (MB) [17].
IiB Lightning Network
To mitigate the bitcoin scalability problem, various solutions are proposed, such as forks (hard fork and soft fork) [18] and the Layer2 systems (LN [3] and Sprites [8]). fork means the protocol changes and divides the blockchain into two distinct entities, which is typically conducted in order to add new features to a blockchain to reverse the effects of hacking or catastrophic bugs [18]. Different from fork, the Layer2 Network is implemented on top of the blockchain (most commonly bitcoin network) as a cache to allow payments to be performed while does not immediately claim on the blockchain [3]. LN is a Layer2 Network, which is constituted of a mass of bidirectional payment channels^{1}^{1}1For simplicity, in following payment channel of this paper means bidirectional payment channel. and theoretically enables fast transactions between participants.
IiB1 Payment Channels
LN, which constitutes of numerous payment channels, is a technique designed to allow two participants to make multiple transactions (e.g., bitcoin) without committing all of the transactions to the blockchain. Each payment channel has two parties, who deposit their own bitcoins and make many secure payments between each other in exchange for making only a few events (e.g., open a new payment channel) on the blockchain. Consequently, the payment channel improves the transaction throughput and eliminates the transfer fee between the two participants. Furthermore, Revocable Sequence Maturity Contract (RSMC) [3] must be leveraged one each payment channel, which guarantees the transactions’ safety between twoparty.
IiB2 Payment Channel Network
A payment channel only permits secure transfer of funds inside a channel while it cannot perform a payment between an indirectlinked twoparty. The payment channel network is hence introduced, which is able to perform a secure payment using a series of payment channels by Hashed Timelock Contracts (HTLCs) [3]. HTLC leverages hashlocks and timelocks and can allow payments to be securely routed across multiple payment channels without any risk of intermediate nodes stealing the payment in transit.
In a nutshell, suppose that Alice wants to pay Bob bitcoin through Carol. As an intermediary, Carol earns transfer fees from this payment. The brief steps are shown in Fig. 2 and represented as follows.

Bob generates a random number and calculates its SHA256 hash .

Bob gives to Alice by secure ways (out of the scope of our paper). Carol will earn bitcoin as transfer fees.

Alice uses her payment channel to pay Carol bitcoin, but she adds a hashlock that Carol gives her to the bitcoin along with an extra condition: in order for Carol to withdraw the bitcoin, she must provide which was used to produce in days^{2}^{2}2We use days here as in the original description [3]. Instead, the height of blocks is used for description in the real world.. Carol uses her payment channel to pay Bob bitcoin, but she also adds a same hashlock that Bob gives her to the payment along with an extra condition: in order for Bob to withdraw the bitcoin, she must provide which was used to produce in days.

Bob has which is used to generate , so Bob can use it to unlock the hashlock and fully receive the bitcoin from Carol; Carol also uses the to unlock the hashlock from Alice. Finally, Bob receives bitcoin from Alice. In addition, Carol earns bitcoin as transfer fees.
IiB3 Routing
In LN, the source should find a routing path to the destination while a payment is generated. The LN routing discovering implements a modified version of Dijkstra’s algorithm to find the shortest path between the them [19]. If the available routing path is found by the source, it returns a series of intermediate nodes which encoded the chosen path from the destination to the source.
Iii Motivation and Overview
In the following, we first describe an example to illustrate that the payment performed on the LN causes timeconsuming and moneycosts. Then, we discuss the motivation of this paper. Lastly, we propose the overview for Rapido.
Iiia An Illustrative Example and Motivation
Although LN enables fast payments between participating nodes and has been touted as a solution to the bitcoin scalability problem, drawbacks are also obvious. For example, some payments might not be performed through LN directly.
Fig. 1 describes a simple payment case to elucidate the abovementioned drawbacks. Suppose that the simple topology is a part of LN. Moreover, we suppose that Alice has and only has routing paths to Bob. However, the naive solution not only cannot resolve the shares issue but also brings some issues (privacy, skewness issue, an extra timeconsuming and an extra moneycosts) , which has been discussed in Section I. These issues endows LN with a poor efficiency, which goes against the original intention of LN.
Some existing works focus on LN [4, 7, 8], such as a skewed network issue [7] and the payment value’s privacy issue [4]. For executing a rebalance process, all participants of rebalance process need to negotiate a better ratio with each other before a rebalance is proceed. A rebalance process might be aborted if the negotiation process fails. Moreover, the participants must be in a loop [7]. Furthermore, REVIVE cannot resolve the shares issue which is shown in Fig. 1. For the privacy of payment value, the authors suppose that all intermediate nodes among a payment path are honest and then a trust function is revealed to all of them. By this way, any intermediary of this payment path has the knowledge of the payment value. However, no one can guarantee that all the intermediary are honest [4].
We propose an idea to resolve the shares issue by multiple path payments. As shown in Fig. 1, in an alternative case, Alice splits bitcoins into shares, such as , and , and respectively sends the shares to Bob through Dani, Carol and Eva, which does not require to close any existing payment channel or set up a new one. We hereby propose a new scheme, named Rapido, that a customer can perform a payment by splitting the payment value into shares and then respectively performs the payments to the merchant. Rapido can mitigate the abovementioned issues, such as shares, skewness, payment value privacy timeconsuming and moneycosts issues, and then perform payments more efficiently among the Layer2 Network.
IiiB Challenges
To realize Rapido, there are some challenges to be solved..

How can a customer find available routing paths to the merchant effectively and efficiently.

How to design a split strategy of payment value for customers and avoid serious skewness.

How to design a smart contract to fulfill the payment effectively and securely.
For the first challenge, we implement a routing discovering algorithm with a proactive and a reactive part. For the second challenge, we propose a VDP program. For the third challenge, we design a new smart contract named DHTLC, which enables the customer to perform a payment successfully.
IiiC Overview and Goals
IiiC1 Overview
The overview of Rapdio is shown in Fig. 3. What is more, simplified steps of a payment from Client to Client through a Layer2 Network are represented as follows.

Through Beacon Election Module, several nodes are randomly elected as beacons in one period.

Each Client finds routing paths to all beacons by the Proactive Module.

The information of routing paths (e.g., the deposits distribution among the payment channel) is gathered by Reactive Module of Client 1 when a transaction from Client 1 to Client 2 is generated.

According to the gathered information, Client 1 leverages Value Distributing Module to calculate then select several available routing paths and splits the payment value into several shares.

The Client 1 distributes these shares to Client 2 by DHTLCs among the selected paths, respectively.
IiiC2 Goals
Rapido further reaches the following properties.

Highrespond. Rapido mitigates the shares issue and reaches a high success rate for numerous mircopayments.

Lessskewed. Rapido mitigates the skewed issue and the congestion issue, such as a skewed node [7], after performing lots of payments.

Privacy. Rapido can preserve payment value privacy, which is a private issue of customer and merchant.

Generality. Rather than implementing a solution for issue, Rapido is general and applicable to all payments among the Layer2 Network.
Iv The Rapido Construction
In this section, we discuss Rapido construction in detail, which includes 1) Beacons Election, 2) Routing, 3) Value Distributing, and 4) DHTLC. Further, the difference between Rapido and current LN is disscussed in 5) Remark.
Iva Beacon Election
In Rapido, each node not only can be a normal status but also can be beacon status, which can coexist in one node. Hence, each node has a fixed probability to be elected as a beacon in Rapido. To elect beacons, the network topology is split into
portions. Then, the nodes in a portion elect a beacon for this portion. The election follows uniform distribution and rotates in a period (e.g.,
hours). By this way, each node has a chance to be elected as a beacon and can earn transfer fees, which incents all nodes always online as well as improve the entire topology and transaction capabilities of Rapido.IvB Routing in Rapido
Routing path from a customer to a merchant is prerequisite for a payment to succeed. The routing discovering algorithm implemented in Rapido includes a proactive part as well as a reactive part. The proactive part gathers information that is static or changes slowly, such as payment channels between nodes, whereas the reactive part mainly focuses on dynamic information such as the distribution of deposits among payment channels.

Proactive Part. Number of nodes in a topology are randomly elected as beacons for a predefined period. Then, all nodes attempt to find routing paths to all beacons through BreadthFirstSearch (BFS) algorithm. Detailed information of routing paths to each beacon is stored in each node’s routing table. The routing paths information tends to remain unchanged except a new node joins the Layer2 Network or a new payment channel is set up. In next period, the election process is executed once again. The proactive routing process then is executed repeatedly, and new information is hence stored in each node instead of the elder one.

Reactive Part. There are some dynamic information in the Layer2 Network, such as the distribution of deposits in each payment channel which consumes lots of computing resources (e.g. CPU) if gathered in real time. In Rapido, instead of gathering all information in real time, the customer and the merchant only gather the dynamic information of each payment channel among the prestored routing paths. Moreover, the customer and merchant request the dynamic information of the routing paths to all intermediate nodes. As intermediate nodes, they response the requests by the reactive part of routing. Finally, the gathered information is sent back to the customer. Although the nodes among these routing paths can response the request from the customer and merchant by Tor [19, 20], the Tor achieves a low performance, such as about seconds to complete kb data request to onion sever [21]. This issue will be discussed in VB2.
IvC Value Distributing
The customer gathers the information of the available routing paths when a transaction is generated, such as the distribution of deposits on these routing paths. Once information gathering process is finished, the customer can split the payment value into
shares by Linear Program and pay to the merchant through each routing path, respectively.
In this part, we proceed to formulate the criterion for congestion that represents the state of a node’s deposit in a payment channel. Inspired by the congestion factors [22, 23], we introduce a metric channel congestion factor , where represents the th share is transferred through and represents the deposit owns to the th intermediate node deposits in th payment channel over , and . In addition, a channel congestion factor can predict the skewness of a node after a payment is performed. According to [22] and [23], we introduce another metric network congestion factor which indicates the bottleneck of the whole network. For the value distributing issue, it can be equivalent to the wellknown Maximum Flow Problem [24] iff there are no other restrictions on the routing paths. Therefore, one can find a solution that minimizes the network congestion factor in polynomial time through a standard maxflow algorithm [24]. However, the cumulative transfer fees in a routing path is one of essential metrics for the customer, which should be considered in the value distributing process.
For this problem, we aim at minimizing the network congestion factor which subjects to a restriction on a transfer fees according to the chosen paths. It is formulated as follows.
VDP (Value Distributing Problem). Given a Layer2 Network , a sourcedestination pair (), each participant within a transaction sends their transfer fees information and the deposits to . Besides, a payment has a transfer fee restriction . Finally, we find a feasible solution to distribute shares that minimize the network congestion factor.
Theorem 1
VDP is NPhard.
Proof IV.1
Consider the following Partition Problem [25]. Given a set . Moreover, the size of can be represented as . Then, we can find a subset such that . We transform the Partition Problem to a simple VDP as follows.

Given an element with size . In a Layer2 Network, we suppose a transaction between and the , where would be transferred and the set constitute all intermediate nodes. We define a transfer fee of node as .

Suppose that is split into two parts ( and ) for transferring through each routing path, respectively. Suppose that is transferred from to through a routing path and is transferred through another routing path . Besides, we assume that each channel’s capacity is .
We shall prove that it is possible to transfer and through each routing path, that the total of transfer fees are not exceed and each payment channel’s channel congestion factor is not exceed to iff there exits a subset and exits .
Note that if variables satisfy and , it follows that and in addition . We hence conclude that and , it follows that and in addition . In this issue, can be split into two parts as and that the channel congestion factor is not be violated. We hereby find two part that the total fees restrict to . The simple VDP hereby can be reduced to a Partition Problem such that the positive integer can be seem as a transfer fee of the node .
The Partition Problem is known as strongly NPhard [25]. We note that the VDP has more restrictions than the simple VDP such that a payment value could be split into shares and transferred through routing paths from a customer to a merchant after a transaction is generated in the Layer2 Network. The VDP hereby can be considered as a kPartition Problem [25] which is known as strongly NPhard [25]. Consequently, the VDP is NPhard.
Owing to the VDP is NPhard without polynomial time algorithm. To resolve VDP, it should be relaxed to a noninteger linear programming to obtain a approximate solution. The first step towards obtaining a solution to Problem VDP is to define it as a linear programming. To that end, we need some additional notations.
Program VDP:
minimize  (1)  
s.t.  (2)  
(3)  
(4)  
(5)  
(6)  
(7)  
(8)  
(9)  
(10) 
Recall that we are given a network , and , sourcedestination pair , a payment is performed between and and go through nodes, a transfer fee for each node , and a node’s deposit in its former channel (i.e., the th node’s deposit of the th channel in ) for each payment channel , total of transfer fees restriction for a payment. Let be the network congestion factor. Denote by the flow along that has been routed from to through paths with a total fees . Finally, for each , denote by the set of channels that out from , and by the set of channels that input node . To mitigate a congestion issue and skewed node issue, a payment is performed iff where is predefined. Therefore, the VDP can be formulated as a linear program, as specified in Program VDP.
The objective function of Program VDP minimizes the network congestion factor . The constraint equations , and denote that the conservation constraint of the payments and transfer fees through each node. Equation states that the cumulative fees of a payment out of node has to be equal to the cumulative fees before this payment inputs node and the transfer fees for node . For the equations and , any payment from a to a , in which the transfer fees do not need to pay a or a . The inequation states that the constraint of a payment’s total of transfer fees. Equation states that the sum of the shares must be equal to the payment value. For the inequation , the deposits in the th payment channel owns to the th node which is in the must larger than the th share. To mitigate the skewness and congestion issue, the inequation states that the payment channel congestion must be not less than a predefined threshold . Finally, the inequation and restrict the variables to be nonnegative.
According to the result of Program VDP, the customer can splits the payment value into shares. However, there might exist some intermediate nodes disapprove of this payments. Therefore, we introduce a request mechanism which is executed before distributing these shares. In request mechanism, the customer proposes a proposal and requests each node among these selected routing paths such that, whether participating this payment as an intermediate node. The customer is going to perform this payment iff each node agrees this proposal with the customer. Otherwise, the customer aborts these selected routing paths and reduplicate the Routing process. The request mechanism can mitigate some extra costs that an intermediate node might abort his share payment when a payment is performing.
IvD DHtlc
DHTLC is a smart contract which is based on HTLC [3]. In DHTLC, we introduce a punish mechanism to avoid some traps.For example, nodes on routing paths might maliciously abort before payment, resulting in the reset of DHTLC and, unavoidably, the waste of extra costs. To solve this problem, we lock a certain amount of for each node until a DHTLC is set up for this payment.
IvD1 Notation
Input a network , suppose that a customer attempts to transfer coins to a merchant . Then, has been spilt into shares by Program VDP, that each share has its own routing path to , such as the th share is paid to through . For each routing path, generates a SHA256. Besides, the means that the th node is on . The DHTLC is deployed between and , which is composed of sender , receiver , the th value , transfer fee , hashlock and timelock . In addition, should prepare a according its own transfer (base fee and fee rate). We represent as the list of all s.
IvD2 Definition of Operations
DHTLC has main operations: openPunish, newContract, getBack, withdraw, refund and punish. We briefly describe these operations as follows.

openPunish When a client attempts to initialize a payment, the openPunish is called. Nodes that responses request from are listed in . This function is responsible for locking a certain amount of cash which are listed in from every involved nodes. It returns iff all nodes in have locked the corresponding amount of ; otherwise, it returns 0.

newContract This operation constructs a new DHTLC from from the to the . It returns ; otherwise, it returns . Note that sequence between several newContracts should be consist with the sequence of nodes on the path.

getBack This operation is called when is trying to retrieve its locked after newContract succeeds and is returned.

withdraw This operation is called when attempts to withdraw from the previous within . It succeeds iff is able to reveal the correct to .

refund If there was no withdraw until is expired, refund is called to refund to .

punish As previously mentioned, we have a punish mechanism to penalize dishonest nodes. Thus, this punish function is called once a new DHTLC aborts because of , then would get . For the latter nodes, the remaining locked s are unlocked.
IvE Remark
We design a Layer2 system, Rapido, which is different from the current LN. At the first, we design a new routing discovering algorithm for Rapido, which incents nodes always online. Secondly, Rapido splits the payment value into several shares and distributes these shares to a node by DHTLC. Thirdly, DHTLC is designed based on HTLC while DHTLC inherently preserves the privacy of payment value.
V System Discussion
In this part, we discuss the scenario where Rapido can be used as well as its limitations..
Va Usability
VA1 Context
Employing the Layer2 Network makes transactions more rapid and convenient than the transactions are performed onchain. As summarized in the above discussion, LN has some issues while Rapido can mitigate them. In particular, for the shares issue, the naive solution introduces an extra time and money costs whereas Rapido can eliminate these costs, which is not require to claim in blockchain.
Different from HTLC, a payment is performed by DHTLC should be split into several shares and distributed to the merchant through selected routing paths. In other words, a payment is performed by DHTLC requires more participants. According to the statics of LN from [26], nodes that each node has payment channels on average. Hence, the condition provides a suitable context for Rapido. Moreover, the Layer2 Network such that LN’s scale is increasing from its birth to the present. The Layer2 Network with its growth, the future context is also suitable for Rapido.
VA2 Scalability
With the scale expansion of the Layer2 Network, more and more nodes and channels would be generated. For the proactive part of routing, it is . Moreover, the beacon election is only executed once in each period, which is not always consumed computing resource. Moreover, the predefined period of election is not short. In reactive part, for performing a payment, the customer calculates and selects available routing paths through several beacons and then pay the split payment shares to the merchant. Considering the number of beacons is always much less than the total number of nodes, the process of routing path selection is rapid unless the number of beacons grows clipping.
VB Security Analysis
VB1 Threat Model
We suppose that an adversary would be willing to intercept some information from a transaction between a customer and a merchant among the Layer2 Network. A transaction over the Layer2 Network might go through serval intermediate nodes, whereas security flaws of some nodes can be found and may be leveraged by an adversary. Therefore, a payment value can be intercepted if one of intermediate nodes is compromised. An adversary in our paper targets the privacy of payment value, which is crucial as the other security issues (e.g., anonymity of customer/merchant) when a payment is performing on the Layer2 Network.
VB2 Guarantees for privacy
Under the previous LN discussion and adversarial assumption, an adversary can easily intercept the payment value if one of intermediate nodes is compromised. In Rapido, the adversary cannot intercept the total payment value unless it at least compromises one intermediate node on each routing path. This is because the payment value is split into several shares and distributed to the merchant through numerous paths by the customer while the adversary can only intercept a part of payment value. Moreover, a payment based on DHTLC includes more routing paths as improving difficulty level to compromise all intermediate nodes. Hence, it is difficult that an adversary could intercept a complete information of payment value. In addition, the Rapido also could confuse the adversary, which only leaks a part of information. Rather than Fulgor and Rayo [4], Rapido need not introduce an extra trust function to preserve the privacy of payment value and make a assumption that all participates are honest.
In addition, any node can requests information of payment channel to perform the payment in reactive part. Although the privacy of information can be transmitted and protected by optional Tor [19, 20], it achieves a low performance [19, 21]. We note that it might cause some information leakage in Rapido, if the Tor is turnoff. Considering that lots of nodes are elected as beacons, there are a majority of nodes would be as intermediate nodes when a payment is performed. Moreover, lots of payments might be generated on the Layer2 Network in a short time. Therefore, the information, e.g., the node’s deposits on each payment channel, is rapidly changing and out date quickly. Consequently, Rpaido theoretically enables information leakage with a low probability.
Vi Simulation
In this section, we present extensive experiments to evaluate Rapido. To be more convincing, we provide a working proof of concept (POC) implemented in Python with a real dataset of LN.
Via Dataset and Setup
The experiments were conducted on machines with Intel i K and GB RAM. For simulating a Layer2 Network, we crawled a dataset with nodes and payment channels from LN of Recksplorer [26] on July . Besides, detailed information of each node and payment channel are also demonstrated, such as capacity, base transfer fee, rate of transfer fee and so on. In common, the % people always own % of all wealth [27], which also can be analogous to LN. Based on the fact that there usually exits some super “huge” nodes which owns lots of payment channels () and thus deposits (e.g., “tady je slushovo” [26]), we assume that the distribution of deposits on each channel follows the Pareto distribution [27]. Under this assumption, we suppose that two nodes among a payment channel, where the node who own more channels has % deposits. We simulate a simple blockchain by golang, which has links open on our Layer2 Network. Based on these statics, assumptions and setup, we derive datasets for our simulation which are represented as following.
ViB Beacon Election and Average Routing Hops
In our work, the routing algorithm includes proactive part and reactive part. In proactive part, some beacons are elected, and then each node finds a routing path to each beacon. The left half of Fig. 4 represents that the average hops between any two nodes among the Layer2 network topology. The label of Xaxis (, , and ) represents numbers of beacon nodes. We can find that the , , and labeled bars are of about the same height, with the average hops of about . However, the more beacons are elected, the more routing information should be stored in routing table each node. To avoid routing table overhead and meanwhile incent more nodes to be online, we empirically elect beacons in topology.
On the other hand, the right half of Fig. 4 represents the routing algorithm of current LN. We notice that the average hops between any two nodes of current LN is about , which is less compared with our approach. This stems from that the route discovering algorithm of current LN does not need go through any beacons. Under some circumstances, a shares issue might appear, which cannot be fulfilled by current LN whereas it might be fulfilled by Rapido. In addition, each node has a chance to be elected as a beacon, which makes all nodes possible to earn transfer fees and thus incents them to be online more often. Furthermore, Rapido can preserve the privacy of payment value without any trust function. Under estimating a transfer fee, the customer extra pays about Satoshis (sato)^{3}^{3}3 bitcoin = Satoshis, Satoshi $ [5]. fees to a node in general when a value of satos payment goes through a node, which is extremely small. Therefore, the quantitative difference of average hops is acceptable.
ViC Transaction Scenarios
ViC1 Scenario 1
We investigate the success rate of micropayments on LN and Rapido respectively through simulation. According to the above mentioned statics and assumptions, a series of micropayments are generated between randomly selected customermerchant pairs (the selected customer owns enough deposits in all his payment channels to perform the payments). Considering that in a LN with nodes [26], the probability of concurrent payment is pretty low, thus we does not take concurrent payments into account in our simulation.
Fig. 5 shows average transfer fees under different payment value (we empirically choose , , and satos according to the nature of micropyment) and different systems (yellow and green bars denote for Rapido, blue ones denote for LN). We attribute large error bars to the randomness of nodes selection strategy, in which the routing paths between selected nodes vary a lot. More than one group of fee restrictions were set for Rapido, and the results showed that adaptive restrictions (, , , ) can achieve a lower average transfer fee compared with the fixed one (, , , ), and achieves almost the same average transfer fee with which in LN. Fig. 6 shows the corresponding success rate. With similar transfer fees, Rapido always achieves a high success rate than LN. For LN, the customer require to find the available shortest routing path when a transaction is generated. Additionally, there is no guarantee that an available routing path should exit for a payment. For Rapido, benefiting from the VDP program, the payment value by Rapido can be split into shares and pay to the merchant respectively.
Furthermore, we note that Rapido can achieve a higher success rate if the restriction of transfer fee is relaxed (as the yellow bars in histogram compared with the green ones). However, we observe that % success rate is not achieved, due to the fact that once all nodes attempt to connect with all beacons, then the beacons might not enough deposits to perform the payment. In addition, combined with Fig. 5, we can note that not large transfer fee increment (about satos $) could bring a large improvement on success rate. Therefore, to achieve a higher success rate, the transfer fee restriction can be relaxed.
ViC2 Scenario 2
In this scenario, we randomly select customermerchant pairs, each of which independently generates payments of , , and satos respectively for times. Note that the payments can only be initiated by customers and then received by merchants. In addition, we assume that the selected customers has enough deposits to fulfill the payments. Under this assumption, both customers and merchants should be huge nodes which both have payment channels
To better describe a skewed node, we introduce a metric to denote the skewness of a node in a certain direction. Concretely, a payment of value attempts to go through a node with an input channel and an output channel that the deposit named and respectively. Thus the skewness on the direction from input to output is . Since the node earns a transfer fee of , then becomes until the payment is done. Apparently, if several payments with large value goes through this node, its could decrease badly, which means that the node tends to be “very skewed”. In this paper, we call a node is seriously skewed if its is less than . Furthermore, if there are nodes seriously skewed among all nodes which involved in a payment, we say that the ratio of serious skewed is .
Fig. 7 shows the ratio of serious skewed node after rounds of above mentioned payments from customers to merchants. We find out that there exit skewed nodes even when both sides of payments are huge nodes, and the ratio of seriously skewed nodes tends to be higher in LN than in our Rapido implementation. Our experiment proves that Rapido is capable of mitigating the skewness of nodes and congestion after several payments.
Vii Related Work
There are some limitations on LN and some prior research works have studied on them. Most of the works mainly focus on customer/merchant anonymity. Heilman proposed TumbleBit which allows parties to make fast, anonymous, offblockchain payments through an untrusted intermediary called the Tumbler [10]. Green and Miers represented Bolt that allows for secure, instantaneous and private payments that substantially reduce the storage burden on the LN [6]. Malavolta et al. proposed Fulgor and Rayo [4] that Fulgor and Rayo are payment protocols for LN that can protect the balance security, payment value privacy and customer/merchant anonymity based on a trust function. Fulgor is a blocking protocol and therefore prone to deadlocks of concurrent payments, whereas Rayo is a protocol that enforces nonblocking progress (i.e., at least one of the concurrent payments terminates). In addition, some research works studied on the applicability of LN such that a skewed LN might be generated after multiple transactions. Khalil and Gervais proposed REVIVE that allows an arbitrary set of user in LN to rebalance their nodes, according to the preferences of the nodes [7]. REVIVE can only be leveraged to solve a skewed loop network, in which might cause an increased collateral cost on payment routing path.
Viii Conclusion
The idea of the Layer2 Network is proposed to resolve the bitcoin scalability problem, which theoretically enables fast transactions between participates. However, there exists some drawbacks. In this paper, we obeserve a new issue, shares issue, which might bring some unnecessary costs. To mitigate shares issue, we propose Rapido which is equipped with DHTLC. Furthermore, Rapido also mitigates the skewness issue. In addition, Rapido inherently preserves the privacy of total payment value, for which the payment value is split into shares that an intermediate node cannot intercept the whole information. We have conducted extensive experiments to evaluate Rapido, which demonstrate that the proposed system outperforms the stateofthearts.
References
 [1] S. Nakamoto, “Bitcoin: A peertopeer electronic cash system,” 2008.
 [2] “Cryptocurrency market capitalizations,” [Online].https://coinmarketcap.com/, July 2018.
 [3] J. Poon and T. Dryja, “The bitcoin lightning network: Scalable offchain instant payments,” Online:https://lightning.network/lightningnetworkpaper.pdf, 2016.
 [4] G. Malavolta, P. MorenoSanchez, A. Kate, M. Maffei, and S. Ravi, “Concurrency and privacy with paymentchannel networks,” in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2017, pp. 455–471.
 [5] “Statics,” [Online].Available:https://www.blockchain.com, July 2018.
 [6] M. Green and I. Miers, “Bolt: Anonymous payment channels for decentralized currencies,” in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2017, pp. 473–489.
 [7] R. Khalil and A. Gervais, “Revive: Rebalancing offblockchain payment networks,” in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2017, pp. 439–453.
 [8] A. Miller, I. Bentov, R. Kumaresan, C. Cordi, and P. McCorry, “Sprites and state channels: Payment networks that go faster than lightning,” arXiv preprint arXiv:1702.05812, 2017.
 [9] P. Prihodko, S. Zhigulin, M. Sahno, A. Ostrovskiy, and O. Osuntokun, “Flare: An approach to routing in lightning network,” WhitePaper(https://bitfury.com/content/5whitepapersresearch/whitepaper_flare_an_approach_to_routing_in_lightning_network_7_7_2016.pdf), 2016.
 [10] E. Heilman, L. AlShenibr, F. Baldimtsi, A. Scafuro, and S. Goldberg, “TumbleBit: An Untrusted BitcoinCompatible Anonymous Payment Hub,” in NDSS. Reston, VA: Internet Society, 2017.
 [11] “Stella,” [Online].https://www.stellar.org/.
 [12] “Ripple,” [Online].https://ripple.com/.
 [13] G. Malavolta, P. MorenoSanchez, A. Kate, and M. Maffei, “SilentWhispers: Enforcing Security and Privacy in Decentralized Credit Networks,” in NDSS. Reston, VA: Internet Society, 2017.
 [14] P. MorenoSanchez, M. B. Zafar, and A. Kate, “Listening to whispers of ripple: Linking wallets and deanonymizing transactions in the ripple network,” Proceedings on Privacy Enhancing Technologies, vol. 2016, no. 4, pp. 436–453, 2016.
 [15] P. MorenoSanchez, A. Kate, M. Maffei, and K. Pecina, “Privacy preserving payments in credit networks,” in Network and Distributed Security Symposium, 2015.
 [16] G. Wood, “Ethereum: A secure decentralised generalised transaction ledger,” Ethereum project yellow paper, vol. 151, pp. 1–32, 2014.
 [17] K. Croman, C. Decker, I. Eyal, A. E. Gencer, A. Juels, A. Kosba, A. Miller, P. Saxena, E. Shi, E. G. Sirer et al., “On scaling decentralized blockchains,” in International Conference on Financial Cryptography and Data Security. Springer, 2016, pp. 106–125.
 [18] F. Tschorsch and B. Scheuermann, “Bitcoin and beyond: A technical survey on decentralized digital currencies,” IEEE Communications Surveys & Tutorials, vol. 18, no. 3, pp. 2084–2123, 2016.
 [19] “Lightning network daemon,” [Online].Available:https://github.com/lightningnetwork/lnd, July 2018.
 [20] R. Dingledine, N. Mathewson, and P. F. Syverson, “Tor: the secondgeneration onion router,” in Proceedings of the 13th conference on USENIX Security Symposium, 2004, pp. 21–21.
 [21] “Tor metrics,” [Online].https://metrics.torproject.org/torperf.html.
 [22] S. Iyer, S. Bhattacharyya, N. Taft, N. McKeoen, and C. Diot, “A measurement based study of load balancing in an ip backbone,” SprintATL Technical Repport. TR02ATL051027, 2002.
 [23] D. O. Awduche and J. Agogbua, “Requirements for traffic engineering over mpls,” IETF RFC 2702, 1999.
 [24] D. K. Smith, “Network flows: Theory, algorithms, and applications,” Journal of the Operational Research Society, vol. 45, no. 11, pp. 1340–1340, 1994.
 [25] M. R. Garey, D. S. Johnson, and L. Stockmeyer, “Some simplified npcomplete graph problems,” Theoretical computer science, vol. 1, no. 3, pp. 237–267, 1976.
 [26] “Lightning network explorer,” [Online].https://github.com/chemicstry/recksplorer, July 2018.
 [27] M. E. J. Newman, “Power laws, pareto distributions and zipf’s law,” Contemporary Physics, vol. 46, no. 5, pp. 323–351, 2005.