OS Manuals

/usr/bin/anvil

Local Ethereum development node

From foundry-anvil 1.9.0-r0 (enterprise-packages), captured 2026-11-08 by running anvil --help (exit 0). permalink

A fast local Ethereum development node

Examples:
- anvil (start a local node on 127.0.0.1:8545)
- anvil --fork-url $RPC_URL (fork the latest state of a live network)
- anvil --block-time 12 (mine a new block every 12 seconds)
- anvil --state state.json (load state if it exists and dump it on exit)

Usage: anvil [OPTIONS] [COMMAND]

Commands:
  completions  Generate shell completions script [alias: com]
  help         Print this message or the help of the given subcommand(s)

Options:
  -a, --accounts <NUM>
          Number of dev accounts to generate and configure

          [default: 10]

  -b, --block-time <SECONDS>
          Block time in seconds for interval mining

          [alias: --blockTime]

      --balance <NUM>
          The balance of every dev account in Ether

          [default: 10000]

      --config-out <FILE>
          Writes output of `anvil` as json to user-specified file

      --derivation-path <DERIVATION_PATH>
          Sets the derivation path of the child key to be derived.

          [default: m/44'/60'/0'/0/]

      --dump-state <PATH>
          Dump the state and block environment of chain on exit to the given file.

          If the value is a directory, the state will be written to `<VALUE>/state.json`.

      --fund-accounts <ADDRESS:AMOUNT>...
          Fund specific accounts with custom balances on startup.

          Accepts multiple address:balance pairs where balance is in ETH. Example: --fund-accounts
          0x1234...5678:1000 0xabcd...ef01:5000

  -h, --help
          Print help (see a summary with '-h')

      --hardfork <HARDFORK>
          The EVM hardfork to use.

          Choose the hardfork by name, e.g. `prague`, `cancun`, `shanghai`, `paris`, `london`,
          etc... [default: latest]

      --init <PATH>
          Initialize the genesis block with the given `genesis.json` file

      --ipc [<PATH>]
          Launch an ipc server at the given path or default path = `/tmp/anvil.ipc`

          [alias: --ipcpath]

  -j, --threads <THREADS>
          Number of threads to use. Specifying 0 defaults to the number of logical cores

          [alias: --jobs]

      --load-state <PATH>
          Initialize the chain from a previously saved state snapshot

  -m, --mnemonic <MNEMONIC>
          BIP39 mnemonic phrase used for generating accounts. Cannot be used if `mnemonic_random` or
          `mnemonic_seed` are used

      --max-persisted-states <MAX_PERSISTED_STATES>
          Max number of states to persist on disk.

          Note that `prune_history` will overwrite `max_persisted_states` to 0.

      --max-transactions <MAX_TRANSACTIONS>
          Maximum number of transactions in a block

      --mixed-mining
          Enable mixed mining mode. Blocks are mined on a timer (set by `--block-time`), but also
          whenever a transaction is submitted. Requires `--block-time` to be set

      --mnemonic-random [<MNEMONIC_RANDOM>]
          Automatically generates a BIP39 mnemonic phrase, and derives accounts from it. Cannot be
          used with other `mnemonic` options. You can specify the number of words you want in the
          mnemonic. [default: 12]

      --mnemonic-seed-unsafe <MNEMONIC_SEED>
          Generates a BIP39 mnemonic phrase from a given seed Cannot be used with other `mnemonic`
          options.

          CAREFUL: This is NOT SAFE and should only be used for testing. Never use the private keys
          generated in production.

      --no-mining
          Disable auto and interval mining, and mine on demand instead

          [alias: --no-mine]

      --number <NUM>
          The number of the genesis block

      --order <ORDER>
          How transactions are sorted in the mempool

          [default: fees]

  -p, --port <NUM>
          Port number to listen on

          [default: 8545]

      --preserve-historical-states
          Preserve historical state snapshots when dumping the state.

          This will save the in-memory states of the chain at particular block hashes.

          These historical states will be loaded into the memory when `--load-state` / `--state`,
          and aids in RPC calls beyond the block at which state was dumped.

      --profile <PROFILE>
          The configuration profile to use

      --prune-history [<PRUNE_HISTORY>]
          Don't keep full chain history. If a number argument is specified, at most this number of
          states is kept in memory.

          If enabled, no state will be persisted on disk, so `max_persisted_states` will be 0.

  -s, --state-interval <SECONDS>
          Interval in seconds at which the state and block environment is to be dumped to disk.

          See --state and --dump-state

      --slots-in-an-epoch <SLOTS_IN_AN_EPOCH>
          Slots in an epoch

          [default: 32]

      --state <PATH>
          This is an alias for both --load-state and --dump-state.

          It initializes the chain with the state and block environment stored at the file, if it
          exists, and dumps the chain's state on exit.

      --tempo.consensus-seed <SEED>
          Development consensus seed for Tempo, as 32 bytes of hex.

          Defaults to a domain-separated hash of the dev-account mnemonic. Only used on Tempo
          networks.

      --tempo.epoch-length <BLOCKS>
          Number of block heights in a Tempo consensus epoch. Only used on Tempo networks

          [default: 21600]

      --tempo.fee-payer <ADDRESS>
          The account used to sponsor Tempo fee-payer requests (`eth_signRawTransaction` and raw
          transactions carrying the sponsorship placeholder).

          Must be an unlocked account. Only used on Tempo networks; defaults to the last dev
          account.

      --timestamp <NUM>
          The timestamp of the genesis block

      --transaction-block-keeper <TRANSACTION_BLOCK_KEEPER>
          Number of blocks with transactions to keep in memory

      --transaction-coalescing-window <MILLISECONDS>
          Time in milliseconds to group ready transactions into one auto-mined block. Defaults to 0
          (no delay). Set a positive value to enable transaction coalescing

          [default: 0]

  -V, --version
          Print version

Display options:
      --color <COLOR>
          The color of the log messages

          Possible values:
          - auto:   Intelligently guess whether to use color output (default)
          - always: Force color output
          - never:  Force disable color output

      --json
          Format log messages as JSON

      --md
          Format log messages as Markdown

  -q, --quiet
          Do not print log messages

  -v, --verbosity...
          Verbosity level of the log messages.

          Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).

          Depending on the context the verbosity levels have different meanings.

          For example, the verbosity levels of the EVM are:
          - 2 (-vv): Print logs for all tests.
          - 3 (-vvv): Print execution traces for failing tests.
          - 4 (-vvvv): Print execution traces for all tests, and setup traces for failing tests.
          - 5 (-vvvvv): Print execution and setup traces for all tests, including storage changes
          and
            backtraces with line numbers.

Server options:
      --allow-origin <ALLOW_ORIGIN>
          The cors `allow_origin` header

          [default: *]

      --cache-path <PATH>
          Path to the cache directory where persisted states are stored (see
          `--max-persisted-states`).

          Note: This does not affect the fork RPC cache location, which uses endpoint-specific files
          under `~/.foundry/cache/rpc/<chain>/<block>/`.

      --host <IP_ADDR>
          The hosts the server will listen on

          [env: ANVIL_IP_ADDR=]
          [default: 127.0.0.1]

      --no-cors
          Disable CORS

      --no-request-size-limit
          Disable the default request body size limit. At time of writing the default limit is 2MB

Fork config:
      --compute-units-per-second <CUPS>
          Sets the number of assumed available compute units per second for this provider

          default value: 330

          See also --fork-url and
          <https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second>

  -f, --fork-url <URL>
          Fetch state over a remote endpoint instead of starting from an empty state.

          If you want to fetch state from a specific block number, add a block number like
          `http://localhost:8545@1400000` or use the `--fork-block-number` argument.

          Multiple `--fork-url` flags can be provided to distribute requests across endpoints using
          round-robin load balancing. On failure, the retry layer rotates to the next endpoint.

          [alias: --rpc-url]

      --fork-block-number <BLOCK>
          Fetch state from a specific block number over a remote endpoint.

          If negative, the given value is subtracted from the `latest` block number.

          See --fork-url.

      --fork-chain-id <CHAIN>
          Specify chain id to skip fetching it from remote endpoint. This enables offline-start
          mode.

          You still must pass both `--fork-url` and `--fork-block-number`, and already have your
          required state cached on disk, anything missing locally would be fetched from the remote.

      --fork-header <HEADERS>
          Headers to use for the rpc client, e.g. "User-Agent: test-agent"

          See --fork-url.

      --fork-retry-backoff <BACKOFF>
          Initial retry backoff on encountering errors.

          See --fork-url.

      --fork-state-by-number
          Read fork state by block number instead of by block hash.

          Use this for RPCs that cannot serve `eth_getBalance`, `eth_getCode`, `eth_getStorageAt` or
          `eth_getTransactionCount` for a block hash. Block hash ancestry is still validated against
          the fork block.

          See --fork-url.

      --fork-transaction-hash <TRANSACTION>
          Fetch state from after a specific transaction hash has been applied over a remote
          endpoint.

          See --fork-url.

      --no-bal
          Disable pre-filling the fork cache with block access list (BAL) post-state.

          By default, eligible Ethereum forks briefly try fetching a BAL at the fork block. Missing
          or invalid BALs fall back to ordinary state reads. This setting also applies to subsequent
          resets and does not disable serving BAL RPC methods.

      --no-fork-node-info
          Do not probe the fork endpoint with `anvil_nodeInfo` / `anvil_metadata`.

          Those calls detect a nested Anvil. Some public RPCs retry unknown methods for tens of
          seconds instead of returning method-not-found, which delays listen until the probe
          finishes.

      --no-rate-limit
          Disables rate limiting for this node's provider.

          default value: false

          See also --fork-url and
          <https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second>

          [alias: --no-rpc-rate-limit]

      --no-storage-caching
          Explicitly disables the use of RPC caching.

          All storage slots are read entirely from the endpoint.

          This flag overrides the project's configuration file.

          See --fork-url.

      --retries <retries>
          Number of retry requests for spurious networks (timed out requests)

          Default value 5

      --timeout <timeout>
          Timeout in ms for requests sent to remote JSON-RPC server in forking mode.

          Default value 45000

