scaffold-eth-2
Installation
SKILL.md
Scaffold-ETH 2
Full-stack Ethereum dApp development framework. Monorepo with Foundry (or Hardhat) for contracts and Next.js for the frontend. Ships custom React hooks that auto-wire contract ABIs and addresses from deployment artifacts -- no manual ABI imports, no address management. Includes an auto-generated debug page that gives you read/write UI for every public function on every deployed contract.
What You Probably Got Wrong
Agents trained on pre-2024 data generate Scaffold-ETH 1 code. SE2 is a complete rewrite -- different stack, different hooks, different project structure. Every pattern below is SE2-specific.
- SE2 is NOT SE1 -- SE1 used Create React App + ethers.js + Hardhat. SE2 uses Next.js 14+ + wagmi + viem + Foundry (default). The codebases share nothing. If you see
useContractReaderorscaffold-eth/hooks, that is SE1 and will not work. - Foundry is the default, not Hardhat --
npx create-eth@latestdefaults to Foundry. Hardhat is available via--hardhatflag but Foundry is the recommended path. Do not assume Hardhat unless the user explicitly chose it. - Hooks read from
deployedContracts.ts, not raw ABI + address -- SE2 hooks takecontractNameas a string (e.g.,"YourContract"). The hook resolves the ABI and address from the auto-generateddeployedContracts.tsfile. Never passaddressandabidirectly to SE2 hooks. - The debug page reads AND writes -- It auto-generates a UI for ALL public/external functions on every deployed contract. You can call view functions and send transactions directly from the browser. This is not just a read-only viewer.
- You do NOT need to write frontend boilerplate -- SE2 hooks handle wallet connection, transaction lifecycle, error display, and loading states. A complete contract interaction is 5-10 lines of JSX. Do not recreate wagmi provider setup or wallet connect logic.
yarn deployregeneratesdeployedContracts.ts-- Every time you deploy, the contract addresses and ABIs are written topackages/nextjs/contracts/deployedContracts.ts. The frontend picks up changes on next page load (hot reload in dev).externalContracts.tsis for contracts you did NOT deploy -- To interact with Uniswap, Aave, or any already-deployed protocol, add the ABI and address toexternalContracts.ts. SE2 hooks then treat them the same as your own contracts.