tx_getTransactions
查询指定区块区间的所有交易。
Parameters
<Object>
from
:<blockNumber>
- 起始区块号。to
:<blockNumber>
- 终止区块号。
<blockNumber>
可以是十进制整数或者进制字符串,可以是“latest”
字符串表示最新的区块。from
必须小于等于to
,否则会返回error。
Returns
[<Transaction>]
- Transaction对象字段如下:
version
:<string>
- 平台版本号。hash
:<string>
- 32字节的十六进制字符串,交易哈希值。blockNumber
:<string>
- 十六进制,交易所在区块的高度。blockHash
:<string>
- 32字节的十六进制字符串,交易所在区块的哈希。txIndex
:<string>
- 十六进制,交易在区块中的偏移量。from
:<string>
- 20字节的十六进制字符串,交易发送方的地址。to
:<string>
- 20字节的十六进制字符串,交易接收方的地址。amount
:<string>
- 转账金额。timestamp
:<number>
- 交易发生的unix时间戳(单位ns)。nonce
:<number>
- 16位随机数。extra
:<string>
- 交易的额外信息。executeTime
:<string>
- 交易的处理时间(单位ms)。payload
:<string>
- 部署合约、调用合约、升级合约的时候才有这个值,可以通过这个值追溯到合约调用的方法以及调用传入的参数。
Example1: 正常的请求
- # Request
- curl -X POST --data '{"jsonrpc": "2.0", "namespace":"global", "method": "tx_getTransactions", "params": [{"from": 1, "to": 2}], "id": 71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace":"global",
- "id": 1,
- "result": [
- {
- "version": "1.0",
- "hash": "0x88d5b325dc9042ff92a9fa26ed8c943719bb049ac7022abd09bb85da36f531e4",
- "blockNumber": "0x2",
- "blockHash": "0xc6418753c28ad6d744cb4bbe689521696ba65ad010ce24056b6f8def9fc5cdd5",
- "txIndex": "0x0",
- "from": "0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd",
- "to": "0x0000000000000000000000000000000000000000",
- "amount": "0x0",
- "timestamp": 1486994814684628715,
- "nonce": 7948317390228704,
- "extra": "",
- "executeTime": "0x2",
- "payload": "0x60606040526000805463ffffffff19168155609e908190601e90396000f3606060405260e060020a60003504633ad14af381146030578063569c5f6d146056578063d09de08a14607c575b6002565b346002576000805463ffffffff8116600435016024350163ffffffff199091161790555b005b3460025760005463ffffffff166040805163ffffffff9092168252519081900360200190f35b3460025760546000805463ffffffff19811663ffffffff90911660010117905556"
- },
- {
- "version": "1.0",
- "hash": "0xf7149a8349f1853d8d713a15935e5059e6f55c2827f0c88f8414dd0402d6760b",
- "blockNumber": "0x1",
- "blockHash": "0x4bab3f9297e737eb197d666a2f08219f94460ace08a8e1ecad87e6e52183bcd5",
- "txIndex": "0x0",
- "from": "0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd",
- "to": "0x0000000000000000000000000000000000000000",
- "amount": "0x0",
- "timestamp": 1486994799163184948,
- "nonce": 2099818402815731,
- "extra": "",
- "executeTime": "0x7",
- "payload": "0x60606040526000805463ffffffff19168155609e908190601e90396000f3606060405260e060020a60003504633ad14af381146030578063569c5f6d146056578063d09de08a14607c575b6002565b346002576000805463ffffffff8116600435016024350163ffffffff199091161790555b005b3460025760005463ffffffff166040805163ffffffff9092168252519081900360200190f35b3460025760546000805463ffffffff19811663ffffffff90911660010117905556"
- }
- ]
- }
Example2: 区块不存在
- # Request
- curl -X POST --data '{"jsonrpc": "2.0", "namespace":"global", "method": "tx_getTransactions", "params": [{"from": 1, "to": 2}], "id": 71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace": "global",
- "id": 71,
- "code": -32602,
- "message": "block number 1 is out of range, and now latest block number is 0"
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .