FFiber WebLN
API / Provider / provider.openChannel

provider.openChannel

Optional

Connect to a peer and ask the provider to fund a new public Fiber channel with on-chain CKB.

Signature

function openChannel(args: OpenChannelArgs): Promise<OpenChannelResult>
PERMISSION

Requires enable(), explicit channel-funding approval, and provider unlock when configured.

Parameters

NameTypeDescription
args.peerAddressstring

Optional peer multiaddress. Known public nodes can be connected by pubkey alone.

args.pubkeyrequiredstring

Compressed Fiber public key of the counterparty, with or without a 0x prefix.

args.fundingAmountrequiredHex

On-chain funding capacity in hex-encoded shannons.

Response

NameTypeDescription
temporaryChannelIdstring | undefined

Temporary identifier returned while channel negotiation and confirmation proceed.

Example

if (fiber.openChannel) {
  await fiber.openChannel({
    pubkey: peerPubkey,
    fundingAmount: "0xb9e459300"
  });
}

Provider behavior

W

WASM node

Calls fiber-js connectPeer(), waits briefly for peer state, then calls openChannel().

R

Remote fnn

Calls fnn connect_peer and open_channel over JSON-RPC.

Notes

  • Submission does not mean the channel is ready. Observe listChannels() until the node reports ChannelReady.
  • The current public nodes require at least 499 CKB of channel funding; allow additional on-chain capacity for a change cell and transaction fee.

Errors