NodeInfo
How a test node is set up: its head, its hard fork, its fees and blob parameters, and the endpoint it forks.
import { Effect } from "effect";import { Anvil } from "@ethect/core/rpc";
const fork = Effect.gen(function* () { const info = yield* Anvil.nodeInfo(); // info: NodeInfo.NodeInfo const { forkUrl, forkBlockNumber } = info.forkConfig; return forkUrl === null ? "not a fork" : `${forkUrl} at block ${forkBlockNumber}`;});Schemas
Section titled “Schemas”| Schema | Type | Describes | Returned by |
|---|---|---|---|
NodeInfo.schema |
NodeInfo.NodeInfo |
the setup of a test node | Anvil.nodeInfo |
Fields
Section titled “Fields”| Field | Type | Notes |
|---|---|---|
currentBlockNumber |
bigint |
the number of the head |
currentBlockTimestamp |
bigint |
the timestamp of the head, in seconds |
currentBlockHash |
Hash |
the hash of the head |
hardFork |
string |
the name of the active hard fork, as anvil spells it |
transactionOrder |
"fees" | "fifo" |
how the node orders the transactions of a block |
environment |
an object | see below |
forkConfig |
an object | see below |
network |
string (optional) |
the kind of network the node runs: "ethereum" on a default anvil |
blobParams |
an object (optional) | see below |
environment
Section titled “environment”| Field | Type | Notes |
|---|---|---|
baseFee |
bigint |
the base fee of the next block, in wei |
chainId |
number |
|
gasLimit |
bigint |
the gas limit of a block |
gasPrice |
bigint |
the node’s gas price, in wei |
forkConfig
Section titled “forkConfig”| Field | Type | Notes |
|---|---|---|
forkUrl |
string | null |
the endpoint the node forks |
forkBlockNumber |
bigint | null |
the block it was forked at |
forkRetryBackoff |
number | null |
the wait before a failed request to the endpoint is tried again, in milliseconds |
blobParams
Section titled “blobParams”| Field | Type | Notes |
|---|---|---|
targetBlobCount |
number |
|
maxBlobCount |
number |
|
updateFraction |
bigint |
|
minBlobFee |
bigint |
in wei |
maxBlobsPerTx |
number |
|
blobBaseCost |
number |
On the wire
Section titled “On the wire”What anvil 1.9 answers when started without options:
{ "currentBlockNumber": "0x0", "currentBlockTimestamp": 1795857411, "currentBlockHash": "0x556ff4b89f7a003c8c90bc7363901efcc112ef515d5629825ee90a7cf0e84eed", "hardFork": "Bpo1", "transactionOrder": "fees", "environment": { "baseFee": "0x3b9aca00", "chainId": 31337, "gasLimit": "0x1c9c380", "gasPrice": "0x77359400" }, "forkConfig": { "forkUrl": null, "forkBlockNumber": null, "forkRetryBackoff": null }, "network": "ethereum", "blobParams": { "targetBlobCount": 10, "maxBlobCount": 15, "updateFraction": "0x7f5a51", "minBlobFee": "0x1", "maxBlobsPerTx": 6, "blobBaseCost": 8192 }}Behavior
Section titled “Behavior”- Block numbers and timestamps are
bigints. anvil sendscurrentBlockTimestampandforkBlockNumberas JSON numbers and the head’s number as a hex quantity: all three decode tobigint. The chain id, the retry backoff and the blob counts staynumber. nullmeans not a fork. The three fields offorkConfigare always present, andnullunless the node is a fork.- On a fork, anvil 1.9 reports
forkUrlas the URL it was given with a trailing slash added, and aforkRetryBackoffof1000. - Optional means absent.
networkandblobParamsare left out of the object when the node does not send them. - A snapshot of the moment. The head and the fees are those at the time of the call. The
same node is described by
NodeMetadatatoo.