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

JSON RPC API Reference

web3

web3_clientVersion

Returns the current client version.

Parameters

none

Returns

String - The current client version.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc":"2.0",
  "result": "gabey/v1.1.0-unstable-d4c05e98/linux-amd64/go1.10"
}

web3_sha3

Returns Keccak-256 (not the standardized SHA3-256) of the given data.

Parameters

  1. DATA - the data to convert into a SHA3 hash.

Example Parameters

params: [
  "0x68656c6c6f20776f726c64"
]

Returns

DATA - The SHA3 result of the given string.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'

// Result
{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}

net

net_version

Returns the current network id.

Parameters

none

Returns

String - The current network id.

  • "19330": abeychain Mainnet

  • "18928": Testnet

  • "100": Devnet

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc": "2.0",
  "result": "19330"
}

net_listening

Returns true if client is actively listening for network connections.

Parameters

none

Returns

Boolean - true when listening, otherwise false.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc":"2.0",
  "result":true
}

net_peerCount

Returns number of peers currently connected to the client.

Parameters

none

Returns

QUANTITY - integer of the number of connected peers.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'

// Result
{
  "id":74,
  "jsonrpc": "2.0",
  "result": "0x2" // 2
}

ABEY

abey_protocolVersion

Returns the current abeychain protocol version.

Parameters

none

Returns

String - The current abeychain protocol version.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_protocolVersion","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc": "2.0",
  "result": "0x40"
}

abey_syncing

Returns an object with data about the sync status or false.

Parameters

none

Returns

Object|Boolean, An object with sync status data or FALSE, when not syncing:

  • currentFastBlock: QUANTITY -current block number(fastchain)

  • currentSnailBlock: QUANTITY -current block number(snailchain)

  • highestFastBlock: QUANTITY - already highest block number(fastchain)

  • highestSnailBlock: QUANTITY -already highest block number(snailchain)

  • knownStates: String -already know state

  • pulledStates: String -already complete state

  • startingFastBlock: QUANTITY -start sync block number(fastchain)

  • startingSnailBlock: QUANTITY -start sync block number(snailchain)

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_syncing","params":[],"id":1}'

// Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "currentFastBlock": "0x2e9a",
        "currentSnailBlock": "0xab",
        "highestFastBlock": "0x3a3d2",
        "highestSnailBlock": "0xab7",
        "knownStates": "0x0",
        "pulledStates": "0x0",
        "startingFastBlock": "0x2e98",
        "startingSnailBlock": "0x0"
    }
}
// Or when not syncing
{
  "id":1,
  "jsonrpc": "2.0",
  "result": false
}

abey_coinbase

Returns the client coinbase address.

Parameters

none

Returns

DATA, 20 bytes - the current coinbase address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_coinbase","params":[],"id":64}'

// Result
{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0xc94770007dda54cF92009BFF0dE90c06F603a09f"
}

abey_mining

Returns true if client is actively mining new blocks.

Parameters

none

Returns

Boolean - returns true of the client is mining, otherwise false.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_mining","params":[],"id":71}'

// Result
{
  "id":71,
  "jsonrpc": "2.0",
  "result": true
}

abey_hashrate

Returns the number of hashes per second that the node is mining with.

Parameters

none

Returns

QUANTITY - number of hashes per second.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_hashrate","params":[],"id":71}'

// Result
{
  "id":71,
  "jsonrpc": "2.0",
  "result": "0x38a"
}

abey_gasPrice

Returns the current price per gas in wei.

Parameters

none

Returns

QUANTITY - integer of the current gas price in wei.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_gasPrice","params":[],"id":73}'

// Result
{
  "id":73,
  "jsonrpc": "2.0",
  "result": "0xf4240" // 1000000
}

abey_accounts

Returns a list of addresses owned by client.

Parameters

none

Returns

Array of DATA, 20 Bytes - addresses owned by the client.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_accounts","params":[],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f"]
}

abey_blockNumber

Returns the number of most recent block.

Parameters

none

Returns

QUANTITY - integer of the current block number the client is on.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_blockNumber","params":[],"id":1}'

