API Reference

eth_getBlockByHash - Xlayer

Xlayer API - Returns information about a block by hash.

Parameters

  • DATA, 32 Bytes - Hash of a block.
  • Boolean - If true it returns the full transaction objects, if false it returns only the hashes of the transactions.
params: [
	"0x1b1d1e5183b00a1ccbc6a28ed44df6db156768ad167c4c6491402a0ccbc10bcc",
	true,
];

Returns

Object - A block object with the following fields, or null when no block was found:
number: QUANTITY - the block number. null when its pending block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.
  • parentHash: DATA, 32 Bytes - hash of the parent block.
  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.
  • 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. null when its pending 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://xlayer-mainnet.unifra.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x1b1d1e5183b00a1ccbc6a28ed44df6db156768ad167c4c6491402a0ccbc10bcc", true],"id":0}'
URL: https://xlayer-mainnet.unifra.io/v1/your-api-key
RequestType: POST
Body:
{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0x1b1d1e5183b00a1ccbc6a28ed44df6db156768ad167c4c6491402a0ccbc10bcc", true],
    "id":0
}

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "difficulty": "0x0",
    "extraData": "0x",
    "gasLimit": "0x4000000000000",
    "gasUsed": "0x0",
    "hash": "0x1b1d1e5183b00a1ccbc6a28ed44df6db156768ad167c4c6491402a0ccbc10bcc",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0xaf9d27ffe4d51ed54ac8eec78f2785d7e11e5ab1",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "number": "0x1b4",
    "parentHash": "0x7164f74600eb2f5a97b80d076a59d8c8e2d084991951a21188914aae6732b248",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x202",
    "stateRoot": "0x1204888a4f629eee9b5bece2952c45b8ba6657f0a4448c17e6d0054624bc2030",
    "timestamp": "0x66085f9d",
    "totalDifficulty": "0x0",
    "transactions": [],
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": []
  }
}
🚧

Try API with your API KEY.

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