April 28, 2024

Lightning Network: Over 60,000 One-Way Channel Closures

In another article about the Lightning Network, we present updated data from BitMEX Research on growth and current sizenetworks, as well as statistics of private channels, which are often set by mobile wallets and, as a rule, are not taken into account in traditional network metrics.

First of all, we focused onunilateral (incompatible) closing of channels and the database we built, which, in our opinion, contains all transactions of this type. Our database shows that one-way channel closures are fairly widespread and that the level of use of the Lightning Network is actually higher than anticipated.

Main conclusions

  • The number of one-way closures of lightning channels in the history of Bitcoin is more than 60,000.
  • In one-way channel closing transactions, more than 1000 BTC was spent.

Overview

Lightning Network has yet to faceserious challenges, and even if they are overcome, considerable uncertainty still exists regarding network potential. Nevertheless, the Lightning Network, in our opinion, is one of the most exciting projects of the crypto industry, at least from a technical point of view.

A lot has been written about the Lightning Network. In this report, we focus on Lightning Network data and statistics on its use, often used to measure network growth. However, most of this data is based on the numbers reported by the Lightning Network nodes participating in the Lightning peer-to-peer (p2p) gossip network. For example, the site TXStats.com, a joint project of BitMEX Research and Coinmetrics, publishes historical data on the number of public lightning channels and bitcoins contained in them. According to TXStats.com, at the end of December 2019, there were 36,335 public channels containing 871 BTC.

Figure 1 - A screenshot from TXStats.com illustrating the growth of the Lightning Network over the past 2 years. (: TXstats.com)

Although the above analysis is useful, itonly data on public channels is taken into account. This can create an incomplete picture of the network, since many lightning channels do not advance at all: for example, mobile wallets can keep their channels closed. In this report, we publish new data on the Lightning Network, based on an analysis of the Bitcoin blockchain and information on all one-way closures of lightning channels, including private ones.

Lightning Network Transaction Database Methodology

Before moving on to the results, I would like totalk about how we got this data. There are several types of Lightning Network transactions that are recorded on the chain and can potentially be identified as lightning transactions.

Transaction type The ability to identify a transaction through blockchain analysis
Channel opening It is impossible to reliably identify this type of transaction only based on information from the blockchain.</p>

However, in the case of public channels, theseTransactions can be identified by data received from the Lightning Network node. In addition, a transaction can be identified as belonging to the Lightning Network later, when the transaction is refunded when the channel is closed one-way (see below).

Joint (bilateral) closure Distinguish this type of transaction from others, notLightning related might be too complicated. You can scan the blockchain for all expenses reimbursed using a multi-signature script of type 2-of-2, but you can not be sure that all these transactions are associated with the Lightning Network.
One-way (incompatible) closure The analysis is complex, and with absolute certainty to say whether the transaction belongs to the Lightning Network, it seems difficult.</p>

Nevertheless, it is still possible with a sufficient degreeauthenticity to identify these transactions as lightning. After a channel is closed, a transaction can be more accurately classified as one-way closing if its exit is refunded when funds are withdrawn after the channel is closed.

This third scenario is the main theme of today's report.

In case of one-way channel closurea transaction can potentially be accompanied by three types of scenarios, two of which lead to a transaction of withdrawing funds from the channel using the Bitcoin OP_IF script (sweep transactions). Identification with a relatively high degree of certainty of these OP_IF channel cleanup transactions is possible by analyzing blockchain data.

Transaction type The ability to identify a transaction through blockchain analysis
Normal sweep transaction Such transactions can be reliably identified.
Penalty sweep transaction Such transactions can also be identified fairly reliably, but rather rarely.</p>

The ForkMonitor website has a penalty transaction alert system.

No sweep transaction In some cases, after a one-way close, the sweep transaction is not performed.</p>

This can happen for the following reasons (the list is not exhaustive):

  • The user deleted or disconnected his wallet, and therefore does not withdraw funds from the channel.
  • Lock-time has not yet come to an end
  • In the last state of the channel, all funds inside it were transferred to the party that did not initiate the closing of the channel, and therefore a sweep transaction is not required.

If there is no sweep transaction, then obviously there is no object for onchain analysis.

Figure 2 below shows part of the methodology,which we used to build a database of one-way channel closing transactions. We worked in the opposite direction - up the diagram, in the opposite direction to the flow of funds, in order to determine which transactions were one-way closures, and even to identify channel opening transactions.

Figure 2 - A diagram showing how to reliably identify transactions of opening and one-way closing of a channel based on data from the blockchain. (: BitMEX Research)

Of course, this methodology is not enough toidentify all one-way channel closures, as some of them, as mentioned above, can occur without a sweep transaction. Therefore, in addition to our analysis, for the remaining transactions, we also used a less reliable scanning method.

Results and their analysis

In the tables and diagrams below we givestatistics on one-way closures of Lightning Network channels. With a more reliable methodology, using sweep transactions, we were able to identify 59 508 channel closing transactions for a total of 1074 BTC. This can be considered as the lower limit for the actual number of one-way closures. In addition to this, a direct search for one-way closures yielded a total of 90,667 results with a total of 1,405 BTC. The result obtained with a more reliable sweep transaction search methodology is a subset of the quantity found using a less reliable direct search.

Identification data for one-way channel closures

Identification method Number of transactions Cost in BTC
Regular (non-penal) sweep transactions 59,239 1070
Penalty Sweep Transactions 269 3
Bottom line 59 508 1074
One-way closures without subsequent sweep transactions (direct search) 31 159 332
Upper bound 90 667 1405

: results of a blockchain analysis conducted by BitMEX Research.

Note: On-chain data covers the period from 1 to 611,000 blocks.

The transaction volume here is quite large and mayindicate more experimental uses of the Lightning Network than many expected. The data also suggests that the percentage of unilateral channel closures is actually higher than is commonly thought.

Figure 3 below shows the totalone-way closures in each calendar month since the launch of the Lightning Network based on data obtained by all search methodologies. The results seem to indicate that activity peaked in the first half of 2019, which does not differ too much from other network metrics, such as the number of public channels. Of particular interest is the fact that in December 2019 the coefficient of unilateral closures fell to a level not observed since the beginning of last year, although the number of public channels for this period increased significantly. This may be because users are better able to learn how to use the Lightning Network technologies, and to improve wallets.

Figure 3— Total number of one-way closures of lightning channels per month (upper limit).
:for blockchain data – BitMEX Research, for public channel data – TXStats.com.
Note:On-chain data covers the period from block 1 to block 611,000, an interactive chart is available in the original article.

Figure 4 below shows the number of bitcoinsspent in one-way channel closing transactions over time. Again, there is a gradual increase in the number of transactions with the steepest slope in April 2019.

Figure 4— The total number of BTC spent per month in transactions of unilateral closure of lightning channels (upper limit).
:for blockchain data – BitMEX Research, for public channel data – TXStats.com).
Note:On-chain data covers the period from block 1 to block 611,000, an interactive chart is available in the original article.

Figure 5 shows only one-way closures defined using a more robust sweep transaction search methodology.

Figure 5— Number of one-way channel closures per month (lower limit).
:results of blockchain analysis conducted by BitMEX Research.
Note:On-chain data covers the period from block 1 to block 611,000, an interactive chart is available in the original article.

Figure 6 below shows only one-sidedclosures defined using a less reliable direct search methodology, where funds were not withdrawn from channels using the OP_IF script. Here the numbers seem more volatile. As we approach the current date, there is no peak in these transactions, which may indicate that waiting for the lock-time to expire cannot be a significant driver for transactions in this category. A likely reason for the appearance of these transactions may be a scenario where the user initiates a one-way channel closure with only incoming bandwidth - possibly unwanted or unused.

Figure 6— The total number of BTC spent in transactions of one-way closure of lightning channels per month (without sweep transactions).
:results of blockchain analysis conducted by BitMEX Research.
Note:On-chain data covers the period from block 1 to block 611,000, an interactive chart is available in the original article.

