Overview
Chain forking creates a local copy of a live blockchain network. Your local environment gets the complete state of the target network — all contracts, all balances, all storage — at a specific block. This lets you:
- Test against real DeFi protocols — Interact with Uniswap, Aave, Compound, etc. locally
- Reproduce mainnet bugs — Fork at the block before a bug and replay the transaction
- Test token integrations — Use real USDC, WETH, DAI balances in your tests
- Simulate governance — Impersonate any address and execute transactions
Quick Start
Supported Networks
Using Custom RPC URLs
For faster forks or private access, use your own RPC URL:
Or with the --fork flag on dokrypt up:
Fork on Startup via Config
You can configure forking directly in dokrypt.yaml:
Use Cases
Test Against Uniswap
Impersonate a Whale
Reproduce a Bug
Multi-chain Fork
If your dokrypt.yaml has multiple chains, specify which one to fork:
How It Works
- Resolution — The network name is resolved to an RPC URL
- Reset —
anvil_reset (or hardhat_reset) is called with the fork configuration
- Wait — Dokrypt waits up to 120 seconds for the fork to complete
- Funding — Test accounts are funded with 10,000 ETH each
- Ready — The local chain is now a fork of the target network
Forking from public RPCs can be slow. For production testing, use a dedicated RPC provider (Alchemy, Infura, QuickNode) for much faster fork times.