Building On Top Of Bitcoin
Layer 2 And The Lightning Network
The Bitcoin trilemma highlights the difficulty of accommodating the three ideal aspects of a blockchain-based money system, that is security, scalability and decentralisation. Bitcoin can provide security and decentralisation but at the cost of scalability.
The bitcoin blockchain can currently only process around five transactions per second, when Visa processes thousands of transactions per second. The term Layer 2 simply refers to the idea of building functionality on top of Bitcoin’s blockchain, to solve the scalability part of the trilemma.
The Lighting Network is a specific Layer 2 solution, focused on speeding up payments and competing with the likes of Visa.
The idea of Layer 2 is to build protocols or secondary infrastructure that can interact with a fundamental base blockchain but not be restricted by its scale limitations. This is where we make a clear distinction between on-chain and off-chain.
Transactions described as being on-chain are processed entirely through the relevant blockchain's consensus mechanism and recorded publicly onto the chain.
Channels And Invoices
The technology uses micropayment channels to scale the bitcoin blockchain’s capability by processing transactions more efficiently. Micropayment channels are opened between two parties looking to conduct a transaction.
This channel is opened off-chain and without the overhead of the consensus mechanism, can process transactions much more efficiently than those that occur on-chain. Transactions are added to the chain once both parties have closed the channel, i.e. agreed to the transaction's validity.
On the Lightning Network, payment channels are opened between two parties through multi-signature addresses. These act as mutual vaults that both parties can deposit funds into; multi-signature means that more than one signature is needed to release funds, a fail-safe ensuring one side cannot walk away with the funds within the channel.
When funds are deposited, a channel is opened, creating a balance sheet between the two parties; this is then added to the main chain. Transactions between the two parties are recorded by updating this balance sheet to include the new balance between the two parties. These updates come in the form of Invoices.
The Lightning Network structure is designed to connect individual users through micropayment channels in the most efficient way possible. Therefore, it isn’t unnecessary to open a payment channel with every individual actor you want to use.
All of this not only means faster transactions - some estimates put the upper limits of lightning network capability at nearly 1 million transactions per second - it also means lower transaction costs. The fewer transactions that have to be processed by bitcoin's consensus mechanisms, the fewer fees have to be paid.
Bitcoin's Killer Application
By enabling the transaction to occur through payment channels rather than on-chain, the lightning network offers a potential way for bitcoin to address its scalability problem. People have likened this to what fiat currency did for gold, arguing that the lightning network could be bitcoin's killer application.
The analogy works when you think about it, fiat currency was a way of scaling gold, just like the lightning network is a way of scaling bitcoin. In a sense, Fiat 'killed' gold as a currency and turned it into a value store. It remains to be seen if the lightning network can do this for Bitcoin.
Lightning is still handling only a tiny fraction of on-chain transactions. Nodes are growing along with the number of wallets that support Lightning, but there is a long way to go to simplify the User Experience of creating/managing channels and invoices.
Another, perhaps more significant, problem, is the risk of powerful hubs developing on the network. Hubs are big pools of capital that could facilitate a large proportion of the transactions in the network. This would risk the network's security, and of course, risk re-introducing centralisation to the system.