Environment config:
      --block-base-fee-per-gas <FEE>
          The base fee in a block

          [alias: --base-fee]

      --chain-id <CHAIN_ID>
          The chain ID

      --code-size-limit <CODE_SIZE>
          EIP-170: Contract code size limit in bytes. Useful to increase this because of tests. To
          disable entirely, use `--disable-code-size-limit`. By default, it is 0x6000 (~25kb)

      --disable-block-gas-limit
          Disable the `call.gas_limit <= block.gas_limit` constraint

      --disable-code-size-limit
          Disable EIP-170: Contract code size limit

      --disable-min-priority-fee
          Disable the enforcement of a minimum suggested priority fee

          [alias: --no-priority-fee]

      --enable-tx-gas-limit
          Enable the transaction gas limit check as imposed by EIP-7825 (Osaka hardfork).

          From Amsterdam, the cap always applies to regular gas only, and gas above it becomes the
          EIP-8037 state gas reservoir.

          [alias: --tx-gas-limit]

      --gas-limit <GAS_LIMIT>
          The block gas limit

      --gas-price <GAS_PRICE>
          The gas price

EVM options:
      --auto-impersonate
          Enables automatic impersonation on startup. This allows any transaction sender to be
          simulated as different accounts, which is useful for testing contract behavior

          [alias: --auto-unlock]

      --disable-console-log
          Disable printing of `console.log` invocations to stdout

          [alias: --no-console-log]

      --disable-default-create2-deployer
          Disable the default create2 deployer

          [alias: --no-create2]

      --disable-pool-balance-checks
          Disable pool balance checks

      --memory-limit <MEMORY_LIMIT>
          The memory limit per EVM execution in bytes

      --print-traces
          Enable printing of traces for executed transactions and `eth_call` to stdout

          [alias: --enable-trace-printing]

      --steps-tracing
          Enable steps tracing used for debug calls returning geth-style traces

          Steps are recorded by replaying the transaction from its parent block's state, so they are
          unavailable once that state is pruned or when loading a state dump created without
          `--preserve-historical-states`.

          [alias: --tracing]

Networks:
      --celo
          Enable Celo network features

  -n, --network <NETWORK>
          Enable a specific network family

          [possible values: ethereum, optimism, tempo, monad]
