COURSE 2 - 9.1. Lightning Network: Intro
The small dimension of Bitcoin blocks limits Bitcoin's blockchain scalability. Visa, which is based on a centralized ledger, can process up to 24.000 transactions per second. On the other hand, Bitcoin's blockchain could originally process only up to 3-4 transactions per second.
This problem was in part mitigated by SegWit (Segregated Witness): a protocol upgrade that increased block efficiency in terms of space, reduced the transaction size and therefore increased the number of transactions per second to 5-7.
SegWit, however, did not solve the problem of Bitcoin's blockchain scalability. 7 transactions per second is still negligible compared to Visa's 24.000.
Increasing the block size would immediately solve the problem of Bitcoin's blockchain scalability, just as increasing the size of the pages of a ledger would increase the amount of transactions that can be annotated in each page (and since a page is added every 10 minutes, this would increase the number of transactions per second). However, this would kill Bitcoin. In fact, at the core of Bitcoin there's censorship resistance, which depends of decentralization. Increasing the block size requires more powerful computers (e.g. for nodes) and bandwidth: this would produce centralization and therefore would eliminate censorship resistance, without which Bitcoin would not survive.
The solution to the problem of scalability was not found onchain but offchain. More specifically, by adding a "second layer" for fast, economical and private transactions on top of Bitcoin's first layer (the blockchain). This was achieved by Lightning Network (LN).
LN serves as a secondary layer protocol built on top of Bitcoin, engineered for transactions that are economical, swift, and confidential. It operates as a network of payment channels where only the initial setup and the final settlement of these channels are logged on Bitcoin's main blockchain. Apart from the initial setup and the final settlement, all other transactions are done outside of the blockchain. This allows for transactions which are fast, economical and more private.
Bitcoin transactions are therefore already developing into two different and mutually beneficial directions:
Smaller transactions (e.g. buying a coffee) are being done more and more in Lightning Network (i.e. “offchain”) as here they are immediate and with a transaction cost which is almost zero (if the same transaction was done in the blockchain, today the transaction fee would be much higher than the cost of the coffee and the coffee drinker would need to wait on average 20 minutes before he can drink his coffee). The blockchain enormously benefits from this because it is relieved of all small transactions (which occupy as much space in the block as the largest ones and are more numerous - and will be more and more so).
Larger transactions (which need a higher level of security, usually can wait longer and in relation to which the high transaction fee is more justifiable), on the contrary, are done in the blockchain
In this way, the problem of scalability is solved without increasing the block size: i.e. without making Bitcoin vulnerable by centralizing it.
Here's how it works in essence (from Grok):
Setup of Payment Channels:
Two parties (Alice and Bob) decide to transact frequently. They each lock some Bitcoin into a payment channel by creating a special multi-signature transaction recorded on the Bitcoin blockchain. This transaction is like opening a tab at a bar; money is committed, but not yet spent.
Off-Chain Transactions:
Now, Alice and Bob can transact with each other without involving the blockchain for each transaction. They simply update the balance between them. For example, if Alice pays Bob, they both agree on this change, and the balance in their channel updates accordingly. This process is fast, cheap, and doesn't clog the main Bitcoin network.
Closing the Channel:
When they're done transacting or want to settle their balances, they close the channel. This involves one final transaction on the blockchain that reflects the net result of all their off-chain transactions. This transaction closes the channel and redistributes the funds according to the final balance.
Network of Channels:
The magic happens because these channels can connect. If Alice has a channel with Bob, and Bob has one with Carol, Alice can pay Carol through Bob without ever opening a direct channel with her. This creates a network where payments can hop from one channel to another, hence the name "Lightning Network."