<a href="https://github.com/ardislu/block-hash-calculator/">GitHub</a>
<p>Enter a block number and a JSON-RPC provider below to recalculate the block's hash from its header fields. Known supported networks: Ethereum, Polygon PoS, BNB Chain, OP Mainnet, Base, Arbitrum One, Linea, Scroll, Blast, Mantle, Avalanche C-Chain, ZKsync Era, Ink Mainnet, Sonic Mainnet, Unichain, World Chain, Soneium, Zircuit Mainnet, and Taiko Alethia.</p>
<form>
- <label for="num">Block number</label>
- <input id="num" name="num" type="number" min="0" placeholder="12345678" required>
+ <label for="num">Block number (empty value will default to latest block)</label>
+ <input id="num" name="num" type="number" min="0" placeholder="12345678">
<label for="rpc">JSON-RPC</label>
<input id="rpc" name="rpc" type="url" placeholder="https://ethereum-rpc.publicnode.com" value="https://ethereum-rpc.publicnode.com" required>
jsonrpc: '2.0',
id: 1,
method: 'eth_getBlockByNumber',
- params: [`0x${BigInt(num).toString(16)}`, false]
+ params: [num === '' ? 'latest' : `0x${BigInt(num).toString(16)}`, false]
})
}).then(r => r.json()).catch(e => e);