Skip to content

Commit 71fb21f

Browse files
author
ScottyPoi
committed
fix blockchain example
1 parent 57e881f commit 71fb21f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/blockchain/examples/simple.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const main = async () => {
2121
difficulty: blockchain.genesisBlock.header.difficulty + 1n,
2222
},
2323
},
24-
{ common, setHardfork: true },
24+
{ common },
2525
)
2626
const block2 = createBlock(
2727
{
@@ -31,11 +31,11 @@ const main = async () => {
3131
difficulty: block.header.difficulty + 1n,
3232
},
3333
},
34-
{ common, setHardfork: true },
34+
{ common },
3535
)
36+
console.log(`Block 1: ${bytesToHex(block.hash())}`)
37+
console.log(`Block 2: ${bytesToHex(block2.hash())}`)
3638
// See @ethereumjs/block for more details on how to create a block
37-
await blockchain.putBlock(block)
38-
await blockchain.putBlock(block2)
3939

4040
// We iterate over the blocks in the chain to the current head (block 2)
4141
await blockchain.iterator('i', (block) => {
@@ -44,7 +44,7 @@ const main = async () => {
4444
console.log(`Block ${blockNumber}: ${blockHash}`)
4545
})
4646

47-
// Block 1: 0xa1a061528d74ba81f560e1ebc4f29d6b58171fc13b72b876cdffe6e43b01bdc5
48-
// Block 2: 0x5583be91cf9fb14f5dbeb03ad56e8cef19d1728f267c35a25ba5a355a528f602
47+
// Block 1: 0xf6673384492391fc85b76c2a3628eb1600896c51eb813a61cf44867d981eca58
48+
// Block 2: 0x751f498d2156ffb678eec7286a39b0c7cef7abde9183ed2073aa61cef316a417
4949
}
5050
void main()

0 commit comments

Comments
 (0)