// Result
{
  "id":83,
  "jsonrpc": "2.0",
  "result": "0xc94" // 1207
}

abey_getBalance

Returns the balance of the account of given address.

Parameters

  1. DATA, 20 Bytes - address to check for balance.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Example Parameters

params: [
   '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
   'latest'
]

Returns

QUANTITY - integer of the current balance in wei.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58" // 158972490234375000
}

abey_getLockBalance

Returns the locked balance of the account of given address.

Parameters

  1. DATA, 20 Bytes - address to check for balance.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Example Parameters

params: [
   '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
   'latest'
]

Returns

QUANTITY - integer of the current balance in wei.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getLockBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58" // 158972490234375000
}

abey_getTotalBalance

Returns the total balance of the account of given address.

Parameters

  1. DATA, 20 Bytes - address to check for balance.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Example Parameters

params: [
   '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
   'latest'
]

Returns

QUANTITY - integer of the current balance in wei.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTotalBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58" // 158972490234375000
}

abey_getStorageAt

Returns the value from a storage position at a given address.

Parameters

  1. DATA, 20 Bytes - address of the storage.

  2. QUANTITY - integer of the position in the storage.

  3. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

DATA - the value at this storage position.

Example

Calculating the correct position depends on the storage to retrieve. Consider the following contract deployed at 0x295a70b2de5e3953354a6a8344e616ed314d7251 by address 0x391694e7e0b0cce554cb130d723a9d27458f9298.

contract Storage {
    uint pos0;
    mapping(address => uint) pos1;

    function Storage() {
        pos0 = 1234;
        pos1[msg.sender] = 5678;
    }
}

Retrieving the value of pos0 is straight forward:

curl -X POST --data '{"jsonrpc":"2.0", "method": "abey_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"], "id": 1}' localhost:8545

{"jsonrpc":"2.0","id":1,"result":"0x00000000000000000000000000000000000000000000000000000000000004d2"}

Retrieving an element of the map is harder. The position of an element in the map is calculated with:

keccack(LeftPad32(key, 0), LeftPad32(map position, 0))

This means to retrieve the storage on pos1["0x391694e7e0b0cce554cb130d723a9d27458f9298"] we need to calculate the position with:

keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"))

The gabey console which comes with the web3 library can be used to make the calculation:

> var key = "000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"
undefined
> web3.sha3(key, {"encoding": "hex"})
"0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9"

Now to fetch the storage:

curl -X POST --data '{"jsonrpc":"2.0", "method": "abey_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "latest"], "id": 1}' localhost:8545

{"jsonrpc":"2.0","id":1,"result":"0x000000000000000000000000000000000000000000000000000000000000162e"}

abey_getTransactionCount

Returns the number of transactions sent from an address.

Parameters

  1. DATA, 20 Bytes - address.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Example Parameters

params: [
   '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
   'latest' // state at the latest block
]

Returns

QUANTITY - integer of the number of transactions send from this address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x1" // 1
}

abey_getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

Parameters

  1. DATA, 32 Bytes - hash of a block.

Example Parameters

params: [
   '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]

Returns

QUANTITY - integer of the number of transactions in this block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xc" // 11
}

abey_getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the given block number.

Parameters

  1. QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

Example Parameters

params: [
   '0xe8', // 232
]

Returns

QUANTITY - integer of the number of transactions in this block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xa" // 10
}

abey_getCode

Returns code at a given address.

Parameters

  1. DATA, 20 Bytes - address.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.

Example Parameters

params: [
   '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
   '0x2'  // 2
]

Returns

DATA - the code from the given address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
}

abey_sign

