Bitcoin’s Lightning Network, similar to Bitcoin, has had a bumpy ride over the years.
Haven’t heard of Bitcoin’s Lightning Network before? Let us help you.
Bitcoin’s Lightning Network was the brainchild of two developers, Thaddeus Dryja and Joseph Poon, in 2015. A second layer is added to the Bitcoin network, which allows off-chain transactions to be processed quickly and economically. Considered a crusader in the cryptocurrency world, Bitcoin’s Lightning Network helps speed up transaction processing times and decreases the associated costs of Bitcoin’s blockchain. However, it is susceptible to scam or malicious attacks.
What is the Bitcoin Lightning Network?
Bitcoin’s Lightning Network is an advanced system constructed on top of Bitcoin to enable people to spontaneously transfer/receive payments and lessen transaction fees by keeping them off the front network. Bitcoin’s Lightning Network helps Bitcoin to be more serviceable as a day-to-day currency.
Bitcoin Scalability Challenges
The soaring popularity of Bitcoin also comes with some challenges., Dealing with the large number of transactions on the network is a tedious job, as its design permits only a limited number of transactions in each Bitcoin block. Unprocessed transactions wait in a queue to be added to the next block.
Although the old payments have infrastructure that can process thousands of transactions per second, Bitcoin, on the other hand, can only process 2-7 transactions/second, with a new block added every ten minutes. This creates virtual “traffic jams” – at peak times coupled with delays that can last a day.
Why is it needed?
Bitcoin is undoubtedly the world’s biggest cryptocurrency, with a current market cap of over USD 600 Billion. Bitcoin transactions are decentralized and assorted to form blocks. Bitcoin transactions are verified by “miners,” through a network of powerful computers that race to solve cryptographic puzzles and add the following block to the chain.
Bitcoin’s proof-of-work system is energy-intensive since numerous miners compete together. This gives rise to extensive costs, which the miners offset through their block rewards and the transaction fees collected. Historically, during peak network congestion, fees have spiked to more than $50.
Solutions proposed (with a focus on Lightning)
Bitcoin’s Lightning Network is a solution to Bitcoin’s problems.
In a transaction, you can only send a minimum amount of Bitcoin – approximately 0.00000546 BTC. At the time of writing, that’s 22.53 INR. The Lightning Network enables you to push the limits to transact the smallest unit available – 0.00000001 BTC, or one Satoshi.
The high fees on routine transactions make sending small amounts on blockchain seem useless. Though in a channel, you’re free to transfer a fraction of a Bitcoin for free.
Bitcoin’s Lightning Network offers users a great degree of confidentiality. While you can look at the blockchain and point that this transaction opened a channel, you won’t be able to tell what’s going on inside it. If the participants make their channel private, only they will know about the transactions taking place.
A multi-signature (or multisig) address has multiple private keys to spend from. When creating a multisig address, you define how many private keys can spend the funds and how many of those keys are needed to sign a transaction. For example, a 1-of-5 scheme entails that five keys can produce a valid signature and that only one key is needed to sign the transaction. In Bitcoin’s Lightning channel, initially, the participants lock their funds in a 2-of-2 scheme. Only two private keys can perform signing, and both are necessitated to move coins.
Suppose two friends Ria and Jay, decide to open a Lightning Network channel. They start by depositing 5 BTC each into the jointly-owned multisig address. Remember that Jay can’t move funds out of the address without Ria agreeing, or vice versa. Now, they have a sheet of paper that adjusts the balances on each side. Both have a starting balance of 5 BTC.
If Ria wants to make a payment of 1 BTC to Jay, why not note that Ria now owns 4 BTC and Jai owns 6 BTC? Balances can be tracked like this until they decide to move the funds out. That’s possible, but doesn’t that make it incredibly easy for someone not to cooperate? If Ria ends up with 10 BTC and Jay with none, Jai loses nothing by refusing to release the funds.
Hash Timelock Contracts (HTLCs)
The system we mentioned above gets a lot more interesting when introducing a mechanism that enforces the “contract” between Ria and Jai. If one of the two parties does not obey the rules, the other one has a way to get their funds out. This mechanism is a Hash Timelock Contract (or HTLC). It couples two technologies (hash locks and timelocks) to remedy any uncooperative behavior in payment channels.
The sender hashes a piece of data, including the hash in the transaction to the receiver. The only way the receiver can spend it is to provide the original data (the secret) that matches the hash. They can provide that data only if the sender gives it first. A timelock is a condition that stops you from spending funds before a specific time. This can be actual time or a specified block height. HTLCs are created by combining hash locks and timelocks. HTLCs can be utilized to create conditional payments – the receiver has to provide a secret before a specific time, or the sender can reclaim the funds.
Opening and closing channels
Remember, for the coins to move out of the multisig, both Ria and Jay jointly sign a transaction. If Ria wanted to send all the ten coins to an external address, she would need Jai’s approval. She’d first put together a transaction (ten bitcoins to this address) and add her signature. Ria must give the incomplete transaction to Jai first. His signature makes it valid.
In the mechanism mentioned before, each party needs to come up with a secret – let’s call those As and Bs. The pair will now generate the secrets’ hashes – h(As) and h(Bs), respectively. Instead of sharing their secrets, they now share these hashes.
Ria and Jai share the hashes of their secrets with each other
Ria and Jai also need to create a set of commitment transactions before publishing their first transactions to the multi-signature address. If you create a new pair of commitment transactions, you’re rebalancing the funds between the two participants. In Ria’s transaction with two outputs – one to her address and one to a new multisig, she still needs Jai’s signature to make it valid. Jai does the same – one output pays himself, the other pays another multisig address. He signs it and gives it to Ria.
Two similar, incomplete transactions
Usually, Ria could add a signature to Jai’s transaction to make it valid. These partially signed transactions will, however, only be usable once the multisig is up and running. Your counterparty can spend immediately if you sign a transaction because there are no special conditions on their output. You can choose to wait for the timelock to expire and spend the funds by yourself or cooperate with the other party to spend. The transactions can be published into the original 2-of-2 multi-signature address. This is safe as you can retrieve your funds in case your counterparty leaves the channel.
Once the transactions are confirmed, the channel is ready
If Ria wanted to pay 1 BTC to Jai, the two new transactions would credit 2 BTC to Ria and 4 BTC to Jai. This is how the balance is constantly updated. Any one of the parties can sign and broadcast one of the most recent transactions to “settle” it on the blockchain.
However, the party that does so will need to wait until the time lock has expired, while the other can spend immediately. If Jai signs and broadcasts Ria’s transaction, she has an output with no conditions implied. Both parties can close the channel together-the easiest and quickest way to get your funds back. But, even if one party becomes unresponsive or refuses to cooperate, the other can still reclaim their funds by waiting out the timelock.
Origins and development over the years
How it works
The Lightning Network consists of channels (for payments) that enable near-instant transactions between users of a network. The concept it leverages is that not every single transaction needs to be recorded on the primary Bitcoin blockchain. Instead, only the net balance is settled on the blockchain via 2 transactions – the transaction that sets up the channel and the exit transaction.
For example, let’s say two Bitcoin users want to send funds to each other quickly and easily regularly. Under the Lightning Channel, they would create a channel by setting up a multi-signature (multisig) wallet and adding funds. Now, they should be able to execute as many transactions as they want backed by these funds. As you may guess, these are off-chain transactions recorded using a type of digital ledger protected by a time clock. Both users digitally sign and update the ledger after each transaction – commonly done by scanning a QR code. The actual settlement of the original funds in the wallet only happens on the blockchain when they close the channel, based on the final balance sheet.
In case of discrepancies or disputes, either user can rely on the most recently signed balance sheet to recover funds. Both users also have the option to close the channel, ending their relationship unilaterally.
Once the payment channel is terminated, the updated balance is validated on-chain, and users can then make use of their remaining Bitcoin balance on the primary blockchain.. Channels can even connect to and communicate with each other. So funds can be transferred between any group of users holding a Lightning wallet, with algorithm determining the most practically viable exchange between users automatically.
How does it work?
- A multi-signature wallet holding some bitcoin (provided by at least one of both parties) is set up.
- The wallet address is added to the public bitcoin blockchain. A balance sheet (smart contract) is made that proves how much of the bitcoin deposits belong to which party.
- The two parties can conduct unlimited transactions without needing the information the blockchain stores.
- With each transaction, both parties sign an updated balance sheet.
- Both parties keep the updated balance sheet.
- If a dispute or the payment channel is closed, both parties can use the most recent balance sheet to pay their share of the multi-sig wallet.
For the end-user, all of the steps mentioned above will happen automatically. Bitcoin’s Lightning networks allow users to transact with each other directly. They don’t have to broadcast their business. By tracking their payments on their own, the two parties can avoid expensive and time-consuming interactions with the blockchain.
Current status, future roadmap
The cryptocurrency community has, with all its love, embraced the launch of Bitcoin’s Lightning Network. Initially, it was designed especially for Bitcoin, but the technology is currently being developed for various other cryptocurrencies, such as Litecoin, Ether, Ripple, etc.
The developers also advise users to stay patient, as the network’s code is very complex and requires rigorous testing. Bitcoin’s Lightning Network will need to prove safe and usable to be fully adopted by the Bitcoin community. Experts say that a fully working Lightning Network can be away by several months or a couple of years.
If Bitcoin’s Lightning Network solves Bitcoin’s main roadblock, other cryptocurrencies will be highly adopted in the market.
That rings in the possibility of cross-chain atomic swap technology being developed further, thus marking a first step towards building genuinely decentralized cryptocurrency exchanges.
Comparison to other options
- The instant payment, scalability, and low cost give Bitcoin more real-world uses. For example, funds in a Lightning channel can be used as quickly as paying with a credit card.
- Bitcoin transactions currently cost around $13, but transactions using the Lightning network cost around one Satoshi, equivalent to a fraction of one cent.
- Lighting can be used for tinier payments – the minimum is 0.00000001 BTC or one Satoshi.
- Small payments: Since fees are proportional to the payment amount, you can pay a fraction of a cent, as accounting is even done in thousandths of a satoshi.
- Payments are settled immediately: The money is sent in the time taken to cross the network to your destination and go back, mainly a fraction of a second.
- Improved privacy: Only once when the payment channel is eventually closed, and the balance is paid out to both parties
- The platform launched in 2018 has technology and adoption in its early stages, with a long way to go.
- Opening and closing a channel involves Bitcoin transaction fees.
- Transactions can only be made when all parties involved are online.
- Peer failures: If a peer is unresponsive, consumers might have to wait for hours before closing a payment channel and resending the funds via an alternative route.
- No Offline Payments: Users aren’t permitted to pay someone not online
- Not suitable for large payments: Even though a route via various payment channels might exist, the funds in the peers are multi-sig. wallets might not be sufficient to transfer significant funds
- Centralization: The Lightning Network might encourage centralization in payment hubs.