Bitcoin Payments: What Is the Lightning Network?

Bitcoin Payments: What Is the Lightning Network?

Bitcoin Payments: What Is the Lightning Network?
Bitcoin Payments: What Is the Lightning Network?
Bitcoin Payments: What Is the Lightning Network?


Bitcoin Payments: What Is the Lightning Network?

The Lightning Network, and how to use it to pay with Bitcoin, is explained in this in-depth beginner’s guide.


Key Takeaways:

  • First introduced in 2016, the Lightning Network is a Layer-2 payment protocol built on top of the Bitcoin blockchain. It enables near-instant payments by using Bitcoin’s native smart contract functionality.
  • The Lightning Network is composed of multiple bi-directional payment channels that handle transactions parallel to the main blockchain.
  • It aims to address Bitcoin’s scaling issues, such as long block creation time, limited throughput, and high transaction fees.

Bitcoin’s limitations as a payment system include

Relatively long block creation time. 

For a transaction to be added to a block on the blockchain, it must be validated through the  Miner validation is key to the decentralised and secure nature of Bitcoin, but this also means that transactions are not instantaneous, and they take a considerable amount of time to be confirmed as successful. In fact, a new block gets mined in (on average, at the time of writing).

Limited throughput capacity.

To compare, a major payment giant like Visa can support around transactions per second (tps) on its network, while the Bitcoin blockchain can only handle up to 7 tps (at the time of writing). As a payment network, Bitcoin’s throughput is far too low to handle such large amounts of transactions, which can be a significant hindrance to widespread usage.

Disproportionately high transaction fees for small payments.

Bitcoin transaction fees peaked  in April 2021. While this might not seem like a significant amount to some, if merchants decide to accept Bitcoin as payment, transaction costs will have to be significantly lower to be considered sustainable, especially for small purchases.

This is what the Lightning Network was made for: It enables Bitcoin to operate more like ‘digital cash’ as was originally envisioned. By allowing transactions — like small payments to buy a cup of coffee — to bypass the mainnet, the Lightning Network can process near-instant, high-volume transactions in its network at scale, while still taking advantage of the decentralised and secure nature of the Bitcoin network.


What Is the Bitcoin Lightning Network?

Simply put, the Lightning Network is a built on top of the Bitcoin blockchain that enables near-instant payments for participants via payment channels.

Lightning Network was designed as a scalability solution to Bitcoin: In an effort to reduce Bitcoin network congestion, it uses payment channels to handle Bitcoin micropayments off-chain. These payment channels are what make up the layer.

A  is an off-chain network that runs parallel to the main blockchain. The idea is to establish a channel between two parties who want to make a transaction, where the transaction made in that payment channel basically bypasses the main blockchain. This enables multiple transactions to be conducted without having the global consensus and confirmation on the mainnet (like the Bitcoin network). As a result, transactions are almost instant, and the fees are extremely low.

Users in a payment channel can make any number of transactions, and these channels can operate for as long as required. The only times a payment channel touches the mainnet are upon opening and terminating it. When a channel is closed down, the participants’ latest ‘state’ — an off-chain transaction that serves as a ‘sign-off’ from both parties agreeing that the information in the channel is correct — is consolidated into a single transaction, which is then broadcast to the mainnet.


A Brief History of Bitcoin and Lightning Network

2016: The concept of the Lightning Network was first proposed by Joseph Poon and Thaddeus Dryja, who founded Lightning Labs to develop the network.

2017: Segregated Witness (SegWit), a protocol upgrade for Bitcoin, was launched and considered a key milestone in fully enabling the Lightning Network as a Layer-2 solution. The year also saw the first Lightning payment on Litecoin, which demonstrates its potential outside of the Bitcoin network.

2018: After going through a beta testing phase, the Lightning Network eventually went live on the Bitcoin mainnet.

How Does the Lightning Network Work?

The Lightning Network relies on a network of nodes in order to run, and there are about 16,000 active Lightning nodes at the time of writing. Lightning’s main difference with Bitcoin is that global consensus is not required, and the nodes transact with each other privately instead. To execute transfers and payments in the network, Lightning nodes use channels.

Step 1: Opening a Lightning channel

Let’s say Alice wants to pay Bob with Bitcoin. ​​To establish a payment channel, Alice or Bob (or both) must deposit Bitcoin into a 2-of-2 multi-signature (multisig) wallet. This creates an on-chain ‘funding transaction’ that is recorded on the mainnet; funds are locked up in this jointly owned multisig address. The amount contributed by both parties is shown on the opening channel ‘state’. They can then immediately trade once this initial opening transaction has been confirmed.

Step 2: Transacting in the Lightning channel

Now that there is funding available, Alice can send the payment to Bob. The Lightning Network uses bi-directional payment channels to facilitate transfers, which means Bob can also send funds to Alice in the same channel if he wants to.

All transactions between Alice and Bob are executed by smart contracts and made off-chain, with low fees, as long as each signs every transaction (otherwise, the transaction may fail to go through). It is designed so that each party holds a private key, and redistributing funds in the channel can be done only if both parties are confirmed. For every transaction made, the channel’s balance also updates off-chain.

Using the example above, both Alice and Bob deposited 1 Bitcoin each upon opening a channel. There were three transactions that occurred off-chain: 1) Alice transfers 0.25 BTC to Bob, 2) Alice transfers another 0.25 BTC to Bob, and 3) Bob sends 1 BTC back to Alice. Upon closing the channel, the closing transaction takes account of these prior transactions and is updated with each party’s outstanding balance: 1.5 BTC for Alice, and 0.5 BTC for Bob.

Step 3: Closing the Lightning channel

Like the initial funding transaction to open a channel, closing a Lightning channel is also an on-chain transaction. One party can initiate to close the channel, but both parties have to agree on this, after which funds are sent back to their respective wallets. Once the channel has been successfully closed, a single transaction, which represents the balance between parties, is broadcast on-chain.

Routing and Multi-Party Transactions

The Lightning Network’s multisig and smart contract design ensures that the network runs independently without counterparty risk, which comes in handy for multi-party transactions. For example, Alice can open a channel with Bob, who happens to have a channel with Carol, who also has one with Dave. What if Alice wants to send funds to Dave, but they are not directly connected? In this case, the payment will be routed through Bob and Carol, using them as ‘hops’.

As long as two parties already have their own payment channel set up, they can let the network decide how the payment will be routed to the recipient. Lightning Network employs a combination of source routing and onion routing protocols to make this possible. Source routing enables the nodes to have full control over their payment route; onion routing allows a node to choose an optimal path to ensure the shortest route and lower fees where each hop is encrypted.

Hashed Timelock Contracts

This is all securely carried out with the help of a hashed timelock contract (HTLC). In simple terms, an HTLC serves as a smart contract that enables the recipient to receive the funds once certain conditions are met within a time period (or block height). To see this in play, let’s use Alice as an example and see how a transaction with Dave is made (see diagram below). In this scenario, Alice wants to send 1 BTC to Dave, with a 10-block refund timeout. Alice’s node decides the most optimal path and calculates the fees (e.g., 0.002 BTC fee to send 1 BTC).


See more news

Leave a Reply

Your email address will not be published. Required fields are marked *