Bitcoin Lightning Network ~ Part 2

Maddy Bergen
ElektraVC
Published in
9 min readAug 12, 2022

This story is written by our Web3 VC cohort.

Source: Cryptopolitan

How does it work?

The Lightning Network achieves speed and decentralisation by allowing transactions to be processed off-chain without the need for third-party custody of funds. All transactions are completed on a peer-to-peer basis through a network of payment channels. Any two individuals can create a payment channel between them as long as they each have an LN-compatible Bitcoin wallet. The network primarily relies on users cooperating with each other, but has mechanisms in place to safeguard users’ funds and deter malicious acts.

What Happens in a Payment Channel?

A payment channel is essentially a 2-of-2 multi-signature (‘multi-sig’) contract where transactions are authorised only if signed off by both of the two users wishing to transact.

To open a new channel, at least one of the two users must first commit some funds, creating an initial balance of Bitcoins in a multi-sig wallet. The initial balance then determines the channel’s transacting capacity over its lifetime. The two users must each provide their signature to the LN accepting their respective starting balances as correct. The opening transactions are published on the Bitcoin blockchain.

Once a payment channel is opened, the two users can send payments to each other without publishing their transactions on the blockchain. They can transact as many times as they wish using their channel. The LN has its own off-chain ledger recording all the transactions on each payment channel.

Once they finish transacting, users can either keep their payment channel open or closed. In most cases of closure, the two users close their channel cooperatively by agreeing on their respective final balances and signing off a final transaction which sends the remaining funds to their respective wallets. The final transaction is published on the Bitcoin blockchain. In some cases, a channel may be closed unilaterally, known as a ‘force close.’ This scenario will be discussed in the ‘How is the Lightning Network Trust-less?’ section of this article.

The diagram below is a good illustration of the LN payment channel’s lifecycle:

Lifecycle of an LN Payment Channel (Source: Kurt, Ahmet & Mercan, Suat & Erdin, Enes & Akkaya, Kemal. (2020). Enabling Micro-payments on IoT Devices using Bitcoin Lightning Network.)

Finally, it is worth mentioning a few words on the powerful scalability of the LN payment channel structure. As individual users open payment channels with each other, a network of multiple inter-connected channels will form. This network will allow users to transact with anyone without necessarily having to create a new channel with them. For example, should Alice wish to transact with Carol, with whom she does not have a payment channel, she can do so through Bob who has a payment channel with both Alice and Carol respectively. This mechanism facilitates efficient transaction processing and allows the payment network to expand exponentially.

How is the Lightning Network Trust-less?

The LN has built-in mechanisms which safeguard users’ funds without needing an intermediary or any pre-existing trust between transacting parties. It works in the following ways:

1. Consensus: In normal cases, closure of a payment channel is initiated when both users are online to sign off the final balances and post the agreed balances onto the blockchain.

2. Dispute Period: In the cases where one party is unavailable to sign off the closing balance (e.g., if they were offline), the other party can unilaterally close the payment channel (known as ‘force close’) by broadcasting the most recently agreed balance on-chain. This will then give the unavailable party a predefined time period (set in the smart contract at the opening of the payment channel) to dispute the amounts posted. If no dispute is raised within the timeframe, then the payment channel will be closed and the initiating party will be able to withdraw their portion of the broadcasted final balance.

3. Penalty: The above mechanism leaves the network vulnerable to dishonest actors who can take advantage of counterparties who are offline for an extended period of time. Because offline counterparties may not be able to dispute the broadcasted balance in time, malicious actors can post an incorrect balance which distributes funds in their favour and withdraws funds after the dispute timeframe has elapsed. However, such malicious actors face the risk of losing all their funds to the other party because of a penalty mechanism in place. Within the LN, should a user try to cheat the system by posting a false balance that favours them, the smart contract will award the entire balance on the channel to the cheated party provided that they raise the dispute in time.

4. Watchtower: In addition, users of the LN can hire a third party (known as a ‘watchtower’) to monitor their channel and take action when malicious acts are detected. This will help users safeguard their funds even when they are offline. It is worth noting that such third parties will only be given the power to take action against malicious counterparties, but will not be able to force close the channel themselves.

How are they progressing?

Although Lightning Network (LN) is seen mostly as a Layer 2 solution for Bitcoin, it is not limited to it. In May 2017, Christian Decker of Blockstream made the first secure Lightning payment on Litecoin.

In December 2017 the Lightning Network developers revealed Lightning Network Protocol 1.0 RC and Mainnet testing, a significant step towards standardisation that began more than a year before. The work has been put together by the Bitcoin community and 3 teams named ACINQ, Blockstream and Lightning Labs. The first version of the Lightning Network was launched on Bitcoin in March 2018.

To understand the progress of LN, we will look at 3 important data points: number of nodes, number of channels and network capacity.

Lightning nodes open payment channels with one another that are funded with Bitcoin. Data shows that on 15th of January 2018, the number of nodes was 64. On 1st of August 2022, this number reached 17026 with its peak at 20,712 on 14th of March 2022.

