A
A
Ankr Docs
Search…
Supported JSON RPC Methods
This section details all the methods Ankr supports

Websockets

    Subscribe
    Unsubscribe
View Code Samples for examples

web3_clientVersion

Returns the current client version.

Parameters

none

Returns

String - The current client version

Example

1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
3
4
// Result
5
{
6
"id":67,
7
"jsonrpc":"2.0",
8
"result": "Mist/v0.9.3/darwin/go1.4.1"
9
}
Copied!

web3_sha3

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

Parameters

DATA - the data to convert into a SHA3 hash
1
params: [
2
"0x68656c6c6f20776f726c64"
3
]
Copied!

Returns

DATA - The SHA3 result of the given string.

Example

1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'
3
4
// Result
5
{
6
"id":64,
7
"jsonrpc": "2.0",
8
"result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
9
}
Copied!

eth_blockNumber

Returns the number of most recent block.
Parameters
none
Returns
QUANTITY - integer of the current block number the client is on.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' https://apis-sj.ankr.com/5b35f2812b16458b86af90b07eb25734/426563cffe4da67496916285dcfe3ebc/eth/fast/main
3
4
// Result
5
{"id":83,"jsonrpc":"2.0","result":"0xc9c64f"}
6
7
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
Copied!

eth_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. eth_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. For details see Ethereum Contract ABI in the Solidity documentation
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
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{see above}],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0x"
9
}
Copied!

eth_chainId

Returns the currently configured chain ID, a value used in replay-protected transaction signing as introduced by EIP-155.
The chain ID returned should always correspond to the information in the current known head block. This ensures that caller of this RPC method can always use the retrieved information to sign transactions built on top of the head.
Parameters
None
Returns
QUANTITY - integer of the current chain ID.
Example
1
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":83}'
2
3
// Result
4
{
5
"id": 83,
6
"jsonrpc": "2.0",
7
"result": "0x3d" // 61
8
}
Copied!

eth_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 eth_call parameters, expect that all properties are optional. If no gas limit is specified geth 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
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{see above}],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0x5208" // 21000
9
}
Copied!

eth_gasPrice

Returns the current price per gas in wei.
Parameters
none
Returns
QUANTITY - integer of the current gas price in wei.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
3
4
// Result
5
{
6
"id":73,
7
"jsonrpc": "2.0",
8
"result": "0x1dfd14000" // 8049999872 Wei
9
}
Copied!

eth_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
1
params: [
2
'0x407d73d8a49eeb85d32cf465507dd71d507100c1',
3
'latest'
4
]
Copied!
Returns
QUANTITY - integer of the current balance in wei.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0x0234c8a3397aab58" // 158972490234375000
9
}
Copied!

eth_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.
1
params: [
2
'0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae',
3
false
4
]
Copied!
Returns
Object - A block object, or null when no block was found:
    number: QUANTITY - the block number. null when its pending block.
    hash: DATA, 32 Bytes - hash of the block. null when its pending block.
    parentHash: DATA, 32 Bytes - hash of the parent block.
    nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.
    sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
    logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.
    transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
    stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
    receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
    miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    difficulty: QUANTITY - integer of the difficulty for this block.
    totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
    extraData: DATA - the “extra data” field of this block.
    size: QUANTITY - integer the size of this block in bytes.
    gasLimit: QUANTITY - the maximum gas allowed in this block.
    gasUsed: QUANTITY - the total used gas by all transactions in this block.
    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.
    uncles: Array - Array of uncle hashes.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae", false],"id":1}'
3
4
// Result
5
{
6
{
7
"jsonrpc": "2.0",
8
"id": 1,
9
"result": {
10
"difficulty": "0x4ea3f27bc",
11
"extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
12
"gasLimit": "0x1388",
13
"gasUsed": "0x0",
14
"hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
15
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
16
"miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
17
"mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
18
"nonce": "0x689056015818adbe",
19
"number": "0x1b4",
20
"parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
21
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
22
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
23
"size": "0x220",
24
"stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
25
"timestamp": "0x55ba467c",
26
"totalDifficulty": "0x78ed983323d",
27
"transactions": [
28
],
29
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
30
"uncles": [
31
]
32
}
33
}
Copied!

eth_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.
1
params: [
2
'0x1b4', // 436
3
true
4
]
Copied!
Returns
Object - A block object, or null when no block was found:
    number: QUANTITY - the block number. null when its pending block.
    hash: DATA, 32 Bytes - hash of the block. null when its pending block.
    parentHash: DATA, 32 Bytes - hash of the parent block.
    nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.
    sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
    logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.
    transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
    stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
    receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
    miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    difficulty: QUANTITY - integer of the difficulty for this block.
    totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
    extraData: DATA - the “extra data” field of this block.
    size: QUANTITY - integer the size of this block in bytes.
    gasLimit: QUANTITY - the maximum gas allowed in this block.
    gasUsed: QUANTITY - the total used gas by all transactions in this block.
    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.
    uncles: Array - Array of uncle hashes.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1b4", true],"id":1}'
3
// Result
4
{
5
{
6
"jsonrpc": "2.0",
7
"id": 1,
8
"result": {
9
"difficulty": "0x4ea3f27bc",
10
"extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
11
"gasLimit": "0x1388",
12
"gasUsed": "0x0",
13
"hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
14
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
15
"miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
16
"mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
17
"nonce": "0x689056015818adbe",
18
"number": "0x1b4",
19
"parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
20
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
21
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
22
"size": "0x220",
23
"stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
24
"timestamp": "0x55ba467c",
25
"totalDifficulty": "0x78ed983323d",
26
"transactions": [
27
],
28
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
29
"uncles": [
30
]
31
}
32
}
Copied!

eth_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
1
params: [
2
'0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
3
]
Copied!
Returns
QUANTITY - integer of the number of transactions in this block.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0xb" // 11
9
}
Copied!

eth_getBlockTransactionCountyByNumber

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.
1
params: [
2
'0xe8', // 232
3
]
Copied!
Returns
QUANTITY - integer of the number of transactions in this block.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0xa" // 10
9
}
Copied!

