HomeWikiDiscovering Bitcoin LN

Discovering Bitcoin LN

One thing has to be said: there isn’t only Bitcoin LN, there are other very complex lightning networks

Alla scoperta dei Lightning Network: Leggi qui l’articolo in Italiano.

We will try to deal with this concept from the point of view of how it works, in terms as simple as possible.

For further information, you can follow the links and use the resources at the bottom of the article.

Bitcoin’s limitations as of today

The blockchain

Today’s Bitcoin is based on a transaction log, duplicated on each computer in the network. This log is the proof that no one has ever created crypto outside the rules. It is also a guarantee that bitcoins never have been spent twice. This register also provides a map of all the “computers” containing the unspent (UTXO) bitcoins currently in circulation and the rules for spending them (ScriptPubKey).

Certification of miners

Each page of the single transaction log must be certified and placed in a chronological order through a complex mechanism (mining) that involves repetitive and massive calculations and that leads to certify a small page of transactions on average every ten minutes. It means that the current network can certify less than 7 transactions per second.

To appear on a page, it is also necessary to leave a fee for those who will allow the certification on the network. Since the space on the page is limited, in periods of overload, the certification of a single transaction could be slow and costly.

Verification of nodes

To ensure that Bitcoin user does not have to rely on third parties to verify the correct accounting of the money he receives, each node in the Bitcoin network performs the verification of each transaction: this makes the Bitcoin system not very scalable. Furthermore, the fact that every transaction must be verified means that it is readable by everyone in every detail, and this puts users’ privacy at risk.

But is it really necessary that every node in the network should verify and see every single payment and that this should be subjected to the mining process for its certification?

Bitcoin LN

What are Lightning Networks

Lightning Networks are distinct networks but in communication with the Bitcoin network, whose nodes can exchange Bitcoin transactions as if they were “payment obligations”.

Such transactions, not being transmitted on the Bitcoin network, but remaining only in possession of the “obligated”, do not weigh down the Bitcoin network until the parties decide that it is time to obtain the net balance of the transactions from the network itself. At that time, closing transactions will be transmitted, verified, and certified through the network mining process.

It is a bit as if the nodes exchanged unfalsifiable, always collectible, cheques (transactions) at an always open credit institution that cannot be insolvent (the Bitcoin network can not exhibit or use more than the assets in existence).

A transaction executed on the Lightning Network is:

  • Instant
  • Almost free (very small fees)
  • Of microscopic amounts as well (so-called micro-transactions)
  • With greater privacy, since only the balance of transactions between operators ends up permanently on the blockchain

To understand why this is possible, you need to know how Bitcoin transactions work.

Bitcoin LN

Transactions on the Bitcoin network

Transactions on the Bitcoin network consist of a request to release bitcoins from a computer puzzle in which they are bound, providing a valid digital signature and place them under new constraints (provided by the recipient of a transaction in the form of an “address”).

If this request is transmitted on the Bitcoin network, it involves, as we have seen, all the nodes of the network for the verification and the mining process for the certification.

There are, however, ways to write the transactions so that they constitute potential financial flows that the recipients can accept as effective even if not transmitted and certified on the Bitcoin network, being strengthened by the non-repudiation of valid transactions once certified on the network.

The metaphor of the game of darts

To understand how this happens, let’s use a metaphor: for example, let’s take two people who play darts and decide to pay 1 thousandth of a bitcoin per game.

It is neither intelligent nor necessary for them to block the network with reciprocal payments at the end of each game.

They could put “at stake” (on the Bitcoin network) a bitcoin each and decide to recover what they owe each other once one of the two players decides to go to bed (or at the end of the tournament).

On the Bitcoin network, this means binding a certain amount to a common address (funding transaction) from which it can only be spent with the consent (expressed as a digital signature) of both players and transmitting this transaction to the network certifying the transaction on the blockchain.

To make sure they can get their deposit back, players complete a transaction that returns the amounts due to them (commitment transaction), they sign a copy for each other and they exchange it but DO NOT transmit anything on the net. They simply keep their copy for when they want to go home.

