eth_getBlockReceipts

参数

  1. DATA, 32 Bytes - 区块标识符,可为十六进制表示的区块号、区块哈希(支持带或不带 0x 前缀),或标签("latest"、"earliest"、"finalized")。

返回值

  • Object - 一个对象数组。每个对象为该区块内一笔交易的回执,交易回执内容参见 eth_gettransactionreceipt

    注意:对于创世块,轻节点已经裁剪的块和未生产的块返回 null

📘

注意

解析返回交易的 logs 之前,请逐笔确认其 status"0x1"——这是保证数据一致性的推荐做法。log 解码规则详见 Event Log

示例

请求

# query by blockNumber
curl --location 'https://api.shasta.trongrid.io/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{   "method":"eth_getBlockReceipts",
   "params":["0x377a8a2"],
   "id":1,
   "jsonrpc":"2.0"
}'

# query by blockHash
curl --location 'https://api.shasta.trongrid.io/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{   "method":"eth_getBlockReceipts",
   "params":["00000000049e470616a96ca7af19fc46a473e9733796960d840697dd70ac14ad"],
   "id":1,
   "jsonrpc":"2.0"
}'

#query by tag
curl --location 'https://api.shasta.trongrid.io/jsonrpc' \
--header 'Content-Type: application/json' \
--data '{   "method":"eth_getBlockReceipts",
   "params":["latest"],
   "id":1,
   "jsonrpc":"2.0"
}'

结果

{
	"jsonrpc": "2.0",
	"id": 64,
	"result": [{
		"blockHash": "0x00000000020ef11c87517739090601aa0a7be1de6faebf35ddb14e7ab7d1cc5b",
		"blockNumber": "0x20ef11c",
		"contractAddress": null,
		"cumulativeGasUsed": "0x646e2",
		"effectiveGasPrice": "0x8c",
		"from": "0x6eced5214d62c3bc9eaa742e2f86d5c516785e14",
		"gasUsed": "0x0",
		"logs": [],
		"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
		"status": "0x1",
		"to": "0x0697250b9d73b460a9d2bbfd8c4cacebb05dd1f1",
		"transactionHash": "0xc9af231ad59bcd7e8dcf827afd45020a02112704dce74ec5f72cb090aa07eef0",
		"transactionIndex": "0x6",
		"type": "0x0"
  }]
}