Skip to main content
NEXUS exposes a standard JSON-RPC 2.0 API over HTTP. You send a request, you get a response. That’s it.

Endpoint

POST http://localhost:9945
Content-Type: application/json

Request Format

Every request has the same shape:
{
  "jsonrpc": "2.0",
  "method": "nexus_blockNumber",
  "params": [],
  "id": 1
}
  • jsonrpc — always "2.0"
  • method — the RPC method to call
  • params — arguments (varies by method)
  • id — any number; the response will include the same ID

Response Format

{
  "jsonrpc": "2.0",
  "result": "0x1a4",
  "id": 1
}

Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32600,
    "message": "Invalid Request"
  },
  "id": 1
}

Quick Example

curl -X POST http://localhost:9945 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_blockNumber","params":[],"id":1}'

API Categories


Error Codes

CodeMeaningWhen It Happens
-32600Invalid RequestMalformed JSON-RPC
-32601Method not foundUnknown method name
-32602Invalid paramsWrong argument types or count
-32603Internal errorUnexpected server error
-32000Execution errorTransaction failed (contract reverted)
-32001Insufficient balanceNot enough vSAT/vZEC/vDOGE
-32002Invalid nonceTransaction nonce out of sequence
-32003Gas limit exceededTransaction ran out of gas

WebSocket (Real-Time Events)

Subscribe to live events on port 9945 (same as RPC):
const ws = new WebSocket('ws://localhost:9945');

ws.send(JSON.stringify({
  jsonrpc: '2.0',
  method: 'nexus_subscribe',
  params: ['newBlocks'],
  id: 1
}));

ws.onmessage = (msg) => {
  const data = JSON.parse(msg.data);
  console.log('New block:', data);
};

Rate Limiting

The default rate limit is 100 requests per second per IP address. Configurable via node settings:
[rpc]
max_requests_per_second = 100

Authentication

The RPC API has no built-in authentication. For production deployments, place a reverse proxy (nginx, Caddy) in front with IP allowlisting or API key headers.