block_getBatchBlocksByNumber
根据区块号列表批量查询区块详细信息。
Parameters
<Object>
numbers
:[<blockNumber>]
- 要查询的区块号数组,区块号可以是十进制整数或者进制字符串,也可以是“latest”字符串表示最新的区块。isPlain
:<boolean>
- 值为true
,表示返回的区块不包括区块内的交易。值为false
表示返回的区块包括区块内的交易信息。
Returns
[<Block>]
- Block对象数组,Block对象字段见 Block.
Example1:返回的区块包括交易信息
- # Request
- curl -X POST --data ' {"jsonrpc":"2.0","method":"block_getBatchBlocksByNumber","params":[{
- "numbers": ["1","2"]
- }],"id":1}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace": "global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": [
- {
- "version": "1.3",
- "number": "0x1",
- "hash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
- "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
- "writeTime": 1509440821032039312,
- "avgTime": "0x11",
- "txcounts": "0x1",
- "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481",
- "transactions": [
- {
- "version": "1.3",
- "hash": "0x7aebde51531bb29d3ba620f91f6e1556a1e8b50913e590f31d4fe4a2436c0602",
- "blockNumber": "0x1",
- "blockHash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
- "txIndex": "0x0",
- "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to": "0x0000000000000000000000000000000000000000",
- "amount": "0x0",
- "timestamp": 1509440820498000000,
- "nonce": 5098902950712745,
- "extra": "",
- "executeTime": "0x11",
- "payload": "0x6060604052341561000f57600080fd5b60405160408061016083398101604052808051919060200180519150505b6000805467ffffffff000000001963ffffffff19821663ffffffff600393840b8701840b81169190911791821664010000000092839004840b860190930b16021790555b50505b60de806100826000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a9ae69d811460465780638466c3e614606f575b600080fd5b3415605057600080fd5b60566098565b604051600391820b90910b815260200160405180910390f35b3415607957600080fd5b605660a9565b604051600391820b90910b815260200160405180910390f35b600054640100000000900460030b81565b60005460030b815600a165627a7a7230582073eeeb74bb45b3055f1abe89f428d164ef7425bf57a999d219cbaefb6e3c0080002900000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005"
- }
- ]
- },
- {
- "version": "1.3",
- "number": "0x2",
- "hash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
- "parentHash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
- "writeTime": 1509440823930976319,
- "avgTime": "0x6",
- "txcounts": "0x1",
- "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481",
- "transactions": [
- {
- "version": "1.3",
- "hash": "0x22321358931c577ceaa2088d914758148dc6c1b6096a0b3f565d130f03ca75e4",
- "blockNumber": "0x2",
- "blockHash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
- "txIndex": "0x0",
- "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to": "0xaeccd2fd1118334402c5de1cb014a9c192c498df",
- "amount": "0x0",
- "timestamp": 1509440823410000000,
- "nonce": 8291834415403909,
- "extra": "",
- "executeTime": "0x6",
- "payload": "0x0a9ae69d"
- }
- ]
- }
- ]
- }
Example2:返回的区块不包括交易信息
- # Request
- curl -X POST --data ' {"jsonrpc":"2.0","method":"block_getBatchBlocksByNumber","params":[{
- "numbers": ["1","2"],
- "isPlain": true
- }],"id":1}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace": "global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": [
- {
- "version": "1.3",
- "number": "0x1",
- "hash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
- "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
- "writeTime": 1509440821032039312,
- "avgTime": "0x11",
- "txcounts": "0x1",
- "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481"
- },
- {
- "version": "1.3",
- "number": "0x2",
- "hash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
- "parentHash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
- "writeTime": 1509440823930976319,
- "avgTime": "0x6",
- "txcounts": "0x1",
- "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481"
- }
- ]
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .