JSON-RPC API Reference
The NHBCoin node exposes a custom JSON-RPC API. The primary RPC access point for the live network is <strong>https://api.nhbcoin.com</strong>. Public read methods (listed under Core RPC Endpoints below) can be called directly with no authentication. State-changing calls made through the Escrow Gateway require the signed-request headers described below.
View the JSON-RPC reference on GitHubAuthentication prerequisites
Every request sent through the Escrow Gateway to api.nhbcoin.com must be authenticated. Gather the following values from your developer dashboard before integrating:
- API key (X-Api-Key): Identifies your application and maps requests to your quota.
- Timestamp (X-Timestamp): Unix seconds generated at request time; requests outside a small window are rejected.
- Nonce (X-Nonce): A fresh random value generated per request; reusing one is rejected as a replay.
- HMAC signature (X-Signature): The hex-encoded
HMAC-SHA256oftimestamp + nonce + METHOD + path + body(newline-joined), keyed with your API secret.
curl -X POST https://api.nhbcoin.com/escrow/create -H "Content-Type: application/json" -H "X-Api-Key: <YOUR_API_KEY>" -H "X-Timestamp: 1715861103" -H "X-Nonce: <RANDOM_NONCE>" -H "X-Signature: <HMAC_HEX_DIGEST>" --data '{"payer":"nhb1...","payee":"nhb1...","token":"NHB","amount":"1000000000000000000"}'Core RPC Endpoints
nhb_getBalance
Returns the complete state of an account, including all native balances (NHB, ZapNHB, Staked) and on-chain data like the nonce and Engagement Score.
Parameters
| Parameter | Type | Description |
|---|---|---|
| Address | string | The nhb... address of the account to query. |
Returns
An Account object.
curl -X POST --data '{"jsonrpc":"2.0","method":"nhb_getBalance","params":["nhb1..."],"id":1}' -H "Content-Type: application/json" http://localhost:8080{"id":1,"result":{"address":"nhb1...","balanceNHB":"100000","balanceZNHB":"5000","stake":"5000","username":"alice.nhb","nonce":1,"engagementScore":5}}nhb_sendTransaction
The universal endpoint for submitting ANY signed transaction to the network. The node's State Processor will automatically route the transaction to the correct module (Native or EVM) based on its Type field.
Parameters
| Parameter | Type | Description |
|---|---|---|
| Signed Transaction | object | The fully formed, signed transaction object. |
Returns
A string confirming receipt by the node.
// This is a pseudo-code example of the JSON payload.
// The parameter is the complete, signed transaction object.
{
"jsonrpc": "2.0",
"method": "nhb_sendTransaction",
"params": [{
"type": 1,
"nonce": 5,
"to": "nhb1...",
"value": "10000000000000000000",
"gasLimit": 21000,
"gasPrice": 1,
"r": "0x...", "s": "0x...", "v": "0x1b"
}],
"id": 1
}{"id":1,"result":"Transaction received by node."}Rate limits & error handling
Respect the platform-wide throttles to avoid being blacklisted. Automatic backoff keeps your payments resilient while protecting the shared infrastructure.
- 60 requests per minute per API key on the payments Gateway.
- HTTP
429responses always include aRetry-Afterheader expressed in seconds. - Repeated 4XX/5XX responses bubble back to your client; log the
errorpayload for observability.
{
"error": "rate_limit_exceeded",
"message": "Too many requests. Retry after 2 seconds.",
"retryAfterSeconds": 2
}Native Transaction Construction
Standard Transfer / EVM Call (Type 1)
To send NHBCoin, deploy a contract, or call a contract, construct a transaction with Type 1. Our State Processor automatically routes these to the integrated EVM for execution.
// For NHB transfers, contract calls, and deployments
const evmTx = {
type: 1, // TxTypeTransfer (delegates to EVM)
nonce: userAccount.nonce,
to: 'nhb1...',
value: ethers.utils.parseEther("10.0"), // 10 NHBCoin
gasLimit: 21000,
gasPrice: 1,
};Stake ZapNHB (Type 6)
Construct a transaction to lock a specified amount of liquid ZapNHB into a staked position. The amount to stake is specified in the value field.
// To stake ZapNHB
const stakeTx = {
type: 6, // TxTypeStake
nonce: userAccount.nonce,
value: ethers.utils.parseEther("5000"), // Staking 5000 ZapNHB
gasLimit: 50000,
gasPrice: 1,
};Escrow Gateway (REST)
Alongside the JSON-RPC API above, a separate hosted REST surface at the same host handles escrow -- it signs and submits the underlying transactions for you, so your app never touches a private key or builds a raw transaction. See the Building with Escrow guide for full request/response shapes, the wallet-signature requirement, and webhooks.
| Method | Path | Auth required | Description |
|---|---|---|---|
| POST | /escrow/create | API key + HMAC + payer signature | Create an escrow and get a payIntent (vault + memo) to fund it. |
| GET | /escrow/{id} | None -- public read | Look up an escrow's status and event history. |
| POST | /escrow/release | API key + HMAC + payee/mediator signature | Release a funded escrow to the payee. |
| POST | /escrow/refund | API key + HMAC + payer signature | Refund a funded escrow to the payer. |
| POST | /escrow/dispute | API key + HMAC + payer/payee signature | Flag an escrow as disputed. |
| POST | /escrow/resolve | API key + HMAC | Not yet available -- returns 503 until arbitration realms are provisioned. |
The old escrow_create/escrow_release/escrow_refund/escrow_dispute/escrow_resolve JSON-RPC methods are permanently disabled (HTTP 410) -- this REST surface, not JSON-RPC, is the supported way to mutate escrow state today.
Authentication API (OAuth 2.0)
User authentication is handled by a separate, standard OAuth 2.0 REST API, not the L1's JSON-RPC. This provides a secure, seamless 'Login with NHBCoin' experience for third-party applications. See the Authenticating Users guide for the full flow.
GET /authorize:The initial endpoint to redirect users to for login and permission granting.POST /token:The secure, backend-to-backend endpoint for exchanging an authorization code for an access token.GET /userinfo:The endpoint to fetch a user's profile (address, username) using their access token.