Skip to content

eth_getTransactionByBlockNumberAndIndex


Returns a transaction by index into a block, given by a block number.

Parameters

Block Number

The block number can be:

  • A hex number in a string: eg. "0x800"
  • A block hash as a string eg. "0xf77e76c25038b0be1fbd12a4f3e404173802bf0c9a9e62deef7949201d59ebfb
  • "earliest" for the earliest block
  • "latest" for the latest block
  • "safe" for the block that the node's high quorum certificate points to
  • "finalized" for the latest finalized block.
  • "pending" is the block that is about to be created.

Index

A zero-based index, as a hex string - eg. 0x0

Returns

A transaction, or null if no such transaction is known to this node.

Returned transaction

Parameter Type Required Description
blockHash string required Hash of the block in which this transaction appears
blockNumber string required Hex number of the block in which this transaction appears
from string required From address of this transaction
gas string required Hex number - the amount of gas used by this transaction
gasPrice string required Hex number - the gas price charged for this transaction, per gas unit
maxFeePerGas string optional Hex number - max fee per gas for this transaction. See EIP-1559.
maxPriorityFeePerGas string optional Hex number - max priority fee per gas. See EIP-1559.
hash string required The transaction hash for this transaction
input string required The input for this transaction
nonce string required Hex number; the nonce for this transaction.
to string required To address for this transaction
value string required Hex number; the value sent with this transaction
v string required Hex number; the v parameter for the signature for this transaction
r string required Hex number; the r parameter for the signature on this transaction
s string required Hex number; the s parameter for the signature on this transaction
chainId string optional Hex number. The (EVM) chain id for this zq2 chain
access_list array optional EIP-1559 access list.
type string required Hex number; type of this transaction

Example Request

 curl -d '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByBlockNumberAndIndex",
    "params": [ "0x235", "0x0"
 ]}' -H "Content-Type: application/json" -X POST "https://api.zq2-prototestnet.zilliqa.com/"

Example response

