API ReferenceEVM RPCeth_getBlockByHashVersion: 2.2On this pageeth_getBlockByHashGet Block By Hash​POSThttps://site1.moralis-nodes.com/:chain/:apiKeyReturns information about a block by hash. Optionally, it can also return the full transaction objects if the second parameter is set to true; otherwise, only the transaction hashes are returned.NotePlease refer to RPC schema page for more details on the RPC params and RPC response definitions of the RPC method.PATH PARAMSchainstringrequiredThe blockchain to interact with.ethholeskypolygonamoybscbsc testnetarbitrumarbitrum sepoliaoptimismoptimism testnetbasebase sepoliaapiKeystringrequiredYour API key for authentication.BODY PARAMjsonrpcstringrequiredJSON-RPC version (typically 2.0).idnumberrequiredThe request identifier.methodstringrequiredThe JSON-RPC method being invoked.paramsrpcArrayrequiredParameters for the block query, including the block hash and a boolean indicating whether to return full transaction objects.[ "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f", true ]Responses200 Returns detailed information about the requested block.objectTest Live APINode.jsPythoncURLGoPHP// Dependencies to install:// $ npm install node-fetch --save// add "type": "module" to package.jsonimport fetch from 'node-fetch';const options = { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' }, body: JSON.stringify({ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByHash" })};fetch('https://site1.moralis-nodes.com/eth/YOUR_API_KEY', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));# Dependencies to install:# $ python -m pip install requestsimport requestsurl = "https://site1.moralis-nodes.com/eth/YOUR_API_KEY"payload = { "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByHash"}headers = { "Accept": "application/json", "Content-Type": "application/json"}response = requests.request("POST", url, json=payload, headers=headers)print(response.text)curl --request POST \ --url 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByHash"}'package mainimport ( "fmt" "strings" "net/http" "io/ioutil")func main() { url := "https://site1.moralis-nodes.com/eth/YOUR_API_KEY" payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getBlockByHash\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('POST', 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY', [ 'body' => '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByHash"}', 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ],]);echo $response->getBody();Response Example200 Returns detailed information about the requested block.{ "jsonrpc": "2.0", "id": 1, "result": { "number": "0x10d4f", "hash": "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f", "transactions": [ { "blockHash": "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f", "blockNumber": "0x15df", "from": "0x354f3eD35Ae1a182aF933b793e49d3c86CFcDc63", "to": "0x354f3eD35Ae1a182aF933b793e49d3c86CFcDc63" } ], "parentHash": "0xd584c5509e3a3d4b2d3bbde4c8e8c0adec7f5c560e9d42b8f12f3c039dd40e92", "nonce": "0x0000000000000000", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "logsBloom": "0x00000000...", "transactionsRoot": "0x3a1b2c...", "stateRoot": "0xf1132b...", "receiptsRoot": "0x140f3e...", "miner": "0x4e65fda2159562a496f9f3522f89122a3088497a", "difficulty": "0xffffffff", "totalDifficulty": "0x222e4800", "extraData": "0xd783010703846765746887676f312e392e34856c696e7578", "size": "0x280", "gasLimit": "0x47e7c4", "gasUsed": "0x45f3", "timestamp": "0x5a5b8d80", "uncles": [ "0x1602e3..." ] }}