fiber-pay skill
Use this skill to execute and automate Fiber Network workflows with the current grouped CLI and the TypeScript SDK.
Project goal
fiber-pay is an AI payment layer over Fiber Network (fnn) for CKB Lightning workflows, with Fiber compatibility target v0.6.1.
Focus areas for this skill:
- •CLI-first operations for real node and payment workflows
- •SDK guidance for typed RPC integrations and watchers
Repository map (relevant)
- •
packages/cli: operator command surface (most important for execution) - •
packages/sdk: typed RPC client, polling helpers, verification/security utilities - •
packages/node: binary + process lifecycle substrate used by CLI/runtime
Mandatory source-of-truth rule
Before doing any CLI task, read:
- •
packages/cli/llm.txt
This file is the authoritative and current CLI behavior reference (commands, flags, runtime defaults, env vars, multi-node setup, troubleshooting).
Do not invent command forms that are not documented there.
CLI model
Use grouped commands only:
- •
node - •
channel - •
invoice - •
payment - •
peer - •
binary - •
balance - •
config
Examples of valid style:
- •
fiber-pay node start - •
fiber-pay payment send <invoice> - •
fiber-pay channel list --json
Output conventions
- •Default output is human-readable.
- •Use
--jsonwhenever output is consumed by another tool/agent step. - •When automating, prefer
--jsonconsistently for stable parsing.
Core CLI workflows
1) Bootstrap a node
- •
fiber-pay binary download - •
fiber-pay config init --force --json - •
fiber-pay node start - •
fiber-pay node status - •
fiber-pay node info --json
2) Receive payment (invoice flow)
- •
fiber-pay invoice create --amount 10 --description "service" - •Share returned invoice string
- •
fiber-pay invoice get <paymentHash> --json - •Optional cancel:
fiber-pay invoice cancel <paymentHash> --json
3) Send payment
- •
fiber-pay balance --json - •
fiber-pay payment send <invoice> --json - •
fiber-pay payment get <paymentHash> --json - •Optional watch:
fiber-pay payment watch <paymentHash> --json
4) Channel lifecycle
- •
fiber-pay peer connect <multiaddr> --json - •
fiber-pay channel open --peer <peerIdOrMultiaddr> --funding <CKB> - •
fiber-pay channel watch --until CHANNEL_READY --json - •
fiber-pay channel list --json - •Close when needed:
fiber-pay channel close <channelId>
5) Multi-node local setup
Use one env file per node and dedicated terminals. Follow the exact pattern in packages/cli/llm.txt under “Running Multiple Local Nodes”.
SDK usage map
Use @fiber-pay/sdk when building code integrations instead of shell orchestration.
Primary exports:
- •
FiberRpcClient,FiberRpcError - •
ChannelState - •amount utilities:
ckbToShannons,shannonsToCkb - •helpers:
InvoiceVerifier,PaymentProofManager,PolicyEngine,KeyManager
For full SDK method/type coverage, read:
- •
skills/fiber-pay/references/SDK.md
Amount and encoding conventions
At RPC boundary, numeric values are typically hex-encoded shannons (0x...).
Operational guidance:
- •CLI input flags generally use CKB units.
- •SDK helper conversions:
- •
ckbToShannons(...) - •
shannonsToCkb(...)
- •
Do not mix CKB decimal values with raw RPC hex fields.
Practical gotchas
- •ESM imports inside packages use
.jsfile extensions in source imports. - •Key formats are strict:
- •
fiber/skuses raw bytes - •
ckb/keyuses hex string
- •
- •RPC commands require a reachable node endpoint; verify with
fiber-pay node statusandfiber-pay node info --json. - •On Apple Silicon, x86_64 binary fallback may require Rosetta.
- •For command updates, keep grouped semantics and output policy stable.
Validation commands
Use these after CLI/SDK changes:
pnpm --filter @fiber-pay/cli typecheck pnpm --filter @fiber-pay/cli build pnpm --filter @fiber-pay/sdk test pnpm typecheck
Quick execution policy for agents
- •Read
packages/cli/llm.txtbefore issuing CLI commands. - •Use grouped command forms only.
- •Use
--jsonfor machine workflows. - •Verify node readiness before RPC-dependent commands.
- •Prefer SDK polling helpers over ad-hoc loops in custom scripts.