{
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0xbdf1dad26e2ab2e03b131f683e72d05d8088068e900d3fb8b0bbd2f64666967c",
    "blockNumber": "0x235",
    "from": "0xcb57ec3f064a16cadb36c7c712f4c9fa62b77415",
    "gas": "0xbb278",
    "gasPrice": "0x454b7a4e100",
    "hash": "0xf4818804242f4a1f5c8f9d255a51b80bd1e21c0047affffd5f480636ac2a9773",
    "input": "0x608060405234801561001057600080fd5b50604051610c38380380610c3883398101604081905261002f91610298565b8282600361003d8382610393565b50600461004a8282610393565b505050600061005d61007260201b60201c565b90506100698183610076565b50505050610478565b3390565b6001600160a01b0382166100a55760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b6100b1600083836100b5565b5050565b6001600160a01b0383166100e05780600260008282546100d59190610451565b909155506101529050565b6001600160a01b038316600090815260208190526040902054818110156101335760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161009c565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661016e5760028054829003905561018d565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516101d291815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261020657600080fd5b81516001600160401b0381111561021f5761021f6101df565b604051601f8201601f19908116603f011681016001600160401b038111828210171561024d5761024d6101df565b60405281815283820160200185101561026557600080fd5b60005b8281101561028457602081860181015183830182015201610268565b506000918101602001919091529392505050565b6000806000606084860312156102ad57600080fd5b83516001600160401b038111156102c357600080fd5b6102cf868287016101f5565b602086015190945090506001600160401b038111156102ed57600080fd5b6102f9868287016101f5565b925050604084015190509250925092565b600181811c9082168061031e57607f821691505b60208210810361033e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561038e57806000526020600020601f840160051c8101602085101561036b5750805b601f840160051c820191505b8181101561038b5760008155600101610377565b50505b505050565b81516001600160401b038111156103ac576103ac6101df565b6103c0816103ba845461030a565b84610344565b6020601f8211600181146103f457600083156103dc5750848201515b600019600385901b1c1916600184901b17845561038b565b600084815260208120601f198516915b828110156104245787850151825560209485019460019092019101610404565b50848210156104425786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b8082018082111561047257634e487b7160e01b600052601160045260246000fd5b92915050565b6107b1806104876000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063313ce56711610071578063313ce5671461011c57806370a082311461012b57806385bb7d691461015457806395d89b411461015b578063a9059cbb14610163578063dd62ed3e1461017657600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806319ff1d211461010157806323b872dd14610109575b600080fd5b6100b66101af565b6040516100c391906105fa565b60405180910390f35b6100df6100da366004610664565b610241565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100b661025b565b6100df61011736600461068e565b61028c565b604051601281526020016100c3565b6100f36101393660046106cb565b6001600160a01b031660009081526020819052604090205490565b602a6100f3565b6100b66102b0565b6100df610171366004610664565b6102bf565b6100f36101843660046106ed565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101be90610720565b80601f01602080910402602001604051908101604052809291908181526020018280546101ea90610720565b80156102375780601f1061020c57610100808354040283529160200191610237565b820191906000526020600020905b81548152906001019060200180831161021a57829003601f168201915b5050505050905090565b60003361024f8185856102cd565b60019150505b92915050565b60603361026a816103e86102df565b505060408051808201909152600681526548656c6c6f2160d01b602082015290565b60003361029a85828561031e565b6102a585858561039c565b506001949350505050565b6060600480546101be90610720565b60003361024f81858561039c565b6102da83838360016103fb565b505050565b6001600160a01b03821661030e57604051634b637e8f60e11b8152600060048201526024015b60405180910390fd5b61031a826000836104d0565b5050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610396578181101561038757604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610305565b610396848484840360006103fb565b50505050565b6001600160a01b0383166103c657604051634b637e8f60e11b815260006004820152602401610305565b6001600160a01b0382166103f05760405163ec442f0560e01b815260006004820152602401610305565b6102da8383836104d0565b6001600160a01b0384166104255760405163e602df0560e01b815260006004820152602401610305565b6001600160a01b03831661044f57604051634a1406b160e11b815260006004820152602401610305565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561039657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104c291815260200190565b60405180910390a350505050565b6001600160a01b0383166104fb5780600260008282546104f0919061075a565b9091555061056d9050565b6001600160a01b0383166000908152602081905260409020548181101561054e5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610305565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610589576002805482900390556105a8565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516105ed91815260200190565b60405180910390a3505050565b602081526000825180602084015260005b81811015610628576020818601810151604086840101520161060b565b506000604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b038116811461065f57600080fd5b919050565b6000806040838503121561067757600080fd5b61068083610648565b946020939093013593505050565b6000806000606084860312156106a357600080fd5b6106ac84610648565b92506106ba60208501610648565b929592945050506040919091013590565b6000602082840312156106dd57600080fd5b6106e682610648565b9392505050565b6000806040838503121561070057600080fd5b61070983610648565b915061071760208401610648565b90509250929050565b600181811c9082168061073457607f821691505b60208210810361075457634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561025557634e487b7160e01b600052601160045260246000fdfea2646970667358221220c897a6dc5042fca31e75cf787b9a01c183696d0d2633cbe16843fac3a4115cf464736f6c634300081a0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000008525257546573744100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045254414100000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0",
    "to": null,
    "transactionIndex": "0x0",
    "value": "0x0",
    "v": "0x1059b",
    "r": "0x187862d385dcea721250462ee0afa98e61f25434301dac120c94c23e210a6518",
    "s": "0x217a53d53590aa2ffad21d2227e9c2268d513a3e17743fed5ee597be48dc7b01",
    "chainId": "0x82bc",
    "type": "0x0"
  },
  "id": "1"
}

Arguments

Parameter Type Required Description
id string Required "1"
jsonrpc string Required "2.0"
method string Required "eth_getTransactionByBlockHashAndIndex"
params array Requred [ block_number, index]