At the end of the first game, a new transaction that distributes the common deposit will be compiled, taking into account the fact that the winner will have his deposit fee increased by one-thousandth of a bitcoin and the loser his deposit decreased by the same amount.

We, the undersigned Alice and Bob, demand from the Bitcoin network to transfer the amount of 2 bitcoins to our joint account:

  • As much as 0,999 bitcoins to Alice
  • As much as 1,001 to Bob

It is understood that the publication of any previous contract on the Bitcoin network by one of the players will result in a punitive transfer of the entire amount in common to the other player.


Translation into an understandable language of the Commitment transaction that is retained by Bob, in the event that Bob has the advantage of a game on Alice and that can be countersigned and transmitted on the Bitcoin network to close the payment channel.

This transaction will be signed and copied by both players (each will have a signed copy), who will tear up the previously stored transaction.

In reality, a valid transaction that spends money not spent before is always due if transmitted over the network and one of the players could transmit an old commitment transaction more favorable to him.

Therefore, stratagems are needed to make such behavior useless or unprofitable.

Since these transactions do not need to be transmitted over the network and verified by all nodes to be payable, but only by the software of the two players who can check the correctness and collectability on the network, the game can go on for years without any transaction touching the network.

At the end of the evening, the players will have in their pockets the net balance of the winnings (besides other transactions that serve to invalidate the obsolete intermediate balances), which is made up of a single transaction that returns the money according to the net final outcome of the matches.

At the end of the tournament both players, in case they want to close the accounts, can countersign their copy of the commitment transaction and send it to the network (Closing transaction).

The counterparty is given some time to check what is transmitted and certified on the network so that, if the transaction does not reflect the final balance, the counterparty can react by publishing a special transaction that nullifies the effects of this attempt.

Currently, this publication even provides for the withdrawal by the injured party of the entire amount of the money staked (Penalty transaction).

This composition of transactions and their exchange, which amplifies the transactional potential of the bitcoin is called “bidirectional payment channel“.

It is understandable that the use cases of these configurations are very limited.

It is difficult for two economic operators to have strong needs for very frequent mutual payments. Part of the novelty of lightning networks is, in fact, the routing of payments.

This article does not mention the fees that intermediary nodes collect to convey the payments, in order to simplify the exposure, although it is a vital component of the protocol.

Payment routing

Suppose each user has two-way payment channels in place with different people. Even if I don’t have a direct channel with “Charlie”, I could tell “Bob”, who has one with me and one with Charlie, to pay Charlie for me and promise to then sell it on the channel I have with him. It wouldn’t be a big problem for Bob, as long as he can rely on the certainty of being able to collect from me after or having paid Bob.

To make this payment authorization completely secure, you can package special Bitcoin transactions called HTLC.

Explained in understandable words, the recipient of the payment sends a question which only he knows the answer to me and Bob (in reality it is a commitment scheme).

I prepare a transaction that allocates the amount to Bob as long as Bob provides the answer to Charlie’s question within a certain time (e.g. 1 hour) and Bob completes a transaction with the same condition for Charlie but expiring in 50 minutes.

At this point the payment is either made, correctly compensating all participants or it is not fulfilled at all and each node involved regains the ownership of the bitcoins that should have been transferred.

It is easy to imagine that the demand that links the payment inside the intermediaries is similar to an invoice issued by the beneficiary and that contains elements useful for the correct execution.

The intermediaries of each payment can be different and do not need to know or trust each other: a payment that passes through ten or so intermediaries is perfectly executable today. The set of nodes involved in a payment is called the payment “route”.

As we write, the official Lightning Network, on top of the Bitcoin network, already has more than 2400 nodes connected together by more than 7000 bidirectional payment channels.

Of course, the routing of payments on the Lightning Network has many constraints and is a complex problem. For further information, a post has been published on the state of LN to date.

