AI-Native Smart Wallet with On-Chain Policy Rules — built on the 0G Blockchain.
AI-Native Smart Wallet with On-Chain Policy Rules — built on the 0G Blockchain.
iWallet creates deterministic sub-wallets derived from your master wallet, each controlled by an AI agent. On-chain policy rules (daily spend limits, contract whitelists, cooldowns) act as guardrails — even a misbehaving agent cannot exceed its boundaries. Agent conversations are permanently stored on 0G decentralized storage.
Frontend: [https://wallet.goon4.site](https://wallet.goon4.site)
Backend/MCP: [https://be-wallet.goon4.site](https://be-wallet.goon4.site)
Contract (Mainnet): [0x08a7Ea416AF2b8DD4614aa6A314ee7c96F8aA68d](https://chainscan.0g.ai/address/0x08a7Ea416AF2b8DD4614aa6A314ee7c96F8aA68d)
Contract (Testnet): [0xCF1f2860BA28aD3c7BCfCc29ab34c2f70D64F4ca](https://chainscan-galileo.0g.ai/address/0xCF1f2860BA28aD3c7BCfCc29ab34c2f70D64F4ca)
On-Chain Policy Enforcement — daily limits, allowed contracts, cooldowns enforced by smart contracts
0G Storage Integration — agent conversations permanently archived on decentralized storage
AI Agent with Tool Calling — check balances, send ETH, read policy via LLM
MCP Protocol — any MCP-compatible client (Claude, Cursor, VS Code) can control the wallet
Deterministic Sub-Wallets — derived from master wallet signature, no new seed phrases
AI agents that control crypto wallets are powerful — but dangerous. Most existing setups give the agent a full private key with no restrictions. If the agent is compromised by prompt injection, hallucination, or a malicious plugin, there is nothing stopping it from draining all funds.
Off-chain guardrails (server-side rate limiters, software checks) are not enough. They can be bypassed. A compromised backend or a single prompt injection attack is all it takes.
Real incidents:
Freysa AI (Nov 2024) — agent tricked into releasing $47K via prompt injection disguised as an admin override
Grok + Bankrbot (May 2025) — Morse code tweet bypassed text filters, drained $200K
ElizaOS (2025) — Princeton researchers demonstrated memory poisoning attacks exposing $140M+ in TVL
iWallet introduces session keys — derived sub-wallets that the AI agent uses to sign transactions. Each session key is bound to an on-chain policy set by the master wallet owner:
Daily ETH spend limit — agent cannot send more than X ETH per day, no matter what
Contract whitelist — if set, agent can only interact with approved addresses
Cooldown period — minimum seconds between transactions
Session expiry — session key automatically becomes invalid after a set time
Token allowances — per-ERC20 daily transfer limits
These rules live inside the iWallet smart contract on 0G Chain. Every execute() call checks all policy constraints atomically before forwarding. Violations revert on-chain. The AI agent has no way around it.
On-Chain Policy Enforcement — daily limits, allowed contracts, cooldowns enforced by smart contracts
0G Storage Integration — agent conversations permanently archived on decentralized storage
AI Agent with Tool Calling — check balances, send ETH, read policy via LLM
MCP Protocol — any MCP-compatible client (Claude, Cursor, VS Code) can control the wallet
Deterministic Sub-Wallets — derived from master wallet signature, no new seed phrases
Smart contracts deployed on 0G Mainnet and Testnet enforce policy rules on every agent transaction. The iWalletFactory deploys per-user wallets using the Beacon Proxy pattern, allowing protocol-wide upgrades in a single transaction.
Problem solved: Cryptographically guaranteed spending limits — no backend, no server, no trust required.
After each agent session, the full conversation history is uploaded to 0G Storage via @0gfoundation/0g-ts-sdk. On the next session, the backend fetches the history and injects it into the agent's system prompt as persistent memory.
Problem solved: AI agents are stateless by default. 0G Storage gives them permanent, decentralized memory across sessions without any centralized database.
1. Connect — User connects their master EOA wallet
2. Deploy — iWalletFactory creates a deterministic iWallet contract for the user on 0G Chain
3. Set Policy — User configures rules (daily limit, whitelist, cooldown, expiry) stored on-chain
4. Fund — Send 0G to the iWallet address + session key for gas
5. Chat — AI agent uses session key to sign transactions; contract enforces policy on every call
6. Memory — Conversation archived to 0G Storage; next session loads history automatically
Contracts: Solidity 0.8.28, Hardhat v3, OpenZeppelin (UUPS + Beacon upgradeable)
Backend: Bun, Elysia.js, OpenAI-compatible LLM (MiniMax M2), viem, @0gfoundation/0g-ts-sdk
Frontend: React 19, TanStack Start, Tailwind v4, wagmi v3, Reown AppKit, Three.js
Protocol: MCP (Model Context Protocol) for AI agent interoperability
Storage: 0G Storage Log layer for immutable conversation archival
<h1>iWallet — Hackathon Progress</h1><h2>Day 1 — Apr 20: Project Kickoff</h2><ul><li><p>Initialized the monorepo (Bun workspace, packages structure)</p></li><li><p>Set up initial documentation and project setup guide</p></li></ul><hr><h2>Day 2 — Apr 21: Smart Contract Foundation</h2><ul><li><p>Wrote <code data-inline="true" spellcheck="false">iWallet.sol</code> — the core agent-bounded smart wallet with per-session policy enforcement (daily ETH limits, contract whitelists, cooldowns, expiry)</p></li><li><p>Wrote <code data-inline="true" spellcheck="false">iWalletFactory.sol</code> — factory contract for deploying per-user wallets</p></li><li><p>Set up Hardhat v3 with OpenZeppelin upgradeable contracts</p></li><li><p>Configured shared <code data-inline="true" spellcheck="false">packages/chains</code> and <code data-inline="true" spellcheck="false">packages/tokens</code></p></li></ul><hr><h2>Day 3 — Apr 27–28: Frontend & 3D Landing Page</h2><ul><li><p>Built the interactive 3D landing page using React Three Fiber (R3F) with a robot model</p></li><li><p>Implemented scroll-driven animation stages with GSAP — atmosphere lighting, narrative text overlays, scene transitions</p></li><li><p>Optimized 3D model with PBR textures and GLB processing script</p></li><li><p>Added responsive mobile layout and camera adjustments</p></li><li><p>Deployed CI/CD pipeline via GitHub Actions to <code data-inline="true" spellcheck="false">wallet.goon4.site</code></p></li><li><p>Set up <code data-inline="true" spellcheck="false">be-wallet.goon4.site</code> subdomain for backend</p></li></ul><hr><h2>Day 4 — Apr 29: Landing Page Polish & Merge</h2><ul><li><p>Merged <code data-inline="true" spellcheck="false">landing-page</code> branch — copywriting, color refinements, footer polish</p></li><li><p>Fixed peer dependency issues in lockfile</p></li></ul><hr><h2>Day 5 — May 4: MCP Protocol Integration</h2><ul><li><p>Refactored backend from private-key-based to <strong>MCP (Model Context Protocol)</strong> based architecture</p></li><li><p>Any MCP-compatible client (Claude Desktop, Cursor, VS Code) can now control the wallet</p></li><li><p>Fixed CI: <code data-inline="true" spellcheck="false">bun x</code> compatibility, lockfile drift handling, SSR bundle assertions</p></li></ul><hr><h2>Day 6 — May 9: Mainnet Deployment & Dashboard</h2><ul><li><p><strong>Deployed upgradeable iWallet stack to 0G Aristotle Mainnet</strong> <code data-inline="true" spellcheck="false">0x08a7Ea416AF2b8DD4614aa6A314ee7c96F8aA68d</code>)</p></li><li><p>Upgraded contracts to Beacon + UUPS proxy pattern — factory owner can upgrade all wallets in one tx</p></li><li><p>Fixed bug: session counters now clear correctly on <code data-inline="true" spellcheck="false">addSession</code> after revoke</p></li><li><p>Added multichain support — backend routes by session <code data-inline="true" spellcheck="false">chainId</code>, no more <a href="http://localhost">localhost</a> switch</p></li><li><p>Auto-verifies newly deployed iWallets on <code data-inline="true" spellcheck="false">factory.Deployed</code> event</p></li><li><p>Built full dashboard UI: wallet balance grid, Withdraw All, session cap progress bars, status pills, reissue-bearer dialog</p></li></ul><hr><h2>Day 7 — May 15: AI Agent + 0G Storage Integration</h2><ul><li><p><strong>Integrated 0G Storage</strong> for persistent agent memory — conversations are archived to the 0G Log layer and loaded back as context on new sessions</p></li><li><p>Built the AI agent chat UI with streaming SSE responses — users see tool calls (balance check, send ETH) in real time</p></li><li><p>Implemented agent tools: <code data-inline="true" spellcheck="false">get_balance</code>, <code data-inline="true" spellcheck="false">send_eth</code>, <code data-inline="true" spellcheck="false">get_policy</code>, <code data-inline="true" spellcheck="false">get_session_info</code></p></li><li><p>Added landing page, sidebar layout, and <code data-inline="true" spellcheck="false">/agent</code> chat page</p></li><li><p>Refactored routing: <code data-inline="true" spellcheck="false">/connect</code> → <code data-inline="true" spellcheck="false">/policy</code>, added dedicated <code data-inline="true" spellcheck="false">/mcp</code> page with connection instructions</p></li><li><p>Fixed 0G Storage to save full conversation history and inject it into the system prompt as persistent memory</p></li><li><p>Added robust health check retry logic in deploy script</p></li><li><p>Updated all READMEs and added <code data-inline="true" spellcheck="false">.env.example</code> files for both packages</p></li></ul><p></p>