跳转至

区块

原文:https://docs.elrond.com/sdk-and-tools/rest-api/blocks

查询区块信息。

GETGET Hyperblock by Nonce

https://gateway.elrond.com/hyperblock/by-nonce/:nonce

这个端点允许通过它的 nonce 来查询超级块。

RequestResponse 路径参数

参数 需要 类型 描述
目前 必需的 number 块随机数(高度)。

已成功检索块详细信息。

{
    "hyperblock": {
        "nonce": 185833,
        "round": 186582,
        "hash": "6a33...",
        "prevBlockHash": "aa7e...",
        "epoch": 12,
        "numTxs": 1,
        "shardBlocks": [
            {
                "hash": "cba4...",
                "nonce": 186556,
                "shard": 0
            },
            {
                "hash": "50a16...",
                "nonce": 186535,
                "shard": 1
            },
            {
                "hash": "7981...",
                "nonce": 186536,
                "shard": 2
            }
        ],
        "transactions": [
            {
                "type": "normal",
                "hash": "b035...",
                "nonce": 3,
                "value": "1000000000000000000",
                "receiver": "erd1...",
                "sender": "erd1...",
                "gasPrice": 1000000000,
                "gasLimit": 70000,
                "data": "Zm9yIHRlc3Rz",
                "signature": "1047...",
                "status": "executed"
            }
        ]
    }
} 
重要

此端点仅由代理定义。观察者不公开这个端点。

提示

一个超级块是一个类似块的抽象,它将来自所有碎片的数据重新组合在一起,并且只包含完全执行的交易(也就是说,在目的地碎片中执行的交易)。

一个超块是使用一个元块作为起点组成的——因此,超块的noncehash与基本元块的noncehash相同。

获取 通过哈希获取超级块

https://gateway.elrond.com/hyperblock/by-hash/:hash

该端点允许用户通过其散列来查询超级块。

RequestResponse 路径参数

参数 需要 类型 描述
混杂 OPTIONAL string 块哈希。
{
    "hyperblock": {
        "nonce": 185833,
        "round": 186582,
        "hash": "6a33...",
        "prevBlockHash": "aa7e...",
        "epoch": 12,
        "numTxs": 1,
        "shardBlocks": [
            {
                "hash": "cba4...",
                "nonce": 186556,
                "shard": 0
            },
            {
                "hash": "50a16...",
                "nonce": 186535,
                "shard": 1
            },
            {
                "hash": "7981...",
                "nonce": 186536,
                "shard": 2
            }
        ],
        "transactions": [
            {
                "type": "normal",
                "hash": "b035...",
                "nonce": 3,
                "value": "1000000000000000000",
                "receiver": "erd1...",
                "sender": "erd1...",
                "gasPrice": 1000000000,
                "gasLimit": 70000,
                "data": "Zm9yIHRlc3Rz",
                "signature": "1047...",
                "status": "executed"
            }
        ]
    }
} 
重要

此端点仅由代理定义。观察者不公开这个端点。

获取 获取块的随机数

https://gateway.elrond.com/block/:shard/by-nonce/:nonce

这个端点允许通过它的 nonce(或高度)来查询碎片块。

RequestResponse 路径参数

参数 需要 类型 描述
碎片 OPTIONAL number 碎片。
目前 必需的 number 块随机数(高度)。

查询参数

参数 需要 类型 描述
withTxs OPTIONAL boolean 是否在响应中包括交易。

成功检索块,包括交易。

{
    "data": {
        "block": {
            "nonce": 186532,
            "round": 186576,
            "hash": "7aa3...",
            "prevBlockHash": "2580...",
            "epoch": 12,
            "shard": 2,
            "numTxs": 1,
            "miniBlocks": [
                {
                    "hash": "e927...",
                    "type": "TxBlock",
                    "sourceShard": 2,
                    "destinationShard": 1,
                    "transactions": [
                        {
                            "type": "normal",
                            "hash": "b035...",
                            "nonce": 3,
                            "value": "1000000000000000000",
                            "receiver": "erd1...",
                            "sender": "erd1...",
                            "gasPrice": 1000000000,
                            "gasLimit": 70000,
                            "data": "Zm9yIHRlc3Rz",
                            "signature": "1047...",
                            "status": "partially-executed"
                        }
                    ]
                }
            ]
        }
    },
    "error": "",
    "code": "successful"
} 
重要

对于观察者来说,不应该设置shard参数。

获取 获取块哈希

https://gateway.elrond.com/block/:shard/by-hash/:hash

这个端点允许通过散列来查询碎片块。

RequestResponse 路径参数

参数 需要 类型 描述
碎片 OPTIONAL number 碎片。
混杂 必需的 string 块哈希。

查询参数

参数 需要 类型 描述
withTxs OPTIONAL boolean 是否在响应中包括交易。

成功检索块,包括交易。

{
    "data": {
      "block": {
          "nonce": 186532,
          "round": 186576,
          "hash": "7aa3...",
          "prevBlockHash": "2580...",
          "epoch": 12,
          "shard": 2,
          "numTxs": 1,
          "miniBlocks": [
              {
                  "hash": "e927...",
                  "type": "TxBlock",
                  "sourceShard": 2,
                  "destinationShard": 1,
                  "transactions": [
                      {
                          "type": "normal",
                          "hash": "b035...",
                          "nonce": 3,
                          "value": "1000000000000000000",
                          "receiver": "erd1...",
                          "sender": "erd1...",
                          "gasPrice": 1000000000,
                          "gasLimit": 70000,
                          "data": "Zm9yIHRlc3Rz",
                          "signature": "1047...",
                          "status": "partially-executed"
                      }
                  ]
              }
          ]
      }
    },
    "error": "",
    "code": "successful"
} 
重要

对于观察者来说,不应该设置shard参数。



回到顶部