eth_getTransactionReceipt
按交易哈希返回交易回执。待打包交易(pending)没有回执。
DATA(32 字节)— 交易哈希。
Object|null — 回执对象;查不到时返回 null。
| 字段 | 类型 | 说明 |
|---|---|---|
| transactionHash | DATA | 交易哈希 |
| blockHash | DATA | 区块哈希 |
| blockNumber | QUANTITY | 区块号 |
| from | DATA | 发送方地址 |
| to | DATA | 接收方(合约创建时为 null) |
| contractAddress | DATA | 创建出的合约地址(非创建交易为 null) |
| gasUsed | QUANTITY | 本交易消耗 Gas |
| cumulativeGasUsed | QUANTITY | 截至该交易区块累计 Gas |
| status | QUANTITY | 0x1 成功 / 0x0 失败 |
| logs | Array | 本交易产生的日志 |
curl -X POST https://eth-mainnet.blockreq.com/v1/rpc/public \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "params": ["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"], "id": 1 }'JavaScript (ethers.js v6)
Section titled “JavaScript (ethers.js v6)”import { JsonRpcProvider } from "ethers";const provider = new JsonRpcProvider("https://eth-mainnet.blockreq.com/v1/rpc/YOUR_API_KEY");const receipt = await provider.getTransactionReceipt("0x88df...");console.log("Status:", receipt.status === 1 ? "Success" : "Failed");console.log("Gas used:", receipt.gasUsed.toString());Python (web3.py)
Section titled “Python (web3.py)”from web3 import Web3w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.blockreq.com/v1/rpc/YOUR_API_KEY"))receipt = w3.eth.get_transaction_receipt("0x88df...")print(f"Status: {'Success' if receipt['status'] == 1 else 'Failed'}")| Method | Cost |
|---|---|
| eth_getTransactionReceipt | 10 RU |