Fibre account services
The Fibre service module gives node users one account-facing API for Fibre data transfer and escrow funds. It joins the Fibre data client with the node transaction client, then exposes the result through the nodebuilder RPC layer. Account actions use on-chain Fibre state, while blob upload and download use Fibre Service Providers (FSPs).
Service boundary
The Fibre service is the node-side boundary for Fibre-native work. It keeps ordinary blob reads in the blob service, while Fibre submission, FSP retrieval, and escrow account actions stay in the dedicated fibre service.
The public module presents these capability groups:
| Capability | Purpose |
|---|---|
| Data transfer | Upload data to FSPs, optionally wait for payment settlement, and download data by Fibre blob ID. |
| Escrow view | Read an account balance and the balance that is not locked by withdrawals. |
| Escrow funds | Add funds or request a withdrawal for the selected signing account. |
| Withdrawal view | List withdrawals that are still waiting before they can be claimed. |
Upload returns after the off-chain data path and validator attestations complete. It starts payment settlement in the background. Submit runs the same data path and waits for the settlement transaction to be included, so it also returns chain height and transaction hash. This gives callers a choice between lower response time and an immediate on-chain confirmation.
The module reports Fibre-native reconstructed data through Download. The existing blob module remains the place for chain-visible namespace enumeration and subscription, including Fibre system blobs.
References: nodebuilder/…/fibre.go• L17-40 nodebuilder/…/types.go• L13-43 docs/…/adr-013-fibre-api.md• L61-73
Nodebuilder integration
The nodebuilder creates the Fibre service only when a core endpoint is configured. It registers the module as the fibre RPC service and keeps the same interface available when Fibre is disabled, but disabled calls return a clear unavailable error.
The service assembly connects four roles:
- The Fibre data client reaches FSPs and supports Fibre data operations.
- The transaction client signs and submits escrow and payment messages.
- The account client reads escrow state and sends account actions.
- The nodebuilder module converts service results into the public RPC result types.
The following flow shows how a configured node exposes the service and how a request reaches its backing clients.
flowchart LR
Caller[RPC caller] --> API[Fibre RPC API]
API --> Module[Fibre nodebuilder module]
Module --> Service[Fibre service]
Service --> Data[Fibre data client]
Service --> Tx[Transaction client]
Service --> Account[Account client]
Data --> FSP[Fibre Service Providers]
Tx --> Core[Core endpoint]
Account --> Core
Light and bridge nodes use the state client described below for validator and FSP information. Other configured node types use the Fibre client's normal state source. Lifecycle hooks start and stop the Fibre data client with the node.
References: nodebuilder/…/constructor.go• L25-46 nodebuilder/…/constructor.go• L49-77 nodebuilder/…/constructors.go• L18-40 nodebuilder/node.go• L56-78 nodebuilder/…/stub.go• L16-55
Account access
Fibre account access treats escrow as prepaid storage funds owned by a signer. Read calls name the signer directly. Write calls use transaction configuration to select the signer, then submit the matching account message through the shared transaction client.
The account model separates total funds from funds that can be used now. A withdrawal request reduces the available amount until its waiting period ends. The pending-withdrawal view gives callers the amount and the time when each request becomes claimable.
Signer selection follows this order:
- An explicit signer address in the transaction configuration.
- A key name in the transaction configuration.
- The node's default account.
The account client can use its configured core connections in turn for state reads. This allows account queries to continue when one configured connection cannot answer.
The account lifecycle and its message-level behavior are covered in Fibre account operations.
References: fibre/account.go• L16-55 fibre/account.go• L58-105 fibre/account.go• L107-217 state/…/tx_config.go• L57-88 docs/…/adr-013-fibre-api.md• L214-245
Fibre state client
The Fibre state client supplies validator sets and FSP hosts without making a light or bridge node trust an unverified remote state response. It takes validator sets from locally verified headers and checks each host record against the trusted application hash before the Fibre data client uses it. It does not fall back to a remote validator set when the requested header is not local.
Host lookup uses a refresh window for each validator. A recent host is reused during that window without an ABCI query. When the window expires, the client gives the query a fixed time limit and can serve the last known host if the endpoint has a temporary failure. The first failed lookup also opens the refresh window, so repeated callers do not create a query storm. A verified absence of provider information does not use the fallback because it is an authoritative result. The client protects this cache for concurrent callers and warms it from the current validator set when it starts.
The state path works as follows:
- The local header store supplies the trusted head and validator set.
- The client queries the core endpoint for each validator's Fibre provider record at the state height that matches the head's application hash.
- The returned value or absence proof is checked against that application hash.
- Verified hosts become available to the Fibre data client.
At startup, the client records the chain ID from the local head and prefetches host records in parallel against that same head. Prefetch errors do not prevent startup. They leave the affected host uncached until a later lookup succeeds.
The client serves the DA-side state role only. It does not verify Fibre payment promises or report app-node health and provider-registration status. Those operations return a no-op or an explicit unsupported result instead of using an unverified remote answer.
The related Fibre account operations page should be consulted when a change affects both account lifecycle actions and the state reads that support them.
References: fibre/…/stateclient.go• L47-57 fibre/…/stateclient.go• L102-165 fibre/…/stateclient.go• L167-233 fibre/…/stateclient.go• L236-271 fibre/…/stateclient.go• L273-312 fibre/…/stateclient_test.go• L72-109 fibre/…/stateclient_test.go• L151-264 fibre/…/stateclient_test.go• L266-337 nodebuilder/…/constructor.go• L60-65
Data and payment flow
Fibre data transfer has an off-chain storage step and an on-chain payment step. The service creates the Fibre payment promise during upload, sends data to FSPs, collects validator signatures, and uses the signed result for MsgPayForFibre settlement.
The two public paths share the off-chain work but differ in when they return:
| Path | Caller receives | Payment settlement |
|---|---|---|
Upload | Blob ID, payment promise, and validator signatures | Starts in the background. |
Submit | The upload result plus height and transaction hash | Completes before the call returns. |
Download | Reconstructed original data | Reads from FSPs by blob ID. |
This diagram shows the relationship between the off-chain result and the optional wait for chain confirmation.
sequenceDiagram
participant Caller
participant Service as Fibre service
participant FSP as FSPs
participant Core as Core endpoint
Caller->>Service: Upload or Submit(namespace, data)
Service->>FSP: Store Fibre data
FSP-->>Service: Blob ID, promise, validator signatures
alt Upload
Service-->>Caller: Upload result
Service-)Core: Settle payment in background
else Submit
Service->>Core: Submit payment settlement
Core-->>Service: Inclusion height and hash
Service-->>Caller: Confirmed submit result
end
The signer used for the promise must match the signer used for settlement. An account without enough escrow cannot complete the confirmed submission path.
References: fibre/service.go• L50-115 fibre/service.go• L117-203 fibre/service.go• L205-249 nodebuilder/…/module.go• L30-88 nodebuilder/…/types.go• L13-43
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the public module, RPC API wrapper, local service, and disabled stub aligned when Fibre methods or result shapes change.
- Preserve signer consistency between payment-promise creation and
MsgPayForFibresubmission when transaction selection changes. - Recheck the distinction between FSP-reconstructed data and chain-visible Fibre system blobs when changing read APIs.
- Keep the node type rule for verified state access aligned with Fibre client construction.
- Keep escrow availability and pending withdrawal timing aligned with the account query responses.
- Keep host cache refresh, query timeout, and fallback behavior aligned with the rule that verified provider absence is authoritative.
- Keep proof query height aligned with the local head application hash when changing state lookup.
- Keep DA-client unsupported health checks and no-op promise verification aligned with the state-client contract.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| No core endpoint is configured | All Fibre module calls return the unavailable error. | Configure a core endpoint before enabling Fibre operations. |
| A payment signer has no escrow or too little escrow | Fibre payment submission fails and no usable escrow account is created for the rejected account. | Deposit enough funds into the same signer selected by TxConfig. |
| The blob ID is malformed | Download stops before contacting FSPs. | Validate and preserve the complete Fibre blob ID. |
| A validator has no verified Fibre provider record | That validator cannot supply a usable host for the data path. | Register provider information on chain and wait for verified state to include it. |
| A host query fails after a cache entry expires and no prior host exists | Fibre host discovery fails. A stalled query is stopped at the client timeout. | Keep the local header chain and core state query available. |
| Upload background settlement fails | Data upload can return successfully while on-chain payment is not confirmed. | Monitor settlement errors and use the confirmed Submit path when immediate confirmation is required. |
| A caller requests app-node health or provider-registration state from a DA client | The request returns an unsupported error instead of a health result. | Use an app-node state client for provider health data. |
Key files
| File | Why to read it |
|---|---|
| nodebuilder/…/fibre.go | Defines the public Fibre module and its account and data capabilities. |
| nodebuilder/…/constructor.go | Shows when nodebuilder enables Fibre and how it wires the clients. |
| nodebuilder/…/module.go | Shows how the local service becomes the RPC-facing module. |
| fibre/service.go | Explains the shared upload, payment, and download service boundary. |
| fibre/account.go | Explains escrow account reads, deposits, withdrawals, and pending state. |
| fibre/…/stateclient.go | Explains verified validator and FSP host discovery for light and bridge nodes. |
| fibre/…/stateclient_test.go | Shows the guarantees for cache reuse, bounded lookup, fallback, prefetch tolerance, unsupported health checks, and concurrent access. |
| nodebuilder/…/stub.go | Defines the behavior when the node has no core endpoint. |
| docs/…/adr-013-fibre-api.md | Records the split between Fibre-native operations and the existing blob API. |