Inspiration
The blast radius problem in DeFAI. AI agents are non-deterministic and can hallucinate. Giving them full access to a crypto wallet is a massive financial risk. We built CryptoKnight to act as a restricted "guest pass" for AI, safely combining smart contract guardrails with autonomous trading.
What it does
CryptoKnight is a secure, minimal-privilege execution environment for AI trading bots. It uses ERC-4337 Session Keys to grant scoped access to an agent, strictly caps withdrawal limits via a Smart Vault, logs all micro-actions to a high-speed Valkey database, and generates daily AI-driven diagnostic report cards.
How we built it
We used Solidity and the Alchemy Account Kit to build the Smart Vault and Session Keys. The trading agent is built in Python (Web3.py) to execute live Uniswap V3 swaps. For telemetry, we integrated Valkey to log high-speed metrics off-chain, and built a Next.js dashboard that uses the Google Gemini API to translate those logs into plain-English daily reports.
Challenges we ran into
Initially, we tried logging every single trade to IPFS and on-chain, but it was far too slow and gas-heavy for a trading bot. We successfully pivoted to Valkey for high-speed, off-chain telemetry. Additionally, bridging the off-chain Python bot permissions with the on-chain ERC-4337 session keys required intense debugging of transaction signatures.
Accomplishments that we're proud of
Successfully getting our AI agent to execute live swaps on a real decentralized market (Uniswap) while strictly enforcing funds routed only from the siloed vault. We are also proud of our telemetry pivot; turning raw database logs into a beautiful, human-readable Gemini Daily Report.
What we learned
Account Abstraction (ERC-4337) is the missing infrastructure layer for secure machine-to-machine DeFAI workflows. We also learned that UX is just as crucial as smart contract security; using an LLM (Gemini) to explain what the trading agent is doing builds massive user trust.
What's next for CryptoKnight
We plan to deploy on Ethereum Mainnet and low-gas L2s like Arbitrum and Base. We will also expand the bot to handle multiple strategies (RSI, MACD) and package our architecture into a developer SDK so anyone can easily build secure, vault-isolated AI agents.
Built With
- alchemyapi
- blockchain
- gemini
- github
- hardhat
- javascript
- next
- python
- react
- redis
- solidity
- typescript
- valkey
- viem
- wagmi
Log in or sign up for Devpost to join the conversation.