eth_getBlockByHash

Returns information about a block by block 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: [
    '0x02b853cf50bc1c335b70790f93d5a390a35a166bea9c895e685cc866e4961cae',
    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.

Request

curl https://eth-mainnet.g.alchemy.com/v2/${apiKey} \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x46c76980ad1ca32698fa0b81601d4e1dfa26b7b43c6106134545d0e4e0b7499f", true],"id":0}'
URL: https://eth-mainnet.g.alchemy.com/v2/your-api-key
RequestType: POST
Body: 
{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0x02b853cf50bc1c335b70790f93d5a390a35a166bea9c895e685cc866e4961cae", true],
    "id":0
}
// Optional config object, but defaults to demo api-key and eth-mainnet.
const settings = {
  apiKey: "demo", // Replace with your Alchemy API Key.
  network: Network.ETH_MAINNET, // Replace with your network.
};
const alchemy = new Alchemy(settings);

alchemy.core
  .getBlock(
    "0x92fc42b9642023f2ee2e88094df80ce87e15d91afa812fef383e6e5cd96e2ed3"
  )
  .then(console.log);

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "size": "0x452f",
    "baseFeePerGas": "0x1453a72791",
    "stateRoot": "0x40195b50817adcb365b0ee25c40bed891f3b819b74bbbafb2ab0c86db5cddb25",
    "timestamp": "0x62e2b9bb",
    "transactions": [
      "0x328e5ef22e20957f415d2e3e8220be1cfc5b0d1b7a672d9dc7c350b7834cf332",
      "0xf1ef4f8dd6284592883b288db9e18b030d5bee72f277059d6340f1bdb9424393",
      "0xfafb3561c31cbda9ae4a09612a2e5a4d27cbc06e2bb8c2bbb91f8a99a4588e5e",
      "0x1bd0dd1a404e840707e6e806f7a4a9e4d39c5ce441e0c5139b5cb8051b54af9d",
      "0x7c2ea2d34edf58fa9de37882a51afafd4f6c57af9b1df8591c0fd6f90131c50b",
      "0xd8d758a8fdca924ef4c368d823ea744d15155dd776ab3395453b3fee4b3d8300",
      "0x715ad233216ac223920f4cb60de9c0ef5d2b02da850953c19bd1cc4e0129a7ae",
      "0xe4904ab4fb2ae94cd461aaadc174678e66ffb60815c4c9d33561be17e3cb6995",
      "0xcd547b77c3d02b0c7ced712714620688d82aefd72028c6ff468b73d86329bc19",
      "0xd5b5be006773fe025fa7c0c8c365887b3de5b625c1c4bde8a4fa031bc741404b",
      "0xe27347cd7b1f15c8921230fc81b549425972dd39c581c698f5a9b15198b5f9b8",
      "0x0cbd379444c6f255c74d8df7b35ce73710ec2243281560a04ef55151d892f9f0",
      "0x833e67b3513f3c67bfd4d53af2f313cbef0f8caf2ebaa65eda4182478d03ed64",
      "0xa620dfacc7787f18511875bfba960d9c99715252f682c5efaee6dc3250e8060f",
      "0x63a1baf6e501d8322b612e920f4d7bc4bb1dc5fd5d858418a8a330c2f4de9708",
      "0x378b9f9a89db1ac9b34b782ad6817f4ddcf0680e8d4ab5f97b0844540c3f0d33",
      "0xedc04f6b9f75e8de3253dade925c1394389e617b05062678a07d268ebef05d77",
      "0x2c5d9ccb9836af7f1da88547369d2cb3b673fd9f9d593aa343f6b876b6c9f81d",
      "0xdf9a001e4e2ee42e5cf1f579226d1b87ea017afe4c70195f29efffeda3e6bc85",
      "0x5d8be2c37977c8afd2e91af1ee3a9dd3aeb59bce5a73222cfb3bebdfa7e8f456",
      "0x52b521496e9e4bff72ceeb6fcaac8e50465eb3c7431e60412267351cd4428555",
      "0x59222c1358138a1569ec19ea58994ad867a834851b4c2c458077af9f7f553612",
      "0x3ea4163f464b9a9459a4e517cf77d6bb38d4344036dc568c3be316d7ba31afcd",
      "0x5058ccf0bb297bf34de68be61a222c607bc0f801baa0586dd7336d037503bac1",
      "0xb31fc494d3de33c300fac32238dd8d490884071a428e1c834df2a8fb3f769088",
      "0xd6063edf1bc9d90896484f85f6ce7669bbee2fada36fce0073be72f1d96a10da",
      "0xfd7ed105cd0b110e70f8a26f50686a5ca9758bab402dd6f2e23ea5fab6d7ffc0",
      "0x7a3e0f9ba4da388c2b2f6c4c6d324db2a363acabebccedfc67ddaa4b3780eb4d",
      "0x238a76f606f3e7228d3028c0f11db82bfafba93c013a9a6da31b90d747ad6f4d",
      "0x8d1b6bc6b94141f04c2d63ae92b5f2a5ffa40091360c7ea8b6d7f83363b361eb",
      "0xe417b7f00ad4fb74188fcfbddd1f5452924ebde0a3b41d7464a57eeafcbefd6c",
      "0x807215d5311f9287f86eb19ff41413f0f46b42aa851b718f89317cbcad968c78",
      "0xcca8cc0bbc62434ae88af539c120604ccec0d6aaa77f47b8d9898a833f80f84e",
      "0xc626970a875c296e676be2a267bb1571ed4c65580e9f88f45508e9bee30ec919",
      "0x63454ea45147e905a116f9ed00a3606c430f1984eb8f9e329be1f749331b6ebc",
      "0x7147bd8ba4c128a4cc6622986128035de53a45a4fc4583bbb8fcafb6fe1b53c7",
      "0x7660e2332e39a97d230d75bd4284211301209ccadc72a8479f9c6972c051aca4",
      "0xf24eca29b163e1d17ff038563ba4a0f291c4aa92aeef7f2eaaa834fc5d767d5f",
      "0xaf4076b6e4f3ecadd37f9d767d8ef1c9a632056a464e0bc85d42713583931e12",
      "0x55e84642d9bd00528bea6775fb19be44372771f10707dc90023433b3f1e53b9e",
      "0x61e89cc7b426560d4899233381d313a5bdf613d3ff117b9771182b4b6804c379",
      "0xf3e8e892f1428b82175440b3b034269476178cbef3e2371fbc0951cd92ba859f",
      "0x29cb67e8f568e8bf53d01d6e080f99d4562397d9784202a4d11239fe72f054d5",
      "0x7d92657f968db07deb3baf1a8f30b395a3fec59b211a49dcd8d07887b433cb4a",
      "0x8ebad026904c0b7df3d13279c83b8a586e37b16cf4862b1dd5467e45276742fd",
      "0x5eb74c69d2dd9832fef4f74604c9f6643ac8e99f0e84043bbbd7467bf7e3b4bc",
      "0xf8ee4cf8bbe3ef23e83e3fd24295c8daa7d4965a05ec3fb5c8bea00c7a68b67d",
      "0x418647feb1adbabe46223dc0918a28fe1b33aab93359e8441f0c328a46f92ce7",
      "0x3df6794fa104684ce4e7b030b9f56e1471d82dac17b97ef6ab13c7d5b68266cd",
      "0x7719fc34a46b4e122567ba701632fc26b2647fa53ebb8ca11d36eb2a9255d6d5",
      "0x188509a2c53baf255b1801fc67eb9c00b4a45f5918d04259b3c10746b62636eb",
      "0x9aad2d9a4a7cb2cb2d4b828b667f91942569288e568c9be93b6bcd5c6b8da19f",
      "0xb2df7fde6cc593b5538dcc8e6977043397f0238e56121e1e5f05e25500f4d5e7",
      "0x3b1229f49beed698821396e3c99d12ad02f24b85152bc45ff5bcbd55c077fabd",
      "0x48354a24315293453ae05a07d4c4a2e2a5220ce35894e6a871dd8003de93ef7c",
      "0xc2f3e2a2f87bb49ab4faab239700d1af905d1f257c238e55846ce5af49b9ed98",
      "0x38d51fa0b3b800939647f724655a6196a38f4f99485cec0cc84929e3276fd6ce",
      "0xcdf2ea836313cf956d92fa1af02c928baf1b4111e1b36d80df7a6ec3cfc36cc6",
      "0x701d82d18d1caebe675ac00d50f57bf14ba34b8ba2286fdb922d37e942d7a378",
      "0xd1b8cf42f221e15ad39b40d747fd386b01cd153df799aaa2f42db90823c745cb",
      "0xb88efa7d2debea6b7c28733aeb4cdc27730bfd24537ee977545fd72d14c83281",
      "0xe81a7550e47f851255d1e89c564749a42308631acccc390f16dc224f5e48f1d3",
      "0xca6ce9a17c9ab1186848b19688dd275d26fbddcb2c3bb14331e4eaab5e485a7e"
    ],
    "difficulty": "0x2aacd2da384605",
    "logsBloom": "0xa2a000180108080098c0101180000021c0042404b4a000a501214400040045090104010824c0e1208200190200400181422184202a052a86c40100c2b02428000000800a28019a2c3a824d1804214020041110080268040328824cc48104c12196820000028208409000402a800008c000000c080a090412230105318149000023c09240ae220328a048014000462420010001811180103a403006600a1541809a0a81613402e0802c40c0810004000000488a454122200268200026200811004240d022100040001104482080021060080800400c4e009c06011982203028000032240804922600a00410006010088702402110080800482040080014a4d8e0",
    "totalDifficulty": "0xba8d00b6f0044a1d70d",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "parentHash": "0x443f39a067ff28cfcc2998fb6fa750132241725d6edf1f842043350cc147eb32",
    "hash": "0x46c76980ad1ca32698fa0b81601d4e1dfa26b7b43c6106134545d0e4e0b7499f",
    "extraData": "0x617369612d65617374322d39",
    "gasUsed": "0x423be4",
    "transactionsRoot": "0xc0d602568624142967f057720799cf1c4640b1fc2575200e6946d8301a420805",
    "gasLimit": "0x1ca35ef",
    "number": "0xe86c49",
    "miner": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
    "uncles": [],
    "nonce": "0x4eefd7fa066b0984",
    "mixHash": "0xe8896955193ffcb82edfeea4f75d36cab5bd7ffe640efdca6862a270e691555d",
    "receiptsRoot": "0xac5c6fd00b90f76f3e6cd3f749c022d10b4834a14d614557cf20c0362449ded7"
  }
}

🚧

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

Language