Bitcoin Commission Market Value

In figure 7, the number of one-way closureschannels per day is related to the size of Bitcoin commissions. The chart, apparently, does not indicate that channel closures were provoked by a sharp increase in commissions for on-chain transactions, as many feared. This can be an element of risk for the further development of the Lightning Network.

Figure 7— The number of one-way closures of lightning channels per day and Bitcoin commissions.
:for blockchain data – BitMEX Research, for commission data – txstats.com.
Note:On-chain data covers the period from block 1 to block 611,000, an interactive chart is available in the original article.

The share of penal transactions

Recall that there are two economic scenarios,resulting from one-way closing: with violation (when the closing side broadcasts the old state of the channel in an attempt to steal funds) and without violation. The one-way close data in this report includes both of these scenarios. In the event of a violation, a cancellation transaction may follow the closure of the channel if an attempted theft is detected and the honest side requests all the funds. Our analysis shows that these penal transactions are very rare. Only 0.30% of one-way closures lead to penal transactions, the total cost of which is 0.22% of the volume of all channel closures.

Number of transactions Transaction Input Cost
One-way closures (upper bound) 90 667 1405.2 BTC
Penalty Transactions 269 3.1 BTC
Percent 0.30% 0.22%

: results of a blockchain analysis conducted by BitMEX Research.

Note: On-chain data covers the period from 1 to 611,000 blocks.

Direct search for one-way closures

As mentioned above, in addition to searchingin sweep transactions, we tried to use a less reliable method of direct search for one-way closures, in order to also detect closures without using the OP_IF script. Our [imperfect and somewhat amateurish] methodology was based on the following:

  • Transaction logon redemption is a 2-of-2 multi-signature pay-to-witness-script-hash (P2WSH) script
  • Transaction has one input.
  • Lock Time Field
  • Nsequence field
  • Empty field script_sig

We applied the above filter to alltransactions in Bitcoin history. I repeat once again: our methodology is not ideal, it may include transactions that are not actually closures of lightning channels. On the other hand, we believe that many transactions can hardly meet these criteria, in addition to lightning, since transactions with 2-of-2 P2WSH multi-signature are quite rare. Therefore, our estimate can be quite accurate.

The following factors may testify to the accuracy of our database:

  • The method allowed to correctly identify almost 60,000 transactions, already identified as one-way closures by a more accurate search system for sweep transactions.
  • Our analysis correctly identified each of the 350 one-way closures in which our lightning nodes were the other side of the transaction.
  • There was not a single false positive insidesamples of 750 joint channel closures performed by our nodes. This means that the method does not erroneously determine joint closures as one-way.
  • Our assessment methodology did not reveal anyunilateral closing transactions until the launch of the Lightning Network in December 2017, although this may be explained by the fact that such transactions separate the witness into a separate structure (Segregated Witness), which did not happen until August 2017.

Data integrity

Looking for additional confirmationthe reliability of the data, we calculated the number of transactions by categories based on the values ​​of their inputs. Figure 8 presents this data for one-way closures, defined by more reliable and less reliable methods. For both data sets, a small peak is visible in the diagram in the range from 0.16 to 0.17 BTC. This range accounts for the transaction size limitation that is valid in most lightning channels and is equal to 0.167 BTC (or 1/6 bitcoin). This peak in the range of 0.16–0.17 BTC and the shape of the graph below may indicate that our data set accurately reflects the number of lightning transactions using both reliable and less reliable methodology.

Figure 8— Shares of transactions of one-way closure of lightning channels, grouped by input value (in BTC).
:results of blockchain analysis conducted by BitMEX Research.
Note:On-chain data covers the period from 1 to 611,000block. The value of transactions in categories is greater than or equal to the lower limit and less than the upper limit of the specified ranges. The last range is greater than or equal to 0.5 BTC. An interactive chart is available in the original article.

