Skip to main content

Usage

Arguments

Flags

Description

Resets the local chain to a fork of a live blockchain network. After forking, your local environment has the complete state of the target network at the specified block — you can interact with all deployed contracts (Uniswap, Aave, etc.) as if you were on mainnet.

How It Works

  1. Resolves the network name to an RPC URL (or uses the custom --url)
  2. Calls anvil_reset (or hardhat_reset) with forking parameters
  3. Waits up to 120 seconds for the fork to complete
  4. Fetches the new chain ID and block number
  5. Funds the specified number of accounts with 10,000 ETH each

Supported Networks

Examples

Fork Ethereum mainnet (latest block)

Fork at a specific block

Fork Polygon

Fork with a custom RPC URL

Fork with more funded accounts

Fork a specific chain in a multi-chain setup

Use Cases

Test against real DeFi protocols

Reproduce a mainnet bug

Test token integrations