📝 Project Story — BaseLens

🚀 Inspiration

We wanted to make on-chain knowledge accessible, not cryptic.
When exploring Base contracts, we quickly realized how painful it is to understand proxy chains, factory deployments, upgradeable logic, hidden calls, or even basic source code when it isn’t verified.
Reading bytecode isn’t a skill everyone has — but everyone should be able to understand how protocols work.

BaseLens was born from one idea:

Understanding a contract should be as easy as asking a question.
$$\text{Code} + \text{Graph} + \text{AI} \rightarrow \text{Clarity}$$

We built a tool that brings visibility, transparency, and autonomous interaction directly on Base.


🔍 What it does

BaseLens analyzes any contract on Base Mainnet or Sepolia, reconstructs its structure, and visualizes:

  • proxies & implementations
  • factories & child contracts
  • internal calls, inheritance & libraries
  • source code or decompiled bytecode when not verified

Then we add AI with RAG embeddings so users can ask questions like:

“Where can this contract upgrade its implementation?”
“Which functions handle user funds?”

And BaseLens answers — using real code context.

Finally, our autonomous on-chain agent can receive funds, execute swaps or staking instructions, and return what’s left.
Like ChatGPT — but it can transact.


🛠 How we built it

Architecture summary

  • Full TypeScript stack — shared types everywhere
  • React + Vite + React Flow for contract visualization
  • Node backend + BullMQ workers for async analysis
  • Data stored in Postgres + pgvector
  • Smart wallets via ERC-4337 (ZeroDev + Paymaster)
  • x402 USDC payments to unlock analysis
  • AgentKit to execute real steps on-chain

$$\text{Panoramix Decompiler} + \text{Basescan Metadata} \Rightarrow \text{Unified Graph Model}$$


🧩 Challenges we ran into

Challenge How we solved it
Large proxy & factory chains Built automatic recursive resolution + job queue retry logic
Unverified contract sources Integrated Panoramix deep bytecode decompilation
Creating meaningful embeddings Layered RAG docs → explanations + types + raw code
Payments for API usage Implemented x402 USDC gating + signature flow
Autonomous agent execution Step-based transaction pipeline w/ safety checks

The hardest part was combining analysis, AI, execution, and payments into a single seamless UX.


🏆 Accomplishments we’re proud of

  • Fully working pipeline from address → graph → AI understanding
  • Autonomous on-chain agent that executes real DeFi flows
  • x402-powered monetization — meaning this can be a SaaS today
  • Smart wallet integration for gasless operations
  • Clean DX + fast dev iteration with pnpm monorepo

Most importantly — non-experts can now understand contracts in minutes, not hours.


📚 What we learned

  • How deep proxy patterns really go once you visualize them
  • That RAG over decompile code can still generate meaning
  • How to combine LLM planning with deterministic execution engines
  • How Base + x402 + AgentKit + ERC-4337 unlock new UX primitives
  • That AI + on-chain execution is not the future — it's here now

🔮 What's next for BaseLens

Short-term

  • Add exploit-pattern detection
  • Multi-contract comparison views
  • Auto-generated risk scoring

Mid-term

  • Plugin marketplace for analysis modules
  • Save/share graph states
  • Full mainnet deployment & production SaaS billing
  • IA Agent being able to call any already analyzed contract

Long-term

BaseLens becomes the AI terminal for every smart contract developer on Base.
A world where reading code is optional — but understanding it is not.

Built With

Share this project:

Updates