Web3API
HomeAPI EndpointsContactTwitter
  • ​🚀 Welcome to Web3API
  • Introduction
    • ✨Getting Started
    • 📡 Choosing A Network
  • Developers
    • 🔌API Endpoints
      • eth_hashrate
      • eth_gasPrice
      • eth_blockNumber
      • eth_getBalance
      • eth_getStorageAt
      • eth_getTransactionCount
      • eth_getBlockTransactionCountByHash
      • eth_getBlockTransactionCountByNumber
      • eth_getCode
      • eth_sendRawTransaction
      • eth_call
      • eth_getBlockByHash
      • eth_getBlockByNumber
      • eth_getTransactionByHash
      • eth_getTransactionByBlockHashAndIndex
      • eth_getTransactionByBlockNumberAndIndex
      • eth_getTransactionReceipt
      • eth_getUncleByBlockHashAndIndex
      • eth_getUncleByBlockNumberAndIndex
      • eth_getUncleCountByBlockHash
      • eth_getUncleCountByBlockNumber
      • eth_estimateGas
      • eth_syncing
    • 😟API Errors and Troubleshooting
  • Tutorials
    • ⚡Adding a Custom RPC to Metamask
  • Dashboard
    • 🔑Forgot Password
  • Resources
    • ❓ FAQ
    • 🤝 Support
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. API Endpoints

eth_getTransactionByBlockNumberAndIndex

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

Example

curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY 
-X POST 
-H "Content-Type: application/json"  
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\": [\"0x6F3620\", \"0x0\"],\"id\":1}"
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params": ["0x6F3620", "0x0"],"id":1}'
  1. BLOCK PARAMETER - An int block number in the form of hex, appended with 0x such as 0x6D7FE0, or pre-defined strings latest, earliest, pending.

  2. TRANSACTION INDEX POSITION - a hex of the integer representing the position in the block, appended with 0x such as 0x0 .

Web3API's Composer accepts int block numbers, which will be auto-converted to a hex representation before being sent to a node.

Result Fields

TRANSACTION - A transaction object, or null when no transaction was found

Within the transaction object, the following information are available.

  1. blockHash: 32 Bytes - hash of the block where this transaction was in, null when its pending.

  2. blockNumber: block number where this transaction was in, null when its pending.

  3. from: 20 Bytes - address of the sender.

  4. gas: gas provided by the sender.

  5. gasPrice: gas price provided by the sender in Wei.

  6. hash: 32 Bytes - hash of the transaction.

  7. input: the data send along with the transaction.

  8. nonce: the number of transactions made by the sender prior to this one.

  9. to: 20 Bytes - address of the receiver. null when its a contract creation transaction.

  10. transactionIndex: integer of the transactions index position in the block. null when its pending.

  11. value: value transferred in Wei.

Body

{
   "jsonrpc":"2.0",
   "id":1,
   "result":{
      "blockHash":"0xe84fe3e06769f2bc5bae419de2c68a6f58917feb1c9fe7fa22abe9685b09412d",
      "blockNumber":"0x6f3620",
      "from":"0x4cf8800ccc0a56396f77b1e7c46160f5df0e09a5",
      "gas":"0x186a0",
      "gasPrice":"0x5d21dba00",
      "hash":"0x6c46e09a9a0d563ceb540ff32204e43f63090f8a28f1240ebde6f3aef6481a28",
      "input":"0xa9059cbb000000000000000000000000e926e07abd2aa8170cef9ecfad6e2e65af7cceaa000000000000000000000000000000000000000000000000a4c81fda4bf52000",
      "nonce":"0x406c",
      "to":"0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
      "transactionIndex":"0x0",
      "value":"0x0",
      "v":"0x93",
      "r":"0xbe9f336c68ef336fcf03fed1d4c8fa6f51beb092056f2201a28e1f59d465ef7e",
      "s":"0x5f28510ad969b4faf8ca648900d8e5ab961761b940b5908a6e85db69db383c96"
   }
}
Previouseth_getTransactionByBlockHashAndIndexNexteth_getTransactionReceipt

Last updated 3 years ago

Was this helpful?

🔌