How the Lightning Network Works: Simple Explanation
By Marco Gagliardi profile image Marco Gagliardi
7 min read

How the Lightning Network Works: Simple Explanation

The Lightning Network has emerged as an additional layer on top of Bitcoin's blockchain, in order to ensure the possibility of fast, cheap and scalable transactions. This technology works by creating channels between the various network users and through shared connections and shared channels, a decentralised and efficient

The Lightning Network has emerged as an additional layer on top of Bitcoin's blockchain, in order to ensure the possibility of fast, cheap and scalable transactions. This technology works by creating channels between the various network users and through shared connections and shared channels, a decentralised and efficient network has been generated. In this article, we will explore the history of the network and its complex workings in the least complex way possible.

Bitcoin: Bigger Blocks or Lightning Network?

During the hot summer of 2017, Bitcoin (BTC) reached the astronomical $3,000 mark. The network's popularity grew by the day, along with the listing, and the community came up against a long-standing dilemma: the limitation of the block size of Bitcoin's blockchain.

Satoshi Nakamoto had in fact set the block size at 1MB, effectively too small for the volume of transactions that the network should and could guarantee in the event of greater adoption. The community, faced with the need to scale Bitcoin, split into two paths:

- The first path proposed increasing the block size. Initially to 8MB, then to 32.

- The second path proposed a more complex solution, involving a modification of the protocol to implement Segregated Witnesses (SegWit). This modification slightly increased the block size but introduced the revolutionary technology of the Lightning Network

In reality, both solutions were valid, however the increase in block size would have cut out all those individual Full Nodes running on devices with underperforming hardware, eroding the decentralisation of the Network.

In fact, you should know that a Bitcoin Full Node requires low hardware requirements and can be maintained on any computer with an internet connection, which is what makes Bitcoin the most secure and distributed network in the world.

The two paths just mentioned have led to a real bifurcation of the 'Bitcoin path'. In fact, the technical jargon 'fork' derives precisely from this division of the chain into two separate paths. On one side were the larger blocks, on the other side the SegWit technology. At this point a question arose: Which chain should continue to be called Bitcoin? This dilemma was solved directly by the centralised exchanges, continuing to call Bitcoin the network adopting SegWit technology, and Bitcoin Cash the network with the largest blocks.

The Lightning Network has emerged as the solution to the challenges posed by Bitcoin's block size limit. It works through channels, which technically correspond to multi-signature addresses on Bitcoin's blockchain. Thus, moving BTC within the channel requires two signatures, one of the sender and the other of the receiver.

Through technical mechanisms that we will explore shortly, the channel maintains a kind of accounting, determining the balance of BTC for each party involved through the exchange of signed transactions.

It is crucial to know that these signed transactions remain as such: they are not written to the blockchain until the channel is closed. We have to imagine the transactions as mere slips of paper, signed by both parties, where it is written "From this channel containing 10 BTC, Marco is entitled to 6 BTC and Sara is entitled to 4 BTC". In reality, the channel is very rarely closed and Bitcoins circulate through the exchange of these metaphorical slips of paper. The Lightning Network keeps track of everyone's debits and credits, settling them when the channel is closed by writing the transaction on Bitcoin's blockchain.

The Six Degrees of Separation Theory in Bitcoin

The Lightning Network recalls the concept of the six degrees-of-separation theory in semiotics and sociology. This theory holds that any person can be connected to any other person through a chain of knowledge and relationships, with no more than five intermediaries. By exploiting this theory, the whole world could easily be connected. This is then simplified through the creation of grand hubs of connectivity, harking back somewhat to the history of the Internet.

In practical terms, the Lightning Network operates on the basis of indirect connections. Users do not have to establish direct channels with everyone, but can use channels with common contacts. So Sara, even if she does not have an open channel directly with Claudia, will still be able to send her BTCs easily, quickly and safely through Marco, the mutual friend with whom they both have an open direct channel. 

Preserving Security: The Role of Disincentives in the Lightning Network

For the brave, let's now get technical.

How is a Lightning Network channel opened? Paradoxically, to open a channel a closing transaction is prepared. Therefore, even before opening the channel, the network and the two users already know how to close it. This excludes potential fraudulent actions or inconveniences resulting from the need for multiple signatures (disappearance of the signatory or threat of non-signature of the transaction), which would make it impossible to securely close the channel.

