Skip to content

JSON-RPC Reference

Start the server:

sh
node bin/adamant.js rpc server

The server listens on config.rpc.port, defaulting to 5080.

Example request:

sh
curl -s -X POST http://127.0.0.1:5080 \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","method":"clientVersion","params":[],"id":1}'

Array-style methods require params as an array. Template-style send and vote methods accept named object parameters.

Methods

MethodParams styleResult
clientVersionnoneConsole version and config metadata
accountNewarrayNew account object
delegateNewarrayDelegate account object
getAddressarrayAccount object
getBlockarrayBlock object
getBlocksarrayBlock array
getDelegatearrayDelegate object
getChatsarrayChat array
getChatMessagesarrayMessage or transaction array
getChatTransactionsarrayTransaction array
getMessagearrayTransaction object
getTransactionarrayTransaction object
getTransactionsarrayTransaction array
getTransactionsInBlockByIdarrayTransaction array
getTransactionsInBlockByHeightarrayTransaction array
getTransactionsReceivedByAddressarrayTransaction array
nodeHeightarrayNode height
nodeVersionarrayNode version and commit
nodeStatusarrayNode, network, loader, and WebSocket status
sendTokensobjectTransaction ID
sendMessageobjectTransaction ID
sendRichobjectTransaction ID
sendSignalobjectTransaction ID
voteForobjectVote transaction

Array Params Example

json
{
  "jsonrpc": "2.0",
  "method": "getTransaction",
  "params": ["123456789", "returnUnconfirmed=1"],
  "id": 1
}

Object Params Example

json
{
  "jsonrpc": "2.0",
  "method": "sendMessage",
  "params": {
    "address": "U123456789",
    "message": "hello",
    "amount": "0.1ADM",
    "passphrase": "your local passphrase"
  },
  "id": 1
}

Do not use real passphrases in shared examples, logs, CI output, issue reports, or screenshots.

Error Handling

Console maps thrown API errors into JSON-RPC errors. If params is not an array for array-style methods, the method returns:

json
{
  "success": false,
  "error": "\"params\" parameter should be an array"
}

Released under the GPL-3.0 License.