Introducing a new way to review your PRs.

Read the announcement

celestiaorg / celestia-node

Celestia Data Availability Nodes

View on GitHub

22 documents · Updated Nov 23, 2026

docs / rpc-services

Node RPC service wiring

Nodebuilder turns node services into externally callable JSON-RPC endpoints. It gives each service a stable namespace, applies shared access and transport settings, and ties endpoint startup to the node lifecycle. See node assembly, node configuration, and P2P networking for related views.

RPC boundary

The RPC boundary separates client calls from the internal service graph. During node construction, nodebuilder gives the RPC server the service modules and the API wrappers that describe their public calls. The server then exposes those services through one endpoint.

Service assembly flow

The flow below shows how node configuration and application services become a running RPC endpoint.

flowchart LR
    C[Node configuration] --> R[RPC server]
    S[Application service modules] --> R
    R --> E[HTTP or HTTPS JSON-RPC endpoint]
    R -. WebSocket subscriptions .-> E

The RPC module joins the node's module graph. It registers the available service namespaces before startup. Node lifecycle hooks then start and stop the server with the rest of the node, so endpoint availability follows node readiness.

References: nodebuilder/…/constructors.go• L19-41 nodebuilder/…/constructors.go• L43-58

RPC namespaces

Each namespace groups calls around one node capability. Namespace names form part of the client contract because clients use them to select the service view they need.

Service namespace map

The nodebuilder RPC module connects these service areas to matching public API wrappers:

NamespaceCapability
dasData availability sampling state
headerChain headers and sync state
stateAccount queries and state-changing transactions
shareShares, data squares, samples, and proofs
p2pPeer and network state
nodeNode status and administration
blobBlob submission, retrieval, and proofs
blobstreamData-root tuples and inclusion proofs
fibreFibre account services

Each registration pairs one service module with one API wrapper. This pairing lets node assembly select the internal service while keeping the external namespace stable.

References: nodebuilder/…/constructors.go• L19-41

RPC configuration

RPC configuration controls where the endpoint listens and which protections apply to requests. Nodebuilder starts with safe local defaults, then passes the selected settings to the server when it constructs the RPC module.

Endpoint defaults

The default endpoint binds to localhost:26658. Authentication is enabled by default. CORS, TLS, and rate limiting are disabled by default. The endpoint URL uses HTTP unless TLS is enabled, in which case it uses HTTPS.

The configuration validates the bind address and port before the server starts. TLS also requires existing certificate and key files. When rate limiting is enabled, its sustained rate, burst size, and per-IP bucket limit must all be positive.

References: nodebuilder/…/config.go• L37-69 nodebuilder/…/config.go• L80-125 nodebuilder/…/constructors.go• L43-58

Request protection settings

The RPC server applies access controls at the endpoint boundary. Authentication limits calls by permission, CORS controls browser access when enabled, and TLS protects the network connection. Optional rate limiting controls request volume for each observed remote IP.

Rate limiting is off by default because a reverse proxy often owns this control in production. If a proxy hides client addresses, the RPC server sees the proxy as one client. In that setup, server-side per-IP limits can group unrelated users into one bucket.

References: nodebuilder/…/config.go• L19-35 nodebuilder/…/config.go• L59-68 nodebuilder/…/constructors.go• L43-58

RPC lifecycle

The RPC endpoint is part of the node process and follows the node's start and stop sequence. Construction prepares the server and its registered services. Startup binds the configured endpoint, while shutdown releases it with the node.

Startup and shutdown

A valid configuration is required before the endpoint can start. An invalid address, port, TLS file, or enabled rate-limit value prevents valid server setup. The endpoint therefore becomes available only after the node can start its RPC service successfully.

The configured transport determines whether clients connect over HTTP or HTTPS. The registered service set also includes namespaces that can support subscription calls, so clients use the endpoint for both request and event-style RPC access.

References: nodebuilder/…/config.go• L80-125 nodebuilder/…/constructors.go• L19-58

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep every namespace in nodebuilder/…/constructors.go aligned with the matching client namespace and API contract.
  • Keep the RPC module inputs aligned with the service modules selected by each node type.
  • Treat changes to authentication, CORS, TLS, or rate limiting as changes to the external access policy.
  • Keep DefaultConfig, URL construction, and validation aligned so displayed endpoint URLs match the server's transport.
  • Preserve the node lifecycle contract when changing server construction or endpoint startup behavior.

Important failure modes

TriggerConsequenceGuard
The bind address or port is invalidRPC setup fails before the endpoint can serve requestsValidate the address and port before startup
TLS is enabled without usable certificate and key filesThe secure endpoint cannot startRequire both paths and validate both files
An enabled rate limit has a non-positive rate, burst, or cache sizeThe RPC configuration is rejectedValidate all rate-limit bounds when the feature is enabled
A proxy hides client IP addresses while server rate limiting is enabledUnrelated clients share one limit bucketApply the limit at the proxy or preserve the real client IP
A service namespace is changed in only one contractClients cannot reach the expected typed serviceUpdate registration and client/API contracts together

Key files

FileWhy to read it
nodebuilder/…/constructors.goShows the service-to-namespace registrations and the transfer of configuration to the server
nodebuilder/…/config.goDefines RPC defaults, URL transport choice, and validation rules
nodebuilder/…/config_test.goCaptures the intended defaults, URL forms, and basic validation guarantees
nodebuilder/…/module.goShows where RPC construction joins the node lifecycle
api/…/server.goDefines the externally callable server boundary and request controls
api/…/client.goShows the client-side namespace contract