Azxa
← Avalanche C-Chain overview

Avalanche C-Chain · eth

eth_getTransactionByBlockNumberAndIndex

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

Parameters

  • Block required
    Schema
    {
      "title": "Block number or tag",
      "oneOf": [
        {
          "type": "string",
          "title": "Block number",
          "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
        },
        {
          "type": "string",
          "title": "Block tag",
          "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error",
          "enum": [
            "earliest",
            "finalized",
            "safe",
            "latest",
            "pending"
          ]
        }
      ]
    }
  • Transaction index required
    Schema
    {
      "type": "string",
      "title": "hex encoded unsigned integer",
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
    }

Result

Transaction information

Schema
{
  "oneOf": [
    {
      "type": "null",
      "title": "Not Found (null)"
    },
    {
      "type": "object",
      "title": "Transaction information",
      "properties": {
        "blockHash": {
          "type": "string",
          "title": "block hash",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "blockNumber": {
          "type": "string",
          "title": "block number",
          "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
        },
        "blockTimestamp": {
          "type": "string",
          "title": "block timestamp",
          "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
        },
        "from": {
          "type": "string",
          "title": "from address",
          "pattern": "^0x[0-9a-fA-F]{40}$"
        },
        "hash": {
          "type": "string",
          "title": "transaction hash",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "transactionIndex": {
          "type": "string",
          "title": "transaction index",
          "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
        }
      },
      "required": [
        "blockHash",
        "blockNumber",
        "blockTimestamp",
        "from",
        "hash",
        "transactionIndex"
      ],
      "oneOf": [
        {
          "type": "object",
          "title": "Signed 7702 Transaction",
          "properties": {
            "accessList": {
              "type": "array",
              "title": "accessList",
              "description": "EIP-2930 access lists",
              "items": {
                "type": "object",
                "title": "Access list entry",
                "properties": {
                  "address": {
                    "type": "string",
                    "title": "hex encoded address",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "storageKeys": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "title": "32 byte hex value",
                      "pattern": "^0x[0-9a-f]{64}$"
                    }
                  }
                },
                "required": [
                  "address",
                  "storageKeys"
                ]
              }
            },
            "authorizationList": {
              "type": "array",
              "title": "authorizationList",
              "description": "List of authorizations for the transaction",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "title": "hex encoded address",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "chainId": {
                    "type": "string",
                    "title": "chainId",
                    "description": "Chain ID on which this transaction is valid",
                    "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
                  },
                  "nonce": {
                    "type": "string",
                    "title": "nonce",
                    "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
                  },
                  "r": {
                    "type": "string",
                    "title": "r",
                    "pattern": "^0x(0|[1-9a-f][0-9a-f]{0,63})$"
                  },
                  "s": {
                    "type": "string",
                    "title": "s",
                    "pattern": "^0x(0|[1-9a-f][0-9a-f]{0,63})$"
                  },
                  "yParity": {
                    "type": "string",
                    "title": "yParity",
                    "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature",
                    "pattern": "^0x[0-9a-f]{1,2}$"
                  }
                },
                "required": [
                  "chainId",
                  "nonce",
                  "address",
                  "yParity",
                  "r",
                  "s"
                ]
              }
            },
            "chainId": {
              "type": "string",
              "title": "chainId",
              "description": "Chain ID that this transaction is valid on",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gas": {
              "type": "string",
              "title": "gas limit",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gasPrice": {
              "type": "string",
              "title": "gas price",
              "description": "The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "input": {
              "type": "string",
              "title": "input data",
              "pattern": "^0x[0-9a-f]*$"
            },
            "maxFeePerGas": {
              "type": "string",
              "title": "max fee per gas",
              "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "maxPriorityFeePerGas": {
              "type": "string",
              "title": "max priority fee per gas",
              "description": "Maximum fee per gas the sender is willing to pay to miners in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "nonce": {
              "type": "string",
              "title": "nonce",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "r": {
              "type": "string",
              "title": "r",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "s": {
              "type": "string",
              "title": "s",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "to": {
              "type": "string",
              "title": "to address",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "type": {
              "type": "string",
              "title": "type",
              "pattern": "^0x4$"
            },
            "v": {
              "type": "string",
              "title": "v",
              "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            },
            "value": {
              "type": "string",
              "title": "value",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "yParity": {
              "type": "string",
              "title": "yParity",
              "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            }
          },
          "required": [
            "accessList",
            "authorizationList",
            "chainId",
            "gas",
            "input",
            "maxFeePerGas",
            "maxPriorityFeePerGas",
            "nonce",
            "r",
            "s",
            "to",
            "type",
            "value",
            "yParity"
          ]
        },
        {
          "type": "object",
          "title": "Signed 4844 Transaction",
          "properties": {
            "accessList": {
              "type": "array",
              "title": "accessList",
              "description": "EIP-2930 access list",
              "items": {
                "type": "object",
                "title": "Access list entry",
                "properties": {
                  "address": {
                    "type": "string",
                    "title": "hex encoded address",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "storageKeys": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "title": "32 byte hex value",
                      "pattern": "^0x[0-9a-f]{64}$"
                    }
                  }
                },
                "required": [
                  "address",
                  "storageKeys"
                ]
              }
            },
            "blobVersionedHashes": {
              "type": "array",
              "title": "blobVersionedHashes",
              "description": "List of versioned blob hashes associated with the transaction's EIP-4844 data blobs",
              "items": {
                "type": "string",
                "title": "32 byte hex value",
                "pattern": "^0x[0-9a-f]{64}$"
              }
            },
            "chainId": {
              "type": "string",
              "title": "chainId",
              "description": "Chain ID that this transaction is valid on",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gas": {
              "type": "string",
              "title": "gas limit",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gasPrice": {
              "type": "string",
              "title": "gas price",
              "description": "The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "input": {
              "type": "string",
              "title": "input data",
              "pattern": "^0x[0-9a-f]*$"
            },
            "maxFeePerBlobGas": {
              "type": "string",
              "title": "max fee per blob gas",
              "description": "The maximum total fee per gas the sender is willing to pay for blob gas in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "maxFeePerGas": {
              "type": "string",
              "title": "max fee per gas",
              "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "maxPriorityFeePerGas": {
              "type": "string",
              "title": "max priority fee per gas",
              "description": "Maximum fee per gas the sender is willing to pay to miners in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "nonce": {
              "type": "string",
              "title": "nonce",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "r": {
              "type": "string",
              "title": "r",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "s": {
              "type": "string",
              "title": "s",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "to": {
              "type": "string",
              "title": "to address",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "type": {
              "type": "string",
              "title": "type",
              "pattern": "^0x3$"
            },
            "v": {
              "type": "string",
              "title": "v",
              "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            },
            "value": {
              "type": "string",
              "title": "value",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "yParity": {
              "type": "string",
              "title": "yParity",
              "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            }
          },
          "required": [
            "accessList",
            "blobVersionedHashes",
            "chainId",
            "gas",
            "input",
            "maxFeePerBlobGas",
            "maxFeePerGas",
            "maxPriorityFeePerGas",
            "nonce",
            "r",
            "s",
            "to",
            "type",
            "value",
            "yParity"
          ]
        },
        {
          "type": "object",
          "title": "Signed 1559 Transaction",
          "properties": {
            "accessList": {
              "type": "array",
              "title": "accessList",
              "description": "EIP-2930 access list",
              "items": {
                "type": "object",
                "title": "Access list entry",
                "properties": {
                  "address": {
                    "type": "string",
                    "title": "hex encoded address",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "storageKeys": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "title": "32 byte hex value",
                      "pattern": "^0x[0-9a-f]{64}$"
                    }
                  }
                },
                "required": [
                  "address",
                  "storageKeys"
                ]
              }
            },
            "chainId": {
              "type": "string",
              "title": "chainId",
              "description": "Chain ID that this transaction is valid on.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gas": {
              "type": "string",
              "title": "gas limit",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gasPrice": {
              "type": "string",
              "title": "gas price",
              "description": "The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "input": {
              "type": "string",
              "title": "input data",
              "pattern": "^0x[0-9a-f]*$"
            },
            "maxFeePerGas": {
              "type": "string",
              "title": "max fee per gas",
              "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "maxPriorityFeePerGas": {
              "type": "string",
              "title": "max priority fee per gas",
              "description": "Maximum fee per gas the sender is willing to pay to miners in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "nonce": {
              "type": "string",
              "title": "nonce",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "r": {
              "type": "string",
              "title": "r",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "s": {
              "type": "string",
              "title": "s",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "to": {
              "title": "to address",
              "oneOf": [
                {
                  "type": "null",
                  "title": "Contract Creation (null)"
                },
                {
                  "type": "string",
                  "title": "Address",
                  "pattern": "^0x[0-9a-fA-F]{40}$"
                }
              ]
            },
            "type": {
              "type": "string",
              "title": "type",
              "pattern": "^0x2$"
            },
            "v": {
              "type": "string",
              "title": "v",
              "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            },
            "value": {
              "type": "string",
              "title": "value",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "yParity": {
              "type": "string",
              "title": "yParity",
              "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            }
          },
          "required": [
            "accessList",
            "chainId",
            "gas",
            "gasPrice",
            "input",
            "maxFeePerGas",
            "maxPriorityFeePerGas",
            "nonce",
            "r",
            "s",
            "type",
            "value",
            "yParity"
          ]
        },
        {
          "type": "object",
          "title": "Signed 2930 Transaction",
          "properties": {
            "accessList": {
              "type": "array",
              "title": "accessList",
              "description": "EIP-2930 access list",
              "items": {
                "type": "object",
                "title": "Access list entry",
                "properties": {
                  "address": {
                    "type": "string",
                    "title": "hex encoded address",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "storageKeys": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "title": "32 byte hex value",
                      "pattern": "^0x[0-9a-f]{64}$"
                    }
                  }
                },
                "required": [
                  "address",
                  "storageKeys"
                ]
              }
            },
            "chainId": {
              "type": "string",
              "title": "chainId",
              "description": "Chain ID that this transaction is valid on.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gas": {
              "type": "string",
              "title": "gas limit",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gasPrice": {
              "type": "string",
              "title": "gas price",
              "description": "The gas price willing to be paid by the sender in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "input": {
              "type": "string",
              "title": "input data",
              "pattern": "^0x[0-9a-f]*$"
            },
            "nonce": {
              "type": "string",
              "title": "nonce",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "r": {
              "type": "string",
              "title": "r",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "s": {
              "type": "string",
              "title": "s",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "to": {
              "title": "to address",
              "oneOf": [
                {
                  "type": "null",
                  "title": "Contract Creation (null)"
                },
                {
                  "type": "string",
                  "title": "Address",
                  "pattern": "^0x[0-9a-fA-F]{40}$"
                }
              ]
            },
            "type": {
              "type": "string",
              "title": "type",
              "pattern": "^0x1$"
            },
            "v": {
              "type": "string",
              "title": "v",
              "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            },
            "value": {
              "type": "string",
              "title": "value",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "yParity": {
              "type": "string",
              "title": "yParity",
              "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.",
              "pattern": "^0x[0-9a-f]{1,2}$"
            }
          },
          "required": [
            "accessList",
            "chainId",
            "gas",
            "gasPrice",
            "input",
            "nonce",
            "r",
            "s",
            "type",
            "value",
            "yParity"
          ]
        },
        {
          "type": "object",
          "title": "Signed Legacy Transaction",
          "properties": {
            "chainId": {
              "type": "string",
              "title": "chainId",
              "description": "Chain ID that this transaction is valid on.",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gas": {
              "type": "string",
              "title": "gas limit",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "gasPrice": {
              "type": "string",
              "title": "gas price",
              "description": "The gas price willing to be paid by the sender in wei",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "input": {
              "type": "string",
              "title": "input data",
              "pattern": "^0x[0-9a-f]*$"
            },
            "nonce": {
              "type": "string",
              "title": "nonce",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "r": {
              "type": "string",
              "title": "r",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "s": {
              "type": "string",
              "title": "s",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "to": {
              "title": "to address",
              "oneOf": [
                {
                  "type": "null",
                  "title": "Contract Creation (null)"
                },
                {
                  "type": "string",
                  "title": "Address",
                  "pattern": "^0x[0-9a-fA-F]{40}$"
                }
              ]
            },
            "type": {
              "type": "string",
              "title": "type",
              "pattern": "^0x0$"
            },
            "v": {
              "type": "string",
              "title": "v",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            },
            "value": {
              "type": "string",
              "title": "value",
              "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
            }
          },
          "required": [
            "gas",
            "gasPrice",
            "input",
            "nonce",
            "r",
            "s",
            "type",
            "v",
            "value"
          ]
        }
      ]
    }
  ]
}

Example request

Endpoint: https://your-avax-node.azxa.io

JSON-RPC
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "0x1442e",
    "0x2"
  ]
}
Example response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0x510efccf44a192e6e34bcb439a1947e24b86244280762cbb006858c237093fda",
    "blockNumber": "0x422",
    "chainId": "0x7e2",
    "from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
    "gas": "0x5208",
    "gasPrice": "0x3b9aca00",
    "hash": "0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44",
    "input": "0x",
    "nonce": "0x1",
    "r": "0x84caf09aefbd5e539295acc67217563438a4efb224879b6855f56857fa2037d3",
    "s": "0x5e863be3829812c81439f0ae9d8ecb832b531d651fb234c848d1bf45e62be8b9",
    "to": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
    "transactionIndex": "0x0",
    "v": "0xfe7",
    "value": "0x4e1003b28d9280000"
  }
}

Test fixture

Fixture: get-block-n

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "0x1",
    "0x0"
  ]
}
Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0x80e911b62f552f563a2544dfef5eb39ec8863d9082c998ca6b657f76e19de38e",
    "blockNumber": "0x1",
    "blockTimestamp": "0xa",
    "from": "0x7435ed30a8b4aeb0877cef0c6e8cffe834eb865f",
    "gas": "0x13a54",
    "gasPrice": "0x1",
    "hash": "0xc1d605c6612a5fe84dc95810030bfe5b1d327652b381bc695e28f50d13b2b09e",
    "input": "0x600d380380600d6000396000f36000438152602001468152602001418152602001488152602001…013481526020016000f3",
    "nonce": "0x0",
    "to": null,
    "transactionIndex": "0x0",
    "value": "0x0",
    "type": "0x0",
    "v": "0x1c",
    "r": "0xd642ba4d1f9388c5fd312bb9fb42d189a0b3c796de55093c85f30802a85147c8",
    "s": "0x37aa8680923f811a6988c03dd414ca00cd25d6876ba5925c7ca8ac6aad21669d"
  }
}

cURL

curl -X POST https://your-avax-node.azxa.io \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":["0x1442e","0x2"]}'
1

Select Chain

2

Desired Period

3

Contact Information

cross

Select Preferred Chain

BNB Smart Chain
Polygon
Tron
Arbitrum
Optimism
IoTeX
Gnosis
Fantom
Moonbeam
Polkadot
Avalanche
Bitcoin
Ethereum
Aptos
Other
cube

Other Chain

Continue
logo
cross
background