Node assembly and service lifecycle
The node builder creates one managed Celestia node from a node type, network, persistent store, and configuration. It combines consensus access, peer networking, data availability, state access, and RPC access behind one process and one lifecycle boundary. Bridge, full, light, and auxiliary roles describe how much of this shared service graph a node uses.
Assembly model
The node is a dependency graph. Shared resources are created first, then service modules receive the resources they need and add their start and stop work. This lets bridge and light paths expose a common node interface while keeping their data and consensus needs distinct.
Service graph
The service graph connects storage and configuration to consensus, peer, header, share, state, blob, availability, Fibre, administration, and RPC services. The header service provides the shared chain view. The blob service combines that view with state access and shared data retrieval, so higher services use common dependencies instead of making separate copies of them.
The peer module supplies the network resources used by higher services. Bridge mode adds resources for a full peer and performs reachability and bootstrap work. Light mode uses an autoscaled resource path without those bridge-only duties.
This diagram shows the main service relationships.
flowchart LR
Store[Persistent store] --> Core[Consensus access]
Store --> P2P[Peer network]
Config[Node configuration] --> Core
Config --> P2P
Core --> Header[Header service]
P2P --> Header
Header --> Share[Share service]
P2P --> Share
Header --> Blob[Blob service]
Share --> Blob
State[State access] --> Blob
Header --> DAS[Availability service]
Share --> DAS
Core --> Fibre[Fibre service]
Header --> Fibre
Core --> RPC[RPC boundary]
Header --> RPC
Share --> RPC
State --> RPC
Blob --> RPC
DAS --> RPC
Fibre --> RPC
Bridge[Bridge-only peer resources] --> P2P
Light[Light peer resources] --> P2P
The builder also gives modules one lifecycle context. Each module can add start and stop work while the node keeps control of the complete process.
References: nodebuilder/module.go• L24-57 nodebuilder/node.go• L41-82 nodebuilder/…/service.go• L23-54 nodebuilder/…/module.go• L15-50 nodebuilder/…/module.go• L13-53
Node modes
The selected node type controls how the node reaches consensus and the data-availability network. Bridge and Light are the public node types. Full and Auxiliary describe service roles within those assemblies.
| Mode or role | Assembly meaning | Main system effect |
|---|---|---|
| Bridge | Valid node type | Joins consensus access to the full data-availability path. |
| Full | Service role in bridge assembly | Serves data and advertises as a full peer. |
| Light | Valid node type | Uses peer retrieval and sampling with less local data. |
| Auxiliary | Supporting service role | Adds shared access such as RPC, administration, blobs, Fibre, pruning, or metrics. |
Bridge mode
Bridge mode joins the consensus side to the data-availability side. Consensus access supplies block and header input. Storage and peer services support local data use and service to other nodes. The bridge path can retain all data or use pruning.
An archival bridge keeps old headers, shares, and blobs available after they pass the normal availability window. A pruned bridge can discard older data and rely on an archival peer when that data is outside its local retention window. This gives archival mode a retention role without changing the bridge node's external service boundary.
References: nodebuilder/…/type.go• L21-29 nodebuilder/…/module.go• L36-100 nodebuilder/…/module.go• L41-48 nodebuilder/…/module.go• L54-80 nodebuilder/…/archival_test.go• L23-29 nodebuilder/…/archival_test.go• L55-105 nodebuilder/…/catchup_test.go• L24-110
Full service role
Full is part of the bridge assembly rather than a separate public node type. The bridge share path creates local data storage and full availability services. Its share network server and broadcast path let a bridge serve data to light nodes. Light nodes consume this role without advertising themselves as full peers.
The bridge full-peer path serves share, extended data square, row, range, and namespace retrieval. Peered bridge nodes return the same share data, and range responses carry proofs that callers can check against the data root.
References: nodebuilder/…/module.go• L41-48 nodebuilder/…/module.go• L107-147 nodebuilder/…/constructors.go• L47-64 nodebuilder/…/p2p_constructors.go• L41-99 nodebuilder/…/shrex_test.go• L17-110 nodebuilder/…/get_range_result.go• L22-29
Light mode
Light mode keeps less local data while it checks availability through peer retrieval and sampling. It uses the light availability path and does not create the bridge extended data square store. Consensus access is optional. Without it, state and Fibre use unavailable-service paths so the node can still assemble.
The light share path uses a peer getter and a local sampling service. It does not start the bridge share server. After a restart, a light node keeps stored headers and resumes sampling from saved progress. Its RPC endpoint can become ready before peer links return. Peer-dependent callers must treat peer readiness as a separate condition.
References: nodebuilder/…/module.go• L49-54 nodebuilder/…/module.go• L96-107 nodebuilder/…/module.go• L163-186 nodebuilder/…/module.go• L31-54 nodebuilder/…/constructor.go• L25-66 nodebuilder/…/stub.go• L16-56 nodebuilder/…/light_restart_test.go• L42-105
Auxiliary services
Auxiliary services provide common capabilities around the selected node type. RPC and administration serve both supported types. The administrative service reports node information and readiness, controls log levels, and manages signed RPC tokens. Blob, Fibre, pruning, blobstream, and availability services join the same graph. Unavailable-service paths stand in when an optional dependency or feature is not present.
Fibre is live when a core endpoint is configured. Its client and node service start and stop with the node. When no core endpoint exists, the builder keeps the same service shape but returns a clear unavailable-service error instead of creating a live Fibre client.
References: nodebuilder/module.go• L42-57 nodebuilder/…/module.go• L11-20 nodebuilder/…/admin.go• L30-71 nodebuilder/…/node.go• L14-44 nodebuilder/…/module.go• L11-47 nodebuilder/…/constructor.go• L25-77 nodebuilder/…/module.go• L15-105 nodebuilder/…/stub.go• L16-56 nodebuilder/…/module.go• L12-39
Initialization and dependency wiring
Node creation has a construction phase and a running phase. The builder prepares the store and configuration, validates the selected services, and creates the graph. It does not start the node until the caller invokes Start.
Construction sequence
When a caller creates a node, the builder follows this sequence:
- It reads saved configuration from the store or accepts configuration supplied by the caller.
- It gathers the store, keystore, node type, network, data store, and configuration.
- Service modules register consensus, peer, header, share, state, availability, blob, Fibre, administration, pruning, RPC, and blobstream resources.
- The node module wires token signing and verification to persistent token state for the administrative RPC service.
- Each module selects the service path allowed by the node type and configuration.
- The graph creates the services and fills the public
Nodeview with the main handles. - Lifecycle hooks remain ready for a later start or stop call.
The peer module selects bridge resources with reachability and bootstrap support or light resources with autoscaling. The share module selects bridge storage and serving services or light retrieval and sampling services. Fibre selects a live core-backed path when its endpoint is configured and an unavailable path otherwise. These choices happen during construction, while their start and stop hooks run later.
Node initialization also creates the node store, saves configuration, takes the store lock, and generates an account key when no key exists. Initialization tests cover both light and bridge stores, invalid and locked paths, broken configuration, and recovery of the generated account from its mnemonic.
Invalid dependencies, networks, or configuration values can stop construction before any service starts. The choices that affect configuration and node type are described in Node configuration and operating modes. Peer construction is described in Peer-to-peer networking. External service registration is described in Node RPC service wiring.
References: nodebuilder/node.go• L84-99 nodebuilder/module.go• L24-62 nodebuilder/…/config.go• L17-30 nodebuilder/init.go• L24-74 nodebuilder/init_test.go• L21-115 nodebuilder/…/network.go• L29-47 nodebuilder/…/module.go• L13-53 nodebuilder/…/module.go• L25-57 nodebuilder/…/constructor.go• L25-77 nodebuilder/…/stub.go• L16-56 nodebuilder/…/module.go• L11-20
Dependency boundaries
Consensus access is required for bridge block input and optional for light nodes. Header services provide the ordered chain view used by share and blob services. Share services provide data access for availability checks and blob retrieval. State uses a no-consensus path when a light node assembles without direct chain access. Fibre is separate: its live path requires a configured core endpoint.
The header service resolves requests against both the sync view and the local store. Higher services and RPC clients therefore use one chain view during sync. Errors still distinguish future heights, unavailable storage, and invalid ranges.
For bridge and light nodes with Fibre enabled, the Fibre client resolves validator and provider state through the locally verified header chain. This keeps Fibre state discovery tied to the node's trusted chain view. Nodes without the required core endpoint use the unavailable Fibre service instead.
The network selects chain context for peer bootstrap and header work. The keystore supplies account and RPC authentication keys. Build information supplies the node identity reported to callers and peers.
References: nodebuilder/…/config.go• L17-30 nodebuilder/…/module.go• L36-100 nodebuilder/…/module.go• L20-54 nodebuilder/…/constructor.go• L49-77 nodebuilder/…/stub.go• L16-56 nodebuilder/…/auth.go• L14-42 nodebuilder/…/network.go• L38-71 nodebuilder/…/buildInfo.go• L21-58 nodebuilder/…/service.go• L103-155
Service lifecycle
The node owns the start and stop boundary for every service in the graph. Dependency order controls when hooks run. Lifecycle timeouts limit how long the node waits for external systems and cleanup.
Startup sequence
Node.Start applies the startup timeout and starts the dependency container. The startup flow is:
- Stores and external connections become ready.
- Peer, header, share, availability, blob, Fibre, pruning, and related services start when their dependencies are ready.
- A bootstrapper node tries to connect to its configured bootstrap peers.
- A bridge starts its share transport and server. A light node starts its retrieval and sampling path without the bridge server.
- The RPC server starts after its service registrations are ready.
- A successful start marks the node as running.
If a start hook exceeds its timeout, startup fails. The node preserves the hook error when it can instead of returning only a generic timeout. RPC readiness after a restart does not prove that peer links are ready.
The Tastora framework follows the same boundary in its end-to-end setup. It starts the consensus chain, builds the data-availability network, always creates a default bridge, and starts additional bridge or light nodes through explicit node start calls. It can also start archival bridges with a selected retention window. Its restart helper stops and starts a node while keeping its data.
References: nodebuilder/node.go• L101-134 nodebuilder/…/constructors.go• L119-139 nodebuilder/…/module.go• L34-52 nodebuilder/…/constructor.go• L25-37 nodebuilder/…/module.go• L16-27 nodebuilder/…/bootstrap.go• L81-112 nodebuilder/…/module.go• L36-50 nodebuilder/…/module.go• L87-93 nodebuilder/…/module.go• L115-121 nodebuilder/…/module.go• L140-145 nodebuilder/…/framework.go• L118-147 nodebuilder/…/framework.go• L267-297 nodebuilder/…/framework.go• L652-698 nodebuilder/…/framework.go• L748-807
Shutdown sequence
Node.Stop applies the shutdown timeout and stops services in reverse dependency order. Services close their network paths, stores, clients, and exporters during this phase. If the stop context expires, some services may close without the full graceful wait.
The share getter stops for both node types. Bridge-only share transport, server, and data store resources also stop through the same lifecycle boundary. The live Fibre client follows that boundary and stops before the node is fully shut down. Node.Run starts the node and waits for the caller's context. Context cancellation does not stop the node by itself. The caller must call Stop. The command path then closes the persistent store after the node stops.
A restart uses the same stop-then-start boundary while it keeps persistent data. Header state and light-node sampling progress can then resume instead of starting as a new node.
References: nodebuilder/node.go• L137-167 nodebuilder/node.go• L149-155 nodebuilder/…/module.go• L87-93 nodebuilder/…/module.go• L115-121 nodebuilder/…/module.go• L140-158 nodebuilder/…/constructor.go• L27-37 cmd/start.go• L51-76 nodebuilder/…/module.go• L64-110 nodebuilder/…/framework.go• L189-195 nodebuilder/…/framework.go• L874-927 nodebuilder/…/light_restart_test.go• L65-98
Service exposure
The RPC server is the common external boundary for bridge and light nodes. The builder supplies service instances to named RPC groups, so clients use one endpoint while each module keeps ownership of its service.
RPC service surface
The server exposes administration, peer operations, headers, shares, state, availability, blobs, blobstream, and Fibre. The administrative node service reports the node type, API version, and RPC readiness. It also changes log levels and creates, verifies, or revokes JWT tokens. Revocation closes active sessions for that token and blocks later use without affecting other tokens. The RPC layer owns authentication and transport controls. See Node RPC service wiring for the endpoint contract.
The Fibre surface supports off-chain blob upload and download plus on-chain escrow actions. A complete submit includes settlement details. Upload can return a payment promise for later settlement. These operations are available only when the node has a live core-backed Fibre service.
The node command provides client actions for node information, log levels, token permissions, token creation, and token revocation. These actions call the same administrative boundary as other RPC clients.
The blob command provides the client path for reading blobs and proofs and for submitting one or more blobs through the Blob RPC service. A submission can use namespace and data arguments, a JSON input file, or raw standard input. The command validates that the selected input form is complete before it sends the request, then reports the inclusion height and commitments returned by the node.
Share range responses contain both the requested shares and an inclusion proof. Clients can verify the proof against the data root and then verify that it covers the exact requested half-open range. This keeps network data retrieval tied to the square and interval the caller requested.
RPC clients can consume state and blob services through command groups. These clients turn user commands into calls to the node service boundary rather than accessing service internals. The state command group also keeps address-kind checks at the client boundary, so account and validator commands return errors for the wrong address kind instead of accepting it or panicking.
The end-to-end sanity suite checks the assembled bridge through this boundary. It covers node information and readiness, token round-trips, blob subscription and submission, large-block retrieval, and prompt errors for invalid heights.
References: nodebuilder/…/constructors.go• L19-58 nodebuilder/…/module.go• L19-36 nodebuilder/default_services.go• L15-27 nodebuilder/…/admin.go• L30-71 nodebuilder/…/node.go• L14-44 nodebuilder/…/node.go• L17-126 nodebuilder/…/admin_test.go• L20-101 nodebuilder/…/fibre.go• L17-41 nodebuilder/…/module.go• L30-105 nodebuilder/…/stub.go• L16-56 nodebuilder/…/fibre_e2e_test.go• L127-145 nodebuilder/…/get_range_result.go• L22-29 nodebuilder/…/get_range_result.go• L116-153 nodebuilder/…/get_range_result_test.go• L34-102 nodebuilder/…/state.go• L66-70 nodebuilder/…/state.go• L128-192 nodebuilder/…/state.go• L264-318 nodebuilder/…/state.go• L413-496 nodebuilder/…/state_test.go• L12-42 nodebuilder/…/blob.go• L34-39 nodebuilder/…/blob.go• L115-232 nodebuilder/…/blob_test.go• L24-203 nodebuilder/…/e2e_sanity_test.go• L58-201
Network and consensus interfaces
Bridge nodes use consensus input and the peer network for data exchange. Light nodes depend more on peers for headers and shares. The peer module supplies shared network resources that higher services use.
The share layer gives both node types a full-peer discovery path. Bridge nodes advertise as full peers. Light nodes discover and use them. Archival peers remain a separate source for archival retrieval.
See Peer-to-peer networking for peer construction and discovery.
References: nodebuilder/…/module.go• L42-99 nodebuilder/…/module.go• L14-55 nodebuilder/…/p2p_constructors.go• L41-157 nodebuilder/…/module.go• L117-134 nodebuilder/…/shrex_test.go• L26-110
Change checklist
When these files or sections are changed, remember to consider these:
- A new node type must be handled by every module that selects consensus, peer, header, share, state, pruning, RPC, or default behavior.
- A new network must have validation, chain identity, and bootstrap data so header and peer startup use the same chain context.
- A new service must be added to the public node view and RPC registration when callers need direct or external access.
- Changes to optional consensus access must preserve the no-consensus paths for light state and transaction operations.
- Changes to core endpoint gating must keep live Fibre wiring and the unavailable Fibre service compatible with the same RPC shape.
- Changes to full or archival peer discovery must keep peer roles, advertisement rules, and peer limits aligned.
- Changes to bridge or light peer resource policy must keep reachability, bootstrap, and autoscaling behavior aligned with the selected node type.
- Changes to share retrieval or serving must preserve the different bridge and light lifecycle hooks.
- Changes to archival retention or availability-window policy must keep old-data retrieval behavior distinct from pruned bridge behavior.
- Lifecycle hook changes must be checked against both startup and shutdown timeouts.
- Changes to RPC service contracts must keep live services and unavailable stubs compatible.
- Changes to Fibre state discovery must keep validator and provider lookup tied to the node's verified header view.
- Changes to blob command input modes must keep argument validation, byte decoding, and the Blob RPC request contract aligned.
- Changes to header lookup or range rules must keep local callers and RPC clients aligned with the same error and size limits.
- Changes to persistent header or sampling state must preserve restart and catch-up behavior.
- Changes to state command arguments or address parsing must keep the command contract and account-versus-validator checks aligned.
- Changes to the administrative module must keep its interface, RPC permission tags, generated mocks, CLI actions, and token revocation behavior aligned.
- Changes to token verification storage must preserve revocation across new calls and active WebSocket sessions.
- Changes to share range results must keep JSON compatibility and bind the proof to the returned shares, namespace, data root, and exact interval.
- Changes to the Tastora node setup must keep chain identity, genesis context, core endpoints, trusted peers, node type, and archival settings aligned across bridge and light starts.
- Changes to initialization must keep store locking, configuration validity, key creation, and
IsInitchecks aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Bridge has no reachable consensus endpoint | Consensus cannot become ready and node startup fails or times out. | Configure a usable consensus endpoint for bridge mode. |
| Light has no consensus endpoint | Direct state and transaction calls report unavailable-service errors. | Configure consensus access when those operations are required. |
| Fibre has no configured core endpoint | Fibre calls report an unavailable-service error instead of reaching storage providers or chain state. | Configure a Fibre-capable core endpoint when Fibre operations are required. |
| Network or bootstrap data is invalid | Construction or peer and header startup fails. | Use a supported network and valid bootstrap addresses. |
| Required service dependency is missing | The dependency graph cannot build the node. | Keep module optionality aligned with bridge and light paths. |
| Bridge share serving resources are selected for a light node | The light assembly requests services that its mode does not provide. | Keep share getters, availability services, and share server selection tied to the node type. |
| A pruned bridge is asked for data outside its retention window | Old headers, shares, or blobs are unavailable unless an archival source can provide them. | Use archival mode for local historical access or configure archival peer retrieval. |
| Start or stop hook exceeds its deadline | The lifecycle phase returns a timeout and may leave work incomplete. | Use suitable timeouts and cancelable external waits. |
| Header sync or store lookup fails | Header-dependent work returns an error instead of a usable chain view. | Keep sync and store errors visible to callers. |
| Header range boundaries are invalid or exceed the request limit | The header request is rejected before storage access. | Validate range direction, emptiness, and size at the service boundary. |
| Blob submit mixes a JSON input file with positional data or uses a non-JSON file | The command rejects the request before it reaches the Blob RPC service. | Use one supported input form and a JSON file for file-based submission. |
| Blob data is read from a failing stream or cannot form a valid blob | Submission stops before the Blob RPC request is sent. | Check input reads and blob creation errors before submission. |
| State command receives the wrong address kind | The command returns a validation error instead of running with the wrong account or validator. | Keep address parsing type-aware and error based. |
| A revoked token is used for a new call or active WebSocket session | The call is rejected and the active session is closed. | Treat revocation as immediate and issue separate tokens for separate access needs. |
| A share range proof does not match the shares, namespace, data root, or requested interval | The client rejects the result even when part of the proof is valid. | Verify the proof against the data root and exact half-open range. |
| Node store initialization uses an invalid or locked path | Initialization fails before a usable node store exists. | Check the path and release the store lock before retrying. |
| RPC is ready before peers reconnect after restart | Peer-dependent calls fail even though the RPC endpoint responds. | Wait for the required peer count before making peer-dependent requests. |
Key files
| File | Why to read it |
|---|---|
| nodebuilder/node.go | Defines node construction and the start, run, stop, and timeout contract. |
| nodebuilder/module.go | Shows the shared service graph and module lifecycle boundary. |
| nodebuilder/…/type.go | Defines supported node types and the boundary between node types and service roles. |
| nodebuilder/init.go | Shows store setup, configuration saving, locking, and account key creation. |
| nodebuilder/init_test.go | Confirms initialization behavior for node modes, invalid stores, locks, and generated keys. |
| nodebuilder/…/module.go | Shows the bridge consensus path and its relationship to headers. |
| nodebuilder/…/module.go | Shows shared peer resources and the bridge or light resource policy. |
| nodebuilder/…/module.go | Shows bridge and light share choices, peer data flow, and share lifecycle hooks. |
| nodebuilder/…/p2p_constructors.go | Shows full and archival peer discovery roles. |
| nodebuilder/…/module.go | Shows optional consensus access and the light no-consensus path. |
| nodebuilder/…/constructor.go | Shows core endpoint gating, verified state discovery, and Fibre client lifecycle hooks. |
| nodebuilder/…/fibre.go | Defines the Fibre service boundary exposed by the node. |
| nodebuilder/…/stub.go | Shows the unavailable Fibre path used without a core endpoint. |
| nodebuilder/…/types.go | Defines Fibre upload, settlement, and download results returned through the boundary. |
| nodebuilder/…/fibre_e2e_test.go | Confirms the Fibre service flow with uploads, downloads, escrow, settlement, and withdrawal behavior. |
| nodebuilder/…/service.go | Shows the shared header view used during sync and by dependent services. |
| nodebuilder/…/module.go | Shows how blob service construction receives shared header, state, and data dependencies and joins the node lifecycle. |
| nodebuilder/…/blob.go | Shows the external blob client paths for retrieval, proof lookup, and single or multi-blob submission. |
| nodebuilder/…/blob_test.go | Confirms blob command input forms and their validation before RPC submission. |
| nodebuilder/…/module.go | Wires administrative authentication and persistent token verification into the service graph. |
| nodebuilder/…/node.go | Defines the administrative RPC contract and its permission boundary. |
| nodebuilder/…/admin.go | Implements node information, readiness, log control, and token operations. |
| nodebuilder/…/node.go | Shows the client commands for administrative RPC actions. |
| nodebuilder/…/constructors.go | Shows how service modules become named RPC services. |
| nodebuilder/…/get_range_result.go | Defines the share range payload and its proof checks. |
| nodebuilder/…/get_range_result_test.go | Confirms share, namespace, root, and exact-range proof validation. |
| cmd/start.go | Shows the caller-level lifecycle from store open through node stop and store close. |
| nodebuilder/…/framework.go | Shows bridge and light setup, archival settings, restart, peer readiness, and cleanup in an end-to-end environment. |
| nodebuilder/…/e2e_sanity_test.go | Confirms the assembled bridge through readiness, authentication, blob, and bounded-error RPC flows. |
| nodebuilder/…/archival_test.go | Confirms that an archival bridge serves historical headers, shares, and blobs after the normal availability window. |
| nodebuilder/…/light_restart_test.go | Confirms that a light node preserves headers and resumes sampling after restart. |
| nodebuilder/…/catchup_test.go | Confirms bridge catch-up through an archival peer after a data gap. |
| nodebuilder/…/shrex_test.go | Confirms bridge share serving, proof checks, and matching data across peered bridges. |
| nodebuilder/…/state.go | Shows how command clients consume the State RPC boundary and validate address kinds. |
| nodebuilder/…/state_test.go | Confirms state command argument and address-kind contracts. |