Topological Analysis of Bitcoin's Lightning Network

01/15/2019 ∙ by István András Seres, et al. ∙ 0

Bitcoin's Lightning Network (LN) is a scalability solution for Bitcoin allowing transactions to be issued with negligible fees and settled instantly at scale. In order to use LN, funds need to be locked in payment channels on the Bitcoin blockchain (Layer-1) for subsequent use in LN (Layer-2). LN is comprised of many payment channels forming a payment channel network. LN's promise is that relatively few payment channels already enable anyone to efficiently, securely and privately route payments across the whole network. In this paper, we quantify the structural properties of LN and argue that LN's current topological properties can be ameliorated in order to improve the security of LN, enabling it to reach its true potential.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

Code Repositories

LNTopology

A tool to analyze the topology of Bitcoin's Lightning Network


view repo
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 the Bitcoin [nakamoto2008bitcoin] network celebrated its 10th anniversary. During these years Bitcoin gained a huge popularity due to its publicly verifiable, decentralized, permissionless and censorship-resistant nature. This tremendous popularity and increasing interest in Bitcoin pushed its network’s throughput to its limits. Without further advancements, the Bitcoin network can only settle transactions per second (tps), while mainstream centralized payment providers such as Visa and Mastercard can process approximately tps in peak hours. Moreover one might need to pay large transaction fees on the Bitcoin network, while also need to wait 6 new blocks to be published in order to be certain enough that the transaction is included in the blockchain.

Figure 1: LN’s topology. Nodes with higher degree are highlighted with lighter colors and larger circles.

To alleviate these scalability issues the Lightning Network (LN) was designed in 2016 [poon2016bitcoin], and launched in 2018, January. The main insight of LN is that transactions can be issued off-blockchain in a trust-minimized manner achieving instant transaction confirmation times with negligible fees, whilst retaining the security of the underlying blockchain.

Bidirectional payment channels can be formed on-chain using a construction called Hashed Timelock Contracts (HTLC). Later several payments can take place in a payment channel. The main advantage of payment channels is that one can send and receive thousands of payments with essentially only 2 on-chain transations: the opening and closing channel transactions.

Using these payment channels as building blocks one might establish a payment channel network, where it is not necessary to have direct payment channels between nodes to transact with each other, but they could simply route their payments through other nodes’ payment channels. Such a network can be built, because LN achieves payments to be made without any counterparty risk, however efficient and privacy-preserving payment routing remains a challenging algorithmic task [roos2017settling].

Our contributions. We empirically measure111https://github.com/seresistvanandras/LNTopology and describe LN’s topology and show how robust it is against both random failures and targeted attacks. These findings suggest that LN’s topology can be ameliorated in order to achieve its true potential.

2 Lightning Network’s Topology

Number of nodes
Number of payment channels
Average degree
Connected components
Density
Total BTC held in LN

  

B

  

s-metric
Maximal independent set
Bridges
Diameter
Radius
Mean shortest path
Transitivity
Average clustering coefficient
Degree assortativity
Figure 2: LN at a glance: basic properties of the LN graph.

LN can be described as a weighted graph , where is the set of LN nodes and is the set of bidirectional payment channels between these nodes. We took a snapshot222https://graph.lndexplorer.com of LN’s topology on the 10th birthday of Bitcoin, 2019 January 3rd. In the following we are going to analyze this dataset. Although the number of nodes and payment channels are permanently changing in LN, we observed through several snapshots that the main topological characteristics (density, average degree, transitivity, nature of degree distribution) remained unchanged. We leave it for future work to analyze the dynamic properties of LN.

LN gradually increased adoption and attraction throughout 2018, which resulted in 3 independent client implementations (c-lightning333https://github.com/ElementsProject/lightning/, eclair444https://github.com/ACINQ/eclair and lnd555https://github.com/lightningnetwork/lnd) and nodes joining LN as of 2019, January 3rd. The density of a graph is defined as which is the ratio of present and potential edges. As it is shown in Figure 2. LN is quite a sparse graph. This is further justified by the fact that LN has bridges, edges which deletion increases the number of connected components. Although LN consists of components, the second component has only nodes. The low transitivity, fraction of present and possible triangles in the graph, highlights the sparseness of LN as well.

Figure 3: LN’s degree distribution

Negative degree assortativity of the graph indicates that on average low degree nodes tend to connect to high degree nodes rather than low degree nodes [newman2002assortative]. Such a dissortative property hints a hub and spoke network structure, which is also reflected in the degree distribution, see Figure 3.

Average shortest path length is , without taking into account capacities of edges, which signals that payments can easily be routed with a few hops throughout the whole network. Although this is far from being a straightforward task, since one also needs to take into consideration the capacity of individual payment channels along a candidate path.

When a new node joins LN, it needs to select which other nodes it is trying to connect to. In the lnd LN implementation key goals for a node is to optimize its centrality by connecting to central nodes. This phenomena sets up a preferential attachment pattern. Other LN implementations rely on their users to create channels manually, which also most likely leads to users connecting to high-degree nodes. Betweenness centrality of a node is given by the expression where is the total number of shortest paths between node and , whilst is the number of those paths, that pass through . Closeness centrality of a node is defined as where is the number of nodes in the graph and is the distance between node and . Closeness centrality measures how close a node is to all other nodes.

Figure 4: LN’s betweenness centrality Figure 5: LN’s closeness centrality

Small-world architectures, like LN, exhibit high clustering with short path lenghts. The appropriate graph theoretic tool to asses clustering is the clustering coefficient [watts1998collective]. Local clustering coefficient measures how well a node’s neighbors are connected to each other, namely how close they are to being a clique. If a node has neighbors, then between these neighbors could be at maximum edges. If denotes the set of ’s neighbors, then the local clustering coefficient is defined as .

Figure 6: Local clustering coefficient of LN

LN’s local clustering coefficient distribution suggestively captures that LN is essentially comprised of a small central clique and a loosely connected periphery.

2.1 Analysis of LN’s degree distribution

LN might exhibit scale-free properties as the s-metric suggests. S-metric was first introduced by Lun Li et al. in [li2005towards] and defined as . The closer to s-metric of is, the more scale-free the network. Diameter and radius of LN suggests that LN is a small world. Somewhat scale-freeness is also exhibited in the degree distribution of LN. Majority of nodes have very few payment channels, although there are a few hubs who have significantly more connections as it can be seen in Figure 3.

The scale-freeness of LN is further justified also by applying the method introduced in [clauset2009power]. The maximum-likelihood fitting asserted that the best fit for the empirical degree distribution is a power law function with exponent . The goodness-of-fit of the scale-free model was ascertained by the Kolmogorov-Smirnov statistic. We found that the -value of the scale-free hypothesis is , which is accurate within . Therefore the scale-free hypothesis is plausible for the empirical degree distribution of LN.

3 Robustness of LN

It is a major question in network science how robust a given network is. LN, just like Bitcoin, is a permissionless network, where nodes can join and leave arbitrarily at any point in time. Nodes can also create new payment channels or close them any time. Furthermore as new payments are made, capacities of payment channels are changing steadily. Despite the dynamic nature of LN, its topology’s characteristics remain constant after all. In this section we investigate how resilient LN is, whether it can effectively withhold random node failures or deliberate attacks.

Measuring robustness means that one gradually removes nodes and/or edges from the graph, until the giant component is broken into several isolated components. The fraction of nodes that need to be removed from a network to break it into multiple isolated connected components is called the percolation threshold and is denoted as

. In real networks percolation threshold can be well estimated by the point where the giant component first drops below

of its original size [barabasi2016network].

3.1 Random Failures

Network
Internet
WWW
US Power Grid
Mobil Phone Call
Science collaboration
E. Coli Metabolism
Yeast Protein Interactions
LN
Figure 7: Random failures in networks. Values of critical thresholds for other real networks are taken from [barabasi2016network].

Random failures are a realistic attack vector for LN. If nodes happen to be off-line due to bad connections or other reasons, they can not participate in routing payments anymore. Such a failure can be modeled as if a node and its edges are removed from the graph.

For scale-free networks with degree distribution , where the percolation threshold can be calculated by applying the Molloy-Reed criteria, ie. , where and denote the lowest and highest degree nodes respectively. This formula yields for LN in case of random failures. This value is indeed close to the percolation threshold measured by network simulation as shown in Figure 10, that is, LN provides an evidence of topological stability under random failures. In particular this is due to the fact that in LN a randomly selected node is unlikely to affect the network as a whole, since an average node is not significantly contributing to the network’s topological connectivity, see also degree distribution at Figure 3.

3.2 Targeted attacks

Targeted attacks on LN nodes are also a major concern as the short history of LN has already shown it. On 2018 March 21st 666https://www.trustnodes.com/2018/03/21/lightning-network-ddos-sends-20-nodes,

of nodes were down due to a Distributed Denial of Service (DDoS) attack against LN nodes. Denial of Service (DoS) attacks are also quite probable by flooding HTLCs. These attack vectors are extremely harmful, especially if they are coordinated well. One might expect that not only state-sponsored attackers will have the resources to attack a small network like LN. In the first attack scenario we removed 30 highest-degree nodes one by one starting with the most well-connected one and gradually withdraw the subsequent high-degree nodes. We recorded the number of connected components. As it is shown in Figure 

8. even just removing the highest-degree node777http://rompert.com/ fragments the LN graph into 37 connected components! Altogether the removal of the largest hubs incurs LN to collapse into components, although most of these are isolated vertices. This symptom can be explained by the experienced dissortativity, namely hubs tend to be at the periphery.

Figure 8: LN’s vertex connectivity, when all the largest hubs are removed one by one Figure 9: LN’s vertex connectivity if only one high-degree node is removed from the graph.

We reasserted the targeted attack scenario, but for the second time we only removed one of the largest hubs and recorded the number of connected components. As it can be seen in Figure 9 most of the hubs, 25, would leave behind several disconnected components.

Network
Internet
WWW
Facebook
Euroroad
US Power Grid
Mobil Phone Call
Science collaboration
E. Coli Metabolism
Yeast Protein Interactions
LN
Figure 10: Real networks under targeted attacks. Values of critical thresholds for other real networks are taken from [barabasi2016network] and [lin2017assessing].

Such network fragmentations are unwanted in case of LN, because they would make payment routing substantially more challenging (one needs to split the payment over several routes) or even impossible (there would be no routes at all).

Furthermore we estimated the percolation threshold by simulating two attacking strategies. In the first scenario we removed high degree nodes one by one (high degree removal attack, HDR) and in the second we removed nodes with the highest betweenness centrality (high betweenness removal attack, HBR). Note that in both cases after each node removal we recalculated which node has the highest degree or betweenness centrality in order to have a more powerful attack. We found out that for removing high degree nodes, while for removing high betweenness centrality nodes , therefore choosing to remove high betweenness centrality nodes is a better strategy as it can also be seen in Figure 12.

Figure 11: High degree removal (HDR) attack effects average shortest path lengths

Node outage not only affects robustness and connectivity properties, but also affects average shortest path lengths. Although the outage of random nodes does not significantly increase the average shortest path lengths in LN, targeted attacks against hubs increase distances between remaining nodes. The spillage of high-degree nodes not only decrease the amount of available liquidity but also rapidly increase the necessary hops along payment routes as Figure 11 suggests. This could cause increased ratio of failed payments due to larger payment routes.

r

Figure 12: Percolation thresholds for various attack scenarios: , ,

3.3 Improving LN’s resilience against random failures and attacks

Designing networks which are robust to random failures and targeted attacks appear to be a conflicting desire [barabasi2016network]. For instance a star graph, the simplest hub and spoke network, is resilient to random failures. The removal of any set of spokes does not hurt the connectedness of the main component. However it can not withstand a targeted attack against its central node, since it would leave behind isolated spokes. Furthermore when one attempts increasing robustness of a network, they do desire not to decrease the connectivity of nodes.

A similar optimization strategy of robustness and connectivity to that of [shargel2003optimization] could be applied to LN as well. We leave it for future work to empirically assess the robustness and connectivity gains if strategy of [shargel2003optimization] would be implemented in LN client implementations.

Nonetheless, we can still enhance the network’s attack tolerance by connecting its peripheral nodes [barabasi2016network]. This could be achieved by LN client implementations by implicitly mandating newcomers to connect to not only hubs, as current implementations do, but also to at least a few random nodes. This would largely increase robustness of LN even against targeted attacks.

4 Conclusion

In summary, a better understanding of the network topology is essential for improving the robustness of complex systems, like LN. Networks’ resilience depends on their topology. LN is well approximated by the scale-free model and also its attack tolerance properties are similar to those of scale-free networks; in particular, while LN is robust against random failures, it is quite vulnerable in the face of targeted attacks. High-level depictions of LN’s topology, like Figure 1, convey a false image of security and robustness. As we have demonstrated, LN is structurally weak against rational adversaries. Thus, to provide robust Layer-2 solutions for blockchains, such as LN and Raiden, the community needs to aim at building resilient network topologies.

5 Acknowledgements

We are grateful for the insightful comments and discussions to Chris Buckland, Daniel Goldman, Olaoluwa Osuntokun and Alex Bosworth.

References