← clawdcompute.us
🦞Welcome β€” one page, no hype, just the build
Pure Lean 4 Β· Nov 26, 2026

A Solana client
in pure Lean 4.

A Solana client written in pure Lean 4, compiled by its own dependency-free Lean β‡’ x86-64 compiler β€” lsc β€” with raw futex IPC. No C toolchain in the output path. Built by @0rdlibrary.

β€œA lean Solana client would be easy to build if you build your own no-dependencies Lean β‡’ machine compiler and just use a raw low-level futex for IPC.”

β€” toly, Nov 26, 2026 Β· the post this was built in response to

Run it yourself: git clone https://github.com/Solizardking/lean-solana-client && cd lean-solana-client && ./bench.sh — one command runs all 8 vector suites (all passing), then prints the benchmark table with C baselines measured in the same run — losses included.

The voting client

Status: ARMING
The endgame β€” mainnet votes, cast by a theorem prover

Every client that votes on Solana is written in Rust or C. This one votes in Lean 4.

The all-Lean client is being aimed at the one job that matters: casting real mainnet votes. The vote path is Lean end to end β€” byte-exact vote encoding against Agave’s format, ed25519 signing by the repo’s own crypto, no Rust anywhere in it β€” and votes travel over Helius HTTPS RPC, not gossip. The correctness bar is the one this repo already ships: invariants stated as theorems and checked by the Lean kernel β€” the standard behind the machine-checked invariant theorems under proofs/ (zero sorry). It has not voted yet: the client is built, the validator is staged on Fly, and two gates remain β€” the deploy and a 2.05 SOL funding. Both are tracked in public, with the on-chain numbers read live.

identity  Bo4AgZ7X…TFvuYxL
vote acct 9QG7ytLN…79Xt4ZH7 · commission 100%

Plain English

For normal humans

Every Solana validator runs client software β€” the engine that reads the chain, checks signatures, and keeps up with the firehose. Almost all of them are written in C or Rust. This one is written in Lean β€” a language mathematicians use to prove things are correct, not just test them. Lean normally can’t do this job, so the dev first built a whole compiler in Lean that turns Lean straight into machine code. No C, anywhere. Then he pointed it at Solana: it speaks the network’s gossip protocol, does the crypto, and publishes its benchmarks with the losses left in β€” where it’s slower, the page says so.

The Nov 27 upgrade: the chip in a modern server has special circuits for crypto β€” a turbo button the old code never pressed. The client now detects them at startup and uses them. Hashing got 5.4× faster on the live demo host overnight. Signature checking is next: the fast path is built and proven correct, and batch mode is what unlocks the real gains there.

The one-liner for the group chat: everyone else buys their engine β€” this guy forged his own out of math proofs, then raced it.

Why it’s cool

Theorem prover β†’ systems code
01 β€” The compiler is Lean too

Lean is only the frontend. Everything after is Lean.

Lean handles elaboration only. Everything after the IR β€” effect checker, inliner, register allocation, codegen, x86-64 encoder, ELF writer β€” is written in Lean. The runtime (bump allocator, arrays, process start) is also Lean, on raw syscall / SIMD intrinsics.

No C compilerNo lean -cNo libcNo assembler
02 β€” Real systems work

A theorem-prover language running QUIC, TLS & gossip

Its own QUIC + TLS 1.3 stack and a gossip protocol implementation β€” all measured against C / openssl / libsodium, with the raw evidence committed in the repo.

03 β€” Honest numbers

Where it trails C, the README says so

SHA-256 now has a SHA-NI path (β‰ˆ590–620 MB/s vs β‰ˆ103–115 scalar) and ed25519 an AVX-512-IFMA field multiply β€” but openssl is still β‰ˆ3.2Γ— ahead on SHA-256, and single-signature verify sits at parity-to-behind. QUIC throughput is ~7.8Γ— behind quinn. Losses are published next to the wins β€” that’s the culture of the project.

04 β€” Live, not hardcoded

The demo runs the real binaries

At lean.clawdcompute.us, the real lsc-compiled static binaries run next to C / openssl / libsodium baselines and stream every batch to the browser over SSE. Nothing on the page is hardcoded. It now also carries live gossip counters streamed from the real gossip binary running against mainnet.

How we built it

Lean source β†’ static ELF
Lean 4 source
β†’
Lean frontendelaboration only
β†’
Lean IR
β†’
ELF writerstatic, W^X
Inside lsc β€” in order
Effect checker
β†’
Inliner
β†’
Linear-scan register allocation
β†’
Codegen + intrinsics
β†’
x86-64 encoder
β†’
ELF writer

IPC: futex SPSC ring in shared memory

