Channel Lifecycle
Understand the complete lifecycle of a Fiber payment channel — from opening to closing
TL;DR
A channel goes through AwaitingLockin → ChannelReady → Closing → Closed. Each side must reserve 99 CKB. Use list_channels to check the state, and shutdown_channel to close.
A Fiber payment channel goes through several states from creation to closure. Understanding these states is essential for node operators and developers building on Fiber.
Channel States
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Awaiting │────▶│ Channel │────▶│ Closing │
│ Lockin │ │ Ready │ │ │
└──────────────┘ └──────┬───────┘ └──────┬───────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Normal │ │ Closed │
│ Operation │ │ │
└──────────────┘ └──────────────┘AwaitingLockin
The channel has been proposed and the funding transaction is being confirmed on-chain. Both parties are exchanging OpenChannel / AcceptChannel messages and signing the funding transaction.
What happens in this state:
- The initiator sends
OpenChannelwith channel parameters (funding amount, fee rates, TLC limits) - The accepter responds with
AcceptChannel - Both parties exchange
commitment_signedmessages (two rounds) - Both parties exchange
tx_signaturesto finalize the funding transaction - The funding transaction is broadcast to the CKB network
- Both parties exchange
channel_readyonce the funding tx is confirmed
RPC to initiate: open_channel
How long: Depends on CKB block confirmation time (typically a few seconds on testnet)
Common issues:
- If the funding transaction fails to confirm, the channel will time out after
funding_timeout_seconds(default: 24 hours) - If the peer is offline, the channel will stay in
AwaitingLockinindefinitely until the peer comes back online
ChannelReady (Open)
The funding transaction is confirmed and the channel is fully operational. Both parties can now make off-chain payments.
What you can do in this state:
- Add TLCs (
AddTlc): Lock funds in a time-locked contract for a payment - Remove TLCs (
RemoveTlc): Release funds from a TLC (on success with preimage, or on failure with error code) - Update channel parameters (
update_channel): Change fee rates or TLC limits - Send payments (
send_payment): Initiate a payment through the channel
State updates: Every balance change requires a round of CommitmentSigned / RevokeAndAck between both parties. This two-step process ensures that old states can be revoked — if a party tries to submit an outdated commitment transaction, the other party can punish them using the revocation key.
Closing
One or both parties have initiated channel closure. The final state is being negotiated and the closing transaction will be broadcast on-chain.
How closing works:
- One party sends a
Shutdownmessage - The other party responds with
Shutdown - Both parties negotiate the closing transaction fee via
closing_signedmessages - Once fee is agreed, the closing transaction is broadcast on-chain
RPC to initiate: shutdown_channel
Cooperative vs. Uncooperative close:
- Cooperative close (normal): Both parties agree on the final balance and fee, then broadcast the closing transaction. Fast and cheap.
- Uncooperative close (force close): One party broadcasts the latest commitment transaction on-chain without the other's cooperation. The other party must wait for the
to_self_delayto expire before claiming their funds. This is slower and more expensive.
Closed
The channel has been fully settled on-chain. All funds have been distributed according to the final channel state.
What happens: The closing transaction is confirmed, and each party's funds are available in their CKB wallet. The channel is removed from the active channel list.
Channel Reserve
When a channel is open, each party must maintain a reserve of 99 CKB:
- 98 CKB for the commitment lock occupied capacity
- 1 CKB for the shutdown transaction fee
This reserve ensures there are sufficient funds for on-chain settlement when the channel closes. It is not available for off-chain payments.
Example: If you fund 499 CKB in a channel:
- Your available balance for payments: 499 - 99 = 400 CKB
Channel Parameters
When opening a channel, the following parameters are negotiated:
| Parameter | Description |
|---|---|
funding_amount | Amount each party contributes (in shannons) |
funding_fee_rate | Fee rate for the funding transaction (shannons/kB) |
commitment_fee_rate | Fee rate for commitment transactions (shannons/kB) |
max_tlc_value_in_flight | Maximum total value of pending TLCs |
max_tlc_number_in_flight | Maximum number of pending TLCs |
min_tlc_value | Minimum TLC value |
to_self_delay | Delay before a party can claim funds after force close (in epochs) |
tlc_expiry_delta | Time window for forwarding a TLC (in milliseconds) |
Monitoring Channel State
Using fnn-cli
# List all channels with their states
fnn-cli channel list_channels
# Check a specific channel
fnn-cli channel list_channels --channel-id 0x...Using RPC
{
"jsonrpc": "2.0",
"method": "list_channels",
"params": [],
"id": 1
}Channel State Names
The state_name field in the response uses SCREAMING_SNAKE_CASE:
| State Name | Description |
|---|---|
AWAITING_LOCKIN | Channel is being established, funding tx pending |
CHANNEL_READY | Channel is open and operational |
CLOSING | Channel is being closed |
CLOSED | Channel has been fully settled on-chain |
Related Topics
- Payment Lifecycle — how payments work within an open channel
- P2P Message Protocol — the protocol-level message details for each transition
- Troubleshooting — common channel-related issues
- Channel Rebalancing — shift liquidity between channels