API Reference

cfx_getBlockByEpochNumber - Conflux

Returns information about a block, identified by its epoch number.

Parameters

  • QUANTITY|TAG - The epoch number, or the string "latest_mined", "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter.
  • Boolean - If true, it returns the full transaction objects. If false, only the hashes of the transactions are returned

Returns

Object - A block object, or null when no block was found:

  • adaptive: Boolean - true if the weight of the block is adaptive under the GHAST rule.
  • blame: QUANTITY - if 0, then this block does not blame any blocks on its parent path. If it is n > 0, then this block blames its n predecessors on its parent path, e.g. when n = 1, then the block blames its parent but not its parent's parent.
  • deferredLogsBloomHash: DATA, 32 Bytes - the hash of the logs bloom after deferred execution at the block's epoch (assuming it is the pivot block).
    deferredReceiptsRoot: DATA, 32 Bytes - the Merkle root of the receipts after deferred execution at the block's epoch (assuming it is the pivot block).
  • deferredStateRoot: DATA, 32 Bytes - the hash of the state trie root triplet after deferred execution at the block's epoch (assuming it is the pivot block).
  • difficulty: QUANTITY - the PoW difficulty of this block.
  • epochNumber: QUANTITY - the number of the epoch containing this block in the node's view of the ledger. null when the epoch number is not determined (e.g. the block is not in the best block's past set).
  • gasLimit: QUANTITY - the maximum gas allowed in this block.
  • gasUsed: QUANTITY - the total gas used in this block. null when the block is pending.
  • hash: DATA, 32 Bytes - hash of the block.
  • height: QUANTITY - the height of the block.
  • miner: BASE32 - the address of the beneficiary to whom the mining rewards were given.
  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work.
  • parentHash: DATA, 32 Bytes - hash of the parent block.
  • powQuality: DATA - the PoW quality. null when the block is pending.
  • refereeHashes: Array - array of referee block hashes.
  • size: QUANTITY - the size of this block in bytes, excluding the block header.
  • timestamp: QUANTITY - the unix timestamp for when the block was created.
  • transactions: Array - array of transaction objects, or 32-byte transaction hashes, depending on the second parameter.
  • transactionsRoot: DATA, 32 Bytes - the Merkle root of the transactions in this block.
  • custom: Array- customized information. Note from v2.0 custom's type has changed from array of number array to array of hex string.
  • blockNumber: QUANTITY - the number of this block's total order in the tree-graph. null when the order is not determined. Added from Conflux-rust v1.1.5
  • posReference: DATA, 32 Bytes - the hash of the PoS newest committed block.

Note that the fields epochNumber and gasUsed are provided by the node as they depend on the ledger. The rest of the fields are included in or derived from the block header directly.


Example

Request

curl -X POST \
--data '{"jsonrpc":"2.0","method":"cfx_getBlockByEpochNumber","params":[ "latest_mined",
        false],"id":1}' \
-H "Content-Type: application/json" \
https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577 


Result

{
    "jsonrpc": "2.0",
    "result": {
        "adaptive": false,
        "blame": "0x0",
        "blockNumber": "0x753aed4",
        "custom": [
            "0x01"
        ],
        "deferredLogsBloomHash": "0xf182a430a06b17104f1da724e11d3ee6c16028609f703af9a12d4a6ba2e63839",
        "deferredReceiptsRoot": "0x7c8a6b4986d4ab87d6215ba2ad5453dc36fcb1aef48d606fab06692816536336",
        "deferredStateRoot": "0xf48cb0392b58df30e56b2348c5713e1e86f9b394dc135e192f144652deaa2441",
        "difficulty": "0x5c92496fba",
        "epochNumber": "0x31ee350",
        "gasLimit": "0x1c9c380",
        "gasUsed": null,
        "hash": "0x0a7d5bf6a5461697f2270ab01f2f37fc36fae014bd35046c79bb356be1efe524",
        "height": "0x31ee350",
        "miner": "CFX:TYPE.USER:AAKETJH9TKJ5G2K4ZX3KFVB9VKKU8NR956N0EN4FHE",
        "nonce": "0x52894b0d85219434",
        "parentHash": "0x44f57cfaca69dd4e9ff23102f3de5df2b4bae5c6e782e36579f0b1ce29a238ad",
        "posReference": "0x9a3c69d72457631909e507476b8be848a4ff148cea9150048db386602178ed13",
        "powQuality": "0x60be8f88ec",
        "refereeHashes": [
            "0x63493a5f39a10d0376b679a2abf6b53d436732887370a7471d7570791ff95d74"
        ],
        "size": "0x618",
        "timestamp": "0x63049e17",
        "transactions": [],
        "transactionsRoot": "0xa91a89527f3b5b0af762d86ee1b8a8a2aec1ae16dd1459433fc4db8051ff2156"
    },
    "id": 1
}

🚧

The below parameter inputs do not work, please reference the section above instead.

Language
URL
Click Try It! to start a request and see the response here!