The sign method calculates an abeychain specific signature with: sign(keccak256("\x19abeychain Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognisable as an abeychain specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note the address to sign with must be unlocked.

Parameters

account, message

  1. DATA, 20 Bytes - address.

  2. DATA, N Bytes - message to sign.

Returns

DATA: Signature

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_sign","params":["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "0xdeadbeaf"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b"
}

An example how to use solidity ecrecover to verify the signature calculated with abey_sign can be found here. The contract is deployed on the testnet Ropsten and Rinkeby.

abey_sendTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters

  1. Object - The transaction object

    • from: DATA, 20 Bytes - The address the transaction is send from.

    • to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.

    • gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.

    • gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas

    • value: QUANTITY - (optional) Integer of the value sent with this transaction

    • data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters.

    • nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

Example Parameters

params: [{
  "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
  "gas": "0x76c0", // 30400
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use abey_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_sendTransaction","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

abey_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions.

Parameters

  1. DATA, The signed transaction data.

Example Parameters

params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use abey_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_sendRawTransaction","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

abey_sendAbeyRawTransaction

When transaction contain payer or fee,Creates new message call transaction or a contract creation for signed transactions.

Parameters

  1. DATA, The signed transaction data.

Example Parameters

params: ["0xf8c60183989680834c4b4094bea78fea68dba84363d0f9b79219ddf5991ccb2a880de0b6b3a76400008094cfb7ec3ac64a3afde043a5b32212d0b9c25b5d808081eba07cc4b8300a8ab6a7d6aee713f6dc61311848bf827794c370873ca334e7cc2cc1a05cd365ffc46cada820911e3c11123e36245ed1cec7943038632715a89a421b0281eca037d6e60016bd70371fd45a2fadd63f8824b34331f2cb5f7fe69f04df7f6d9caea04e05dda8cffa3e453aa474f955eef97fe63e9c9721860aaea379a0ace111fd16"]

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use abey_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_sendAbeyRawTransaction","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xc7509ef7672e1c1d59cec2854d3d074d442984382bd03c665c2e82ebfdacc25e"
}

abey_call

Executes a new message call immediately without creating a transaction on the block chain.

Parameters

  1. Object - The transaction call object

    • from: DATA, 20 Bytes - (optional) The address the transaction is sent from.

    • to: DATA, 20 Bytes - The address the transaction is directed to.

    • gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. abey_call consumes zero gas, but this parameter may be needed by some executions.

    • gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas

    • value: QUANTITY - (optional) Integer of the value sent with this transaction

    • data: DATA - (optional) Hash of the method signature and encoded parameters

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

DATA - the return value of executed contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_call","params":[{see abey_sendTransaction parameter}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x"
}

abey_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

See abey_call parameters, expect that all properties are optional. If no gas limit is specified gabey uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.

Returns

QUANTITY - the amount of gas used.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_estimateGas","params":[{see abey_sendTransaction parameter}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x5208" // 21000
}

abey_getBlockByHash

Returns information about a block by hash.

Parameters

  1. DATA, 32 Bytes - Hash of a block.

  2. Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

Example Parameters

params: [
   '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',
   true
]

Returns

Object - A block object, or null when no block was found:

  • SnailHash: DATA, 32 Bytes - hash of the snail block.

  • SnailNumber: QUANTITY- the snail block number.

  • committeeRoot: DATA, 32 Bytes - hash of the committtee.

  • extraData: DATA - the "extra data" field of this block.

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

  • gasUsed: QUANTITY - the total used gas by all transactions in this block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

  • maker: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

  • number: QUANTITY - the block number. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

  • signs: Array, committee signs.

    • fastHash: DATA, 32 Bytes - hash of the fast block.

    • fastHeight: QUANTITY- the fast block number.

    • result: QUANTITY- the vote.

    • sign: DATA, 32 Bytes - committee sign hash.

  • size: QUANTITY - integer the size of this block in bytes.

  • stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

  • switchInfos: Array, committee member switch.

  • timestamp: QUANTITY - the unix timestamp for when the block was collated.

  • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

  • transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getBlockByHash","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273312", true],"id":1}'

