block_getBlocksByTime
查询指定时间区间内的区块数量。
Parameters
<Object>
startTime
:<number>
- 起始unix时间戳(单位ns)。endTime
:<number>
- 结束unix时间戳(单位ns)。
Returns
<Object>
sumOfBlocks
:<string>
- 区块总数。startBlock
:<string>
- 起始区块号。endBlock
:<string>
- 结束区块号。
Example1: 正常的请求
- # Request
- curl -X POST --data '{"jsonrpc":"2.0", "namespace":"global", "method":"block_getBlocksByTime","params":[{"startTime":1481778635567920177, "endTime":1481778653997475900}],"id":1}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace":"global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": {
- "sumOfBlocks": "0x3",
- "startBlock": "0x1",
- "endBlock": "0x3"
- }
- }
Example2:如果起始时间和终止时间均大于链上最新区块的写入时间
- # Request
- curl -X POST --data '{"jsonrpc":"2.0", "namespace":"global", "method":"block_getBlocksByTime","params":[{"startTime":1481778635567920177, "endTime":1481778653997475900}],"id":1}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace":"global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": {
- "sumOfBlocks": "0x0",
- "startBlock": null,
- "endBlock": null
- }
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .