This guide details how to set up the local environment, compile the smart contracts, deploy them locally, and run the ERC-8010 Next.js frontend.
- Node.js: Version 20+
- Foundry: Installed (for Solidity compiling, Anvil development node, and testing)
Install the project dependencies for the Next.js frontend:
npm installCreate a .env file in the root directory (you can copy .env.example as a starting point):
cp .env.example .envKey environment variables:
NEXT_PUBLIC_DEMO_PRIVATE_KEY: A private key with some funds on the local network (or Sepolia) used as the preset account for the demo.NEXT_PUBLIC_MEGAETH_RPC: MegaETH testnet RPC URL (defaults to public endpoint if omitted).NEXT_PUBLIC_VALIDATOR_ADDRESS: The deployed address of theSessionKeyValidatorcontract.
# Run Next.js in development mode
npm run dev
# Build the application for production
npm run build
# Run ESLint check
npm run lintOpen http://localhost:3000 to view the application in your browser.
Navigate to the contracts directory to manage Solidity development:
cd contracts
# Compile Solidity contracts
forge build
# Run all unit and integration tests (verbose output)
forge test -vvv
# Run a specific test
forge test --match-test <TestName> -vvvTo run the full interactive demo, you must run a local Anvil node configured with the Prague EVM hardfork (required for EIP-7702):
anvil --hardfork pragueWith Anvil running, deploy the demo smart contracts using the deployment script:
cd contracts
PRIVATE_KEY=<anvil_private_key> forge script script/Deploy.s.sol --broadcast --rpc-url http://127.0.0.1:8545Once deployed, copy the address of the deployed SessionKeyValidator contract and set it as NEXT_PUBLIC_VALIDATOR_ADDRESS in your .env file.