ABEYChain Docs
Search
K

JSON RPC API

Contents

JSON RPC API

JSON is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs.
JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. Primarily this specification defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON (RFC 4627) as data format.
gabey has experimental pub/sub support. See this page for more information.

JSON-RPC Endpoint

Default JSON-RPC endpoints: http://localhost:8545

Go

You can start the HTTP JSON-RPC with the --rpc flag
gabey --rpc
change the default port (8545) and listing address (localhost) with:
gabey --rpc --rpcaddr <ip> --rpcport <portnumber>
If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail:
gabey --rpc --rpccorsdomain "http://localhost:3000"

JSON-RPC support

JSON-RPC 2.0/ Batch requests/ HTTP/ IPC/ WS

The default block parameter

The following methods have an extra default block parameter:
When requests are made that act on the state of abeychain, the last default block parameter determines the height of the block.
The following options are possible for the defaultBlock parameter:
  • HEX String - an integer block number【
  • String "earliest" for the earliest/genesis block
  • String "latest" - for the latest mined block
  • String "pending" - for the pending state/transactions

Curl Examples Explained

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. 127.0.0.1:8545

JSON-RPC methods

abey
impawn
web3
net
version
syncing
sha3
peerCount
coinbase
listening
mining
hashrate
gasPrice
accounts
balance
getCode
sign
-
call