You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -102,18 +139,29 @@ A genesis state can be set along `Blockchain` creation by passing in a custom `g
102
139
For many custom chains we might come across a genesis configuration, which can be used to build both chain config as well the genesis state (and hence the genesis block as well to start off with)
`Genesis hash from geth genesis parameters - ${bytesToHex(blockchain.genesisBlock.hash())}`
161
+
)
162
+
}
163
+
164
+
main()
117
165
```
118
166
119
167
The genesis block from the initialized `Blockchain` can be retrieved via the `Blockchain.genesisBlock` getter. For creating a genesis block from the params in `@ethereumjs/common`, the `createGenesisBlock(stateRoot: Buffer): Block` method can be used.
All parameters can be accessed through the `Common` class, instantiated with an object containing either the `chain` (e.g. 'Chain.Mainnet') or the `chain` together with a specific `hardfork` provided:
console.log(`EIP 4844 is active -- ${c.isActivatedEIP(4844)}`)
70
78
```
71
79
72
80
## Browser
@@ -167,7 +175,11 @@ There are two distinct APIs available for setting up custom(ized) chains.
167
175
There is a dedicated `Common.custom()` static constructor which allows for an easy instantiation of a Common instance with somewhat adopted chain parameters, with the main use case to adopt on instantiating with a deviating chain ID (you can use this to adopt other chain parameters as well though). Instantiating a custom common instance with its own chain ID and inheriting all other parameters from `mainnet` can now be as easily done as:
console.log(`The current chain ID is ${commonWithCustomChainId.chainId}`)
171
183
```
172
184
173
185
The `custom()` method also takes a string as a first input (instead of a dictionary). This can be used in combination with the `CustomChain` enum dict which allows for the selection of predefined supported custom chains for an easier `Common` setup of these supported chains:
@@ -194,8 +206,14 @@ you can pass a dictionary - conforming to the parameter format described above -
194
206
values to the constructor using the `chain` parameter or the `setChain()` method, here is some example:
0 commit comments