Docsโ€บRPC API
โš 
Localhost only. Bind RPC to 127.0.0.1 โ€” never expose port 33332 to the internet. There is no authentication.
โ„น
Public RPC operators. If you intentionally expose RPC with TENSORIUM_RPC_ALLOW_PUBLIC=1, place nginx or another reverse proxy in front with per-IP rate limits, connection limits, and a GET/POST method whitelist.

Endpoint Overview

MethodPathPurpose
GET/healthBasic liveness check
GET/getblockcountCurrent height, block count, chain ID
GET/getdifficultyCurrent leading-zero difficulty target
GET/getblock/<height>Full block payload by height
GET/getblocktemplate/<miner_address>Mining candidate block template
POST/submitblockSubmit a mined block
POST/sendrawtransactionValidate and pool a signed transaction
GET/getmempoolinfoPending tx count and txids
GET/getbanlistInspect peer ban state
GET/unban/<ip>Remove an IP from the ban list
GET/getutxos/<address>List all address UTXOs with maturity flag

GET /health

Check if the node is running.

request
curl http://localhost:33332/health
response
{"ok": true}

GET /getblockcount

Return current chain height and total block count.

request
curl http://localhost:33332/getblockcount
response
{"blocks": 1, "chain_id": "tensorium-mainnet", "height": 0}

GET /getdifficulty

Return current difficulty (leading zero bits required).

request
curl http://localhost:33332/getdifficulty
response
{"chain_id": "tensorium-mainnet", "height": 0, "leading_zero_bits": 42}

GET /getblock/:height

Return full block data at the given height. Hashes are returned as byte arrays โ€” convert to hex for display.

request
curl http://localhost:33332/getblock/0     # genesis
curl http://localhost:33332/getblock/100
response (abbreviated)
{
  "block": {
    "header": {
      "chain_id": "tensorium-mainnet",
      "height": 0,
      "leading_zero_bits": 26,
      "nonce": 95202247,
      "previous_hash": [0, 0, ...],   // byte array โ†’ convert to hex
      "merkle_root":   [33, 214, ...],
      "timestamp_seconds": 1748649600,
      "version": 1
    },
    "transactions": [{
      "id":      [...],               // txid as byte array
      "inputs":  [],                  // empty for coinbase
      "outputs": [{"address": "txm1...", "value_atoms": 1523557865}],
      "payload": [...]                // coinbase data as bytes
    }]
  },
  "hash": [0, 0, 0, 53, ...]          // block hash as byte array
}
โ„น
Byte arrays. Hashes and transaction IDs are returned as [u8; 32] JSON arrays. Convert to hex with: arr.map(b => b.toString(16).padStart(2,'0')).join('')

GET /getblocktemplate/:miner_address

Return a candidate block for mining. Includes pending mempool transactions. Used by tensorium-miner and custom miners.

request
curl http://localhost:33332/getblocktemplate/txm1youraddress
response
{
  "template": {
    "header": { "height": 151, "leading_zero_bits": 26, "nonce": 0, ... },
    "transactions": [...]
  }
}

The miner must set the nonce field to find a valid block hash, then submit via /submitblock.

POST /submitblock

Submit a mined block. Validates PoW, appends to chain, broadcasts to peers, and clears confirmed transactions from mempool.

request
curl -X POST http://localhost:33332/submitblock \
  -H "Content-Type: application/json" \
  -d '{ "header": {..., "nonce": 95202247}, "transactions": [...] }'
response โ€” accepted
{"accepted": true, "height": 151, "hash": [...], "canonical": true}
response โ€” rejected
{"error": "block's parent is not known"}

POST /sendrawtransaction

Submit a signed transaction to the mempool. Validates, pools, and broadcasts to peers.

request
curl -X POST http://localhost:33332/sendrawtransaction \
  -H "Content-Type: application/json" \
  -d '{"id":[...],"inputs":[...],"outputs":[...],"payload":[]}'
response
{"accepted": true, "txid": [...], "mempool_size": 3}

GET /getmempoolinfo

Return current mempool contents.

response
{"count": 2, "txids": [[...], [...]]}

GET /getbanlist

Return currently banned peers.

response
{"count": 1, "entries": [{"ip": "1.2.3.4", "score": 100, "banned": true, "secs_remaining": 1234}]}

GET /unban/:ip

Remove an IP from the ban list.

request
curl http://localhost:33332/unban/1.2.3.4
response
{"unbanned": "1.2.3.4", "was_present": true}

GET /getutxos/:address

Return all known UTXOs for an address, including maturity information for coinbase outputs.

request
curl http://localhost:33332/getutxos/txm1qyouraddresshere
response
{
  "address": "txm1qyouraddresshere",
  "tip_height": 150,
  "utxo_count": 2,
  "utxos": [
    {
      "txid": "0d4d...",
      "txid_bytes": [13, 77, ...],
      "output_index": 0,
      "value_atoms": 250000000,
      "coinbase": false,
      "created_height": 149,
      "mature": true
    }
  ]
}

This is the endpoint used by @tensorium/sdk when deriving spendable balance.

Status Codes And Errors

  • 200: request accepted and JSON body returned.
  • 400: malformed body or invalid RPC input.
  • 404: unknown endpoint or missing resource such as block height.
  • Validation failures are returned as JSON objects with an error field.

SDK Shortcut

If you do not want to handcraft raw HTTP requests, use the official JavaScript SDK.

npm
npm install @tensorium/sdk
TypeScript
import { TxmRPC } from '@tensorium/sdk';

const rpc = new TxmRPC('https://rpc.tensoriumlabs.com');
const info = await rpc.getBlockCount();
console.log(info.height, info.chain_id);

See the Developer Guide for balance, signing, and send examples.

Rate Limit Notes

The node RPC server is intentionally single-threaded. Localhost use is fine, but public operators should treat it as a protected backend, not as a raw internet-facing API.

  • Default safe bind: 127.0.0.1:33332
  • Public bind requires TENSORIUM_RPC_ALLOW_PUBLIC=1
  • Put nginx in front with limit_req and limit_conn
  • Whitelist only GET and POST