ChainConfig
The fork configuration a node runs, as eth_config returns it (EIP-7910): the fork in effect,
the next one scheduled and the last one the node knows.
import { Effect } from "effect";import { Eth } from "@ethect/core/rpc";
const schedule = Effect.gen(function* () { const config = yield* Eth.config(); // config: ChainConfig.ChainConfig const blobs = config.current?.blobSchedule; return { target: blobs?.target, max: blobs?.max, scheduled: config.next !== null };});// { target: 10, max: 15, scheduled: false } on anvil 1.9Schemas
Section titled “Schemas”| Schema | Type | Describes | Returned by |
|---|---|---|---|
ChainConfig.schema |
ChainConfig.ChainConfig |
the current, next and last fork | Eth.config |
ChainConfig.forkSchema |
ChainConfig.Fork |
the configuration of one fork | current, next and last of a ChainConfig.ChainConfig |
Fields
Section titled “Fields”ChainConfig.ChainConfig.
| Field | Type | Notes |
|---|---|---|
current |
ChainConfig.Fork | null |
the fork in effect, null when the node reports none |
next |
ChainConfig.Fork | null |
the next fork scheduled, null when there is none |
last |
ChainConfig.Fork | null |
the last fork the node knows, null when there is none |
Fork fields
Section titled “Fork fields”ChainConfig.Fork.
| Field | Type | Notes |
|---|---|---|
activationTime |
number (optional) |
when the fork takes effect: a Unix timestamp, in seconds |
activationBlock |
number (optional) |
the block the fork takes effect at, on a chain whose forks go by height |
chainId |
number |
|
forkId |
Hex |
|
blobSchedule |
{ target: number; max: number; baseFeeUpdateFraction: number } | null |
the blob parameters of the fork, null on a chain without blobs |
precompiles |
Record<string, Address> |
the address of each precompile, by name |
systemContracts |
Record<string, Address> |
the address of each system contract, by name |
precompiles and systemContracts are keyed by the names the node uses. On anvil 1.9:
import { Effect } from "effect";import { Eth } from "@ethect/core/rpc";
const addresses = Effect.gen(function* () { const { current } = yield* Eth.config(); return { ecrecover: current?.precompiles["ECREC"], // "0x0000000000000000000000000000000000000001" beaconRoots: current?.systemContracts["BEACON_ROOTS_ADDRESS"], // "0x000f3df6d732807ef1319fb7b8bb8522d0beac02" };});Behavior
Section titled “Behavior”nullmeans no such fork. anvil 1.9 answersnextandlastwithnull: it knows no fork after the one it runs. Polygon bor 2.11 answerscurrentwithnull.- A fork starts at a time or at a block. Ethereum forks carry
activationTime. Polygon bor’s go by height and carryactivationBlock. Each is absent where the node does not send it. blobScheduleisnullon a chain without blobs, as Polygon bor answers.activationTimeis anumber. The node sends it as a JSON number, not as a hex quantity. The three values ofblobScheduleare JSON numbers too.chainIdis a quantity on the wire and anumberonce decoded.- Lowercase addresses. The addresses of both records are decoded to their lowercase form.
- A lookup by name can miss. A record has the names the node sent and no other: index it
and check for
undefined.