128-byte cache lines, cached head / tail indices, and a Dekker-style mfence handshake so wakeups are never lost.

Busy-pollPure-futexHybrid

Why futex?

It was in toly’s prompt β€” and it’s the point. No framework, no runtime service. Just a raw low-level futex between processes, exactly as specified.

Phase tracker

P0 β€” P5
P0

Own backend

Lean IR β†’ x86-64 β†’ static ELF, tiny Lean runtime, futex SPSC ring ping-pong.

βœ“ Done
P0.5

Compiler hardening

Effect checker, register allocation, inlining, closures, Array / ByteArray, W^X ELF. IPC within ~1.1–1.3Γ— of gcc -O2 C latency.

βœ“ Done
P1

Crypto primitives

SHA-256 / SHA-512 / ed25519 on ByteArray + SIMD intrinsics, all vector-tested against hashlib / libsodium / openssl. Correct; slower than tuned C β€” stated openly.

βœ“ Done
P2

QUIC + TLS 1.3 + TPU client

QUIC + TLS 1.3 client (AES-128-GCM, X25519, HKDF, key update) and a TPU client: RFC 9001 Appendix A vectors byte-exact; interop with aioquic, quinn and agave; 10/10 Lean-signed transfers landed on a local agave TPU.

βœ“ Done
P3

Gossip client v1

A gossip spy node in pure Lean β€” ephemeral ed25519 identity, signed PullRequests, byte-exact bincode parsing, every record’s signature verified with the repo’s own ed25519, Ping β†’ Pong, distinct-node census, over raw UDP syscalls with no new compiler intrinsics. Proven on loopback (nodes=2, verified=2, bad=0) with hand-computed wire vectors. The same binary now runs against mainnet from the live demo host, with live counters — pulls flow out, responses are gated (see the caveat below). Shreds + erasure coding still pending.

◐ v1 done
P4

Replay, SVM, accounts DB

Pending.

Pending
P5

Voting / consensus

Slice 1 landed Nov 28, 2026 (lean-solana-client master 9668dd2): pure Lean now builds a byte-exact VoteStateUpdate β€” serialized exactly as Agave does, against the real 2-account UpdateVoteState instruction β€” and a complete signed vote transaction: 281 bytes, 216-byte message, the signature verified by the repo’s own ed25519, and a tampered signature rejected. Byte vectors pin the wire format (78-byte update without timestamp, 66-byte with one) and the suite passes 3/3. Plain English: the client can now write a correct vote in the chain’s exact byte format and prove the bytes are right before anything touches a network. Honest status: nothing has run against a cluster yet β€” the devnet rehearsal is next, and Tower lockout / fork-choice is the following slice, not done. Design and gate order: PHASE5-VOTING.md.

◐ Slice 1 landed
Honest caveat on P3: the demo host’s UDP works — the real gossip binary running at lean.clawdcompute.us has sent 257 signed PullRequests at mainnet and counting — but zero PullResponses have come back. Agave’s gossip reachability gate (verify_gossip_addr) requires an unstaked caller to advertise a reachable public gossip address and answer a gate Ping at that address before responses flow; the demo host sits behind NAT and advertises 0.0.0.0, so the gate never opens. The demo’s live counters say exactly that — verified/s = 0, pulls ticking — until the client runs on a public-IP host. Documented in the repo, not papered over.

Key numbers

Live demo Β· Nov 26, 2026
Futex streaming β€” lower is better
353 ns / msg
lsc 353  Β·  gcc -O2 C 503
lsc 353C 503
βœ“ lsc ahead
Ping-pong latency
~1.1–1.3Γ— of C
lsc within ~1.1–1.3Γ— of gcc -O2 C
lscC baseline
β‰ˆ Close to C
Busy streaming β€” lower is better
24.2 ns / msg
lsc 24.2  Β·  cached-index C 9.2
lsc 24.2C 9.2
C ahead β€” stated openly

Source: live demo session, Nov 26, 2026. Full benchmarks, vectors and raw evidence are in the repo README — or run ./bench.sh and measure them on your own machine.

solana-lean β€” community SVM rewrite

Live from GitHub

The VM itself, rewritten in Lean 4 β€” in the open. solana-lean is the public community repo for the Solana Virtual Machine rewrite: executable sBPF semantics with machine-checked proofs, a differential oracle against LiteSVM / Agave, and verified example programs, with every contribution tracked in a public log. The commits and open issues below stream straight from GitHub β€” pick one up and land a proof.

Latest commits

  • Loading from GitHub…

Open issues

  • Loading from GitHub…

Solizardking/solana-lean β€” join in on GitHub β†—