An overview of the Lightning network topology of the Bitcoin network https://rompert.com/recksplorer/

There is more

Since many cryptocurrencies were created from Bitcoin, they share the features necessary for the creation of a Lightning Network. Litecoin, for example, already has lightning nodes that support it and the fact that to carry out a transaction it is often necessary to rely on an intermediary node opens up an incredible possibility:

Suppose Charlie wants to receive payment in litecoins but I only have bitcoins. In the present conditions, I should trade on an exchange with the costs, risks and times that are required today.

Now suppose Bob has a channel with us with his Bitcoin Lightning node and a channel with Charlie with his Litecoin lightning node. Bob could fix an exchange rate and agree on an amount in Bitcoin that we have to pay him for him to pay Charlie in Litecoin.

If I wanted an instant input to the Litecoin world I could simply install a Litecoin Lightning node and open a channel with Bob.

I would have replaced an exchange with something much faster, cheaper and safer: I could send a payment to Bob on condition that Bob sends me the corresponding amount in Litecoin.

The Lightning Networks will thus become the bridge between different cryptos that share the same basic functions necessary to establish lightning channels.

The main operators involved in the project today

The idea of the Lightning Networks was formalized in a whitepaper by Joseph Poon and Thaddeus Dryja in January 2016 but something already very close existed in the white paper of Corné Plooy in February 2013.

The three companies that are today the fulcrum of the development of Lightning nodes are:

  • ACINQ (Paris) develops the Eclair node in Scala. The company has a great capacity for development and has realized the first and, for now, the only client for mobile phones. @acinq_co, @dpadou
  • Blockstream (Montreal) develops the C-lightning node in C. The flexibility and proximity to the C machine language allows this platform the best performance and the best portability on different platforms @rusty_twit @snyke
  • Lightning Labs (California) develops LND in Go. These guys feed a large community and have created the most advanced features (such as autopilot and Neutrino). It is also the most stable implementation at the time of writing @roasbeef @starkness

Following the Milan project, a two-day meeting of the development teams of the three companies involved by Blockchainlab Switzerland and BHB Network in November 2016, the communication protocol of the nodes and the operation of the lightning network was developed.

Today Drija, one of the editors of the white paper, leads the sponsored implementation project that is not yet compatible with the rest of the network but contains some innovative components

Status of development and possible paths of consolidation

The technology in a work in progress. Future developments include parts that would be important for industrial use:

  • Trusted node backup procedures
  • Third-party delegated surveillance infrastructure. Each lightning node must always monitor the Bitcoin network to ensure that there is no fraudulent attempt to close the channel. This is rightly considered difficult for any client, but prohibitive for mobile devices. Watchtowers are software to which a user can delegate the surveillance of their channels in exchange for a small fee.
  • Improved transaction structure through a new operator in the Bitcoin script
  • The possibility to remove and add bitcoins to a channel keeping the channel open during transactions on the Bitcoin network and thus avoid the waiting time that these operations would normally require (splicing).

and some others.

Nevertheless, some merchants have already opened on the official network and it is possible to make purchases of goods and services using this payment channel.

Tomorrow, Lightning Networks will allow instant and secure exchanges between different cryptocurrencies and high-frequency micropayments. There are countless possible scenarios in front of us; and one of the most fascinating is the one that imagines an economy, in which the consumption of service can be paid for in seconds and in which the needs of capital and credit due to the viscosity in the movement of money will be drastically reduced.

Resources for further information:

Gabriele Domenichini
Gabriele Domenichini
Gabriele Domenichini è un investitore interessato all’aspetto tecnologico del Bitcoin. Il suo Family Office (GDTRE srl) ha effettuato investimenti nell’area Lightning Networks e nello specifico in Blockstream e Lightning Labs. GDTRE ha altre partecipazioni in aziende come Ledger e The Rock Trading. Gabriele collabora con la società Blockchainlab Svizzera ed ha presieduto assob.it, l’associazione italiana per lo sviluppo delle tecnologie blockchain per due anni.