This project demonstrates the implementation of EIP-7702 using viem's experimental features.
⚠️ Important Notice: This is an experimental implementation of EIP-7702. Currently, wallet and RPC provider support is limited. The demo uses Alchemy, but your wallet might override this.
EIP-7702 is one of the most exciting Ethereum improvements in a while. It lets your regular wallet (EOA) temporarily gain smart contract superpowers!
Imagine your wallet could:
- Do multiple things in one go - Like sending tokens to 10 people at once, saving you gas and time
- Let someone else pay gas fees for you - Perfect for onboarding new users who don't have ETH yet
Without EIP-7702, you'd need to deploy an actual smart contract wallet to do any of this. Now your regular wallet can have these powers temporarily, exactly when needed!
Technically speaking: EIP-7702 introduces a new transaction type (0x04) with a delegation mechanism that injects contract code into your EOA's execution context.
This demo provides two ways to explore EIP-7702:
See EIP-7702 in action with the example from viem's docs! Send ETH to multiple recipients in a single transaction - something normally impossible with a regular wallet.
- 🔄 Batch transfer ETH to multiple recipients in one transaction
- 📝 Detailed activity logging and real-time feedback
- 🛡️ Simple, focused implementation of the viem example
The real power tool! Test EIP-7702 with any contract of your choice. Just paste a contract address, select a function, and our tool will handle the EIP-7702 transaction setup for you.
- 📄 ABI detection and function parsing
- 🎮 Dynamic form generation for any contract function
- 📱 Visual transaction builder and previewer
- 🔍 Transaction status tracking and error handling
-
🔌 Supports both Sepolia and Holesky testnets
-
💼 MetaMask and other web3 wallet support (once they ship it)
Try it out at [https://eip7702demo.netlify.app/]
- Clone the repository:
git clone https://github.com/yourusername/eip7702-viem-demo.git
cd eip7702-viem-demo- Install dependencies:
npm install- Create a
.envfile with your Alchemy API key:
VITE_ALCHEMY_API_KEY=your_alchemy_api_key- Start the development server:
npm run devThe BatchCallDelegation contract is deployed at:
- Sepolia:
0x6987E30398b2896B5118ad1076fb9f58825a6f1a - Holesky:
0x979dd1ab4a7e3b3370b1daceec8b4198f97e0d6f
To deploy to a different network:
forge script script/Deploy.s.sol --rpc-url your_rpc_url --broadcast-
Authorization: When initiating a transaction, your wallet signs an authorization message allowing the contract to act as an interface.
-
Transaction Creation: The signed authorization is included with your transaction data containing the instructions.
-
Execution: During processing, the EVM temporarily injects the contract's code into your EOA's context.
-
Processing: The contract's functions run within your EOA's context, executing all operations atomically.
- Built with SvelteKit and Viem
- Uses Foundry for contract deployment
- Implements EIP-7702 with multiple fallback methods for wallet compatibility
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Deploy contracts (requires Foundry)
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcastContributions are welcome! Please feel free to submit a Pull Request.
MIT