Join AWS, Dust Labs & OrangeDAO at QuickPitch. Win $80k — Apply Today.
The API credit value for this method is 2 . To learn more about API credits and each method's value, visit the API Credits page.
Parameters:
Returns:
baseFeePerGas - (optional) A string of the base fee encoded in hexadecimal format. Please note that this response field will not be included in a block requested before the EIP-1559 upgrade
difficulty - The integer of the difficulty for this block encoded as a hexadecimal
extraData - The “extra data” field of this block
gasLimit - The maximum gas allowed in this block encoded as a hexadecimal
gasUsed - The total used gas by all transactions in this block encoded as a hexadecimal
hash - The block hash of the requested block. null if pending
logsBloom - The bloom filter for the logs of the block. null if pending
miner - The address of the beneficiary to whom the mining rewards were given
mixHash - A string of a 256-bit hash encoded as a hexadecimal
nonce - The hash of the generated proof-of-work. null if pending
number - The block number of the requested block encoded as a hexadecimal. null if pending
parentHash - The hash of the parent block
receiptsRoot - The root of the receipts trie of the block
sha3Uncles - The SHA3 of the uncles data in the block
size - The size of this block in bytes as an Integer value encoded as hexadecimal
stateRoot - The root of the final state trie of the block
timestamp - The unix timestamp for when the block was collated
totalDifficulty - The integer of the total difficulty of the chain until this block encoded as a hexadecimal
transactions - An array of transaction objects - please see eth_getTransactionByHash for exact shape
transactionsRoot - The root of the transaction trie of the block
uncles - An array of uncle hashes
Code Examples:
require "uri" require "json" require "net/http" url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request.body = JSON.dump({ "method": "eth_getBlockByHash", "params": [ "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b", false ], "id": 1, "jsonrpc": "2.0" }) response = https.request(request) puts response.read_body
from web3 import Web3, HTTPProvider w3 = Web3(HTTPProvider('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/')) print(w3.eth.get_block('0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b',false))
require 'ethereum.rb' client = Ethereum::HttpClient.new('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/') blockData = client.eth_get_block_by_hash('0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b',false) puts blockData["result"]
const ethers = require("ethers"); (async () => { const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"); const blockData = await provider.getBlock( "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b", false ); console.log(blockData); })();
import requests import json url = "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/" payload = json.dumps({ "method": "eth_getBlockByHash", "params": [ "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b", False ], "id": 1, "jsonrpc": "2.0" }) headers = { 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
curl http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"method":"eth_getBlockByHash","params":["0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b",false],"id":1,"jsonrpc":"2.0"}'
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ "method": "eth_getBlockByHash", "params": [ "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b", false ], "id": 1, "jsonrpc": "2.0" }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));