// Result
{
"id":1,
"jsonrpc":"2.0",
"result": {
    {"SnailHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"SnailNumber":"0x0",
"committeeRoot":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"extraData":"0x",
"gasLimit":"0xb71b00","gasUsed":"0x0",
"hash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2",
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"maker":"0x49fc88c2576b4f015cf75dae80e87a815d832888",
"number":"0xab4",
"parentHash":"0x0832d972f5b16ddefc3de154cc0a5a4ea16be2991be19bd740ae3486a83ff59f",
"receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"signs":[{"fastHash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2",
"fastHeight":"0xab4","result":1,
"sign":"0x7a07be32cce585b6d74e6134022c973b6433dcb87447ec456712f5d3b40b8907403ea24c81309aa090e7469fc761372de2e2d32beddf0031eed1aa557185cbc101"},
{"fastHash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2","fastHeight":"0xab4","result":1,"sign":"0x4f1033692e2f354409002ff0ce9eb20d4edb676f6c02dc58223c9d2d15eebcaf4071c2efc630a44d78865da714ae694cd690d4b0d02b393d64ca377c63594a6e01"},{"fastHash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2","fastHeight":"0xab4","result":1,"sign":"0xc8303a5c76fb70e834b63e70180af9720ac09eda59327a0e6be3ab85fcfcbb9b40434ae7dcd23df13fe6a55c1967d29de7db5c5e545674b6849a1a4eabb59b4b00"},
{"fastHash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2","fastHeight":"0xab4","result":1,"sign":"0x041df0a05407cb302695babfeff03d669d300e76cc2d33305512dc0859aeb4dc47b68065b5d62bd88a6b60e3993ed07ae0a64223681084c5c958cdd2041f42a100"},
{"fastHash":"0xd58570f394347e6b73c4beeabfb75f8b4a6c6f08c71f159a233309365836e3d2","fastHeight":"0xab4","result":1,"sign":"0x8b8c97a4155c2b687b0eb90e1a716ede85c1b32ec7b164c0fa721f1b18ada4c41bc46373419d625ef8f0368b123bf86a60b07c168ebb5b97de4b9095847fad5001"}],"size":"0x40a","stateRoot":"0x5c7127948504801c7db0ef17df87950b471a94d6f5332d39ceff41298f3f6b74",
"switchInfos":[],"timestamp":"0x5ce25206","transactions":[],
"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}
  }
}

abey_getBlockByNumber

Returns information about a block by block number.

Parameters

  1. QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

  2. Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

Example Parameters

params: [
   '0x1b4', // 436
   true
]

Returns

See abey_getBlockByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getBlockByNumber","params":["0x1b4", true],"id":1}'

Result see abey_getBlockByHash

abey_getTransactionByHash

Returns the information about a transaction requested by transaction hash.

Parameters

  1. DATA, 32 Bytes - hash of a transaction

Example Parameters

params: [
   "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
]

Returns

Object - A transaction object, or null when no transaction was found:

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when its pending.

  • from: DATA, 20 Bytes - address of the sender.

  • gas: QUANTITY - gas provided by the sender.

  • gasPrice: QUANTITY - gas price provided by the sender in Wei.

  • hash: DATA, 32 Bytes - hash of the transaction.

  • input: DATA - the data send along with the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.

  • transactionIndex: QUANTITY - integer of the transaction's index position in the block. null when its pending.

  • value: QUANTITY - value transferred in Wei.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 32 Bytes - ECDSA signature s

  • payer: DATA, 20 Bytes - address of the payer.

  • fee: QUANTITY - transaction fee in Wei.

  • pv: QUANTITY - ECDSA recovery id

  • pr: DATA, 32 Bytes - ECDSA signature pr

  • ps: DATA, 32 Bytes - ECDSA signature ps

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}'

// Result
{
  "jsonrpc":"2.0",
  "id":1,
  "result":{
    "blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
    "blockNumber":"0x5daf3b", // 6139707
    "from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
    "gas":"0xc350", // 50000
    "gasPrice":"0x4a817c800", // 20000000000
    "hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
    "input":"0x68656c6c6f21",
    "nonce":"0x15", // 21
    "to":"0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
    "transactionIndex":"0x41", // 65
    "value":"0xf3dbb76162000", // 4290000000000000
    "v":"0x25", // 37
    "r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
    "s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
    "payer":null,
    "fee":null,
    "pv":null,
    "pr":null,
    "ps":null
  }
}

abey_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

Parameters

  1. DATA, 32 Bytes - hash of a block.

  2. QUANTITY - integer of the transaction index position.

Example Parameters

params: [
   '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',
   '0x0' // 0
]

Returns

