
Open-source Solana client written in Lean 4
Joined November 2026
- Tweets20
- Following1
- Followers802
- Likes12
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
Lean Client, our Solana validator written in Lean, has been voting on mainnet since Dec 1.
As of Dec 2, it now follows the full Alpenglow voting rules.
Its voting code also comes with machine-checked proofs: it can never cast conflicting votes, it votes in every slot on time, and peers can't flood it.
Lean checks the proofs on every push.
github.com/MidTermDev/lean-S…
Lean AMM is a 0 fee open-source dex AMM written in Lean.
As the cost of code rapidly approaches 0, the only thing left is trust.
With lean, we can prove our claims. This promotes a "Golden Age" of defi as we promote quality, machine proven code without the extraction
Lean AMM - a 0% fee dex program, written in Lean, has just surpassed 100 SOL in TVL.
More features coming soon for Lean AMM
amm.leanclient.app
What started as an experiment in writing a Solana validator entirely in Lean has turned into a 31,000-line independent client, built with its own compiler.
Hundreds of thousands of blocks executed. Zero bank hash mismatches.
We're now executing heavy mainnet blocks in as little as 162ms on average in benchmarks, with votes reaching over 96% of validators.
There's still plenty to optimize, but it's pretty cool to see how far this experiment has come.
Welcome to mainnet, Lean Client Validator #001
Please enjoy your stay. Fees will be directed to keeping vote account funded and increase the stake on this validator.
Future developments for Lean are underway 👀
Votes are hitting mainnet 🔥
explorer.solana.com/address/…
Our validator has reached voting status!
Actual vote TX's should appear within a few hours as we clear our ~33k slot backlog post-update.
Watch live:
leanclient.app/#node
Lean Client update.
Our mainnet node now produces blocks, earns leader rewards, and executes transactions in parallel.
Wallets and RPCs can send transactions straight to the node over QUIC; mainnet gossip lists it as a TPU. Before a transaction goes into a block, the leader checks everything that would get the block rejected: parsing, signatures, repeats, whether the fee payer can pay, and the block's cost limits. Blocks fill highest fee first, using the same formula Agave uses, and go out over turbine in batches while the slot is still running. We rebuilt 134 mainnet blocks this way. All were valid, and every bank hash matched the footer.
Footers now carry reward certificates, which is how a leader gets paid half of what voters earn. We build them from real votes our node hears, about 112 validators per slot so far. Our checker also accepts every reward certificate Agave leaders put in 134 real mainnet footers.
Transactions now run on multiple cores. Each one starts as soon as the transactions it depends on finish, and the bank hash comes out identical to running them one at a time. Over 1,700 mainnet blocks on 8 workers, every bank hash matched, at 122ms a block versus about 180ms single threaded. That's 1.45x faster. The live node runs this way now.
Next is building on whichever parent the votes settle on, and moving more of each block onto the workers.
All Lean, compiled by our own compiler. leanclient.app
12% fewer CPU cycles per mainnet block.
Lean Client now compiles Solana programs lazily: each block of a program becomes machine code the first time it runs, and code that never runs is never compiled.
Live on our mainnet node, every bank hash matching the network.
Compilation. Solana programs are bytecode. We now translate each block of a program to x86 the first time it executes and link blocks directly once both exist, so code that never runs is never compiled.
The design follows @toly's lean-svm-jit, rewritten in Lean.
Feature gates. New Solana behavior ships behind switches that turn on at epoch boundaries. The client now reads each switch from its on-chain account and activates it exactly as Agave does, so upgrades it already supports take effect on schedule, without a new release.
Network duties. Validators pass each block's shreds down a relay tree and fill each other's gaps through repair.
Our node now answers repair requests from the blocks it has verified, over 2,000 in its first minutes, and computes its place in the tree exactly as Agave does.
Account lookups now compare the first 8 bytes of a key before all 32, and duplicate checks run once per call instead of three times. That alone is 12% fewer instructions per block.
All of this is live on our mainnet node.
github.com/MidTermDev/lean-S…
Lean Verify.
Our lean-amm program has been formally verified on chain utilizing lean-verify.
We identified non-existent tooling for users wishing to verify lean program son-chain, so we built it/
Learn more: leanclient.app/verify
Program:
solscan.io/account/AMXwyCL9a…
Lean AMM is live on Solana mainnet.
An open-source AMM written in Lean, with its math formally proven: a swap can't drain a pool, and LP shares can't lose value to rounding.
0% platform fee. Every swap fee goes to LPs.
amm.leanclient.app
How: the program is written in Lean 4 and compiled straight to Solana bytecode with toly's lean-svm.
So the theorems are about the code that runs on chain, not a model of it. Every swap, deposit and withdrawal pays exactly its formula, and never less than your minimum.
Anyone can open a pool for any SPL or Token-2022 token and pick a fee from 0.01% to 1%.
The page checks the token against the program's rules and your price against the market before you send anything.
What isn't proven: which accounts each instruction accepts, and the token transfers. Those are covered by 56 tests in Solana's own runtime.
It hasn't been audited, so start small. Every proof and the build hash are in the README.
1
13
1,714
The best time to (re)write your Solana program(s) in Lean was yesterday. The second best time is today.
Write it in Lean, compile it to sBPF with lean-svm, then run it with leansol run: a Solana VM written in Lean.
github.com/MidTermDev/lean-S…
A rebrand and restructure of the Solana Lean Client is under way.
Open source contracts, tools, etc. in Lean 4 are being built.
leanclient.app








