RPC API
The NOUS node exposes a JSON-RPC API for interacting with the blockchain.
Endpoint
Section titled “Endpoint”Default: http://localhost:8332/rpc
Public: http://rpc.nouschain.org/api
Request Format
Section titled “Request Format”{ "method": "methodname", "params": [...], "id": 1}Methods
Section titled “Methods”getblockcount
Section titled “getblockcount”Returns the current block height.
curl -X POST http://rpc.nouschain.org/api \ -H "Content-Type: application/json" \ -d '{"method":"getblockcount","params":[],"id":1}'Response:
{"result": 4800, "id": 1}getblockhash
Section titled “getblockhash”Returns the block hash at the given height.
Params: [height]
{"method": "getblockhash", "params": [100], "id": 1}getblock
Section titled “getblock”Returns block data for a given hash.
Params: [hash]
Returns transaction data for a given txid.
Params: [txid]
getbalance
Section titled “getbalance”Returns balance for an address.
Params: [address]
Response:
{ "result": { "balance": 100000000, "immature": 500000000 }}balance: Spendable balance in base units (1 NOUS = 100,000,000)immature: Coinbase rewards waiting for 100 confirmations
listunspent
Section titled “listunspent”Returns unspent transaction outputs for an address.
Params: [address]
Response:
{ "result": [ { "txid": "abc123...", "index": 0, "value": 100000000, "height": 4500, "is_coinbase": false } ]}sendrawtx
Section titled “sendrawtx”Broadcasts a signed raw transaction.
Params: [hex_encoded_tx]
Response:
{"result": "txid_hash_here"}getwork
Section titled “getwork”Returns a mining work template.
Params: [address, extra_nonce]
Returns the block header template, 3-SAT formula, difficulty bits, and height.
submitblock
Section titled “submitblock”Submits a solved block.
Params: [hex_encoded_block]
getpeerinfo
Section titled “getpeerinfo”Returns connected peer information.
getmininginfo
Section titled “getmininginfo”Returns current mining difficulty and network stats.