From: Ardis Lu Date: Wed, 14 May 2025 05:44:53 +0000 (-0700) Subject: Add tests for Unichain X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=5ebca4757bd55bbdfc187ac359491efd7300452e;p=block-hash-calculator Add tests for Unichain --- diff --git a/calculate.test.js b/calculate.test.js index f983aee..ef97420 100644 --- a/calculate.test.js +++ b/calculate.test.js @@ -1108,4 +1108,78 @@ suite('Sonic Mainnet', { concurrency: true }, () => { }); deepStrictEqual(hash, '0x025bcc859f1ee37d75a0f07ec8fe1466c54715b4d74b39fc92fc911510d4cfc9'); }); +}); + +suite('Unichain', { concurrency: true }, () => { + test('Block number 0', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x3b9aca00", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x424544524f434b", + "gasLimit": "0x1c9c380", + "gasUsed": "0x0", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0x0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x24e", + "stateRoot": "0xf696bfdf37cad25bb64afb3ab462bff84f61829e2948bb6929cc250a67e54882", + "timestamp": "0x67291fc7", + "transactions": [], + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }); + deepStrictEqual(hash, '0x3425162ddf41a0a1f0106d67b71828c9a9577e6ddeb94e4f33d2cde1fdc3befe'); + }); + + test('Block number 16451358', { concurrency: true }, () => { + const { hash } = calculate({ + "baseFeePerGas": "0x579d", + "blobGasUsed": "0x0", + "difficulty": "0x0", + "excessBlobGas": "0x0", + "extraData": "0x00000000fa00000006", + "gasLimit": "0x1c9c380", + "gasUsed": "0x5cc5a3", + "logsBloom": "0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000008000000000000000010000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000001002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000", + "miner": "0x4200000000000000000000000000000000000011", + "mixHash": "0x0f11edc8195156ee5d50e9d788db77d7d9d9930878c0754522e98415f94157d5", + "nonce": "0x0000000000000000", + "number": "0xfb071e", + "parentBeaconBlockRoot": "0xf3d33d55f6b84441fd7389a8ab3d14a699d2661c4a1ecd56674c67c3ac9c57dc", + "parentHash": "0x914bcb1e7102e599629311b69a1f824bb9cb36b16d0e4f1f0844e2cd7e576471", + "receiptsRoot": "0xd3dcdbc24f8b2a2d00f16a5e5dc33f7aa0f6dfbe6f2edb9ea2e92ee949425d84", + "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "0x7f6", + "stateRoot": "0x5966f1bee03f984c8a6c93e828161ba7272b3a102a2938023b4d24d759e12919", + "timestamp": "0x682426e5", + "transactions": [ + "0x8411607a7c327d39fe4aded2b3aae331242c9de1c9e6da305af123076ce8c8da", + "0x058e82e1099abcd9f3188987b5d2d319074592c2f1927e63dff4d89137fde8e0", + "0xa56cfb5537caa6c61a98aa50ee36d6e030b206c904c67d8954ef7044fcd4ee87", + "0xdd9ee8f1a847c8e423d40818760ba7dc8da5c12cbed3c390163a58da5efbd5c1", + "0x07bed7a32670b3961617323302a14e65a6642f38921eaad7057937f89ca025da", + "0x3c645282e60b0fc66489954f9e641bde8989a9e6e211a6a4a19f0797a60fdc46", + "0x9384b27cd0b1557b842b976a5425cf13b2331debffdfef07136e67cdf4bda16f", + "0xb756fcf26eb3e82776f9d2cf17f49fc2c6b5219d38677e4d3cfb1514ae05a213", + "0x272ea81bf8a5f64002ebef1bb8b617bf2f1a267927b58120fe5e2765dadce445", + "0x6308d7868ba7fef41e56ca75e1ddf23aab851c81cb3337179f357842bbf71351" + ], + "transactionsRoot": "0x68e83a5edd84587cec28ad376d98bb93e90fb286fb3d9f39359845206201c31d", + "uncles": [], + "withdrawals": [], + "withdrawalsRoot": "0x964043199d74bde4513e06dec0c2780c5e254c52d061e7480fa86905812dda6e" + }); + deepStrictEqual(hash, '0x164e6287ac84b922bdecbd4c193b572dd7f1adbac5301e41ec99f9c2dc6b182e'); + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 5eaa76c..286a9f8 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@

Block Hash Calculator

GitHub -

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, and Sonic Mainnet.

+

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, and Unichain.