Flexx

Flexx: A privacy-first AI wallet for secure payments on ethereum and L2s

Flexx

Created At

ETHGlobal Mumbai

Project Description

Flexx is an AI wallet for Ethereum that keeps your data on your own machine. You type what you want in plain English, like "send 50 USDC to Alice", "bridge 10 USDC to Base Sepolia" or "pay rent every month", and it turns that into a transaction you approve. We built it for the Ethereum Foundation's "Access Layer for AI and Ethereum Wallets" problem. For now it runs on testnets (Sepolia, Base Sepolia and Arbitrum Sepolia) with USDC and ETH.

The problem we wanted to fix is that most AI wallets send your prompts, balances and contacts to a cloud model, and one hallucination or malicious input could move real money. In Flexx the AI is useful but never trusted, and your private data stays local.

The model is an open-source one (Qwen, run through Ollama) on your own device, so nothing goes to a cloud LLM. Before it sees a request, amounts, addresses and group names are replaced with random placeholders, so it only ever works with labels. It also doesn't act freely. It runs inside a fixed pipeline, its output is forced into a strict schema, and code re-checks everything: balances, daily limits, address validity and name uniqueness. Text from outside, like a pasted invoice or message, goes to a separate quarantined model. Anything it returns is marked untrusted, needs your explicit confirmation, and can never fund an autopay.

Recipients are resolved through your private address book or ENS (ENSv2), and you can pay a whole group through an ENS parent domain. You then see a plain-language summary and confirm it. Only after that does a stripped hand-off with on-chain fields go to the execution layer. Names, context and your original prompt are never included.

Flexx handles one-time and group payments, bridging between chains, recurring autopays (through a delegated executor contract and Chainlink CRE automation) and cancelling autopays with a refund. Everything goes through an EIP-7702 account with spending limits you set.

Everything is stored in one encrypted local database, and session data like placeholders and prompts is wiped when the session closes. Balances are fetched through anon-rpc so lookups don't reveal who you are. We're shipping it as a local CLI.

How it's Made

We wanted to answer one question: can you hand your wallet to an AI without trusting the AI? Our answer was to treat the model like a smart but unreliable intern. It gets to read and interpret, but it never touches a key, and everything it produces gets checked by code that assumes it's wrong.

Flexx is a TypeScript monorepo on Node 22 with three parts: an agent, a wallet, and a shared protocol package, all talking over authenticated HTTP on localhost. We built it like a small engineering org made of AI agents, with parallel work lanes, versioned contracts between them, and separate agents writing and reviewing the code, so nothing graded its own homework.

The agent is a Fastify service on an encrypted SQLCipher database, with the key in the OS keychain. A local Qwen model on Ollama does the understanding, but it's on a very short leash: 13 fixed steps, narrow questions, and a JSON schema on every answer. Before the pairing step, real amounts and addresses are swapped for placeholders, and we generate a fresh schema per request that only allows those placeholders. The model can't hallucinate a recipient there because the decoder physically can't emit one. Untrusted content like pasted text, files and web pages goes to a quarantined model call with no tools, so a prompt injection has nothing to grab.

The wallet is the paranoid half. It decodes the exact calldata about to be signed and runs it through eth_simulateV1 against Alchemy, QuickNode and PublicNode, requiring two of three to agree at the same pinned block. If the intent, the bytes and the simulated transfers don't all match, nothing gets signed, and there's no "simulation is down, send it anyway" path.

Partner tech did the heavy lifting. MetaMask let us delete key management altogether: it holds the key and approves atomic EIP-7702 batches, and we verify the mined transaction afterwards. ENSv2 turns a name into a payment group, so iitr.eth can be your payroll list with no contacts database. Chainlink CCIP gave us real cross-chain USDC, and we delivered a live transfer from Sepolia to Base and track it to finality. Chainlink CRE is the backbone of autopay: a cron with no spending key that can only run plans the user registered on our IntentExecutorV3 contract. The workflow compiles to WASM and is waiting on deploy access.

Now the fun part, the hacks:

  • Tor circuit trick: we vary the SOCKS credentials per query type, which gives each one its own Tor circuit, so an RPC provider can't easily link your balance reads, ENS lookups and simulations by exit address.
  • Pretending the upgrade already happened: first-time accounts are simulated with a state override that gives them their EIP-7702 code before they've actually upgraded.
  • Time travel: we simulate registering an autopay, jump the clock forward, and watch the first run pay. For cancels, we jump past the cancel and require that the next run doesn't pay.
  • Smuggling a batch through MetaMask: a one-call batch gets sent directly, so we pass our whole checked batch wrapper as that single call.
  • The event log is the database: the contract stores only a hash and a schedule, and emits the full calldata in an event. The cron rebuilds its entire plan list from chain logs and keeps no state of its own.
  • Off-by-one in a delegation: the time-window enforcer's bounds turned out to be exclusive, so we sign start - 1 and end + 1 or lose the first and last valid seconds.
  • Taming RPC providers: Sepolia's node and the others report traced ETH transfers from different pseudo-addresses, so the decoder accepts both. Our log scanner also shrinks itself to fit provider limits, down to the 10 blocks we hit on Alchemy.

We tried hard to break it. Local chain tests run MetaMask's real contracts on Anvil at their real addresses, and we kill -9 the wallet with a payment in flight to prove it can't pay twice. A 50-person autopay used 2.15M gas on its first run and produced a 27.9 KB report, inside CRE's limits. We also discovered that forked chains can't prove bridged USDC arrives, because the fork never mints it, so we stopped trusting the fork and did a real send. The code passes 2,603 agent tests, 208 security and privacy audit checks, and 385 wallet unit tests, and a 154-prompt evaluation against the real model got zero wrong handoffs in its last full run, before we moved to the v2 envelope.

And because a wallet for people who live in the terminal should feel like it, flexx is hand-rolled: a custom renderer, an animated ASCII opening that dissolves into dust, and no TUI library.

background image mobile

Join the mailing list

Get the latest news and updates