Skip to content

docs: comprehensive RPC Overview#70

Open
humble-little-bear wants to merge 2 commits into
nervosnetwork:doc_2.0from
humble-little-bear:doc/rpc-overview-ret-42
Open

docs: comprehensive RPC Overview#70
humble-little-bear wants to merge 2 commits into
nervosnetwork:doc_2.0from
humble-little-bear:doc/rpc-overview-ret-42

Conversation

@humble-little-bear

Copy link
Copy Markdown

This PR replaces the minimal API Overview with a full RPC Overview document.

What's covered

  • Endpoint format and transport details (HTTP POST, single socket, no per-module paths)
  • JSON-RPC 2.0 request/response structure
  • RPC modules overview (info, peer, channel, payment, invoice, graph, cch, watchtower, pubsub, dev, prof)
  • Biscuit authentication flow, permission model (read/write per resource), and the public-address safety guard
  • Configuration examples (YAML, env vars, CLI flags) and CORS setup
  • Concrete curl examples for node_info and send_payment
  • WebSocket subscription notes (pubsub module)
  • Security checklist for production deployments

Source verification

All facts are based on the Fiber v0.8.1 source code:

  • RPC server: crates/fiber-lib/src/rpc/mod.rs
  • Config: crates/fiber-lib/src/rpc/config.rs
  • Auth middleware: crates/fiber-lib/src/rpc/middleware.rs
  • Biscuit rules: `crates/fiber-lib/src/rpc/biscuit.rs"

🤖 Generated with Claude Code

Replace the minimal API Overview with a full RPC Overview covering:
- Endpoint format and transport details
- JSON-RPC 2.0 request/response structure
- RPC modules overview
- Biscuit authentication flow and permission model
- Configuration examples (YAML, env vars, CLI flags)
- Concrete curl examples for node_info and send_payment
- WebSocket subscription notes
- Security checklist

Closes RET-42

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

@humble-little-bear is attempting to deploy a commit to the CKBA-2026 Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fiber-docs Ready Ready Preview, Comment Jun 10, 2026 8:19am

Request Review

Each method is protected by a Datalog rule that checks for a specific permission fact in the token. Permissions are scoped by resource and access level:

- `read("<resource>")` — grants read-only access to that resource.
- `write("<resource>")` — grants read and write access.

@yfeng2824 yfeng2824 Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/nervosnetwork/fiber/blob/v0.8.1/crates/fiber-lib/src/rpc/biscuit.rs#L293-L297, it seems that read and write appear to be separate permissions, so write doesn't imply read access.


### When is auth required?

- **Private addresses** (loopback, LAN, unspecified interfaces like `127.0.0.1`, `[::1]`, `192.168.x.x`): Authentication is optional. If no `biscuit_public_key` is configured, the server accepts all local requests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/nervosnetwork/fiber/blob/v0.8.1/crates/fiber-lib/src/rpc/mod.rs#L252-L254, unspecified bind addresses are treated as public addresses. So 0.0.0.0 / [::] should not be grouped with local/private addresses such as 127.0.0.1 / [::1].


## RPC Modules

Functionality is grouped into **modules**. You can selectively enable or disable modules via the `rpc.enabled_modules` config field. By default, all stable modules are enabled.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/nervosnetwork/fiber/blob/v0.8.1/crates/fiber-lib/src/rpc/config.rs#L3-L6, I don't think pubsub, dev, prof are enabled by default.

export RPC_LISTENING_ADDR="127.0.0.1:8227"

# CLI flag
fiber-bin --rpc-listening-addr "127.0.0.1:8227" --rpc-biscuit-public-key "ed25519/..."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be fnn instead of fiber-bin?

@yfeng2824 yfeng2824 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HappySonnyDev Broken links: Node, watchtower.

- Clarify that write permissions do not imply read permissions.
- Classify unspecified bind addresses (0.0.0.0 / [::]) as public.
- Correct default enabled modules (pubsub/dev/prof are off by default).
- Use fnn binary name in CLI flag example.
- Fix glossary auto-link URL.
- Fix broken Watchtower API reference link.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Each method is protected by a Datalog rule that checks for a specific permission fact in the token. Permissions are scoped by resource and access level:

- `read("<resource>")` — grants read-only access to that resource.
- `write("<resource>")` — grants write access to that resource only; it does **not** imply read access.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看 subscribe_store_changes 方法用的是 internal 权限

- `read("<resource>")` — grants read-only access to that resource.
- `write("<resource>")` — grants write access to that resource only; it does **not** imply read access.

Resources map roughly to modules: `node`, `peers`, `channels`, `payments`, `invoices`, `graph`, `cch`, `watchtower`, `chain`, `messages`, `pprof`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前左侧没有 chain、messages 这两个分类

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants