/foundry-agent:anvil-nodefrom foundry-agent
Run local Ethereum nodes with Anvil. Use when setting up local development environments, forking mainnet for testing, or running integration tests against a local node.
Ships in foundry-agent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Agent-usable Foundry skill: see When to Use / overview above for skills/anvil-node/SKILL.md.
Read-only first: confirm chain id and addresses before writes.
Anvil is Foundry's fast local Ethereum node for development and testing.
# Start local node with 10 pre-funded accounts
anvil
# Start with custom port
anvil --port 8545
# Start with specific accounts
anvil --accounts 5 --balance 1000
When started without flags:
| Setting | Value |
|---|---|
| Port | 8545 |
| Accounts | 10 |
| Balance | 10000 ETH each |
| Chain ID | 31337 |
| Block time | Instant (mines on each tx) |
Default test accounts (deterministic):
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Account #1: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
Account #2: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
Private Key: 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
# Fork at latest block
anvil --fork-url https://eth-mainnet.g.alchemy.com/v2/$API_KEY
# Fork at specific block (reproducible)
anvil --fork-url $MAINNET_RPC --fork-block-number 18000000
# Arbitrum
anvil --fork-url https://arb1.arbitrum.io/rpc
# Optimism
anvil --fork-url https://mainnet.optimism.io
# Base
anvil --fork-url https://mainnet.base.org
# Polygon
anvil --fork-url https://polygon-rpc.com
# Custom number of accounts
anvil --accounts 20
# Custom balance (in ETH)
anvil --balance 100000
# Use specific mnemonic
anvil --mnemonic "test test test test test test test test test test test junk"
# Derivation path
anvil --derivation-path "m/44'/60'/0'/0/"
# Custom chain ID
anvil --chain-id 1337
# Custom port
anvil --port 8546
# Listen on all interfaces
anvil --host 0.0.0.0
# Custom gas limit
anvil --gas-limit 30000000
# Custom gas price
anvil --gas-price 1000000000
# Auto-mine (default - instant blocks)
anvil
# Interval mining (block every N seconds)
anvil --block-time 12
# No mining (manual only)
anvil --no-mining
# Load state from file
anvil --load-state state.json
# Dump state to file on exit
anvil --dump-state state.json
# State snapshot directory
anvil --state ./anvil-state
See forking.md for detailed patterns.
# Start with unlocked accounts
anvil --fork-url $RPC --unlocked 0xWhaleAddress
Or via RPC:
# Unlock account
cast rpc anvil_impersonateAccount 0xWhaleAddress
# Send as whale
cast send 0xRecipient --value 100ether \
--from 0xWhaleAddress \
--unlocked
# Stop impersonating
cast rpc anvil_stopImpersonatingAccount 0xWhaleAddress
# Increase time
cast rpc evm_increaseTime 86400 # 1 day
# Set timestamp
cast rpc evm_setNextBlockTimestamp 1700000000
# Mine block with new timestamp
cast rpc evm_mine
# Mine N blocks
cast rpc anvil_mine 10
# Set block gas limit
cast rpc evm_setBlockGasLimit 50000000
All standard Ethereum JSON-RPC methods are supported.
# Mine blocks
cast rpc anvil_mine [numBlocks]
# Set balance
cast rpc anvil_setBalance 0xAddress 0x8ac7230489e80000 # 10 ETH in hex
# Set code
cast rpc anvil_setCode 0xAddress 0x608060...
# Set storage
cast rpc anvil_setStorageAt 0xContract 0x0 0x1
# Impersonate
cast rpc anvil_impersonateAccount 0xAddress
# Snapshot
SNAPSHOT_ID=$(cast rpc evm_snapshot)
# Revert to snapshot
cast rpc evm_revert $SNAPSHOT_ID
# Set nonce
cast rpc anvil_setNonce 0xAddress 100
# Set chain ID
cast rpc anvil_setChainId 1
contract ForkTest is Test {
function setUp() public {
// Fork mainnet at specific block
vm.createSelectFork("mainnet", 18000000);
}
function test_ForkState() public {
// Tests run against forked state
IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
assertGt(usdc.totalSupply(), 0);
}
}
# Terminal 1: Start Anvil
anvil --fork-url $MAINNET_RPC
# Terminal 2: Run tests
forge test --rpc-url http://localhost:8545
# Start persistent forked node
anvil --fork-url $MAINNET_RPC --dump-state ./state.json
# Connect frontend to http://localhost:8545
# Chain ID: 31337
# Start Anvil in background
anvil --fork-url $MAINNET_RPC &
# Deploy contracts
forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast
# Run integration tests
forge test --rpc-url http://localhost:8545
# Stop Anvil
pkill anvil
# Fork at block before problematic tx
anvil --fork-url $RPC --fork-block-number 17999999
# Replay transaction
cast send --rpc-url http://localhost:8545 ...
# Debug with traces
cast run $TX_HASH --rpc-url http://localhost:8545
# Check if Anvil is running
curl http://localhost:8545 -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
# Limit cache size
anvil --fork-url $RPC --fork-retry-backoff 1000
# Use specific block to limit state
anvil --fork-url $RPC --fork-block-number 18000000
# Add retry backoff
anvil --fork-url $RPC --fork-retry-backoff 1000
# Use multiple RPC endpoints (via load balancer)
What SKILL.md sets; muted values are Claude Code's defaults
foundry-agent@cyotee is listed by cyotee/cyotee-claude-plugins — review the source before installing
npx claudepluginhub cyotee/cyotee-claude-plugins --plugin foundry-agent4 skills in this plugin
/cast-commandsInteract with EVM chains using Cast CLI. Use when querying blockchain data, sending transactions, calling contracts, or converting between formats. Cast is the Swiss Army knife for chain interaction./foundry-agent-safetySafety policy for AI agents using Foundry cast/forge on live chains. Use before any cast send, forge script --broadcast, or value transfer. Covers chain confirmation, secrets, dry-run, and confirmation gates.
/foundry-script-opsMulti-step on-chain agent operations with forge script (approve then deposit, multi-call sequences). Use when sequential cast send is error-prone. Prefer cast for single reads/writes.
Other plugins' skills for the same job