Bitcoin’s Lightning Network Explained

Posted by

The Lightning Network is a Layer 2 solution grounded on the Bitcoin Blockchain. The protocol uses a peer-to-peer network to increase scalability and speed of transactions while simultaneously decreasing the cost. 

The Lightning Network was proposed by researchers Thaddeus Dryja and Joseph Poon in 2015, in a paper titled “The Bitcoin Lightning Network.” In 2016 they founded Lightning Labs to further develop the network. 

The Lightning Network is decentralized, secure, and revolutionary in its speed and capacity.

Decentralized – Settling balances and counterbalances between nodes through smart contracts, and redeeming funds on the Bitcoin blockchain removes the need to delegate funds to a trusted third party. 

Secure – Even though Lighting Network transactions occur off of the Bitcoin blockchain, security is enforced through smart contracts. Participants can enforce non-cooperation by broadcasting signed multi-signature transactions to the blockchain.

Scalable– VISA claims to have the capacity to complete 65,000 transactions per second (TPS), and it was reported that VISA reached a peak TPS of 47,000 during the 2013 holiday season. 

Bitcoin is capable of approximately 7 TPS. The Lightning Network is capable of 1,000,000 TPS, and the founders believe that its capacity could be scaled even faster than other payment processors.

Speed– Lightning Network transactions are practically instantaneous. Each channel only requires agreement from two nodes, usually completing an entire transaction in milliseconds. 

How Does the Lightning Network Work?

By using Bitcoin’s ledger and its native smart contract language, each participant becomes a node to open bi-directional payment “channels”. Each channel will have a corresponding ledger entry on the Bitcoin blockchain. 

During a transaction on the Lightning Network, both parties create transactions by manipulating balances and counterbalances within their contract, but do not broadcast each transaction to the blockchain. The channel can be closed at any time by broadcasting the most recent transaction to the Bitcoin blockchain. 

In its simplest iteration, two parties will open a channel and conduct multiple transactions with each other. Each participant has to lock a certain amount of Bitcoin into the network. Once the channel is open, participants can make as many transactions as they need without waiting for settlement on the Bitcoin blockchain. 

This makes micropayments for things such as purchasing a cup of coffee feasible using Bitcoin as payment. However, this type of simple channel is only useful for two parties who conduct several transactions directly with each other.

Lightning Network Illustration

By creating a network of these two-party ledger entries (channels) it is possible to find a path to route payments entirely on the Lightning Network. Transactions will use multiple channels as they route through the network.

This diagram of a peer-to-peer network shows how users who do not have a direct channel can still conduct transactions on the Lightning Network. For example, User A’s payment to User B utilizes three channels of the network. 

The nodes between transacting parties are incentivized with a small fee for use of their channels. 

Example A

To better illustrate how a transaction moves through and is recorded on the Lightning Network, let’s assume that Ben wants to send a payment to Adam, but does not have a channel open directly to Adam.

Each channel is a bidirectional channel. Ben does not have a direct channel to Adam, but through the Lightning Network he can route his payment through a node that does. 

Lightning Network Explained

Ben’s payment is routed through Sam, and then on to Adam. Once Adam confirms that Sam has sent his payment, he will send Sam a hash (password) to unlock and take control of the payment. This hash will also be the password for Sam to unlock and take control of the payment sent from Ben. 

Lightning Network Payment

Each participant’s balance is recorded on the Lightning Network. The final balance and counterbalance are updated on the Blockchain when one of the participants decides to close the channel. 

One important consideration, and one disadvantage of the Lightning Network, is that participants must keep their channels funded. If one direction of a channel becomes lucrative for participants, the node must continually add Bitcoin or adjust their fee to balance channel usage with available capacity.

Security

Transactions on the Lighting Network use Hash and Time-Lock Contracts (HTLCs) to enforce security. These Hash and Time-Lock Contracts are placed on each channel during the transaction and are only opened once the transaction is successful. 

During the above transaction, the unit that Sam is holding from Ben is protected by one HTLC and the one he sends to Adam is protected by another. Once Adam gives the hash to receive his payment, Sam can unlock his payment from Ben with the hash. 

If the payment fails, the units will revert to their previous holder once the time-lock expires.

The entry on the Bitcoin ledger is also protected by an HTLC. A channel can be closed by broadcasting any transaction to Bitcoin from the Lightning Network. In the case of a bad actor, the Bitcoin blockchain acts as an arbiter for the parties involved.

Privacy

When you make financial transactions in the real world, you do not broadcast that information to everyone else in the world to verify, which is basically what transacting on the Bitcoin blockchain does. Instead, you go about making small payments to different parties, and only get the courts involved if there is a dispute.

During a transaction on the Lightning Network, a node is only in contact with the users on the other side of the channels in use. They will not know if the transaction originated from that user, or a user several channels back. 

Likewise, they will not know if the node they send to is the final recipient, or just another link in the chain. This architecture increases privacy for any transaction that you choose to send through the Lightning Network. 

Transaction Cost on Lightning Network

Median on-chain transaction fees have soared as high as $34 in the past, but transactions on the Lightning Network have always remained near zero.

Even though transaction costs on the blockchain have recently decreased substantially, adoption of the Lightning Network continues to grow. 

Today the median on-chain Bitcoin transaction fee was around $1.05, which is just above the two-year low. On September 7th 2002 the median Lightning Network base fee was 0.938 satoshi or $0.000180078.

Merchants can pay up to 10% of their gross revenue completing small transactions on the VISA network (2.9% + $0.30). For a $2 cup of coffee, a $1.05 transaction fee is over 50% – but the Lightning Network’s median fee equates to a 0.009% transaction cost, which is a fraction of the cost of all existing solutions. 

Lightning Network Incentives

Incentives for Participants

Fees on the Lightning Network are paid directly between participants. Fees are paid for renting the channel for a determined maximum period of time, and for counterparty risk of non-communication. 

A Lightning Network Node can be run on a device equivalent to a desktop PC. This opens up participation in financial networks to the average person. Instead of VISA getting paid for facilitating payments, your own business could help facilitate those transactions with its own Lightning node. 

Incentives for Users

The founders of the Lightning Network envisioned a network where the users running nodes would incentivize more use by keeping their cost low. High throughput could potentially still make running a node lucrative. They even envisioned periods when it would be so profitable for users to use certain channels only in one direction, fees could be set to negative to keep the channel available.

Incentives for Merchants

In other cases, it may cost a small business 2.9% plus a small fee for every transaction they process through VISA. With the cost savings associated with low fees, a business could theoretically pay their customers with a discount instead of paying a fee to the VISA network.

Lightning Network Growth

The Lightning Network has grown steadily since its launch in 2018. 

Lightning Network Growth

This chart shows the growth of the Lightning Network’s capacity since its launch. Capacity in BTC is shown in orange. The US Dollar capacity is shown in blue.

Today there are currently 4,683 Bitcoins locked into Lightning Network Channels. The Lightning Network promises to solve the problem of Bitcoin scalability and using Bitcoin as a currency, but also offers many advantages over existing payment channels.