Lightning Network Basics — Part 3

uenohiro4
Nayuta Engineering Blog
3 min readOct 12, 2022

I will present the basic technical details of the Lightning Network over the course of several articles.

In this article, I will explain about Lightning Network channel openings.

Channel

The Lightning Network performs transfers through channels created between LN nodes.
To make the 1st layer Bitcoin amount available to the 2nd layer Lightning Network, a transaction is deployed to transfer money to a 2-of-2 MultiSig address on each LN node. As long as the transfer to that address is a UTXO, the channel is open.

Then, if for some reason you want to end the channel, you can transfer from that MultiSig address and get your balance back in Bitcoin on the respective Lightning Network (due to Bitcoin transaction restrictions, if your balance is less than the dust limits, it will be added to the transaction fee).

Channel Open

Channel open is described in BOLT #2: Channel Establish. Although the individual messages are omitted, the overall sequence is shown in the figure below.

Basically, the cost of the Bitcoin transaction is paid by the channel originator (funder), including fees. After receiving the funding_signed message, the funder publishes the transaction that opens the channel. If it is determined that the channel cannot be opened based on previous messages, the communication is terminated (an error message can also be sent).

The channel_ready message is sent to the other side after the funding_signed message has been exchanged and each party has determined that it is acceptable to accept the other as a channel (since it is P2P, either party can send the message first). The previous specification was called funding_locked message because the transaction to the 2-of-2 MultiSig address that creates the channel (Funding Transaction) had to be fully approved. However, the message name has been changed to Zero-Confirmation to allow a channel to be started even before the transaction has been approved by mutual agreement.

Funding Transaction and Commitment Transaction

The transaction that the funder publishes when opening a channel is called a Funding Transaction. The rules of a Funding Transaction are that the output is a 2-of-2 MultiSig (P2WSH) using the funding_pubkeyparameter exchanged at the time of channel opening and that the amount to be deposited matches the funding_satoshisparameter.

However, if the funder publishes the Funding Transaction but the fundee suddenly closes the LN node and stops responding, the funder will lose the Bitcoin. To prevent this from happening, the Funding Transaction is published after making it possible to refund the funds from the MultiSig address before it is published. This refund transaction is called a Commitment Transaction.

The Commitment Transaction is re-created each time the balance changes due to Lightning Network transfers, etc., while the channel is open. In this way, you can deploy a Commitment Transaction at any time to close the channel and retrieve the balance.

Note that since the Lightning Network protocol specifies how to create transactions, transaction data is not exchanged directly as messages, but only the necessary parameters are exchanged.

--

--