
Open-source Solana client written in Lean 4
Joined November 2026
- Tweets41
- Following1
- Followers1.3K
- Likes25
A pretty significant milestone for Lean Client today.
We've removed the last 8,000 lines of C from our compiler. No C source, no C compiler, no libc.
Our entire Solana validator now builds through a compiler written in Lean that can compile itself. The result is a single static binary that talks directly to the Linux kernel.
All 1,055 compiler tests match the original, and the validator binary remains byte-for-byte identical.
This is a big step toward being able to formally verify not just the validator, but the very tooling used to build it.
Zero C dependencies. Entirely open source.
github.com/MidTermDev/lean-S…
🤖 Made with AI
The lean client website + docs have been updated to give a clearer picture of what’s been built so far, and where we’re headed.
leanclient.app/docs
Lean AMM, the 0% protocol fee dex built in lean, is now tracked on Defi Llama.
defillama.com/protocol/dexs/…
Lean Solana Kit v0.1.2 is out, and the prover now handles a lot more on its own.
Since v0.1:
🔹 More programs proven with no proof by hand. A vault program now proves automatically in 6 s (the counter went from 20 s to 5 s). Loops that zero account data and both of the compiler's account-walk shapes are handled too. The prover can now state its theorem for inputs exactly as the Solana runtime lays them out. Every proof rests on Lean's three standard axioms only.
🔹 The validator's vote guard is now proven to hold across restarts. On restart it rebuilds itself from the full record on disk, and a theorem shows it refuses any vote that contradicts a vote it already sent.
🔹 Mainnet found a bug and the client stopped itself. One transaction wrote 3,400 bytes in a single instruction. Agave's built-in programs reject instruction data past 1,232 bytes, and our client didn't. The bank hash differed, so the node stopped instead of moving on. The fix is in, and 2,008 blocks have been replayed with every hash matching.
🔹 Executor speed and size. We fixed a bug in parallel execution and compacted the account log from 107 GB to 10.5 GB. Restarts now take seconds, not minutes.
Still to come: automatic proofs for programs that call other programs (CPI).
Lean Solana Dev Kit v0.1 is out.
Write Solana programs in Lean, and prove them.
lsk new hello
lsk build # Lean → sBPF
lsk test # LiteSVM
lsk prove # Lean's kernel checks it
lsk deploy
lsk verify # Solscan verified
What you get:
• Kit: proven building blocks for signer, owner and key checks, overflow-safe math, lamport moves, PDAs and token calls. Each comes with a theorem saying exactly what it does.
• A starter program with its proof and tests.
• lsk prove: your program's theorems are checked by Lean's kernel, and for programs within the automatic prover's reach, the compiled bytecode is proven to match your Lean code too. No hand proofs.
It's the same stack behind our AMM, which is proven down to the bytecode running on mainnet.
Early days: automatic bytecode proofs cover simple programs for now. Programs that call other programs are next.
github.com/MidTermDev/lean-s…
Our AMM is now mathematically proven, all the way down to the bytecode running on Solana.
Audits check the source code. But the chain runs what the compiler outputs, and a compiler bug can slip past any audit.
So we proved the compiled program does exactly what its Lean source says:
• open pool
• open curve
• swap
• deposit
• withdraw
All five are covered by one theorem, checked by Lean's kernel. It relies on no shortcuts and no unproven steps.
The proof is for the exact build that's live on chain.
github.com/MidTermDev/lean-a…
lSOL update: Unstake at full value.
1 lSOL = 1 SOL, backed by staked SOL on-chain. Unstake turns your lSOL into your own stake account, claimable as SOL when the epoch ends.
Additionally, 2 hop routing is being added to the swap page in the next ~30 mins to allow users to swap any token directly to SOL through the lSol / SOL pool.
Phase 2 of making Lean a production toolchain for Solana:
proofs about a program should hold for the bytecode that's actually deployed.
Today a Lean proof stops at the source. Nothing ties it to the sBPF on chain. Phase 2 closes that gap: every build gets checked against an execution model that already matches Agave and mainnet.
First result, on the Lean AMM: across 6,218 inputs, its deployed bytecode and its Lean source never disagree.
* all 47,071 instruction fixtures now producing same results as Agave
The Lean Solana client is now checked against the shared Agave and Firedancer conformance fixtures.
46,809 of 47,071 instruction fixtures produce the same result as Agave: the same success or failure, the same changed accounts, and the same compute units left. That includes every fixture for the system program, compute budget, precompiles, ZK proofs and loaders v1/v2/v4.
It's the same code that replays mainnet, and every memory access in it is proven safe by Lean's kernel.
The fixtures also caught three gaps in our model, now fixed:
• lamport overflow past 64 bits
• Agave's general rent formula
• little-endian alt_bn128 compression
None of them could change a mainnet block, but a trusted model should match Agave exactly.
The remaining 262 differences are listed in the README and are being worked right now.
github.com/MidTermDev/leanCl…
The Lean Solana client is now checked against the shared Agave and Firedancer conformance fixtures.
46,809 of 47,071 instruction fixtures produce the same result as Agave: the same success or failure, the same changed accounts, and the same compute units left. That includes every fixture for the system program, compute budget, precompiles, ZK proofs and loaders v1/v2/v4.
It's the same code that replays mainnet, and every memory access in it is proven safe by Lean's kernel.
The fixtures also caught three gaps in our model, now fixed:
• lamport overflow past 64 bits
• Agave's general rent formula
• little-endian alt_bn128 compression
None of them could change a mainnet block, but a trusted model should match Agave exactly.
The remaining 262 differences are listed in the README and are being worked right now.
github.com/MidTermDev/leanCl…
A Solana client written in Lean.
160,000+ mainnet blocks in a row, every bank hash matching.
Every array access proven safe by Lean's kernel.
No runtime bounds checks.
And every optimization from here has to pass the proofs first.
Alessandro and toly were right: the slowdown was block verification, not the JIT.
Fixed: the Lean client now checks signatures and proof of history as each block's shreds arrive, not after the last one. That cut 60–110 ms per block to under 1 ms. Same results on 800 mainnet blocks, and every bank hash still matches.
Next up: execution.
leanclient.app
.@MidTermDev literally tell the clanker that Alessandro from anza said it’s slow at block verification and it’s not the jit.
Ecosystem integrations are underway! Thank you, Sidoor!
Sidoor × @LeanClient 🚪
Sidoor is the first launchpad to integrate Lean AMM. The integration is now live across both the Sidoor Launchpad and Sidoor Terminal.
Upon integration of this concept, the official Lean Client Validator has reached 685 SOL staked.
I'm considering a somewhat uncharted path to making @LeanClient profitable as a new Solana validator.
I'm extremely thankful that fees from our native token have covered our operating costs thus far, but I want to build something that generates genuine, sustainable value.
The idea is simple:
Introduce a liquid staking token (lSOL) backed by SOL staked with the Lean validator, and use it as the default quote token for launches on our 0% fee AMM.
The AMM will remain permissionless and open to any quote token, but we'll encourage lSOL within our own launchpad to support a non-extractive trading ecosystem.
At a 5% validator commission, we estimate needing roughly 60,000 SOL in active stake to break even on operations.
Instead of extracting fees from every trade, we sustain operations through validator revenue. Users retain their staking yield through lSOL, which appreciates against SOL as staking rewards accumulate, while remaining freely tradable and redeemable for SOL.
The more liquidity our ecosystem attracts, the more stake we can bring to our validator.
A profitable validator, a sustainable 0% fee exchange, and an ecosystem that gives value back to its users.
I think there's something worth exploring here.
Our approach to gaining stake in our validator starts here.
Bootstrap stake by offering the best value of any AMM.
Just staked 200 SOL to our @LeanClient validator and added an additional 200 sol in SOL/lSol pool on Lean AMM.
This will ensure liquid payouts for sol and more people can add SOL to the pool allowing people toget around the 1 epoch delay in unstaking.
Lean Client, WGMI
Token launches are now supported on Lean AMM.
0% fees. Everything belongs to the traders. Paired to lSol (Lean Liquid Staked Solana).
Launches begin at $5,000 market cap with 62% sold by $35k mcap.
amm.leanclient.app/#launch
We have submitted a dashboard to @DefiLlama for Lean AMM
github.com/DefiLlama/DefiLla…
Live now: wall-clock ns per compute unit for every Solana program, measured by our Lean client executing mainnet, plus hot vs cold time and sorting.
leanclient.app/programs
Replying to @MidTermDev @LeanClient
Can it collect counters on what programs it spends the most time in? Hot and cold and just push them to your site. I can pull and have it optimize in a loop












