Progress pill
Opening and Closing Channels

Commitment Transaction

Lightning Network Theory

Commitment Transaction

  • Reminder of the channel lifecycle
  • The initial state of the channel
  • Unpublished Transactions: The Commitment Transactions
  • Transfer Process: The Invoice
  • New State After a Second Transaction
In this chapter, we will examine the technical operation of a transaction within a channel on the Lightning Network, focusing on the process of transferring funds from one side of the channel to the other.

Reminder of the channel lifecycle

As seen previously, a Lightning channel begins with an opening via a Bitcoin transaction. The channel can be closed at any time, also via a Bitcoin transaction. Between these two moments, an almost infinite number of transactions can be performed within the channel, without going through the Bitcoin blockchain. Let's see what happens during a transaction in the channel.

The initial state of the channel

At the time of opening the channel, Alice deposited 130,000 satoshis on the multisignature address of the channel. Thus, in the initial state, all the funds are on Alice's side. Before opening the channel, Alice also had Bob sign a withdrawal transaction, which would allow her to recover her funds if she wished to close the channel.

Unpublished Transactions: The Commitment Transactions

When Alice makes a transaction in the channel to send funds to Bob, a new Bitcoin transaction is created to reflect this change in the distribution of funds. This transaction, called a commitment transaction, is not published on the blockchain but represents the new state of the channel following the Lightning transaction.
Let's take an example with Alice sending 30,000 satoshis to Bob:
  • Initially: Alice has 130,000 satoshis.
  • After the transaction: Alice has 100,000 satoshis, and Bob has 30,000 satoshis. To validate this transfer, Alice and Bob create a new unpublished Bitcoin transaction that would send 100,000 satoshis to Alice and 30,000 satoshis to Bob from the multisignature address. Both parties construct this transaction independently, but with the same data (amounts and addresses). Once constructed, each signs the transaction and exchanges their signature with the other. This allows either party to publish the transaction at any time if necessary to recover their share of the channel on the main Bitcoin blockchain.

Transfer Process: The Invoice

When Bob wants to receive funds, he sends Alice an invoice for 30,000 satoshis. Alice then proceeds to pay this invoice by starting the transfer within the channel. As we have seen, this process relies on the creation and signing of a new commitment transaction.
Each commitment transaction represents the new distribution of funds in the channel after the transfer. In this example, after the transaction, Bob has 30,000 satoshis and Alice has 100,000 satoshis. If either of the two participants decided to publish this commitment transaction on the blockchain, it would result in the closing of the channel, and the funds would be distributed according to this last distribution.

New State After a Second Transaction

Let's take another example: after the first transaction where Alice sent 30,000 satoshis to Bob, Bob decides to send 10,000 satoshis back to Alice. This creates a new state of the channel. The new commitment transaction will represent this updated distribution:
  • Alice now has 110,000 satoshis.
  • Bob has 20,000 satoshis.
Again, this transaction is not published on the blockchain, but it can be at any time if the channel is closed.
In summary, when funds are transferred within a Lightning channel:
  • Alice and Bob create a new commitment transaction, which reflects the new distribution of funds.
  • This Bitcoin transaction is signed by both parties, but not published on the Bitcoin blockchain as long as the channel remains open.
  • The commitment transactions ensure that each participant can recover their funds at any time on the Bitcoin blockchain by publishing the last signed transaction.
However, this system has a potential flaw, which we will address in the next chapter. We will see how each participant can protect themselves against an attempt to cheat by the other party.
Quiz
Quiz1/5
What does the commitment transaction system guarantee to participants of a Lightning channel?