How Does the Lightning Network Work & When Will It Go Live?

Lightning Network

The Lightning Network is a proposed improvement to Bitcoin and other altcoins. It’s currently under active development, with beta testing possible on the Bitcoin mainnet. The developers behind the Lightning Network claim it will solve Bitcoin’s scalability problems without the need for significant changes to the Bitcoin Core protocol, beyond the implementation of Segregated Witness. Their innovative solution involves creating a second layer that sits atop the current Bitcoin network where users can essentially trade IOUs back and forth before settling accounts on the blockchain.

1. Background: Bitcoin Scalability & The Lightning White Paper

Bitcoin Scalability and the Lightning White Paper

Before we get into the specifics of how the Lightning Network works, it’s important to get context for the types of issues the protocol is designed to solve. From 2009 to about 2014, the Bitcoin user experience, while in its infancy, was fairly straightforward. To send a transaction, you simply sent a request to the network. Your newly created transaction got included in a block, you perhaps paid a small fee to miners, and your transaction was added within 10 minutes and confirmed within an hour.

All that began to change as Bitcoin gained in popularity. With more transaction requests, the Bitcoin network couldn’t scale to meet the demand. The result was either high fees or long confirmation times, sometimes both. This inability to scale is actually built into the Bitcoin Core code. Known as the block size limit, the code governing Bitcoin restricts new blocks to only 1MB. Since every node on the network must keep a complete copy of the blockchain’s history, the block size limit prevents the historical ledger from growing too rapidly or outstripping storage capacity on mining machines.

The unintended side effect of the block size limit, however, is only a certain number of transactions can get added to the blockchain every 10 minutes. When there are more transaction requests than can fit inside the 1MB limit, fees go up and Bitcoin becomes unusable as a payment method for smaller transactions.

With the goal of enabling small, fast transactions while still maintaining the block size limit, Thaddeus Dryja and Joseph Poon wrote a white paper in 2015. The paper proposed a new peer network on top of the Bitcoin blockchain. The new network would draw from and settle on the Bitcoin blockchain, but every small transaction wouldn’t have to take up space on the blockchain. This proposed solution became known as the Lightning Network, a fast, trustless network for small, cheap payments on Bitcoin.

2. A Second Layer: Payment Channels for Off-Chain Settlement

Lightning Network: Payment Channels for Off-Chain Settlement

The basic idea behind Lightning Network is a series of IOUs between two parties. Imagine Alice and Bob transact with one another frequently. Instead of constantly paying each other, they each set aside 10 Euros. Combined, their 20 Euros go into a vault where Alice knows half of the vault access code, and Bob knows the other half of the access code. Also in the vault, they place a ledger that says “A: 10, B:10” to keep track of how much they contributed.

If Alice needs to pay Bob 5 Euros, she doesn’t need to have the cash on hand. Instead, she and Bob can use their codes to open the vault and mutually agree to change the balance ledger. Now it says “A: 5, B, 15.” When they mutually agree to change the ledger, the older timestamped ledger becomes invalid. Alice and Bob can keep this IOU payment channel open as long and can change the ledger as many times as they’d like. As long as they agree between themselves, there’s no need to settle the balances in the real world. Whenever they’re ready, they can close the payment channel and settle the balances with the funds originally deposited in the vault.

The Lightning Network automates and secures the process of creating these bi-directional payment channels between Bitcoin users. Users open a Lightning Network payment channel between them with an initial deposit. From there, they can transact as many times between them as they want without needing to write any of those transactions to the blockchain. As long as both parties in the channel agree and sign the new balance sheet, the blockchain never has to arbitrate payment settlement.

3. Blockchain Arbitration & Closing a Channel

Blockchain Arbitration

Only two transactions ever need to be recorded to the blockchain: the opening deposit to a multisignature address, and the closing settlement of the account back to their original owners. As a result, transaction volume on Bitcoin can be reduced dramatically. Additionally, transactions on the Lightning Network don’t incur the same miner fees because they never have to be written to the blockchain. Small transactions with low or no fees are the sweet spot for Lightning utilization.

Secure side channel transactions are possible thanks to smart contracts developed atop Bitcoin. The contracts that run the Lightning Network are hashed time-lock contracts, meaning only the most recent version of the ledger is valid for settlement on Bitcoin. Settlement is as simple as broadcasting the most recent ledger back to the blockchain.

However, there’s a good argument to be made that Lightning Network transactions might rarely need to broadcast back to the blockchain. That’s because everything is written as a coded contract. The results of broadcasting back to the original Bitcoin blockchain are deterministic and certain, so possessing a Bitcoin on the Lightning Network is just as valid as actually possessing the Bitcoin on the blockchain. Only in the event of one party in a channel raising a dispute or failing to cooperate would blockchain arbitration be necessary. Even then, however, you’d know the outcome of the dispute before ever broadcasting it to the blockchain. Non-cooperative closing of a Lightning payment channel just takes slightly longer for adjudication than a cooperative closing where both parties are in agreement.

