The Lightning Network is a second-layer protocol designed to enable off-chain Bitcoin transactions, which are not recorded on the blockchain. By skipping the need to confirm every transaction and settling between channel partners, you remove the restrictions of the base chain, which gives the Lighting Network the ability to route payments faster and cheaper.
The Lightning Network is merely a secondary environment; it has no blockchain and no native asset or token. To access this second layer, you must create a special transaction on the bitcoin blockchain known as a hashed time lock contract. When you broadcast this transaction, you tell the bitcoin blockchain these funds are now locked and cannot be moved until this contract is closed.
On the Lighting network side, those funds are now unlocked into a payment channel.
How are Lightning channels created?
Anyone with a bitcoin full node can run a Lighting node and open a Lightning channel by creating a Bitcoin transaction designed to lock their funds on the bitcoin blockchain and unlock them on the Lighting Network.
This ensures that money cannot be spent in multiple places simultaneously since we aim to avoid double-spending. To the users of the Bitcoin blockchain, the transaction acts just like a normal transaction; only you and your channel partner know that this transaction is to create a Lightning channel. When a Lighting channel is created, the creator must choose how much money he or she wants to have available in that channel.
An example: Alice could make a transaction on the Bitcoin blockchain that gave her 100,000 satoshis on the Lighting Network. That transaction would then lock down the same amount of satoshis on the Bitcoin blockchain, freeing them up on the Lightning Network.
How are Lightning channels used?
A Lightning channel is a bidirectional payment channel, meaning both parties can send and receive payments. Once a Lightning channel is established, its owners can send and receive money through them. Using either a Lightning invoice, a Lighting Address or a QR code.
You can pay either your channel partner or you can pay any other Lighting user an amount that is within the limits of your channel. When routing payments, both parties to the channel keep track of each others balances, making sure the numbers add up.
How to open a Lighting channel?
Depending on the UI front end you’re using to manage your Lightning node, the options might look slightly different, but the principles remain the same. You’ll first need to create a hot wallet or restore a hot wallet with your seed phrase and fund it with bitcoin.
Once that UTXO is confirmed in your wallet on the chain, you should see a channel creation option in your Lightning dashboard. Select the size channel you want to open, have the node pubkey ready for the person you want to open a channel to, and optionally set the fee you’re willing to pay miners to open the channel. You will then broadcast that transaction to the base chain and create the HTLC to unlock those funds on the Lightning Network.
Once the transaction has been confirmed by the bitcoin base chain, you should be able to see a channel for the size you created minus the mining fees you paid. This is true for all instances of Lightning regardless of your implementation, be that Core Lightning, LND or Eclair.
To give you an idea of one way to create a channel, check out this tutorial by BTC sessions.
The reality of liquidity
If you’ve followed the steps above and successfully created a Lightning channel, you still have one more hurdle to overcome, and this can be a real ball ache. Inbound and outbound capacity still needs to be established for your channel, which is why I don’t often recommend new users use non-custodial Lightning right from the start.
If you’ve created a channel to a large established Lightning node, they’ll most likely have the inbound capacity, so you’ll have no problem paying them. In this instance, once your channel is set up, you can start sending satoshis on Lightning without any issues. If, however, you’ve connected to a node that doesn’t have the inbound capacity, there is simply not enough space in their balance to accept your satoshis, and payments will fail.
You’ll find this to be the case if you’ve opened up a channel to a friend who has not yet opened up a channel to anyone else, and you try to pay them, which can be frustrating.
On the flip side, if you’ve followed the channel open example above, you will have no inbound capacity. While you can send satoshis, within the limitation of your channel size, you won’t be able to receive any until you secure some inbound capacity.
This is a teething issue with starting your LIghtning node and can be a royal pain. Still, with Liquidity markets now available, like Lightning Pools and Magma by Amboss, it’s gotten much easier to balance your channels.
Do I need to have a channel for everyone I want to pay?
No, and that’s the beauty of the Lightning Network; once you’ve established a channel, you gain access to the entire network’s public channels, all stitched together and ready to route payments.
When making a payment on the Lightning Network, your node searches for a path of channels between you and your destination. This is what’s referred to as routing; the more direct the path, the less you pay, the more hops your payment needs to take, and the more you’ll pay in fees along the way.
While you don’t need to have direct channels to everyone, if you are interacting with a certain node regularly, it might be better to have a direct channel instead of having your payments hop between a bunch of channels.
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? Have you tried all the forms of Lightning payments? Which one do you prefer? Let us know in the comments down below.