Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
Forking lets you point your toy at mainnet state — every contract, every storage slot, every account balance — and run your protocol against the real world without paying gas or risking funds. This is how protocol engineers get a realistic adversary: real MEV bots watching, real liquidations triggering, real oracle prices moving. A protocol that survives a forked simulation isn't proven, but a protocol that fails one definitely isn't ready.
Anvil with --fork-url boots a local node mirroring mainnet at a specific block. Foundry tests can deploy your toy into that state and call mainnet contracts (Uniswap, Aave, Chainlink) as if they were local. The integration cost drops to zero.
curl -L https://foundry.paradigm.xyz | bash && foundryup). Start anvil --fork-url $MAINNET_RPC_URL. Run cast balance vitalik.eth against the fork and verify it returns a real number.--fork-block-number to pin to a specific block. Re-run your test. Results should be deterministic. Now you can write tests that assume specific market conditions.# Start anvil forking mainnet at block 19000000
anvil --fork-url $MAINNET_RPC_URL --fork-block-number 19000000
# In another shell, run forge tests against the fork
forge test --fork-url http://localhost:8545 --fork-block-number 19000000 -vv
# Or for a one-shot test:
forge test --match-test test_swap_against_real_uniswap \
--fork-url $MAINNET_RPC_URL --fork-block-number 19000000