Relative peak size in the range 0.16–0.17BTC is much higher for a more robust methodology, as you would expect. It should be noted that there is a significant risk that we could mistakenly include in our database transactions that are not related to the Lightning Network. From a statistical point of view, a lower (in relative terms) peak in the range 0.16–0.17 BTC for the direct search methodology could potentially be evidence of false positives. On the other hand, this phenomenon may have other reasons.

Output

Number of one-way channel closuresIt turned out to be higher than we could have expected - more than 60,000, in comparison with our expectations of detecting about 30,000 of such transactions, which would also correspond to the assumptions of several Lightning developers that they expressed to us. The data obtained may indicate that experiments with mobile lightning wallets, which often establish private channels, may be more common than many expected. Data may also indicate that a one-way type of closure is more common than a two-way (joint) closure than was anticipated in the community.

Our analysis provides some insight intoLightning privacy restrictions. While privacy in Lightning is significantly higher than in Bitcoin's on-chain transactions, it is likely that blockchain monitoring services and block explorer can detect and publish one-way closures and penalties in the same way as we did. The fact that one-way closures occur more often than many thought also means that Lightning’s privacy and scalability benefits are lower than many expected. However, future updates to the Bitcoin and Lightning protocols may make this type of analysis more difficult. At the same time, as users learn more about the Lightning Network and lightning wallets improve, the share of one-way closures may decline. Figures 3 and 4 show that to some extent this is already happening.

Assuming joint closuresoccur twice as often as single-sided, which was the case with BitMEX nodes and seems to be a conservative assumption, the gross bitcoin flow in the Lightning Network from the moment of its launch can be conservatively estimated at 4000 BTC. This is not taking into account the funds inside private lightning channels, and is probably an underestimated estimate.

Description Amount
One-way channel closures (lower bound) 1000 BTC
Joint closures of the channels, based on the assumption that they are 2 times more than unilateral (for our nodes, 2.14 times more) 2000 BTC
Contained in public channels 870 BTC
Estimated Total Gross Inflow at Lightning Network 3870 BTC

This is a higher figure than we expected. However, despite the significant gross inflow to Lightning and a higher than expected level of use, we do not think that this is the case when the significant inflow is due to necessity or real trade. Today, Lightning remains a network for enthusiasts and technicians.

Bonus: The ratio of public and private channels

The next question we asked wasratio of the number of public and private channels. We used the database of public lightning channels 1ml.com, correlated it with our set of data on one-way channel closures and came to the conclusion that about 28% of one-way closures belong to private channels. This figure, 28%, can be considered as a reasonable proxy indicator for the total share of private channels in the Lightning Network.

Estimated share of public and private channels in the Lightning Network.
:BitMEX Research, 1ml.com.
Notes:Based on data on one-way closures determined only from sweep transactions.

Lightning channels identified by sweep transaction

Channels from the 1ml.com database (public) 43,839 72.2%
Channels not from the base 1ml.com (private) 16 896 27.8%
Total 60 735 100.0%

: BitMEX Research, 1ml.com.

Notes: Data as of January 23, 2020

It is worth stipulating that we have noconfidence that our results, which relate only to one-way closures identified by a sweep transaction, can be extrapolated to all lightning channels. For example, there may be a variety of reasons for the greater prevalence of one-way closures among private channels. Nevertheless, we believe that this is one of the most comprehensive estimates of the share of private channels available today.

Some of the community members have turned ourattention also to the fact that the analysis of public and private channels based on the number of BTC contained in them can be more informative than the metric we gave based on the number of channels.

Therefore, we decided to provide this data,Based on the output values ​​of 60,000 one-way channel closing transactions. In these transactions, 1070 BTC was spent, of which 939 BTC were associated with public channels and 131 BTC - with private ones.

The ratio among one-way channel closures is public and private.
:BitMEX Research.
Note:channels were determined by searching for sweep transactions, without taking into account penalty transactions; the interactive diagram is available in the original article.

Percentage of total cost, 88% of channelsin our data set are public, compared to 72% of the total number of channels. Assuming that our database reflects all existing lightning channels, this indicates that public channels, on average, are larger than private ones, which could be expected.

 

: 12