eth_getBlockByHash - Astar

Returns information about a block by block hash.

Parameters

  • Hash - Hash of the block
  • Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.
params: [
    '0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a', 
    true
]

Returns

object - A block object, or null when no block was found. The returned object has the following properties:

  • number - The block number of the requested block encoded as a hexadecimal string. null if pending.

  • hash - The block hash of the requested block. null if pending.

  • parenthash - Hash of the parent block.

  • nonce - Hash of the generated proof-of-work. null if pending.

  • sha3uncles - SHA3 of the uncles data in the block.

  • logsbloom - The bloom filter for the logs of the block. null if pending.

  • transactionsroot - The root of the transaction trie of the block.

  • stateroot - The root of the final state trie of the block.

  • receiptsroot - The root of the receipts trie of the block.

  • miner - The address of the beneficiary to whom the mining rewards were given.

  • difficulty - Integer of the difficulty for this block encoded as a hexadecimal string.

  • totaldifficulty - Integer of the total difficulty of the chain until this block encoded as a hexadecimal string.

  • extradata - The “extra data” field of this block.

  • size - The size of this block in bytes as an Integer value encoded as hexadecimal.

  • gaslimit - The maximum gas allowed in this block encoded as a hexadecimal string.

  • gasused - The total used gas by all transactions in this block encoded as a hexadecimal string.

  • timestamp - The unix timestamp for when the block was collated.

  • transactions - Array of transaction objects - please see eth_getTransactionByHash for exact shape.

  • uncles - Array of uncle hashes.

Request

curl https://eth-mainnet.g.alchemy.com/v2/${apiKey} \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_getBlockByHash","params":["0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a",false],"id":1,"jsonrpc":"2.0"}'
URL: https://eth-mainnet.g.alchemy.com/v2/your-api-key
RequestType: POST
Body: 
{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a", false],
    "id":0
}
// Setup: npm install alchemy-sdk
// Github: https://github.com/alchemyplatform/alchemy-sdk-js
import { Network, Alchemy } from "alchemy-sdk";