Options (78)
OptionDescriptionSource
-a, --accounts NUMNumber of dev accounts to generate and configurehelp
-b, --block-time SECONDSBlock time in seconds for interval mininghelp
--balance NUMThe balance of every dev account in Etherhelp
--config-out FILEWrites output of `anvil` as json to user-specified filehelp
--derivation-path DERIVATION_PATHSets the derivation path of the child key to be derived.help
--dump-state PATHDump the state and block environment of chain on exit to the given file.help
--fund-accounts ADDRESS:AMOUNT>...Fund specific accounts with custom balances on startup.help
-h, --helpPrint help (see a summary with '-h')help
--hardfork HARDFORKThe EVM hardfork to use.help
--init PATHInitialize the genesis block with the given `genesis.json` filehelp
--ipc PATHLaunch an ipc server at the given path or default path = `/tmp/anvil.ipc`help
-j, --threads THREADSNumber of threads to use.help
--load-state PATHInitialize the chain from a previously saved state snapshothelp
-m, --mnemonic MNEMONICBIP39 mnemonic phrase used for generating accounts.help
--max-persisted-states MAX_PERSISTED_STATESMax number of states to persist on disk.help
--max-transactions MAX_TRANSACTIONSMaximum number of transactions in a blockhelp
--mixed-miningEnable mixed mining mode.help
--mnemonic-random MNEMONIC_RANDOMAutomatically generates a BIP39 mnemonic phrase, and derives accounts from it.help
--mnemonic-seed-unsafe MNEMONIC_SEEDGenerates a BIP39 mnemonic phrase from a given seed Cannot be used with other `mnemonic` options.help
--no-miningDisable auto and interval mining, and mine on demand insteadhelp
--number NUMThe number of the genesis blockhelp
--order ORDERHow transactions are sorted in the mempoolhelp
-p, --port NUMPort number to listen onhelp
--preserve-historical-statesPreserve historical state snapshots when dumping the state.help
--profile PROFILEThe configuration profile to usehelp
--prune-history PRUNE_HISTORYDon't keep full chain history.help
-s, --state-interval SECONDSInterval in seconds at which the state and block environment is to be dumped to disk.help
--slots-in-an-epoch SLOTS_IN_AN_EPOCHSlots in an epochhelp
--state PATHThis is an alias for both --load-state and --dump-state.help
--tempo.consensus-seed SEEDDevelopment consensus seed for Tempo, as 32 bytes of hex.help
--tempo.epoch-length BLOCKSNumber of block heights in a Tempo consensus epoch.help
--tempo.fee-payer ADDRESSThe account used to sponsor Tempo fee-payer requests (`eth_signRawTransaction` and raw transactions carrying the sponsorship placeholder).help
--timestamp NUMThe timestamp of the genesis blockhelp
--transaction-block-keeper TRANSACTION_BLOCK_KEEPERNumber of blocks with transactions to keep in memoryhelp
--transaction-coalescing-window MILLISECONDSTime in milliseconds to group ready transactions into one auto-mined block.help
-V, --versionPrint versionhelp
--color COLORThe color of the log messageshelp
--jsonFormat log messages as JSONhelp
--mdFormat log messages as Markdownhelp
-q, --quietDo not print log messageshelp
-v, --verbosityVerbosity level of the log messages.help
--allow-origin ALLOW_ORIGINThe cors `allow_origin` headerhelp
--cache-path PATHPath to the cache directory where persisted states are stored (see `--max-persisted-states`).help
--host IP_ADDRThe hosts the server will listen onhelp
--no-corsDisable CORShelp
--no-request-size-limitDisable the default request body size limit.help
--compute-units-per-second CUPSSets the number of assumed available compute units per second for this providerhelp
-f, --fork-url URLFetch state over a remote endpoint instead of starting from an empty state.help
--fork-block-number BLOCKFetch state from a specific block number over a remote endpoint.help
--fork-chain-id CHAINSpecify chain id to skip fetching it from remote endpoint.help
--fork-header HEADERSHeaders to use for the rpc client, e.g. "User-Agent: test-agent"help
--fork-retry-backoff BACKOFFInitial retry backoff on encountering errors.help
--fork-state-by-numberRead fork state by block number instead of by block hash.help
--fork-transaction-hash TRANSACTIONFetch state from after a specific transaction hash has been applied over a remote endpoint.help
--no-balDisable pre-filling the fork cache with block access list (BAL) post-state.help
--no-fork-node-infoDo not probe the fork endpoint with `anvil_nodeInfo` / `anvil_metadata`.help
--no-rate-limitDisables rate limiting for this node's provider.help
--no-storage-cachingExplicitly disables the use of RPC caching.help
--retries retriesNumber of retry requests for spurious networks (timed out requests)help
--timeout timeoutTimeout in ms for requests sent to remote JSON-RPC server in forking mode.help
--block-base-fee-per-gas FEEThe base fee in a blockhelp
--chain-id CHAIN_IDThe chain IDhelp
--code-size-limit CODE_SIZEEIP-170: Contract code size limit in bytes.help
--disable-block-gas-limitDisable the `call.gas_limit <= block.gas_limit` constrainthelp
--disable-code-size-limitDisable EIP-170: Contract code size limithelp
--disable-min-priority-feeDisable the enforcement of a minimum suggested priority feehelp
--enable-tx-gas-limitEnable the transaction gas limit check as imposed by EIP-7825 (Osaka hardfork).help
--gas-limit GAS_LIMITThe block gas limithelp
--gas-price GAS_PRICEThe gas pricehelp
--auto-impersonateEnables automatic impersonation on startup.help
--disable-console-logDisable printing of `console.log` invocations to stdouthelp
--disable-default-create2-deployerDisable the default create2 deployerhelp
--disable-pool-balance-checksDisable pool balance checkshelp
--memory-limit MEMORY_LIMITThe memory limit per EVM execution in byteshelp
--print-tracesEnable printing of traces for executed transactions and `eth_call` to stdouthelp
--steps-tracingEnable steps tracing used for debug calls returning geth-style traceshelp
--celoEnable Celo network featureshelp
-n, --network NETWORKEnable a specific network familyhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.