The Lightning Network is a second-layer protocol that sits on top of the Bitcoin blockchain. It allows for fast, cheap, and scalable payments between peers that have chosen to connect with one another by securing Bitcoin in a 2 of 2 multi-sig transactions. When a user broadcasts a Lightning channel open, they decide how much Bitcoin they want to commit and the peer to connect that capital within this second layer network.Â
The Lightning Network works through a host of individuals creating payment channels between one another. While paying each peer doesn’t seem like a revolutionary upgrade, what makes Lightning a scaling tool is that it allows payments to be routed through the various peer connections made.
In Lightning, public channels are payment routes that can be leveraged by any user as long as they are willing to pay the fee to hop through that channel for the payment to reach its destination. By allowing users to leverage the connections made in the Lightning network, more than just direct payments can be made off-chain, which greatly reduces the fees and the time it takes to confirm a transaction.
Routing a payment
To route a payment through the Lightning Network, a user first needs to open a payment channel with the recipient. This can be done by depositing a small amount of Bitcoin into the channel. Once the channel is open, payments can be sent back and forth between the two users without having to go through the Bitcoin blockchain.
When a user wants to send a payment to someone they don’t have a payment channel with, the payment will be routed through a network of intermediaries. This is done by using a technique called “routing.” Routing is the process of finding the most efficient path through the network to send a payment.
Routing payments require the Lightning Network wallet to scan for potential routes to their destination to ensure that there is enough liquidity along the way to pass on the payment; if there isn’t sufficient liquidity in the route, the payment will fail.
It’s up to routing nodes to constantly rebalance their channels or open new ones and provide more liquidity to keep the network going, but even then, this network’s incentives don’t always ensure that payments will never fail.Â
What is JIT routing?
Proposed by Rene Pickhardt, JIT routing is a solution aimed at avoiding payment failures if there is a mismatch in channel capacity when routing a payment through different Lightning nodes.
When a user wants to send a payment through the Lightning Network, they first need to find a path through the network. This is done by using a technique called “routing.” Routing is the process of finding the most efficient path through the network to send a payment.
Sometimes, a node may not have enough funds on the outgoing channel to forward an incoming HTLC. In this case, the node can pause the routing process and try to rebalance the channel that misses liquidity. This means that the node will try to add more funds to the channel so that it can forward the incoming HTLC.
If the node is unable to rebalance the channel, it should fail the onion and send back an insufficient wire funds error temporary_channel_failure. This means that the payment cannot be sent at this time. In simple terms, this recommendation is saying that if a node doesn’t have enough funds to forward an incoming HTLC, it should try to add more funds to the channel before failing the payment.
This will help to ensure that payments are able to be sent through the Lightning Network even if there are temporary liquidity issues.
What are the advantages of JIT routing?
- JIT routing is possible to do now without any protocol modification.
- Routing nodes can already easily implement JIT routing, and by implementing it, they will increase the routing success even for nodes running older implementations.
- JIT is an alternative solution to Atomic Mulit-path payment (AMP) Routing but can be used in conjunction once AMP is part of the protocol.
- * Local channel balance information along the route can now be part of the path-finding process while not decreasing privacy by sharing information about channel balances with others.
What are the disadvantages of JIT routing?
- JIT routing might be possible but not economically attractive for a routing node in every situation. Theoretically, it costs a node more in fees to use this technique but can’t earn the routing fee as the onion fails later.Â
- Nodes can implement risk management strategies to mitigate these negative fee routing requests.
- The routing process might take a long time as it starts sub-routing processes.
- * While doing JIT routing, the capacity for channels should be reserved even before HTLCs are set up (to prevent hostile recursive chains of rebalancing operations).
Lightning isn’t a solution for every payment.
The Lightning Network is a powerful tool that can be used to make Bitcoin payments faster, cheaper, and more scalable. However, there are some limitations to creating payment channels to route payments across the network. These limitations may be addressed as the Lightning Network continues to develop, or it could be offloaded to other second-layer solutions.
Do your own research.
If you want to learn more about JIT routing on Bitcoin, use this article as a jumping-off point and don’t trust what we say as the final say. Take the time to research, check out their official resources below or review other articles and videos tackling the topic.
- Probing Channel Balances in the Lightning Network
- Evaluating Path finding Strategies on the Lightning Network
- JIT routing proposal
Are you a Bitcoin and Lightning fan?
Have you been using Lightning to make micro-payments? Stream sats or engage with apps? Which app is your favourite? Do you run a Lightning node? Have you tried all the forms of Lightning payments? Which one do you prefer?
Let us know in the comments down below.