If the signatories decide to deposit in cryptocurrencies 5 BTC each, they will sign a closing transaction that will distribute the 10 BTC in the channel equally. Once the parties exchange this transaction, they will open the channel.

To transfer value, new closing transactions will be created in which one of the parties changes the initial BTC values. For example, if the channel consisted of 5 BTC to Marco and 5 BTC to Sara, when Sara needs to pay Marco 1 BTC, she will construct a closing transaction (write on the slip) that returns 6 BTC to Marco and 4 to Sara. The transaction will also be signed by Marco and will be kept by both parties.

The challenge now is for Marco to make sure that Sara discards the original transaction, the one that distributes 5 BTC to each. If Sara decides to write off that transaction, she will close the channel and Marco will lose the BTC that Sara paid him.

How can Marco make sure that Sara destroys that old transaction? Well, he can't. The transaction is a simple file that users can store indefinitely, make copies of, hide. So let's try to understand how the Lightning Network guarantees security.

We need to know that Bitcoin transactions can include conditions, both temporal and practical. In fact, a condition is always included in the closing transaction. If the issue was complex, here we complicate it even more. 

In the first closing transaction held by Sara, where 5 BTC each will be distributed, two conditions are inserted: 5 BTC are given immediately to Marco, and the other 5 are subject to two conditions: they will either go to Sara within 24 hours or they will go to Marco if he reveals a keyword known to both of them.

This way, assuming that after a series of transactions Sara is given 3 BTC and Marco 7 BTC. If Sara decides to write the old transaction on the blockchain, Marco has 24 hours to protect himself, reveal the keyword, activate the condition and take the remaining 5 BTC without anything going to Sara

Obviously, Marco also has the original transaction that distributes 5 BTC per side, but he has no reason to use it as he is entitled to 7 BTC instead of 5.

In all this, the network acts autonomously and activates the security measures on its own. There is no need for Marco to be glued to his PC to monitor that Sara doesn't write the transaction.

In essence, anyone who tries to defraud the counterparty ends up losing all the BTC in the channel, even those he is entitled to. This is a clever trick that doesn't erase the old signed transactions but discourages their use.

Facing the Challenges: Criticalities and Difficulties in Using the Lightning Network

This is all great, isn't it? Well yes, but in reality there are also some critical points.

As we have mentioned, in order to enjoy total security, a constant online presence is necessary to protect oneself from the malicious actions of the other party. In the example mentioned, the 24-hour window serves as an illustration, but the parties can agree on different time periods. This requires a certain degree of vigilance, as participants must be careful during the agreed time period to safeguard their own interests.

Another critical aspect concerns the safekeeping of closing transactions. If one party were to lose it, their recourse would be limited to the hope that the other party would generate a new transaction. This scenario departs from the fundamental principle behind the creation of the blockchain: to establish an environment in which trust in others is minimised.

For a user who has no intention of entrusting their precious BTC to third parties, these two critical issues cannot be ignored. However, by relying on third-party services, it is possible to conduct transactions on the Lightning Network without any such concerns. The trade off is the use of wallet custodial, whereby we are not the owner of the wallet, but use a wallet operated by a third party that offers this service and handles the various mentioned criticalities for us.

The advice is always to use these custodial wallets with caution, loading into them only the amount of BTC that you wish to spend in the short term.

If the difference between custodial and non-custodial wallets is not clear to you, please read this in-depth guide.

Final Thoughts on the Lightning Network

We have therefore attempted to briefly examine how the Lightning Network works, albeit omitting many technicalities. Understandably, it is not an intuitive technology, but for the more enthusiastic and curious users it is worth delving into. 

As the popularity of Bitcoin increases, so do the merchants accepting BTC payments through the Lightning Network, and I must admit that testing this technology first-hand is exciting. 

A speed that puts the fastest blockchains to shame and an unparalleled ease of use (using custodial wallets), all topped off with the total freedom to safely exchange value from one side of the world to the other. Spending BTC is officially possible and this technology makes it possible to do so even for minuscule amounts.

To date, this Bitcoin Supplementary Layer seems to officially offer the solution to the block size problem without compromising the aspirations of smaller operators who wish to maintain a full node to decentralise our beloved Bitcoin.

By Marco Gagliardi profile image Marco Gagliardi
Updated on
Web3 Guide Blockchain DeFi Crypto Community