]> git.ardis.lu - block-hash-calculator/commitdiff
Add tests for World Chain
authorArdis Lu <ardisglu@gmail.com>
Sat, 17 May 2025 06:14:28 +0000 (23:14 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sat, 17 May 2025 06:14:28 +0000 (23:14 -0700)
calculate.test.js
index.html

index ef974201e5a11a62828dbc2de40ccd3cd1c0e46e..bf9288eecdac0c8c1f176777fc65710ec0f21811 100644 (file)
@@ -1182,4 +1182,65 @@ suite('Unichain', { concurrency: true }, () => {
     });
     deepStrictEqual(hash, '0x164e6287ac84b922bdecbd4c193b572dd7f1adbac5301e41ec99f9c2dc6b182e');
   });
+});
+
+suite('World Chain', { concurrency: true }, () => {
+  test('Block number 0', { concurrency: true }, () => {
+    const { hash } = calculate({
+      "baseFeePerGas": "0x3b9aca00",
+      "blobGasUsed": "0x0",
+      "difficulty": "0x0",
+      "excessBlobGas": "0x0",
+      "extraData": "0x424544524f434b",
+      "gasLimit": "0x5f5e100",
+      "gasUsed": "0x0",
+      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+      "miner": "0x4200000000000000000000000000000000000011",
+      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "nonce": "0x0000000000000000",
+      "number": "0x0",
+      "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+      "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
+      "size": "0x24e",
+      "stateRoot": "0xf52039b756cebe8f83712e49ee012e8e2b2eb6b63fecb9c1b2dff8128ed40725",
+      "timestamp": "0x667afad7",
+      "transactions": [],
+      "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+      "uncles": [],
+      "withdrawals": [],
+      "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
+    });
+    deepStrictEqual(hash, '0x70d316d2e0973b62332ba2e9768dd7854298d7ffe77f0409ffdb8d859f2d3fa3');
+  });
+
+  test('Block number 14063338', { concurrency: true }, () => {
+    const { hash } = calculate({
+      "baseFeePerGas": "0x3b6",
+      "blobGasUsed": "0x0",
+      "difficulty": "0x0",
+      "excessBlobGas": "0x0",
+      "extraData": "0x00000000fa00000002",
+      "gasLimit": "0x1f78a40",
+      "gasUsed": "0xa39da2",
+      "logsBloom": "0x41000802c050510082d102948c4044719e6021100767002b208481205cc89824c25a205146c8810980e006918851007014014d04c1066200816d22c01824325b240a01600100000c88c0400c82e14846f2424c093100082d272b8041804ba084100944010e0b7855640000e848801da4642d20630206a0c61180615a633a1a42100b8130a24a100802117038090208c244004a810561401aa1396822840105924a1030000c29308d00c1044003008c6802dcd041040444001d0a03018480648b0d23e04ea206295505094d0091c218400d02b400a22c71501020d410200032c0f074750203090122040aec086100010a0853198a14c02c640cbdc4081039040c",
+      "miner": "0x4200000000000000000000000000000000000011",
+      "mixHash": "0x5502ec47d27268b1ee29a88a32139b40d123013c6f67dbf3b7c656034ec3ed60",
+      "nonce": "0x0000000000000000",
+      "number": "0xd696ea",
+      "parentBeaconBlockRoot": "0xe672fd37e3b8377669600011161d4ede22df6ed3585e7c6f8ed75f4b21d71920",
+      "parentHash": "0xea40f77122f02c45474ede3010009416b46268854091f9780b516fce00da883f",
+      "receiptsRoot": "0x38d155f16fb01d1d0b94d0a256b784a29878e4a1659981d8ce0936bc4ead4fb9",
+      "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
+      "size": "0xb070",
+      "stateRoot": "0x49850687d51e785d1d82de126833aa2a69699cbb14dc087219e190c6bff562f3",
+      "timestamp": "0x682828ab",
+      "transactionsRoot": "0x6902c80159b31aa78c72c576fe1ffdfab846144505261d160a67494945e9eaed",
+      "uncles": [],
+      "withdrawals": [],
+      "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
+    });
+    deepStrictEqual(hash, '0x4a40e4350106d48231b475496346a8499be140d4e911758e83711fac543ee46d');
+  });
 });
\ No newline at end of file
index 286a9f892ea63021735997c4ad034ec2ff41414f..4ef22e89ee13f4d7aa74a418b499075a482e7245 100644 (file)
@@ -25,7 +25,7 @@
   <main>
     <h1>Block Hash Calculator</h1>
     <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, and Unichain.</p>
+    <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, and World Chain.</p>
     <form>
       <label for="num">Block number</label>
       <input id="num" name="num" type="number" min="0" placeholder="12345678" required>
This page took 0.049049 seconds and 4 git commands to generate.