// 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(
    "0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a",
    false
  )
  .then(console.log);

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "number": "0xf8e3d7",
    "hash": "0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a",
    "transactions": [
      "0x501251dd9097bcba3074c7e699be2bc28a343228e321251342188a34e9e54871",
      "0x1e4009ac7b59a0a64fe3f42918185a160ce22ad666215fa182ea1d927a8e1a22",
      "0xa04bdde31cba595dbb6749b4b2f4c712119d1f40c94c402592c2922416dd08a1",
      "0xdc23dd5f6c6ba68d6e73227b5dda9ddd5168beb829fdc3b432ae5d1755022c3b",
      "0x67c6d7216f8a7acce412dcdecea36bc983e040d16f9a594f4f89d785d9b960a3",
      "0x457f0eaf34ac47ded9064b34c8b9277c13eb6bbf1486372f8d021c52cf9f3e0d",
      "0x96fdb2d418087efd71eed95e93c5f298dd497de02c17645932e8937bdb549c8e",
      "0xffe5c80b63f32de4f4f45574eef78c150d6cd175d737686b6fc1b986e62fb6ca",
      "0x8835b74a99a4c3fe85d9f279c218b4d0cca2cee98b036e4b9d8586b6cc9618be",
      "0x05c01c306cffb2ecc9253a8aad1684e91951f0c8fcf1c50a5fe646f6d370ecdb",
      "0x6d619935cf8d20d8815cc428a13cee5fb07516f9f969e9232065e18c533fca4e",
      "0x0cb567356701cd3fcfbabe2b94d3558b9f4ec05e993f94f60f71df3225f52bf2",
      "0xd5fe8a26d9ba05b5f1acc0f897d925d1347477d76e338b6de26d5376f1a6d5fd",
      "0x964c91eda0e40c47f876968088c5a15f76a04d0e407d195a017c16bc184f7b32",
      "0x3d98f1ab95b0392e7937692da71cd3a78e564c03f02441079ffcff0f4ea66596",
      "0x91879b45d4be904960aa4a306ab69ef1093e1dbbf1629cdac64b9dcec84c8563",
      "0x984e3d3aefd00ef6d80e904a67aa7ad5be9f360fae67134ab62bd7ad22d39b45",
      "0x2217d2980b61f4f9fc261b2b1aa9204f488f2380e617c2ff9e91ee017bdc8338",
      "0x753612ae9ea6b78ffde78d02b900f45162b64daeebac77365fce2eefb3010712",
      "0xf3d63f3fbe39fe299df53e4f79f6563f88240baa4b2c03f7fb5afadb2d1ea7b2",
      "0x34065fc0f0d0348a7682179f45ca99bb3ada4443b6e8b518fb6981de64d8dcae",
      "0x44980c7a6e5b741d0104ac469a2600352fe112347ae0af6b046d434877e63ff6",
      "0x81fe70a281f453cb3dfd6772c5c95bd3bf887d4df9d4fd65040b2dae161a790a",
      "0xba1894fd141b711fab3cbdf39d9f37f99e56ec156f4cb7009d7e91c29add88fd",
      "0x6638f7136b2a0049deae40173d2e30b0ec0458572060bf4e0fbbbac93f2f9eeb",
      "0x473d73e7733ff48a75c4f5e46e0775fabd6c071c65b7b695fc06c3944e2c133d",
      "0x2e7c3eb520250471cfd1fe78a42358f361ce10bbea779491a74e94a819338835",
      "0xb71509c9e40700024080db1ae47d0758602e7945e81d062720975d9af8f324b8",
      "0x291da6e412f4089e975863a549feb94afffd690367fcbf05a3d684d492fde084",
      "0x0068510c2323c93f02297e14208cd6afdb961c4f038b487fb5c3d305bbd7269e",
      "0xcde26d0a20a4bd5f8dd1f0b04c6853db7e565bfcfb3eafa3969a7f68fd31630e",
      "0x85ae5f147cee6e69cff58696934dc679a92f37824147041855fe1c8ad4ac56d1",
      "0xf09bce5b2fcdc138eda773a8fff72e74e7f4532a9032ecb5e8ce64fab19c96c4",
      "0xfb05e26b190200b65d5968f0c89912a93856fa65b4f17a0b71cca17a8f4c22e4",
      "0x5aa199dc76f005326fa65fe4613439febd3e3c139ba088c13681abee5196fca8",
      "0x8078b675486a3869f15d4c310d54b12e38fee5a6c5bb157fed87ec66d48f0191",
      "0xa5ef1aaba1eb538760acfbd112af97834ad91dd4375d044278817cdd2bb46ae6",
      "0x2a9b9393d163278644cfd60fd5d74a6e2fff9ce633048408494d9e7ad1d83cd6",
      "0xc7ae40a9f4204fa8bf6e5bfc961d088fd232c9ff34a329588c9f27cd8acaa271",
      "0xd4dc61819dc3cd5bb15215e13bfb92ebad94328fb24080e6a903c7e3c12b0574",
      "0xd9fa7d1960d8f7cf8fdaf7f53931f8feb5313a4173459272dba61934129e2787",
      "0xbfc3285f4c7158eb87eebfae5ca1bbc09bccfb8fa5ae2f453ffbf1ecd3876bb0",
      "0xe4bb733e809419c55ac54036bd4891c35f85b57183942a18f4ba0c1f635116e3",
      "0x3d8caefc50b9f978febb0083cf922993724c3cf73d4411664e65e202d496ee3e",
      "0x86244c4f0a6a69179c1f4631431248f3b758e1be1bdf5f6eaebc932896b95d9c",
      "0x99c1f2edb22e9f03ac45a67dda3200e85de62301b4eb7804bb0d9fca14726a30",
      "0xda998bfd6e231cc13b0749dcd5ee62f8592a1e82adb5ca795b9d6c94f40f9215",
      "0x96611cf04740f7e4cc662010e971968a74d237b8bb0e33c2c0ae8e4bb23ed98e",
      "0x2825bea80bb91d00d0a52e48aa4880c2a1a862f811713625b865fffa7b614c94",
      "0x0f7813db691d55228df91999b43dd7872adbc77e9d1480c78b84530aa7b84c82",
      "0x1d99a6104c9f96663ae286f4cc3fd07196fe722007048b9bd081443d32b20cd1",
      "0xd86fc2f8a3ec3dbf650c78e0915820ac920b199f977f3fd28116deb057017c69",
      "0x3ecb08f0aa2d9b22c36dc7715041cbf0b21c5cb943dde28c7406c3e9365bdd9a",
      "0xda589822e8da50bd4a3524efd66f92cf6a523d12c4c208c5247d8b667a06cb59",
      "0x0e38230dbb0cc421f57a798e6eaef18e3c9ea921f6041817ce0e1a40c54df9bb",
      "0x847209fc78834106ae095d1b8fc8a4794740fcfb0b52e29df6dba8a914ef4879",
      "0x52555075e33f1a4fe8fd3ee0fb35218fc33804d0aeb048ced4b63a83f10d4cf6",
      "0xe32a6e4a2547d6761c333bc2dc768eb5d22861beb32f1faee345c7ac07312132",
      "0xc06306cc8f28f1240f60c4af102d0cd591e32055fb3d95ae13742a103e975237",
      "0xb7cc2299dadbdf0bfa4b5951aeb57e21d9e699969540790db4186f3c8ff34713",
      "0x51252c6b4a33a8abc320861c8b31cf6c682be159a7688071c5a1b1845ea2d131",
      "0xeacda7af240a974f9e2dccb95be89f3aebaf7d7546734045d5749d78dce86e3d",
      "0xec79149b4c959cf1a073fb6fde78da92a84dfce63cb122069867cbaf14203bc0",
      "0x2d28f71f84955c7ab081469ea52cba0e4140c7ca1a84283a468a2181a59668df",
      "0x4be52f902c3e1760d74149b66804f690518fbfa1fd9477af031e0ff4a8e1e92a",
      "0x76a73093ad523a6bd8e5a05372bbbb5ca335284ddb9a02bce1a4b9451e89f515",
      "0x4caf333ad965bb9e6863cd88609869b7b781188745206f9441ef98f68fa4a736",
      "0x31aec7231e2f5ea7509bda9fec1edbfbb37e36fc4e1f650e07192bfc7fb58183",
      "0x3cbb550b047f1685cabe67d2401b0693c826200126bc5043dc4d3d1126d862f1",
      "0x3f63a806ad40f85471381976b09823fd5dea26ee80c28d562be12518880f054a",
      "0x0a0e7d17d6f87b12b9a4d46239320eaa50ad90facd994a779904ac3c888e5de8",
      "0x5d37ba0da5eff8cd00de97b06ecf3da17a6076ddaa644ea701071008152c148d",
      "0x217e6f62317d9355048bfb67488618bf626c8ab0765c0d71b3e56e431851c7e5",
      "0x79c4dd1fe23ed52b40cb303bcf2d5d840da1faeb7b58d31d4ff403b5f7695e95",
      "0x9ffdf32a79a404983125f3f8333f43cc72fa6a87fe2ffd6d288b910df036787a",
      "0x07484072182d16c9b10c92f53a889883d5c5134f76afed9f66f3e599bab4b802",
      "0xce29ba3c39b8ee50f27c421fe8660d30cf4da08ba9dab79951a1e02a866d2b27",
      "0x34a32e8f9b25b0f52e10fdf850a481e0c3d9830b1cff31d3599411b23252834a",
      "0xeb4dd580dda01cf018fa967e32dd3e60c23e4fed465fdc8216b38bade828963d",
      "0x2aff5890d2e31e64f09f02b245bd3b545373e54bd429b8636ca339df745f4712",
      "0x6419ee8534eddd330e3853c3304eb6a9b2692957c0f58070c97bd12f6603dd40",
      "0x4a480419b3e23ea287022c9561273ef1784d4e36535af6be85e5a2c3acdf807d",
      "0xae02a6b666f763e3918ded3519f9128c5c69e93558d3111c8055a5adef3af714",
      "0xc0d079d0efb570fb48d87526a768d4204aeffd0f0e5b236a49a028e973afd60c",
      "0x3bb88a0c838d23a5ea9fa44989980200f8d5591d3215d0a3a4861bd79ea9c3b0",
      "0x3477a50f3acd568bbf028a0b7f751dbfe6e8ad79c39c6e226596744257f331b1",
      "0x61d08f9f2d34a0329d530c4aafdef73c3b4419211a394d36bf9c14de1e0f07d0",
      "0x3281da562e8f332d69aeb8660900bd3302a2e62a85414bc1e7bba7dd6b0150c8",
      "0xa931886fdec0d55851ccd02af9c24da73894e2e27a6d73bd975489090fd9dac7",
      "0x1d67661a9a3e749796a4c01f76a8d8eef05d06e1fcbc629adf4bd867bafb8823",
      "0x53fdc5f70a57700a75762659e99a7c911db219b484d3f198ed16b7b370b4c14c",
      "0x8fe769d0133f799fbfce3a1f03bb197f1e979b598be0df258ecd594af8644832",
      "0xa57337b3b79c7c662425860ae5c5a49dbeef9d67aab8043f6fc3c4e2eb3ebfd5",
      "0xcdc7a687f8a8f68ca71ee95fece932bc294064b2d6d291c78df8f7a6e07ef103"
    ],
    "difficulty": "0x0",
    "extraData": "0x4d616465206f6e20746865206d6f6f6e20627920426c6f636b6e6174697665",
    "gasLimit": "0x1c9c380",
    "gasUsed": "0x1699c83",
    "logsBloom": "0x1c243c7f96541e048c0cc481b0ac333461c12804d880990dfe1980c41c2a49aca538425bc4030022419e3fe80ce6a1819e0c8cbccaec3511034bc7c75a6424b148b3809049eb1a8b6a088bc9629304fa84666835856e23084c00b81191002810d6710c00834290e38544008cba206a7bf4891881609a144000d000b00c896c90b21805320683810d20c90c0810064069f4001911c10a0409400c615e0a34316d8b29c9d4298d7b191a6819811f118c01801021715096405280cbaa4326b1460ca46c66432390d05001c0341a2c82305750c027f4d2ae10971254a94321a9f2132090a00e1f0110b18567920180818fc6b1100e8af2e84040a0408c144015d213",
    "miner": "0xbaf6dc2e647aeb6f510f9e318856a1bcd66c5e19",
    "mixHash": "0xe8ad228f6a0f7c79bd2f8273f717a06f47b271f41d748718699bb966f710fc9b",
    "nonce": "0x0000000000000000",
    "parentHash": "0xbef5b480684b03c0c3ff58deec762cf6650de5b71da431e85d908cca221a10b2",
    "receiptsRoot": "0xce65ddb737ae93370c63077c742ba190d917fbe0876a9a1f9d793d5b125fa04a",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x9684",
    "stateRoot": "0xc57cf792e5cdff63c582e03084a7d21748196f1c6a97171d2b4e07417fa5df2e",
    "timestamp": "0x63b15d3b",
    "totalDifficulty": "0xc70d815d562d3cfa955",
    "transactionsRoot": "0x0cf6abfa0c1f1f8e031dad7a314c5b130099dcf340d39d840accc778cb623f64",
    "uncles": [],
    "baseFeePerGas": "0x2f99b1dd0"
  }
}

📘

NOTE

You can test out this method live from your browser using our composer tool.

Language
ReadMe