cfx_getBlockByHash - Conflux

Returns information about a block, identified by its hash.

Parameters

  • DATA, 32 Bytes - Hash of a transaction
  • 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_getBlockByHash","params":[ "0x23a6e84d9a24dffc8436e72b0e240688d23e29b8cda0b301ff20baab1573c9fd",
        false],"id":0}' \
-H "Content-Type: application/json" \
https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577 


Result

{
    "jsonrpc": "2.0",
    "result": {
        "adaptive": false,
        "blame": "0x0",
        "blockNumber": "0x28117e5",
        "custom": [
            "0x01"
        ],
        "deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
        "deferredReceiptsRoot": "0x1c9e4c6913e56253dd840ed8fb7823b46e5a75b1522212b3464e323787850dfb",
        "deferredStateRoot": "0x8f726764e0f86c6a79246a4ed5fb0686e457ed5af4a1f971d8e0063873cebfa3",
        "difficulty": "0xb06f836a76",
        "epochNumber": "0x10c3e6e",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0x1ce62",
        "hash": "0x23a6e84d9a24dffc8436e72b0e240688d23e29b8cda0b301ff20baab1573c9fd",
        "height": "0x10c3e6e",
        "miner": "CFX:TYPE.USER:AAMCR303A3P32J0UU3AVUKHMB0MREVJPSU7HEP08JJ",
        "nonce": "0x2684000005cdb6d5",
        "parentHash": "0x3d9eb6622da15cf990a5b994bda07109b87006c2d9304a084cafb1629701f29b",
        "posReference": null,
        "powQuality": "0xb2fde57e24",
        "refereeHashes": [
            "0xa8060293b9691181e4d1e909be316d6b9d40f18df230e781650befb0e9109fa2"
        ],
        "size": "0x1f6",
        "timestamp": "0x60cef8dc",
        "transactions": [
            "0xa2ae4700d3ca272c773628a6bf8c2a7fc794a2d3b27e675107df0f6b1a6cbad7"
        ],
        "transactionsRoot": "0x6a8520d409d06c9ae425309a54b64ab4893007c022aa4fec19a5b5cfc95dda89"
    },
    "id": 0
}

🚧

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!