L0vdL0vd

eth_getTransactionByBlockNumberAndIndex

Returns a transaction by block number and position in the block.

Архив · Работает на любом прошлом блоке

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":["0x1208a5f","0x0"]}'

Пример ответа

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xc7a2fd354a9a1512636dad41b44e618905f5e8d2500f08c515c3bbbdf5261f6a",
    "blockNumber": "0x1208a5f",
    "blockTimestamp": "0x65922b33",
    "from": "0x958da591e94cc7678931915018f0af1a0c81b88f",
    "gas": "0x5208",
    "gasPrice": "0x104c533c00",
    "hash": "0xbb62ecfc053ce6aa2f12dd09261e27e7c06b46dd015c67e28d5f7200bd6251ac",
    "input": "0x",
    "nonce": "0x1",
    "to": "0x0016c0d0343e8f2c3a7b6a51606b84b1545ec606",
    "transactionIndex": "0x0",
    "value": "0x33d16ab2475000",
    "type": "0x0",
    "chainId": "0x1",
    "v": "0x25",
    "r": "0x96a1dd0c9729d6340a778a1d5c405f02e25fb2c6eae9f90c2ef30fc7127e50a3",
    "s": "0x3dd747997bd8aa478bbdf2e242ae481995b061be95bf515b0656a73ce3f50b1f"
  }
}
Параметры и свой эндпоинт

Параметры

blockstringобязательный
Block number in hex (e.g. "0x1208a5f") or a tag: "latest", "safe", "finalized", "earliest" or "pending". L0vd endpoints run archive nodes, so any historical block works.
indexstringобязательный
Transaction index, hex.

Возвращает

object Transaction object, or null.

hashstring
Transaction hash.
blockNumberstring
Block number, hex; null while pending.
blockHashstring
Block hash; null while pending.
transactionIndexstring
Position in the block, hex.
fromstring
Sender address.
tostring
Recipient; null for contract creation.
valuestring
Value transferred, hex wei.
inputstring
Call data.
gasstring
Gas limit provided by the sender, hex.
noncestring
Sender nonce, hex.
typestring
Transaction type: "0x0" legacy, "0x2" EIP-1559, "0x3" blob.

Когда использовать

Read the transaction at a given position of a block, e.g. the first transaction or the one at a known index.

Как читать ответ

Transaction object, or null if the index is past the end of the block.

Советы

  • Index is hex: the 11th transaction is "0xa".

Связанные методы