getBlockByNumber

REQUEST

Copy

POST https://mainet.rpc.ctexscan.com

HEADER

Copy

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

  • SHOW TRANSACTION DETAILS FLAG [required] - if set to true, it returns the full transaction objects, if false only the hashes of the transactions.

EXAMPLE

Copy

Explain## You can also replace mainnet with a different supported network
curl https://mainet.rpc.ctexscan.com
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x5BAD55",false],"id":1}'

## JSON-RPC over WSS
wscat -c ws://mainet.rpc.ctexscan.com
>{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x5BAD55",false],"id":1}

RESPONSE

RESULT FIELDS

  • BLOCK - A block object, or null when no block was found

    • number: the block number. Null when the returned block is the pending block.

    • hash: 32 Bytes - hash of the block. Null when the returned block is the pending block.

    • parentHash: 32 Bytes - hash of the parent block.

    • nonce: 8 Bytes - hash of the generated proof-of-work. Null when the returned block is the pending block.

    • sha3Uncles: 32 Bytes - SHA3 of the uncles data in the block.

    • logsBloom: 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.

    • transactionsRoot: 32 Bytes - the root of the transaction trie of the block.

    • stateRoot: 32 Bytes - the root of the final state trie of the block.

    • receiptsRoot: 32 Bytes - the root of the receipts trie of the block.

    • miner: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

    • difficulty: integer of the difficulty for this block.

    • totalDifficulty: integer of the total difficulty of the chain until this block.

    • extraData: the "extra data" field of this block.

    • size: integer the size of this block in bytes.

    • gasLimit: the maximum gas allowed in this block.

    • gasUsed: the total used gas by all transactions in this block.

    • timestamp: the unix timestamp for when the block was collated.

    • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

    • uncles: an Array of uncle hashes.

BODY

Copy

Last updated