See abey_getTransactionByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTransactionByBlockHashAndIndex","params":["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x0"],"id":1}'

Result see abey_getTransactionByHash

abey_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

  1. QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

  2. QUANTITY - the transaction index position.

Example Parameters

params: [
   '0x29c', // 668
   '0x0' // 0
]

Returns

See abey_getTransactionByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTransactionByBlockNumberAndIndex","params":["0x29c", "0x0"],"id":1}'

Result see abey_getTransactionByHash

abey_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Note That the receipt is not available for pending transactions.

Parameters

  1. DATA, 32 Bytes - hash of a transaction

Example Parameters

params: [
   '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]

Returns

Object - A transaction receipt object, or null when no receipt was found:

  • transactionHash: DATA, 32 Bytes - hash of the transaction.

  • transactionIndex: QUANTITY - integer of the transaction's index position in the block.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.

  • blockNumber: QUANTITY - block number where this transaction was in.

  • from: DATA, 20 Bytes - address of the sender.

  • to: DATA, 20 Bytes - address of the receiver. null when it's a contract creation transaction.

  • cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block.

  • gasUsed: QUANTITY - The amount of gas used by this specific transaction alone.

  • contractAddress: DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.

  • to: DATA, 20 Bytes - The address the transaction is directed to.

  • logs: Array - Array of log objects, which this transaction generated.

  • logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.

It also returns either :

  • root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)

  • status: QUANTITY either 1 (success) or 0 (failure)

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}'

// Result
{
"id":1,
"jsonrpc":"2.0",
"result": {
     transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
     transactionIndex:  '0x1', // 1
     blockNumber: '0xb', // 11
     blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
     cumulativeGasUsed: '0x33bc', // 13244
     gasUsed: '0x4dc', // 1244
     contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
     logs: [{
         // logs as returned by getFilterLogs, etc.
     }, ...],
     logsBloom: "0x00...0", // 256 byte bloom filter
     status: '0x1'
  }
}

abey_newFilter

Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call abey_getFilterChanges.

A note on specifying topic filters:

Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:

  • [] "anything"

  • [A] "A in first position (and anything after)"

  • [null, B] "anything in first position AND B in second position (and anything after)"

  • [A, B] "A in first position AND B in second position (and anything after)"

  • [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)"

Parameters

  1. Object - The filter options:

    • fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.

    • toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.

    • address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.

    • topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.

Example Parameters

params: [{
  "fromBlock": "0x1",
  "toBlock": "0x2",
  "address": "0x8888f1f195afa192cfee860698584c030f4c9db1",
  "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", null, ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc"]]
}]

Returns

QUANTITY - A filter id.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_newFilter","params":[{"topics":["0x0000000000000000000000000000000000000000000000000000000012341234"]}],"id":73}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x1" // 1
}

abey_newBlockFilter

Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call abey_getFilterChanges.

Parameters

None

Returns

QUANTITY - A filter id.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_newBlockFilter","params":[],"id":73}'

// Result
{
  "id":1,
  "jsonrpc":  "2.0",
  "result": "0x1" // 1
}

abey_newPendingTransactionFilter

Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call abey_getFilterChanges.

Parameters

None

Returns

QUANTITY - A filter id.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_newPendingTransactionFilter","params":[],"id":73}'

// Result
{
  "id":1,
  "jsonrpc":  "2.0",
  "result": "0x1" // 1
}

abey_uninstallFilter

Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with abey_getFilterChanges for a period of time.

Parameters

  1. QUANTITY - The filter id.

Example Parameters

params: [
  "0xb" // 11
]

Returns

Boolean - true if the filter was successfully uninstalled, otherwise false.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"abey_uninstallFilter","params":["0xb"],"id":73}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": true
}

abey_getFilterChanges

Polling method for a filter, which returns an array of logs which occurred since last poll.

Parameters

  1. QUANTITY - the filter id.

Example Parameters

params: [
  "0x16" // 22
]

Returns

Array - Array of log objects, or an empty array if nothing has changed since last poll.

  • For filters created with abey_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].

  • For filters created with abey_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].

  • For filters created with abey_newFilter logs are objects with following params:

    • removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.

    • logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.