Bitcoin Lightning Network
9 mins read
1 yrs ago
One of the many benefits of using bitcoin is the advanced security system that makes it difficult to hack or falsify data. Another is its decentralised nature also makes it popular among people as it enables transactions across the globe with ease.
These features and others have led to the increased adoption of bitcoin all over the world. However, for bitcoin to remain such a revolutionary breakthrough, its limitations have to be resolved:
The Bitcoin network is run by multiple nodes, which limits the throughput. This makes it difficult to process a large number of transactions per second (TPS). And the more miners have to work to maintain the system, the more likely transaction fees will increase. This may become a problem as one of the reasons bitcoin is attractive to many is its low transaction fees when compared to traditional banking systems.
So for Bitcoin to meet up to its rising demand, it needs to scale. One of the ways that have been proposed to aid Bitcoin’s scalability is through a Bitcoin Improvement Proposal to increase the transactions per second and minimise transaction costs with the Lightning Network.
What is Lightning Network?
The lightning network is a feature that enables fast peer-to-peer transactions on the blockchain. The lightning network may sometimes be referred to as an off-chain or second layer (layer 2) solution. This is because it is built separately from the bitcoin network but still skirts across the bitcoin blockchain. It works at an increased speed while also reducing transaction costs.
The lightning network setup allows users to complete transactions without verification from the bitcoin blockchain. This means the delay caused by verification would be eliminated, thus automatically improving the speed of transactions per second (TPS).
A good way to illustrate how the lightning network works is by looking at the services of Visa and MasterCard. Payment with a card from these financial institutions allows quick verification of funds between the buyer and seller, but the settlement usually takes place a few days later. That is why you may not receive a debit alert after paying for a Uber trip with your card until a few days later.
History of the lightning network
In March 2018, a blockchain engineering lab, Lightning Labs, moved to launch a beta version of the lightning network. In collaboration with certain individuals and companies like Blockstream and ACINQ, it was successfully launched. Even Twitter and Square co-founder, Jack Dorsey, endorsed the network and contributed to the $2.5 million seed investment.
This was the first attempt to solve bitcoin scalability through a second layer solution, and subsequent proposals were to follow.
How the Lightning Network Works
The lightning network is unique in that it allows users to transact on the blockchain without recording every transaction. However, to access or exit this network, you need to set up special transactions on the blockchain. The lightning network allows two users to transact privately within the blockchain. The transactions between these users are not publicly displayed on the blockchain.
These two users can then complete as many transactions as possible “under the radar”. Like other public transactions on the blockchain, these transactions are also secure, and either party cannot exploit the other. This private ledger is called a channel, and limitless transactions can be sent through this channel. Only when the private channel is closed will the details of the transitions be transmitted to the public blockchain. This allows for a faster decentralised system of operation without sacrificing the integrity of the network.
To access the lightning network, you need to lock a certain amount of bitcoin into a payment channel. This bitcoin can only be spent within the lightning network except when you close the channel.
When you want to receive a bitcoin from someone or set up a transaction, you will create what is known as an invoice, an alphanumeric code used to represent a QR code. The person who makes the payment has to scan this invoice and confirm it with their digital signature that they indeed want to make payment. Once the payment is approved, the receiver receives a confirmation.
The lightning network is a peer-to-peer network, and payment processing is not dependent on either side of the parties. The transactions are completed in seconds (thus earning its name as the “lightning network”) unlike the normal bitcoin transaction which takes about 10 minutes or more to get a confirmation.
Payments aren’t made on the Bitcoin blockchain but through the lightning network by circumventing the Bitcoin blockchain resulting in lower transaction fees and faster transactions. This allows for everyday transactions with transaction fees costing as low as one satoshi (one hundred millionths of a bitcoin).
And just as it is easy to open a channel on the lightning network, it is also easy to close one and continue transacting on the standard Bitcoin network.
How to complete bitcoin transactions using the lightning network
You may wish to set up an account with your favourite cable service that accepts payment in bitcoin, for instance. To do this, you would need to send some bitcoins to a wallet. This type of wallet is referred to as a multi-signature (multi-sig) wallet and may require one or more signatures to access these funds. These wallets allow you to enter an agreement to send and receive payments.
Transactions on this wallet would require a balance sheet created every time you make a transaction. The balance sheet would reflect what you spent and what is left on your account. Suppose you no longer wish to patronize the service of this cable service, you can easily close down the channel and return to trading on the main bitcoin network. Your balance sheet would then be committed to the blockchain as a permanent record. Only after the channel is closed will the first, and last balance sheet be broadcasted on the blockchain. If there happens to be a payment dispute, the balance sheet can be used to solve this by referring to the last signed balance sheet.
In a situation, that you wish to set up an account with a person or institution, say a trade merchant, colleague, family member you usually trade with, the process is relatively straightforward. You would need to lock up some bitcoins in a 2-of-2 scheme, a jointly owned address. This means that you set up an account that only the two of you are signatories to. You lock up a certain amount of bitcoin within the channel, for example, 20 bitcoin, with each party having about ten each. It is important to note that transactions will only be completed when the signatures of both parties are present, just like any joint bank account.
But, what if one party fails to include their signature to complete a legitimate transaction?
Well, the lightning network has this loophole covered. Suppose one of the parties fails to meet the terms of their agreement, the lightning network has a mechanism to resolve this conflict known as Hash Timelock Contract (HTLC). This contract contains the details of the agreement to safeguard cheating on either side of the party.
A hashlock is placed on the channel to ensure that either party can only send funds on a particular condition, knowledge of a secret/hash. A party can only send funds within the channel by proving that they know the secret. The sending party includes a hash in the transaction. The receiver can only spend the funds if the secret (original data) is in sync with the hash. This data is only available to them if the sender provides them with that secret.
For instance, if one of the parties decides to broadcast a previous transaction where they had more funds as they already have the other person's signature, they would lose their entire balance.
This is because a timelock would reflect preventing them from spending the balance. The other party can then withdraw all the BTC as the other party's action reveals their secret to them. By choosing to broadcast that detail, the other party indicates the channel is no longer in existence, and the secrets are shown to the other party. While the other party waits for the timelock to expire, the other party can easily withdraw all the funds as, well, a punishment.
The potentials within the Lightning Network
- Bitcoin scalability
The increased adoption of cryptocurrencies across the world has brought more attention to the bitcoin scalability problem. In this regard, the focus has been on scaling Bitcoin’s network to accommodate its ever-increasing audience. Increased transactions within the blockchain often lead to a backlog or queue that may result in hours or even days in completing a transaction which ultimately results in higher transaction fees.
But the lightning network solves this.
This doesn’t mean that you won’t pay transaction fees to create or exit a channel. However, compared to running transactions within the Bitcoin network, this is more affordable as all transactions within that channel are free. If more users adopt the lightning network, it will ease the queue on the bitcoin network, thus, allowing larger transactions to occur within the Bitcoin network and easing everyday transactions.
The bitcoin protocol states that the minimum amount of bitcoin in a transaction is 0.00000546BTC or 546 satoshis. This is, in essence, a small amount. Still, the lightning network would enable you to transact at the minimum (1 satoshi) with low transaction fees. This makes the lightning network more appropriate for everyday transactions such as paying for coffee.
Another amazing perk of the lightning network is the increased privacy it offers. Individuals can conduct transactions outside the broader network. Although on the blockchain, it would reflect that a transaction was used to create a channel. Users outside the channel would be locked out of the transactions occurring within. The participants can transact privately under the radar keeping the details of their transaction private.
Limitations of the Lightning Network
Although the lightning network offers a lot of potentials in terms of low transaction fees, lightning-fast transactions, and increased privacy, it doesn't come without particular limitations. Some of these limitations include:
- The technicality of the system
Bitcoin may be a bit confusing for a beginner (in terms of blocks, mining, fees, codebase, and protocol), which is one reason this course was created to ease you into the crypto world.
However, the lightning network needs individual nodes that are unfamiliar to an average Bitcoin user to stabilise them. Users would need to lock up some bitcoins in their account to access them, which may prove time-consuming and distressing to a user who is unfamiliar with the system.
Another limitation of the lightning network is that it limits the amount of bitcoin you can transact within the chain. If you lock about 10 BTC in a channel, then that's the only amount of bitcoin you can spend. If you desire to spend more, you would need to set up another channel or wait until the other party pays you through it.
- Disrupt Bitcoin's decentralised feature
The decentralised feature of Bitcoin is one of the reasons for increased crypto adoption across the globe. While trying to solve the liquidity problem, there may be a problem of centralisation in the network. The channels utilised in completing these transactions would hold a large percentage of bitcoin within them. These channels may affect bitcoin's flow by going offline, for instance, subsequently controlling the rise and fall of the value of the currency.
Also, this poses the risk of censorship by the individuals or organisation that runs these channels which goes against the very foundation that Bitcoin rests on and may disrupt peer-to-peer relationships, thus, weakening the system.
The lightning network allows you to complete bitcoin transactions at a go without the need to verify them. This allows for faster transactions as it eliminates the time needed to verify these transactions. It poses a solution to the long-standing problem of bitcoin scalability. Although there is still some scepticism about the limitations of the lightning network, developers are working on improving the systems towards a successful integration with Bitcoin.
Disclaimer: This article is meant to provide general guidance and understanding of cryptocurrency and the Blockchain network. It’s not an exhaustive list and should not be taken as financial advice. Yellow Card Academy is not responsible for your investment decisions.