From 27fe78948c6aee3b47f37607dd7e8685f3ee1e8e Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 20 May 2024 18:37:53 -0700 Subject: [PATCH] Add support for Avalanche C-Chain --- index.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 68d2455..6cf87f1 100644 --- a/index.html +++ b/index.html @@ -89,7 +89,7 @@

Block Hash Calculator

-

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, BNB Chain, Optimism, and Base.

+

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, BNB Chain, Optimism, Base, and Avalanche C-Chain.

@@ -147,12 +147,25 @@ BigInt(block.nonce) ]; + // Avalanche Apricot Phase 1 (no specification) + // https://github.com/ava-labs/coreth/blob/master/README.md#block-format + if (block?.extDataHash) { + header.push(block.extDataHash); + } + // London hard fork // https://eips.ethereum.org/EIPS/eip-1559#block-hash-changing if (block?.baseFeePerGas) { header.push(BigInt(block.baseFeePerGas)); } + // Avalanche Apricot Phase 4 (no specification) + // https://github.com/ava-labs/coreth/blob/f4aa91c7af01cc27b95dfc0086fd92a8174cf67c/core/types/block.go#L99 + if (block?.extDataGasUsed) { + header.push(BigInt(block.extDataGasUsed)); + header.push(BigInt(block.blockGasCost)); + } + // Paris hard fork // https://eips.ethereum.org/EIPS/eip-3675#block-structure if (block.nonce === '0x0000000000000000') { -- 2.47.3