eth_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
1
params: [
2
'0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
3
'0x2' // 2
4
]
Copied!
Returns
DATA - the code from the given address.
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],"id":1}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc": "2.0",
8
"result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
9
}
Copied!

eth_getLogs

Returns an array of all logs matching a given filter object.
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.
    blockhash: DATA, 32 Bytes - (optional, future) With the addition of EIP-234, blockHash will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in in the filter criteria, then neither fromBlock nor toBlock are allowed.
1
params: [{
2
"topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]
3
}]
Copied!
Returns
Array - Array of log objects, or an empty array if nothing has changed since last poll.
    For filters created with eth_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].
    For filters created with eth_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].
    For filters created with eth_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.
      transactionIndex: QUANTITY - integer of the transactions index position log was created from. null when its pending log.
      transactionHash: DATA, 32 Bytes - hash of the transactions this log was created from. null when its pending log.
      blockHash: DATA, 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.
      blockNumber: QUANTITY - the block number where this log was in. null when its pending. null when its pending log.
      address: DATA, 20 Bytes - address from which this log originated.
      data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.
      topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":["0x16"],"id":73}'
3
4
// Result
5
{
6
"id":1,
7
"jsonrpc":"2.0",
8
"result": [{
9
"logIndex": "0x1", // 1
10
"blockNumber":"0x1b4", // 436
11
"blockHash": "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
12
"transactionHash": "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
13
"transactionIndex": "0x0", // 0
14
"address": "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
15
"data":"0x0000000000000000000000000000000000000000000000000000000000000000",
16
"topics": ["0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"]
17
},{
18
...
19
}]
20
}
Copied!

eth_getTransactionByHash

Returns the information about a transaction requested by transaction hash.
Parameters
    1.
    DATA, 32 Bytes - hash of a transaction
1
params: [
2
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
3
]
Copied!
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 transactions 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
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}'
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
10
"blockNumber":"0x5daf3b", // 6139707
11
"from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
12
"gas":"0xc350", // 50000
13
"gasPrice":"0x4a817c800", // 20000000000
14
"hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
15
"input":"0x68656c6c6f21",
16
"nonce":"0x15", // 21
17
"to":"0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
18
"transactionIndex":"0x41", // 65
19
"value":"0xf3dbb76162000", // 4290000000000000
20
"v":"0x25", // 37
21
"r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
22
"s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
23
}
24
}
Copied!

eth_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.
1
params: [
2
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',
3
'0x0' // 0
4
]
Copied!
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 transactions 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
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b", "0x0"],"id":1}'
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
10
"blockNumber":"0x5daf3b", // 6139707
11
"from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
12
"gas":"0xc350", // 50000
13
"gasPrice":"0x4a817c800", // 20000000000
14
"hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
15
"input":"0x68656c6c6f21",
16
"nonce":"0x15", // 21
17
"to":"0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
18
"transactionIndex":"0x41", // 65
19
"value":"0xf3dbb76162000", // 4290000000000000
20
"v":"0x25", // 37
21
"r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
22
"s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
23
}
24
}
Copied!

eth_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.
1
params: [
2
'0x29c', // 668
3
'0x0' // 0
4
]
Copied!
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 transactions 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
Example
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["0x29c", "0x0"],"id":1}'
3
// Result
4
{
5
"jsonrpc":"2.0",
6
"id":1,
7
"result":{
8
"blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
9
"blockNumber":"0x5daf3b", // 6139707
10
"from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
11
"gas":"0xc350", // 50000
12
"gasPrice":"0x4a817c800", // 20000000000
13
"hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",