Skip to main content

JSON-RPC Methods

Every Demos node exposes a single JSON-RPC entry point at POST /. Requests are dispatched by processPayload in src/libs/network/rpcDispatch.ts; the HTTP server that hosts it lives in src/libs/network/server_rpc.ts.

Request and response shape

A request is a JSON object with a method string and a params array (validated by isRPCRequest):
Every method returns an RPCResponse:
Unknown methods return result: 501 with "Method not implemented: <method>".
The server may attach X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers to responses so SDK clients can self-throttle.

Top-level methods

These are the case branches of the processPayload switch.

SUDO-protected methods

The following methods are listed in PROTECTED_ENDPOINTS and require the caller’s authenticated public key to equal the node’s SUDO_PUBKEY. Unauthorized callers receive result: 401, response: "Unauthorized sender":
  • rate-limit/unblock
  • getCampaignData
  • awardPoints
See Protected Endpoints for how SUDO authentication is configured and enforced.

nodeCall sub-method registry

nodeCall takes a single NodeCall object in params[0] and routes it to a named handler from handlerRegistry (src/libs/network/handlers/index.ts). Handlers are read-only and grouped by domain.

Peer handlers

Source: peerHandlers.ts.

Block handlers

Source: blockHandlers.ts.

Transaction handlers

Source: transactionHandlers.ts.

Identity handlers

Source: identityHandlers.ts.

Validator handlers

Source: validatorHandlers.ts.

Governance handlers

Source: governanceHandlers.ts.

Storage program handlers

Source: storageProgramHandlers.ts. ACL-enforced read side.

Fork handlers

Source: forkHandlers.ts.

TLSNotary handlers

Source: tlsnotaryHandlers.ts.

L2PS handlers

Source: l2psHandlers.ts.

Misc handlers

Source: miscHandlers.ts.