eth_getBlockByNumber

Returns block information by number.

Parameters:

QUANTITY|TAG - integer of a block number, or the string "latest"

Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns:

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

  • number: QUANTITY - the block number.

  • hash: DATA, 32 Bytes - hash of the block.

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

  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work.

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

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block.

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

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

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

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

  • difficulty: QUANTITY - integer of the difficulty for this block.

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

  • extraData: DATA - the β€œextra data” field of this block.

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

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

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

  • timestamp: QUANTITY - 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: Array - Array of uncle hashes.

Example:

// Request
curl  https://viction.blockpi.network/v1/rpc/your-rpc-key -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", true],"id":1}'

// Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "difficulty": "0x69",
        "extraData": "0xd88302030084746f6d6f88676f312e31372e33856c696e757800000000000000b1d7e6fd0b7b27227e95161a944f187ca6ff75cd2188ce09e6d9a81eec973e442d728c83466351e455cc6163fa8aad30b1421d17f4e74d234feca0f7155fc61900",
        "gasLimit": "0x32116200",
        "gasUsed": "0x0",
        "hash": "0x972794bb327a13710bb2f6f3ebed5dc1d88bf4079ba4def2ef7a0dcef9a74261",
        "logsBloom": "0x01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x41b11ae",
        "parentHash": "0x0bc66b5cd61bc9f27886720058d0c14e8ec495ab64c1c3c540ef8768134d309c",
        "penalties": "0x",
        "receiptsRoot": "0xbcd2a51669cdca54e5f28517bcd09ca95007951a7d7ec181cb3f361f783cde4a",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x351",
        "stateRoot": "0x7e8574656e91e36b2c2407055d8a0b623a942c669be042bc41b53d5c05e4b632",
        "timestamp": "0x64e6fea5",
        "totalDifficulty": "0x231d90772",
        "transactions": [
            {
                "blockHash": "0x972794bb327a13710bb2f6f3ebed5dc1d88bf4079ba4def2ef7a0dcef9a74261",
                "blockNumber": "0x41b11ae",
                "from": "0x1a65542cb18acfc9fdfe9098c215dfdcc73e8f9e",
                "gas": "0x2625a00",
                "gasPrice": "0x0",
                "hash": "0xc5b4d6979e82af27053a7c178895759ce77d536d22fe593a9587a06be1afeff8",
                "input": "0xd279eebfd852efdc89662a7655ff504847639042205edf379970b4c4d6627033a4b83a97a63b3a879373bc957b9634e62884604b6435f14901ec2db41bc24ce7",
                "nonce": "0x177ce6",
                "to": "0x0000000000000000000000000000000000000092",
                "transactionIndex": "0x0",
                "value": "0x0",
                "v": "0xd4",
                "r": "0x4929296d9afe83eeb3ff834a2bf29c426ef33b292ede0a645e88597633fcdf54",
                "s": "0x38c0b86f1441ba1cd098e1acd2671d2c10af64ff87c7da0ac5aab77dca29f89a"
            }
        ],
        "transactionsRoot": "0xff78a077bfbd1f7597982339992992ea62df6b3329daf84d014f0acbb5dbc4c0",
        "uncles": [],
        "validator": "0x30b1699f5f8e414d2ea949882d20fab5c2ed308f7a6c6d874030aa77c76f0b0c4636cba658cb3dbda4e5fcdb29b07e562f49df5cb9e5fe76723fb0221f27a34501",
        "validators": "0x"
    }
}

Last updated