stack_init
Initialize a Scaffold-ETH 2 project that forks a specified mainnet chain for local development with Foundry.
Instructions
Initialize a new Scaffold-ETH 2 project with Foundry, configured for a specific mainnet chain.
IMPORTANT: The chain parameter specifies which MAINNET to fork for local development. All development happens on a LOCAL Anvil fork (chainId 31337) - you never deploy directly to mainnet from here.
Supported chains: mainnet, base, optimism, arbitrum, polygon. NO TESTNETS - use fork workflow instead (fork gives you real mainnet state for free).
Development workflow after init:
stack_install() - Install dependencies
stack_start(["fork"]) - Runs: yarn fork --network
stack_start(["deploy"]) - Deploy to LOCAL fork (free!)
stack_start(["frontend"]) - Start frontend connected to local fork
When ready: yarn generate && yarn deploy --network for mainnet
The workspace path should be an empty directory. Requires Foundry CLI tools (forge, anvil) - call stack_install_foundry first if not installed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | Target chain for forking (e.g., 'base', 'mainnet', 'optimism') | |
| template | Yes | Template to use (only scaffold-eth supported) | |
| workspacePath | Yes | Path where the project should be created |