Node REST API#
Every DecentralChain node exposes an HTTP REST API, compatible in shape with the Dcc node API it was forked from. It’s how wallets, explorers, and SDKs read chain state (balances, blocks, transactions) and broadcast signed transactions, without needing their own indexer.
You normally don’t call this API with raw HTTP requests — use @decentralchain/node-api-js, the typed JavaScript/TypeScript client (soon to be renamed node-api in the monorepo, but install it under its current published name for now — see Client Libraries and SDK), as shown in How-To Guides. Its namespaces map directly onto the REST API’s resource areas:
Namespace |
Covers |
|---|---|
|
Address info, balances, on-chain data entries |
|
Alias lookup by address or name |
|
Asset details, distributions, balances |
|
Block headers, height, sequences |
|
Consensus algorithm parameters, generating balance |
|
Active leases, lease info |
|
Broadcast, transaction info, status, unconfirmed pool |
|
Block reward — current size and voting state |
|
Node status and version |
|
Connected, known, and blacklisted peers |
|
Ethereum-compatibility endpoints |
|
Feature activation status |
|
Hashing, seed generation, script compilation |
If you’re running your own node, point the client at its own host and port instead of a public endpoint like https://testnet-node.decentralchain.io — check your node’s configuration file for the REST API port it’s bound to.
Base URL, port and interactive docs#
A node listens on port 6869 (dcc.rest-api.port) and, by default, only on 127.0.0.1. The node bundles an OpenAPI description (openapi.yaml) and Swagger UI; open the node’s API root in a browser to explore every endpoint.
Note
Verified against node-scala v1.7.0.
Authentication#
Most read-only endpoints are public. Privileged ones — wallet and address management (GET/POST /addresses, GET /wallet/seed), transaction signing on behalf of the node wallet (POST /transactions/sign), /debug/*, all /peers/* endpoints (including the read-only GET /peers/all, /peers/connected, /peers/blacklisted and /peers/suspended, plus /peers/connect and /peers/clearblacklist) and /node/stop — require an X-Api-Key header matching the hash in dcc.rest-api.api-key-hash. See Configuration. Requests with a wrong key get 403. Fee estimation (POST /transactions/calculateFee) does not need a key.
The public Testnet gateway (https://testnet-node.decentralchain.io) deliberately exposes the read-only GET /peers/* lists without a key; on your own node they require X-Api-Key.
Commonly used endpoints#
Endpoint |
Purpose |
|---|---|
|
Blockchain height, state height, update time and |
|
Node version |
|
Current height and last block |
|
Finalized height and header |
|
Address balance |
|
Asset information |
|
Transaction lookup and confirmation status |
|
Submit a signed transaction |
|
Fee estimate for an unsigned transaction |
|
Unconfirmed pool |
|
Block reward state |
|
|
|
Peer lists (require |
|
Compile Ride source |
|
Hashing helpers |
|
Random seed, node time |
Limits#
Several endpoints cap result sizes through settings such as transactions-by-address-limit (1000), blocks-request-limit (100), asset-details-limit (100) and data-keys-request-limit (1000). Requests above a limit are rejected; page through results instead.
CORS#
access-control-allow-origin is empty by default, so browsers on other origins are blocked. Set it to your application’s origin rather than echoing every origin.