Usage
Arguments
| Argument | Required | Description |
|---|---|---|
network | No | Network name or custom RPC URL |
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--url | string | — | Custom RPC URL to fork from |
--block | uint64 | 0 | Fork at a specific block number (0 = latest) |
--chain | string | — | Target chain name (for multi-chain setups) |
--accounts | int | 10 | Number of accounts to fund |
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
- Resolves the network name to an RPC URL (or uses the custom
--url) - Calls
anvil_reset(orhardhat_reset) with forking parameters - Waits up to 120 seconds for the fork to complete
- Fetches the new chain ID and block number
- Funds the specified number of accounts with 10,000 ETH each
Supported Networks
| Network | Aliases | Chain ID | RPC URL |
|---|---|---|---|
| Ethereum | mainnet, ethereum | 1 | https://eth.llamarpc.com |
| Sepolia | sepolia | 11155111 | https://rpc.sepolia.org |
| Goerli | goerli | 5 | https://rpc.ankr.com/eth_goerli |
| Polygon | polygon | 137 | https://polygon-rpc.com |
| Arbitrum | arbitrum | 42161 | https://arb1.arbitrum.io/rpc |
| Optimism | optimism | 10 | https://mainnet.optimism.io |
| Base | base | 8453 | https://mainnet.base.org |
| BSC | bsc | 56 | https://bsc-dataseed.binance.org |
| Avalanche | avalanche | 43114 | https://api.avax.network/ext/bc/C/rpc |