Formal Mind. (@FormalMindAI) header
Formal Mind. (@FormalMindAI) profile picture

Verifying Ethereum smart contracts in Lean.

USA
Joined April 2025
Photo by Formal Mind. (@FormalMindAI)Photo by Formal Mind. (@FormalMindAI)
We're applying for @thedaofund initiative to secure Ethereum by building Lean4 proofs for your repo. If you want to support, please use this link to send a pledge. initiatives.thedao.fund/init…
43
A v2 pair calls out to token contracts. The proof treats each token as an opaque step. So it assumes standard tokens: no fee on transfer, no rebasing. Those break v2's accounting, and the report says so.
19
"Audited" and "verified" aren't the same word. An audit is people reading code for a few weeks. A proof is a machine checking a claim for every input. You want both. Formal Mind doesn't replace audits; it gives auditors machine-checked invariants to start from.
13
A Uniswap v2 statement in plain words: "Burning LP tokens returns your share of the pair's balances, rounded down." Rounded down, never up. That one direction is the difference between a pool and a drain.
12
Formal Mind runs on your Claude plan by default. Each agent turn uses the Claude Code you already signed in to. No credits, no key, nothing extra to pay. Or use formal.team credits, your own Anthropic key, or your own OpenAI key.
7
How the swarm plans a v2 pair: mint, burn, swap, skim, sync, plus the internal _update and _mintFee. The swap theorem is the one that matters. It's also the one with the most cases.
4
Build log: each agent run in the chat is now a card. Its plan item, its status, each step with its file and time, and the agent's note. A file write opens to its diff. You see what the prover touched without opening the folder.
4
USDC's money invariants: total supply equals the sum of all balances a minter never mints past its allowance mint and burn are the only ways supply changes Simple to say. Worth having checked on every upgrade.
8
The Lean model isn't written by hand. formal-ast reads solc's syntax tree and generates one Lean file per contract. Each Solidity function becomes a definition over the contract's storage. So a proof is about the code you wrote, not a copy of it.
7
We've added lean LSP! Verify any Ethereum Solidity contract using formal mind desktop application.
8
Statements: write a claim in plain words. "Only the owner can change the fee recipient." The swarm works out what that means in the code, asks you to confirm its reading, then proves it or disproves it.
7
WETH9 is about as simple as money code gets, and it still has a subtle invariant. What's a contract you think is "too simple to need a proof"? Reply with it.
6
How the swarm works, in one loop: 1. The prover takes the next function and writes a Lean proof 2. `lake build` checks it 3. The reviewer checks the statement against the Solidity 4. Approved → proved. False → a Foundry PoC Then the next function. Same loop, every time.
4
What a WETH9 proof assumes: the EVM's rules for ETH transfers, and solc compiling the code as written. What it doesn't need: trust in any other contract. It calls out only to send ETH to the caller on withdraw.
4
Hacken's 2025 report puts losses from code logic errors at $512M that year. Code that compiled, passed its tests, passed audits, and still let someone withdraw more than they deposited. That's the class of bug a proof rules out.
6
A WETH9 statement in plain words: "transferFrom never moves more than the allowance, unless the allowance is the maximum or the sender is the owner." Both exceptions are in the code on purpose. A proof has to name them, not miss them.
6
Have a Foundry project with a deploy script? Add the folder to Formal Mind, press Start, and watch the plan fill in: one item per function your scripts reach. Free to download for Mac. docs.formal.team/install
8
Week 1 of verifying the contracts that hold the most money onchain: WETH9. A few dozen lines of Solidity. Wrapped ETH for most of DeFi passes through it. Small, old, everywhere. A good first target.
1
41
Formal Mind is a swarm of agents that verifies Solidity. Point it at a Foundry project. It writes a Lean 4 model of every function, proves what each one does, and when a property is false, writes a Foundry test that shows the bug. docs.formal.team
8
WETH9 holds 2.23M ETH, about $5.2B, in roughly 60 lines of Solidity. Almost every DeFi protocol wraps and unwraps through it. We're formally verifying it in Lean 4, in the open.
2
1
33
Next are the properties that protect the money, not just the functions: • Solvency: balances never add up to more ETH than the contract holds • Transfers conserve the total • No one can stop you withdrawing your balance
1
4
Proofs, statements and how to check them yourself (cd formal && lake build): github.com/formalmind/weth9 Protecting the contracts the ecosystem's money sits in, one proof at a time.
4