Fiber LogoFiber Docs
Channel model20 minute tutorial

Open a Unidirectional Fiber Channel

Fund a private one-way channel, verify the payer and acceptor roles, and send a real Testnet payment in the permitted direction.

One-wayPrivate channelKeysend
The model

Only the initiator can send

The browser node opens and funds the channel, so it becomes the payer. Bottle accepts the channel and becomes the receiver. During the channel lifetime, payments can move from the initiator to the acceptor, but not back.

Browser payerPrivate one-way channelBottle acceptor
lib/channel.ts · lines 4–14
1 Connect the acceptor

A public node can accept a private channel

Connect to Bottle over WSS before requesting a channel. Bottle is a public Fiber node, but this specific channel remains private and never appears in the public routing graph.

Public peer ≠ public channel

One-way channels must use public: false. Combining one_way: true with a public channel is rejected.

lib/fiber.ts · lines 3–10
2 Open and inspect

Set one_way when funding the channel

Submit 499 Testnet CKB with one_way: true and wait for ChannelReady. The returned channel confirms is_one_way: true, is_public: false, and is_acceptor: false for this browser node.

lib/channel.ts · lines 16–25
3 Pay forward

Send normally in the allowed direction

Once ready, the payer uses the ordinary sendPayment() API. The routing engine recognizes the channel direction, sends directly to Bottle, and rejects any attempt by the acceptor to pay back through it.

lib/payment.ts · lines 4–22
4 Show the result

Make the role and balance movement visible

The React page displays the channel flags alongside local and remote balances. After a successful payment, local payer balance decreases and remote acceptor balance increases without another on-chain transaction.

app/page.tsx · lines 9–29