RequantTESTNET
Requant documentation

JSON-RPC reference

Every requantd serves JSON-RPC over HTTP on --rpc (default 127.0.0.1:19334 on the test network). It is the full interface to a node: chain data, the mempool, sending, mining and administration. For a read-mostly interface that is safe to expose publicly, see the public API.

Requests

  • POST / with a JSON body; parameters are positional.
  • JSON-RPC 2.0: requests with "jsonrpc": "2.0" get standard responses; batches of up to 100 requests; requests without an id are notifications and get no response.
  • Error codes: -32700 parse error, -32600 invalid request, -32601 unknown method, -32602 invalid parameters, -32000 node error (the message says why).
  • Legacy form: a request without "jsonrpc" gets {"result": …, "error": …, "id": …}, which miners and older tools use.
  • Request bodies up to 4 MiB.
curl -s 127.0.0.1:19334 -d '{"jsonrpc":"2.0","id":1,"method":"getblockhash","params":[100]}'
curl -s 127.0.0.1:19334 -d '[{"jsonrpc":"2.0","id":1,"method":"getinfo","params":[]},
                             {"jsonrpc":"2.0","id":2,"method":"estimatefee","params":[3]}]'

Authentication

  • Keep the RPC on localhost. Anyone who can reach it can send transactions you give it and stop the node from localhost.
  • With --rpc-token-file FILE or --rpc-cookie, every request needs Authorization: Bearer <token>; requests without it get HTTP 401.
  • --rpc-cookie writes a random token to <datadir>/<network>/.cookie at start and removes it at shutdown. Tools read it from the file named in REQUANT_RPC_COOKIE, or take a token from REQUANT_RPC_TOKEN.

Conventions

  • Amounts are integer atoms: 1 RQT = 100,000,000 atoms.
  • Hashes (block ids, txids, key hashes) are 64 lowercase hex characters.
  • Owners. Methods that take an owner take a key hash (hex), not an address; convert with validateaddress. utxos and history also take a list of up to 200 key hashes, and every entry in the answer then names its owner.
  • Blocks are given as a height or a block id.

Chain

MethodParametersResult
getinfoversion, agent, network, height, headers, tip, chainwork, issued_atoms, peers, outbound, mempool, mempool_bytes, indexed_txs, snapshot_height, update_available, load, uptime_s
getblockhashheightblock id on the best chain
getblockheight or idid, height, time, target, prev, best_chain, txs (count), txids, hex
getblockheaderheight or idheader fields, next, confirmations, header hex
getchaintipsknown tips: id, height, status, branch_length
auditsupplywhether the UTXO set holds no more than the emission allows, and the UTXO set hash

Transactions and addresses

MethodParametersResult
gettxtxidfrom the index or the mempool: inputs with the value and owner they spend, outputs, fee, height
decodetxhexthe same view for a raw transaction
sendtxhextxid, after the transaction is accepted to the mempool
utxoskey hash, or list of ≤ 200txid, vout, value, height, coinbase, confirmed, spendable (and owner for lists)
getbalancekey hashconfirmed, unconfirmed, immature
historykey hash or list, [limit = 100]txid, height, confirmations, time, received, sent (newest first; pending entries have no height)
validateaddressaddressvalid, address, key_hash; or valid: false and an error
conditionaddress"multi2", pubkey_a, pubkey_b; "htlc", sha256, claim, refund, timeout; "delayed", owner, revoke, delay; "htlc-revocable", sha256, claim, refund, revoke, timeout, claim_delay, refund_delaykey_hash and address of the condition (spending conditions)

Mempool and fees

MethodParametersResult
getrawmempool[verbose]txids; verbose entries add fee, size and feerate
getmempoolinfosize, bytes, max_bytes, min_feerate, max_tx_bytes
estimatefee[blocks = 3], 1–100feerate in atoms per byte that keeps a new transaction within that many blocks of the queue; also min_feerate and pool_bytes

Mining

MethodParametersResult
getworkpayee key hash, [longpollid]height, longpollid, header, header_digest, epoch_seed, target and the TNet parameters; with a longpollid the call waits up to 60 s for a new block
submitworkheader_digest, nonce, i, c, piece hexaccepted: true and the result, or accepted: false and a reason

See mining protocol for the full exchange and the pool's extensions.

Network and administration

MethodParametersResult
getnetworkinfoprotocol, min_protocol, listen_port, peer counts by direction, uploaded bytes
getpeerinfo (alias peers)addr, outbound, listen, agent, height, connected_s
addpeer"host:port"connects to a peer
geteventsrecent watchman events: time, level, text
getreleasethe newest verified release manifest
submitreleasemanifest, signatureannounce a signed release to the network
stopsaves state and exits; from localhost only

Example: send a payment from your own code

  1. Find the coins of your key hash with utxos.
  2. Build and sign a kind-1 transfer (transactions); the fee is the size times estimatefee.
  3. Submit the hex with sendtx; follow it with gettx until it has the confirmations you need.

Or let requant-wallet build and sign, and use RPC only to watch the chain.