- Lightning Channels
- Levels of Information Exchange
- Steps to Open a Lightning Channel
- When is the channel open?
In this chapter, we will examine the process of opening a payment channel on the Lightning Network in more detail and explore the connection between this operation and the underlying Bitcoin system.
Lightning Channels
As we saw in the first chapter, a payment channel on Lightning can be compared to a "pipe" for exchanging funds between two participants (Alice and Bob in our examples). The capacity of this channel corresponds to the sum of the available funds on each side. In our example, Alice has 100,000 satoshis and Bob has 30,000 satoshis, giving a total capacity of 130,000 satoshis.
Levels of Information Exchange
It's crucial to clearly distinguish the different levels of exchange on the Lightning Network:
- Peer-to-peer communications (Lightning protocol): These are the messages that Lightning nodes send to each other to communicate. We will represent these messages with dashed black lines in our diagrams.
- Payment channels (Lightning protocol): These are the paths for exchanging funds on Lightning, which we will represent with solid black lines.
- Bitcoin transactions (Bitcoin protocol): These are the transactions made on-chain, which we will represent with orange lines.
It's worth noting that a Lightning node can communicate via the P2P protocol without opening a channel, but to exchange funds, a channel is necessary.
Steps to Open a Lightning Channel
- Message exchange: Alice wants to open a channel with Bob. She sends him a message containing the amount she wants to deposit in the channel (130,000 sats) and her public key. Bob responds by sharing his own public key.
- Creation of the multisignature address: With these two public keys, Alice creates a 2/2 multisignature address, meaning that the funds that will later be deposited on this address will require both signatures (Alice and Bob) to be spent.
- Deposit transaction: Alice prepares a Bitcoin transaction to deposit funds on this multisignature address. For example, she may decide to send 130,000 satoshis to this multisignature address. This transaction is constructed but not yet published on the blockchain.
- Withdrawal transaction: Before publishing the deposit transaction, Alice constructs a withdrawal transaction so she can recover her funds in case of a problem with Bob. Indeed, once Alice publishes the deposit transaction, her sats will be locked on a 2/2 multisignature address, which requires both her signature and Bob's signature to be unlocked. Alice protects against this loss risk by constructing the withdrawal transaction that allows her to recover her funds.
- Bob's signature: Alice sends the deposit transaction to Bob as proof and asks him to sign the withdrawal transaction. Once Bob's signature is obtained on the withdrawal transaction, Alice is assured of being able to recover her funds at any time, as only her own signature is now needed to unlock the multisignature.
- Publication of the deposit transaction: Once Bob's signature is obtained, Alice can publish the deposit transaction on the Bitcoin blockchain, thereby officially opening the Lightning channel between the two users.
When is the channel open?
The channel is considered open once the deposit transaction is included in a Bitcoin block and has reached a certain depth of confirmations (i.e., the number of subsequent blocks that have been added to the blockchain).
What should you remember from this chapter?
- Opening a channel starts with the exchange of messages between the two parties (exchange of amounts and public keys).
- A channel is formed by creating a 2/2 multisignature address and depositing funds into it via a Bitcoin transaction.
- The person opening the channel ensures they can recover their funds through a withdrawal transaction signed by the other party before publishing the deposit transaction.
In the next chapter, we will explore the technical workings of a Lightning transaction within a channel.
Quiz
Quiz1/5
lnp2013.1
What is the last step to open a channel on the Lightning Network?