Bitcoin network has scaling problems. The system is designed so that a block is created on average every 10 minutes and the block size is limited to 1 MB. This is because only in this way the decentralized system works. In addition to ramping up the block size, the Lightning protocol was introduced. Because the latter was not implemented swiftly enough, Bitcoin Cash was forged by Bitcoin and the block size was extended to 32 MB.
What is Lightning?
The Lightning Network is a “second layer” payment custom that runs on a Bitcoin blockchain. It allows immediate transactions between competing nodes and has been promoted as an answer to the bitcoin scalability difficulty. It highlights a peer-to-peer method for executing micropayments of cryptocurrency through a network of payment channels without transferring administration of reserves and reducing the liability of third parties. As mentioned earlier, all payment transactions in the lighting network take place off the bitcoin blockchain. Let’s see how that works.
The Lightning Channel
As a first step, two parties open a channel. After that, parties transfer Bitcoin to a 2 of 2 multisig address. Say from this address only transactions can be made that is signed by both parties.
Frank and Maria open a lightning channel. Frank transfers 5 Bitcoin to the Multisig address and Maria transfers 5 Bitcoin to the multisig address. The following problem can arise, Maria could say to Frank: “I will not transfer bitcoin to the multisig address and also I will not sign the transaction that returns the 5 bitcoin to you unless you give me some!”. In order to prevent this, the transaction is signed in advance, which returns the Bitcoin to Frank and then Frank transfers the 5 Bitcoin, signs a transaction for Maria and Maria transfers her 5 Bitcoin.
Now Frank and Maria have a Lightning channel open. When Mary transfers a bitcoin via Lightning to Frank, they both sign the transaction: “4 Bitcoin to Maria and 6 Bitcoin to Frank”. Now Frank wants to transfer 3 Bitcoin to Maria. So the transaction: “3 Bitcoin to Frank and 7 Bitcoin to Maria” is signed by both. As long as the lightning channel is open, these transactions will not be sent to the blockchain and the 10 bitcoins will remain in the multisig address. In the Lightning channel, the balances are changed for each transfer. To close the channel, the last transaction is sent to the blockchain and the bitcoin returned to Frank and Maria depends on what was in the transaction.
You might think, “Wait, what if an old transaction is sent to the blockchain?” Suppose the last transaction TL was: “Frank has 7 Bitcoins and Maria 3 Bitcoins. Frank sends 4 to Maria. So now in the last transaction:” 3 for Frank and 7 for Maria. “Now Frank could send TL to the blockchain and get 7 Bitcoin.
Of course, this is not possible. The multisig address on the blockchain has a time lock. That is, the transaction will not be executed until a predetermined time has elapsed. This gives Maria the opportunity to check that everything is right. In addition, the “if-then” conditions on the multisig address are set such that upon receipt of a newer transaction in the time between receipt of the first transaction and expiration of the time lock, all bitcoin, in our case 10, will go to the sender of this newer transaction as punishment. This is ensured by a key which is created after each new balance sheet change with which the old transaction may be redeemed and the entire balance can be redirected if it sends the counterparty mistakenly to the Bitcoin network. Thus, the system is secure.
The channel is the basic building block in the Lightning network. These channels can be used to form a network. Each Lightning node has one or more channels that connect it to other nodes.
So how does Bitcoin get from A to B even though there is no direct channel? This works much like Atomic Swaps with hash and time locks (HTLC for Hash Timelocked Contracts).
Frank is connected to Marcel via a canal, Marcel to Jana and Jana to Maria. Frank wants to send Maria 1 Bitcoin. We assume that the route above is the cheapest. Now Mary calculates the hash value h from a secret x. She sends this to Frank. Frank creates a transaction from a Bitcoin in the channel to Marcel, which is only valid if x is known by h. This transaction has a validity limit. If x is not available during this time, the transaction expires and the previous one in the channel is the last valid one. Next, Marcel creates a transaction from a Bitcoin in his channel to Jana with exactly the same conditions but a lower validity period. Lastly, Jana creates a transaction from a bitcoin in the channel to Maria.
In the next step, Maria releases x to redeem the transaction. Now Jana has x and uses it to redeem the transaction in the channel to Marcel. The latter, in turn, settles Frank’s transaction with him. The process has been completed, the balance of all involved restored and a Bitcoin has traveled from Frank to Maria.
In this way, bitcoins in the Lightning network can be sent securely and confidently via any number of channels. Addressing via the hosts, each host can have several lightning channels. The protocol should then pick the cheapest channel in the future.
Lighting network transactions are basically free. Nevertheless, large hubs may require small fees for their services as liquidity providers.
- The Lightning network is extremely cheap and in theory scalable. Micropayments will be possible.
- The transactions are very fast, immediate.
- Anonymity is higher in theory than Bitcoin since all off-chain is done.
- The main chain of Bitcoin is relieved. This will reduce transaction costs.
- When routing the transactions, there must be enough bitcoins in each node on the route. If in our example Marcel had no Bitcoin on his side, the route would not be possible through him. This situation can make it much more complicated to route in a large network. The routing algorithms are still in their early stages of development, and it is very likely that there will soon be efficient solutions to this problem.
- It is not yet clear how the network topology will evolve. One can not completely rule out that the network is centralized by giant nodes.
- A Lightning node must always be online so that payments can be accepted. This is not the case with the main network.
- The Lightning network is still relatively young and untested. It will take some time before the necessary security for mass application is guaranteed.
The Lightning network is an important step in the scalability of Bitcoin. It is very important for the BTC community that the main chain works properly. Therefore, changes are made with great care and usually take a long time. Lightning eliminates massive interventions in the protocol, which has proven itself for over 10 years, such as extending the block size or reducing block time.
The developments are progressing rapidly, new nodes are added every day and the volume in the canals is rising steadily. By and large, the project can be regarded as promising and it has an exciting future.
You might also like
More from Education
It's no secret that Ethereum leads the blockchain arena, when it comes to innovation and implementing trend-setting ideas. Ethereum wallets …