tx_getTransactionByBlockHashAndIndex
根据区块哈希和交易偏移量查询交易。
Parameters
<string>
- 32字节的十六进制字符串,区块的哈希值。<number>
- 交易在区块中的偏移量,可以是十进制整数或进制字符串。
Returns
<Transaction>
- Transaction对象字段见 合法交易.
Example1:正常的请求
- # Request
- curl -X POST --data '{"jsonrpc": "2.0", "namespace":"global", "method": "tx_getTransactionsByBlockHashAndIndex","params": ["0xd198976fa8b4ca2de6b1b137552b84dc08b7cdcbebbf9388add88f4710fd2cf9", 0], "id": 71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace":"global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": {
- "version": "1.0",
- "hash": "0xe81d39df11779c7f83e6073cc659c7ee85708c135b6557d318e765b9f938c02f",
- "blockNumber": "0x2",
- "blockHash": "0xd198976fa8b4ca2de6b1b137552b84dc08b7cdcbebbf9388add88f4710fd2cf9",
- "txIndex": "0x0",
- "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to": "0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
- "amount": "0x0",
- "timestamp": 1481767474717000000,
- "nonce": 8054165127693853,
- "extra": "",
- "executeTime": "0x2",
- "payload": "0x6fd7cc16000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- }
- }
Example2:查询的区块不存在
- # Request
- curl -X POST --data '{"jsonrpc": "2.0", "namespace":"global", "method": "tx_getTransactionsByBlockHashAndIndex","params": ["0xd198976fa8b4ca2de6b1b137552b84dc08b7cdcbebbf9388add88f4710fd2cf9", 0], "id": 71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace": "global",
- "id": 71,
- "code": -32001,
- "message": "Not found block 0xd198976fa8b4ca2de6b1b137552b84dc08b7cdcbebbf9388add88f4710fd2cf9"
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .