JSON RPC API

Link https://github.com/kardiachain/go-kardia/wiki/Kardia-JSON-RPC-APIarrow-up-right

JSON RPC API

JavaScript API:

To talk to an KardiaChain node from inside a JavaScript application use the Kardia Javascript SDKarrow-up-right library, which gives a convenient interface for the RPC methods.

JSON-RPC Endpoint:

Ratelimit:

JSON-RPC rate limits after exceeding duration request limit. These rate limits are in place to ensure the reliability.

If you are rate limited, your JSONRPC responses will have HTTP Status code 429

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32005,
    "message": "request rate exceeded limit",
    "data": {
      "view_more": "https://docs.kardiachain.io/docs/for-developers/rpc/json-rpc-api#ratelimit",
      "allowed_limit": "15000 requests per 10 minutes",
      "block_time": "60 minutes"
    }
  }
}

Go:

Start KardiaChain network [README]arrow-up-right. Change the default port (8545) and listing address (0.0.0.0) with:

JSON-RPC Support:

Currently, the Go client of Kardia node supports JSON-RPC 2.0 via HTTP.

Additional protocols such as IPC will be supported in the future.

Curl Examples Explain:

The curl options below might return a response where the node complains about the content type. This is because the --data option sets the content type to application/x-www-form-urlencoded . If your node does complain, manually set the header by placing -H "Content-Type: application/json" at the start of the call.

The examples also do not include the URL/IP & port combination which must be the last argument given to curl e.x. 0.0.0.0:8545

JSON-RPC Methods and Reference:

Click on each method below. It will redirect to a github link which will provide the reference code.

node_nodeInfoarrow-up-right

node_peersarrow-up-right

node_datadir arrow-up-right

kai_blockNumber arrow-up-right

kai_getBlockByHasharrow-up-right

kai_getBlockHeaderByHasharrow-up-right

kai_getBlockByNumberarrow-up-right

kai_getBlockHeaderByNumberarrow-up-right

kai_getBlockHeaderByHasharrow-up-right

kai_kardiaCallarrow-up-right

kai_newFilterarrow-up-right

kai_newBlockFilterarrow-up-right

kai_uninstallFilterarrow-up-right

kai_getFilterChangesarrow-up-right

kai_getFilterLogsarrow-up-right

karrow-up-rightai_getLogsarrow-up-right

kai_validatorarrow-up-right

kai_validatorsarrow-up-right

kai_gasPricearrow-up-right

kai_getCommitarrow-up-right

kai_getValidatorSetarrow-up-right

kai_getProofarrow-up-right

tx_sendRawTransactionarrow-up-right

tx_pendingTransactionsarrow-up-right

tx_getTransactionarrow-up-right

tx_getTransactionReceiptarrow-up-right

account_balancearrow-up-right

account_noncearrow-up-right

account_nonceAtHeightarrow-up-right

account_getCodearrow-up-right

account_getStorageAtarrow-up-right

Last updated

Was this helpful?