Comment on page
Block API
Returns the most recent block.
None.
Object
- The most recent block.// Request
curl -X POST --data '{"jsonrpc":"2.0","id":1,"method":"ain_getRecentBlock"}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":{
"timestamp":1564845946382,
"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"parent_hash":"0xe670ec64341771606e55d6b4ca35a1a6b75...",
"number":675,
"proposer":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed812",
"validators":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
],
"size":163591,
"transactions":[
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f3...",
"timestamp":1566736760322,
"nonce":-1,
"parent_tx_hash":"0x88df016429689c079f3b2f6ad39fa052532c56...",
"operation":{ ... }
},
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1ec191ef20b0e9628c4397665977cb...",
"timestamp":1566736780022,
"nonce":99,
"operation":{ ... }
},
...
]
}
}
Returns the most recent block's block number.
None.
Number
- The most recent block's block number.// Request
curl -X POST --data '{"jsonrpc":"2.0","id":1,"method":"ain_getRecentBlockNumber"}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":98347
}
Returns the block with the given block number.
An object with properties:
- number:
Number
- the block number - getFullTransactions:
Boolean
- if true, it returns full transaction objects; if false or undefined, it returns the transaction hashes only.
Object
- A block object.// Request
curl -X POST --data '{"jsonrpc":"2.0","id":1,"method":"ain_getBlockByNumber","params":{"number":675,"getFullTransactions":true}}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":{
"timestamp":1564845946382,
"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"parent_hash":"0xe670ec64341771606e55d6b4ca35a1a6b75...",
"number":675,
"proposer":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed812",
"validators":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
],
"size":163591,
"transactions":[
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f3...",
"timestamp":1566736760322,
"nonce":-1,
"parent_tx_hash":"0x88df016429689c079f3b2f6ad39fa052532c56...",
"operation":{ ... }
},
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1ec191ef20b0e9628c4397665977cb...",
"timestamp":1566736780022,
"nonce":99,
"operation":{ ... }
},
...
]
}
}
Returns the block with the specified block hash.
An object with properties:
- hash:
String
- block hash - getFullTransactions:
Boolean
- if true, it returns full transaction objects; if false or undefined, it returns the transaction hashes only.
Object
- The block.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getBlockByHash",
"params":{"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"getFullTransactions":true}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":{
"timestamp":1564845946382,
"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"parent_hash":"0xe670ec64341771606e55d6b4ca35a1a6b75...",
"number":67526,
"proposer":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed81",
"validators":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
],
"size":163591,
"transactions":[
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f3...",
"timestamp":1566736760322,
"nonce":-1
"parent_tx_hash":"0x88df016429689c079f3b2f6ad39fa052532c56...",
"operation":{ ... }
},
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1ec191ef20b0e9628c4397665977cb...",
"timestamp":1566736760400,
"nonce":99,
"operation":{ ... }
},
...
]
}
}
Returns a list of blocks that have a block number between "from" block number and "to" block number.
An object with properties:
- from:
Number
- the block number of the starting block - to:
Number
- the block number of the last block to get
Array
- The list of blocks.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getBlocks",
"params":{"from":0,"to":100}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":
[
{
"timestamp":1564845946382,
"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"parent_hash":"",
"number":0,
"proposer":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed81",
"validators":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
],
"size":163591,
"transactions":[
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f3...",
"timestamp":1566736760322,
"nonce":-1
"parent_tx_hash":"0x88df016429689c079f3b2f6ad39fa052532c56...",
"operation":{ ... }
},
{
"hash":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99...",
"address":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"signature":"0x1ec191ef20b0e9628c4397665977cb...",
"timestamp":1566736760400,
"nonce":99,
"operation":{ ... }
},
...
]
},
...
]
}
Returns a list of block headers that have a block number between "from" block number and "to" block number.
An object with properties:
- from:
Number
- the block number of the starting block - to:
Number
- the block number of the last block to get
Array
- The list of block headers.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getBlockHeaders",
"params":{"from":0,"to":100}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":
[
{
"timestamp":1564845946382,
"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484...",
"parent_hash":"",
"number":0,
"proposer":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed81",
"validators":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
],
"size":163591,
},
...
]
}
Returns the number of transactions in the block with the specified block number.
An object with a property:
- number:
Number
- block number
Number
- Number of transactions in the block.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getBlockTransactionCountByNumber",
"params":{"number":"123"}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":11
}
Returns the number of transactions in the block with the specified block hash.
An object with a property:
- hash:
String
- block hash
Number
- Number of transactions// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getBlockTransactionCountByNumber",
"params":{"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484..."}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":11
}
Returns the proposer who produced the block with the given block hash.
An object with a property:
- hash:
String
- block hash
String
- The address of the proposer.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getProposerByHash",
"params":{"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484..."}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed81"
}
Returns the proposer who produced the block with the given block number.
An object with a property:
- number:
Number
- block number
String
- The proposer's address.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getProposerByNumber",
"params":{"number":456}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":"0x04aac78e17374fd075d1f11bfe95ef7d8e4ed81"
}
Returns the validators who validated the block.
An object with a property:
- hash:
String
- block hash
Array
- The list of validators.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getValidatorsByHash",
"params":{"hash":"0x7a6c2a5a91ce3731310885eff761f7ee39484..."}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
]
}
Returns the validators who validated the block.
An object with a property:
- number:
Number
- block number
Array
- The list of validators.// Request
curl -X POST --data
'{
"jsonrpc":"2.0",
"id":1,
"method":"ain_getValidatorsByNumber",
"params":{"number":2143}
}'
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":[
"0x4e65fda2159562a496f9f3522f89122a3088497a",
"0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"0xb60e8dd61c5d32be8058bb8eb970870f07233155"
]
}
Last modified 4yr ago