← Projects

Chainlens — On-Chain Risk X-Ray for Wallets & Contracts

Active
TypeScriptBlockscout APIJSON-RPC (eth_call, eth_getStorageAt)EIP-1967 / EIP-7702Next.js API routenode:test + eval suite
Live ↗View Repository →
▶Product demo

Problem

Crypto users sign token approvals and call contracts they can't read. The things that drain them — a forgotten unlimited approval, a lookalike address planted in their history, an EIP-7702 delegation to sweeper code, a single key that can freeze or upgrade a token — are invisible in a wallet UI.

Business Impact

Approval phishing, address poisoning and malicious EIP-7702 delegations are among the most common ways wallets get drained, and most users never audit what they've signed. Chainlens turns an address into a ranked list of concrete risks with the evidence and the fix — the check a user, a DAO treasury or an exchange compliance desk should run before trusting an address.

System Approach

  • Approvals decoded from raw calldata (approve, increaseAllowance, setApprovalForAll, Permit2.approve), then re-read live with allowance() / isApprovedForAll() so revoked ones stay quiet
  • Address-poisoning detector comparing genuine recipients with lookalikes planted via zero-value transferFrom or fake-token dust
  • EIP-7702 delegation read from account code (0xef0100 designator) and classified by the delegate's verification and tags
  • Proxy admin read from the EIP-1967 and legacy ZeppelinOS storage slots; owner() classified as EOA, contract or renounced
  • Admin powers counted only when verified source shows an access-control guard, so public helpers like Uniswap's sweepToken don't false-positive
  • Keyless multi-chain data: Blockscout REST + tag registry and public RPC nodes, batched and time-budgeted

Key Decisions & Trade-offs

  • Zero runtime dependencies — a hand-written ABI layer (verified against viem in tests) keeps the core small enough to ship inside the site's serverless bundle
  • Pure analysers over replayable snapshots, so the eval suite runs offline and deterministically
  • Honest gaps: if a data source times out, the report says what it couldn't check instead of failing
  • A verdict that distinguishes scam signals from centralisation, so USDC reads 'centrally controlled', not 'dangerous'
  • No wallet connection or signatures, ever — read-only public data

Current Status

Public and open source (MIT). Live at rohitraj.tech/agents/chainlens on five chains. Gated by 24 unit tests and a 35-case eval suite (30 attack scenarios + 5 recorded mainnet fixtures) at 100% recall, 100% severity accuracy and zero false positives.

Roadmap

  • Deeper history scans with a background job for wallets with thousands of approvals
  • Watch mode: alert when a watched wallet grants a risky approval
  • Solana and Bitcoin address support

What I'd Improve Next

  • Faster Base scans (its explorer API is the slowest data source)
  • More registry sources for known-bad addresses

Explore More