4. Networked Transactions are Theoretically Limitless

Lightning Networked Transactions

The benefits of the Lightning Network don’t stop with Alice and Bob. Lightning payment channels can network to settle transactions across multiple parties. For instance, if Bob has a payment channel open with Alice and with Charlie, then Alice doesn’t need to open a new channel to pay Charlie. Instead, she can pay Charlie through Bob. The Lightning Network updates all balances automatically as part of the smart contract protocol.

The Lightning Network really is a complete network of users with bi-directional payment channels between them. As long as a user has at least one connection to the network, the Lightning protocol will find a way to connect that user to anyone else on the network. You don’t need to trust any of the nodes along the route to the payment’s final destination, because the Lightning Network implements a script where the entire transaction, from beginning to end, either succeeds or fails at once, using time locking.

However, pathing still has challenges on the network. If Alice wants to send 10BTC to Charlie, but Bob only has 5BTC in his current channels with Alice or Charlie, then the transaction isn’t possible. Alice will need to create her own channel with Charlie or just pay Charlie directly on the Bitcoin core network. For that reason, you can complete very small transactions on Lighting Network with a high success rate, but as you increase the transaction amount, the success rate drops. It becomes increasingly difficult to find a path to your destination where all the connecting channels have enough funds for the transfer.

There’s an argument to be made that the need for high-capacity channels will lead to the eventual centralization of the Lightning Network around one or a few providers that can create and sustain high-volume channels. The implications of such centralization are unclear, but needless to say mega-nodes of this kind would have significant sway over the network and future development.

5. Benefits & Drawbacks

Lightning Network: Benefits & Drawback

Theoretically, the Lightning Network is capable of millions or billions of transactions per second. This is an amazing improvement over Bitcoin’s current rate of 7 transactions per second. It also far surpasses current payment providers like Visa who can handle around 60,000 transactions per second.

Additionally, you can transact in tiny amounts or very frequently without the current challenges of the Bitcoin blockchain, but with all the security of Bitcoin core backing the network. This is significant as micropayments for services become increasingly popular between companies, machines, and even autonomous organizations.

Since the Lightning Network exists off-chain, its payments are also instant. The payments come with the backing of the Bitcoin blockchain without the wait times. They’ll also be much lower cost without the 1MB limit acting as a bottleneck on the supply-side economics.

There are serious concerns and drawbacks to the Lightning Network, however. Perhaps the largest is trepidation over the security of this largely unproven new technology. Whereas blockchain technology is fairly straightforward to understand and secure, the Lightning Network involves thousands or millions of nodes each opening independent channels with time-locked contracts that the protocol must manage and secure.

Roger Ver, co-founder of Bitcoin Cash and controversial leader in the crypto industry, has expressed his concerns. From his point of view, block size and Segregated Witness are the real challenges to scalability. With Lightning Network still not operational even after years of development, Ver questions whether reinventing the wheel with a more complicated replacement is really a worthwhile solution instead of simply increasing the block size limit, like Bitcoin Cash has.

On the other hand, Jack Dorsey, co-founder of Twitter and founder of Square, is a strong supporter of Lightning Network. He argues it’s the best way to rapidly scale Bitcoin’s underlying security to cover thousands or millions of transactions per second.

As mentioned earlier, transactions much larger than a few Euros in value routinely fail to find a path on the Lightning Network mainnet beta. This will likely improve over time as adoption grows and more funds enter Lightning channels. However, effective pathing still remains a challenge.

6. Current Status & Future Potential

Lightning Network Future

Three main development operations are working on independent versions of the Lightning Network: Blockstream, Lightning Labs, and ACINQ. In a test in 2017, these various development teams proved their solutions to be interoperable with Bitcoin and each other. In December 2017, a release candidate version of the protocol became available to the public. In March 2018, Lightning Labs released their beta of the network to mainnet.

Developers are discouraging users from interacting with Lightning too heavily at the moment. The network still could have security vulnerabilities, and there’s a high likelihood of pathing failure with so few users currently on the network. Expect a new full version release in late 2018 or early 2019. From there, the Lightning Network’s success will be a function of adoption. If Segregated Witness has been any example, adoption may take quite some time, especially as miners fear losing transaction fee revenues from transactions on the Bitcoin main blockchain.

In the future, the Lightning Network can also support atomic swaps for cross-chain transactions, as long as both Lightning Networks use the same hash algorithm. This could open up a whole new economy of decentralized exchange between various blockchains, allowing users greater flexibility, instant conversion, and fees saved on trading commissions.

7. Lightning Network, Explained

The Lightning Network has massive potential to revolutionize the way we think of Bitcoin and all blockchains. With enough adoption, ordered pathing, and highly-secure contracts, Lightning Network could make fee-free, instant, and even cross chain transactions possible. It scales blockchain usability beyond the transaction capacity of current payment processors, and it allows users to transact in small amounts or frequently with nearly no overhead in time or fees. While it’s a long shot and a big technical challenge, if the development teams pull it off it will fundamentally change blockchain.

Share now if you like the article!