Fiber LogoFiber Docs
Stablecoin25 minute tutorial

Pay with RUSD over Fiber

Fund a Fiber channel with Testnet RUSD, inspect token balances, and send a stablecoin payment to Bottle.

RUSDUDT channelKeysend
1 Identify the asset

A Fiber UDT is defined by its type script

CKB and RUSD use the same channel APIs, but an RUSD request includes the Testnet RUSD type script. The script—not a ticker string—identifies the asset.

lib/rusd.ts · lines 1–12
2 Fund the browser identity

Provide both CKB capacity and Testnet RUSD

CKB pays for cells and transaction fees. RUSD supplies channel liquidity. The demo queries matching UDT cells and decodes each little-endian amount.

Testnet assets only

Use the Nervos faucet for CKB and the Stable++ Testnet faucet for RUSD.

lib/rusd.ts · lines 7–12
3 Open the RUSD channel

Pass the asset type script when funding

The 20 RUSD amount is expressed in its smallest unit and paired with funding_udt_type_script. The browser reuses an existing compatible channel after refresh.

lib/channel.ts · lines 1–10
4 Send RUSD

Keep the same asset on the payment

The payment includes udt_type_script so routing selects RUSD liquidity rather than a CKB channel.

lib/payment.ts · lines 1–11
5 Reconcile balances

Show wallet and channel liquidity separately

On-chain RUSD decreases when it enters the channel; the channel local balance decreases as payments are sent. The interface keeps both layers visible.

app/rusd/page.tsx · lines 4–20