L0vdL0vd

eth_getTransactionReceipt

Returns the receipt of a mined transaction: status, gas used and emitted logs.

归档 · 可查询任意历史区块

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

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xc7a2fd354a9a1512636dad41b44e618905f5e8d2500f08c515c3bbbdf5261f6a",
    "blockNumber": "0x1208a5f",
    "contractAddress": null,
    "cumulativeGasUsed": "0x5208",
    "effectiveGasPrice": "0x104c533c00",
    "from": "0x958da591e94cc7678931915018f0af1a0c81b88f",
    "gasUsed": "0x5208",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000…",
    "status": "0x1",
    "to": "0x0016c0d0343e8f2c3a7b6a51606b84b1545ec606",
    "transactionHash": "0xbb62ecfc053ce6aa2f12dd09261e27e7c06b46dd015c67e28d5f7200bd6251ac",
    "transactionIndex": "0x0",
    "type": "0x0"
  }
}

示例中较长的数组和十六进制字符串已截断。

参数与您的端点

参数

transactionHashstring必填
32-byte transaction hash.

返回值

object Receipt object, or null if the transaction is unknown or pending.

statusstring
"0x1" success, "0x0" failure.
gasUsedstring
Gas used by this transaction, hex.
cumulativeGasUsedstring
Gas used in the block up to and including this transaction, hex.
effectiveGasPricestring
Price actually paid per gas, hex wei.
contractAddressstring
Created contract, or null.
logsarray
Logs emitted by the transaction.
transactionHashstring
Transaction hash.
blockNumberstring
Block number, hex.

适用场景

Find out what a mined transaction did: success or failure, gas used, fee paid, created contract and emitted logs.

如何解读结果

status "0x1" is success, "0x0" is a revert.

The fee paid is gasUsed × effectiveGasPrice (plus blob fees for type 3 transactions).

logs holds the events the transaction emitted, already in block order.

提示

  • null means unknown or still pending: poll again later.
  • Fetching receipts for a whole block? Use eth_getBlockReceipts instead.

相关方法