Skip to content

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.9
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

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

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"
};
});
  • null means no such fork. anvil 1.9 answers next and last with null: it knows no fork after the one it runs. Polygon bor 2.11 answers current with null.
  • A fork starts at a time or at a block. Ethereum forks carry activationTime. Polygon bor’s go by height and carry activationBlock. Each is absent where the node does not send it.
  • blobSchedule is null on a chain without blobs, as Polygon bor answers.
  • activationTime is a number. The node sends it as a JSON number, not as a hex quantity. The three values of blobSchedule are JSON numbers too. chainId is a quantity on the wire and a number once 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.