API Reference

eth_getTransactionByBlockNumberAndIndex - Xlayer

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

Parameters

  • QUANTITY|TAG - A block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
  • QUANTITY - The transaction index position.
params: [
  "latest",
  "0x0",
];

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 it's 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 it's 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

Request

curl https://xlayer-mainnet.unifra.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["latest", "0x0"],"id":0}'
URL: https://xlayer-mainnet.unifra.io/v1/your-api-key
RequestType: POST
Body:
{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionByBlockNumberAndIndex",
    "params":["latest", "0x0"],
    "id":0
}

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "blockHash": "0xd7991721b93499100c4e05da94e6b2b90a53623d429ce9ecb9bd3a7cc7ac29a9",
    "blockNumber": "0x20cad15",
    "from": "0xc83b14db302b79e92148f198c285449e25291c9c",
    "gas": "0x54c563",
    "gasPrice": "0x5f5e101",
    "hash": "0xf055b43bbb812a479fc17aef5b5e7ab2750cdf5145faaf2a31030112d18a076d",
    "input": "0x290c05ea000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000050000000000000000000000003ea2a2f97a8bf3bbb1a3539bce45c612982ea9bf00000000000000000000000007acace793c28a3936645c1906cea701dd757f04000000000000000000000000c71f9e1de80eb505c0cb3bbf90ae6593130e5d2500000000000000000000000032d6b77ee026d471c191ea9ef9ed404d2cb4d4a60000000000000000000000004e6c7d221b5fa285aabdd8c7fa692bc0c79e7d8b",
    "nonce": "0x4fb74",
    "to": "0x164d9b632f0eca9c47e52fe4f8467e4d9eb5149c",
    "transactionIndex": "0x0",
    "value": "0x0",
    "type": "0x0",
    "chainId": "0xc4",
    "v": "0x1ac",
    "r": "0xa763ed165454890b2669f0bae456547524e45d757bbe8722a5d48a16b09cc5e4",
    "s": "0x64f7c8e7521f255e87de136c18a597a9c4f210e5e786f453ea2750da6fe3c52"
  }
}
Language
Click Try It! to start a request and see the response here!