Looking at the Lightning Network payment channels, on 15th of January 2018 there were 137. On 1st of August 2022 there were 81,290 unique channels connecting nodes directly for the first time, with the peak at 83,612 on 14th of February 2022.

The Lightning Network capacity refers to the cumulative bitcoin capacity across all channels. When transactions are made over these channels, the balance of the channel is reflected without needing to broadcast a transaction on chain. On 19th of January 2018 the network was handling 1.3 BTC, while on 1st of August 2022 that number grew to approximately 4420 BTC. Important to note this has been a constant increase over the years and the last data offered coincides also with the highest number of BTC ever in the network, although in dollar value the peak was in November 2021 at approximately $216 million (Bitcoinvisuals, 2022).

It is important to note that although we have been in a bear market arguably for the last 8 months (peak in Bitcoin price in November 2021), some of these data points have continuously expanded.

Part of the adoption for Lightning Network has also come from exchanges that have implemented the LN such as Bitfinex, Kraken, OKX, Bitstamp, etc.

In June 2021, legislation for Bitcoin to become legal tender was voted in El Salvador. Part of this decision has been based on the achievements of the Bitcoin Beach ecosystem in El Zonte that uses a LN-based wallet.

Looking at Blockstream and Lightning Labs GitHub there are over 70 repositories, with some of them updated even a few hours before my writing. Some of these repositories have as few as 2 contributors and some of them have over 30 contributors.

One of the interesting developments comes from Lightning Labs with the announcement of Pool, “ a non-custodial, peer-to-peer marketplace” where node operators can get or offer access to liquidity. This has been coined as the beginning of Lightning Finance (LiFi) where you can earn yield on your Bitcoin holdings by lending them out (Coindesk, 2020).

Some Popular Lightning wallets that allow users to make payments are categorised as custodial (Blue Wallet, Wallet of Satoshi) and non-custodial (Electrum, Breez). It is important to notice that one of these wallets has over 500,000 downloads on Google Play (Electrum).

What other Bitcoin scaling solutions are there?

Blocks themselves are batches of transaction data, and the amount of data contained in each block combined with the chain’s block generation speed determines the number of transactions per second, or TPS, that the network can handle. Obviously, having a high rate of TPS is more attractive, so developers are always looking for ways to improve this metric. It is certainly fair to point out that as block size increases, not only can more transactions be confirmed in each block, but also the average transaction fee will drop. This sounds like the best of both worlds, as the network would be both faster and cheaper.

Increasing the network’s transaction processing limit requires making changes to the technical workings of bitcoin, in a process known as a fork. Forks can be grouped into two types:

1.Hard Fork

A hard fork is a rule change such that the software validating according to the old rules will see the blocks produced according to the new rules as invalid. In the case of a hard fork, all nodes that work in accordance with the new rules need to upgrade their software. If one group of nodes continues to use the old software while the other nodes use the new software, a permanent split can occur.

Bitcoin Cash (“BCH”) is a hard fork of bitcoin increasing the maximum block size. Bitcoin XT, Bitcoin Classic and Bitcoin Unlimited each supported an increase to the maximum block size.

Bitcoin SV (“BSV”) is a hard fork of Bitcoin Cash and offers a competing implementation of the Bitcoin protocol that aims to solve the Bitcoin scalability problem by implementing an unbounded block cap size, enabling the network to produce blocks of unlimited size.

2. Soft Fork

A soft fork changes the software protocol where only previously valid transaction blocks are made invalid. Because old nodes will recognise the new blocks as valid, a soft fork is backwards-compatible. This kind of fork requires only a majority of the miners to upgrade to enforce the new rules, as opposed to a hard fork that requires all nodes to upgrade and agree on the new version.

Segregated Witness (SegWit) is an example of a soft fork. It refers to a change in the transaction format of Bitcoin. Its stated purpose as a protocol upgrade was to protect against transaction malleability and decrease transaction times by increasing block capacity. Transaction malleability refers to the possibility that tiny pieces of transaction information could be changed, invalidating new cryptocurrency blocks. It was also intended to speed up the validation process by storing more transactions in a block.

Meet the cohort authors

Ellen Tang

Ellen has extensive experience in the traditional finance space, ranging across Portfolio Management, Trading, Compliance, Audit, and Risk business areas. She has been taking an interest and investing in various blockchain projects since 2017. Ellen also runs a Personal Development Coaching practice and posts investment-related videos on my YouTube channel Investing With Ellen.

Alexandru-Iulian Iurea

Recent graduate in Computing Technologies with a strong interest in Blockchain technology. Alexandru’s journey in this space dates back to the end of 2017 when he discovered what he considers to be 3 of the most important values of any system, decentralisation, security and performance, being combined to generate enhanced solutions.

Yash Mundada

Yash is currently studying at BITS Pilani in India and has lived in the UK for the past 15 years. He is very keen to learn about the web3 space and its rapid development over such a small time frame.

--

--