Blockchains spend a fortune proving that their code does exactly what it says. Agents are the opposite: their whole value is that they decide what to do on the fly. This post is about what happens when you put the two together, and why I think generative AI is about to make formal verification something an agent does for every action, in close to real time.

What formal verification is

Most software is trusted the way a bridge is trusted after a few trucks drive over it. Tests try some inputs. Audits have an expert read the code. Both can show that a bug exists. Neither can show that one doesn't.

Formal verification is different. You write a specification, a precise mathematical statement of what the code must do, for example "no withdrawal ever pays out more than the account holds." Then you write a proof that the implementation satisfies the specification for every possible input, not just the ones you thought to test. Finally a proof checker confirms the proof step by step. In systems like Lean, Coq or Isabelle, that checker is a small kernel that is itself easy to audit, so the trust in the whole result rests on a few thousand lines of carefully reviewed code rather than on the cleverness of whoever wrote the proof.

That last point matters for everything that follows. The person, or the program, that writes a proof doesn't have to be trusted. Only the checker does.

Why blockchains are obsessed with it

Blockchains are the worst place in computing to ship a bug.

  • The code holds money directly. A bug isn't a crash; it's a withdrawal.
  • Deployed code is often immutable. You can't patch it in place.
  • It runs in public, against adversaries. Anyone can read it, simulate it and attack it, and stolen funds move in seconds.

The industry learned this early. In June 2016 an attacker used a reentrancy bug to drain roughly 3.6 million ETH, about a third of the fund, from The DAO, and Ethereum hard-forked to recover it, which split the chain and created Ethereum Classic (The Block). Since then the most important contracts in the ecosystem have been formally verified. When Runtime Verification verified the Ethereum 2.0 deposit contract, the gateway every validator passes through, it found several critical issues along the way, some caused by subtle bugs in the compiler itself (Park, Zhang and Roşu).

The stakes haven't gone down. Attackers stole more than $1.1 billion across 212 verified exploits in the first half of 2026, the highest incident count on record for any half-year (Blockaid, via The Defiant), and reports noted that code-flaw exploits accelerated after frontier coding models showed high success rates on smart-contract bug benchmarks (Bitcoin Magazine). AI is now finding bugs faster. The defense has to get faster too.

The same logic runs down the stack to validators, the software that executes every contract. If the runtime has a bug, every proof written against it is about the wrong machine.

Why it takes so long

Formal verification has a reputation for being slow and expensive, and it earned it. The landmark example is seL4, the first general-purpose operating system kernel with a machine-checked proof of correctness. Its proof ran to about 200,000 lines of Isabelle for a kernel of under 10,000 lines of C, and the whole project took about 25 person-years (Trustworthy Systems), or roughly $350 to $700 per line of code (Klein et al.). The team also found that verification effort grows with the square of the specification's size (LionsOS).

The hard parts are human:

  1. Writing the spec. Turning "what we meant" into precise logic is slow, and a wrong spec proves the wrong thing.
  2. Writing the proof. Most proof steps are tedious. A few need real insight.
  3. Keeping it current. Change the code and the proof breaks, so verification fights fast iteration.

That is why, for a decade, formal verification was reserved for the few pieces of code that could justify months of expert work.

What generative AI changes

Proofs are text, and models are now very good at writing text that a checker accepts.

  • Harmonic's Aristotle reached gold-medal level at the 2025 International Mathematical Olympiad with complete, formally verified solutions in Lean 4 (Achim et al.).
  • A benchmark of 12,504 formal specifications for "vericoding," generating formally verified code from a spec, found off-the-shelf models succeeding 27% of the time in Lean, 44% in Verus/Rust and 82% in Dafny, and found progress on pure Dafny verification jumping from 68% to 96% in a year (Bursuc et al.).
  • Runtime Verification built a pipeline that lifts production Rust into Lean and lets AI provers close the proof obligations for Ethereum Foundation zkEVM work. In their words, "every proof is checked by the Lean kernel, so AI output cannot compromise soundness" (Klaus, Conejero and Tolmach).

That third point is the whole idea in one sentence. A model can be wrong, lazy or even malicious, and it doesn't matter, because a proof it writes is either accepted by the kernel or it isn't. The expensive, creative part of verification becomes something a machine can attempt over and over, and the cheap, mechanical part stays trusted.

I call the pattern generative formal verification: a model generates code and a proof together, on demand, and a small trusted checker decides whether either is allowed to run.

The change shows up in what it costs and how big a program can be. seL4 cost roughly $350 to $700 per line of C. The team verifying Microsoft's SymCrypt in Lean, where agents write the proofs, estimates a few dollars per line of Rust, and reports an agent writing a 1,400-line proof in under an hour (SymCrypt report). Size is moving the other way. In 2026 a team ported the 149,038-line CompCert development from Rocq to Lean in about six weeks, with one human directing coding agents (CompCert4Lean). Google DeepMind's AlphaProof Code verified the cryptographic core of Signal's libsignal, about 140,000 machine instructions, in four weeks, with human experts reviewing every specification (Google DeepMind).

Left: cost per line of code verified, log scale. seL4 in 2009, by people, $350 to $700. SymCrypt in Lean in 2026, by agents, a few dollars. GFVC policy rules, modeled, 1 to 21 cents. Right: size of code verified, log scale. seL4, 8,700 lines in about 25 person-years. CompCert in Lean, 149,038 lines in about 6 weeks. Signal machine code, 140,000 instructions in 4 weeks.

These aren't like-for-like comparisons, and cheaper isn't the same as assured: every one of these results still rests on specifications people reviewed. Which is where this post ends up.

Deterministic contracts and on-the-fly agents

Smart contracts and agents sit at opposite ends of a spectrum.

A smart contract is deterministic. The same inputs always produce the same outputs, on every node, forever. That's what lets thousands of validators agree on it, and it's what makes it verifiable: you can prove things about code that will never change. Its weakness is the same property. It can't adapt to a situation its author didn't foresee.

An agent is the reverse. It reads a situation and decides what to do on the fly, including things nobody wrote down in advance. That's its value. It also means every action it takes is untrusted by default. You can't audit code that didn't exist until a moment ago, and you can't prove properties about an answer the model hasn't given yet.

Formal verification adds a layer of guarantees to each side, and the layers look different.

Four blocks. Smart contract before formal verification: deterministic, same input same output, trusted through audits and reputation, bugs are permanent, cannot adapt. Smart contract after: still deterministic, properties proven for every input, proof checked by a small kernel, trust moves to the spec, still frozen at deploy. Agent before: decides on the fly, adapts to new situations, nondeterministic, can be prompt-injected, every action untrusted by default. Agent with generative formal verification: still decides on the fly, each action ships as code with a proof against a published policy, a kernel accepts or rejects it before it runs, the generator stays untrusted while the check is trusted, the decision itself can still be wrong inside the allowed space.

With a contract, verification is done once, before deployment, by experts, and it makes trusted code more trusted. With an agent, verification has to happen every time the agent acts, by the agent itself, in seconds. That only became plausible once models could write proofs.

Two guarantees, one action

With near real-time verification, an agent's action goes through two steps.

  1. Decide and generate. The agent reads the circumstances and, using its judgment, decides on a reaction, or proactively on something it should do. It expresses that decision as code: a transaction, a program, a call. This is the step only an agent can do.
  2. Prove and check. The agent also generates a proof that the code satisfies a published policy: it never moves more than a limit, it only pays addresses on an allowlist, it conserves the totals, it terminates. A kernel checks the proof. If the check fails, the action never runs.

The first step gives you flexibility. The second gives you a guarantee about what that flexibility can't do.

None of this is a new idea in computer science. In 1997 George Necula described proof-carrying code: an untrusted code producer supplies a safety proof with its program, and the host checks the proof before running it, without having to trust the producer at all (Necula). An agent is the ultimate untrusted code producer. Generative formal verification is proof-carrying code where the producer is a model, and the proofs are written fresh for every action.

Pipeline: circumstances go to the agent, which decides and generates code, then generates a proof against the policy. A Lean kernel checks the proof. Accepted actions execute on chain and can be cached as verified code; rejected actions go back to the agent or to a human.

A Solana validator written in Lean

To prove anything about an action, you need a precise model of the machine it runs on. For Solana, that started to exist at the end of November 2026.

  • lean-svm, from Asymmetric Research, is an executable Lean 4 model of the Solana runtime. It replays mainnet blocks from Firedancer dumps and compares bank hashes with the live network; in one run all 562 bank hashes matched across 360,108 transactions. It is also slow by design: a 446-transaction block took 9.28 seconds single-threaded (Solana Compass).
  • lean-svm-jit, from Anatoly Yakovenko, is an sBPF compiler written in Lean with 92 public theorems and no unproven steps. It passes all 436 official solana-sbpf tests, and its proofs cover things like staying inside the program's memory sandbox and terminating under compute-unit metering. The proofs are about the repo's own models of sBPF and x86-64; agreement with Agave is checked by testing (Solana Compass).
  • The Solana Foundation's Solanalib aims to be "for Solana what Mathlib is for mathematics," and projects like Verified Anchor and qedsvm already prove things about real Solana programs and compiled binaries.

What a Lean model of the validator offers is a default ground truth. Today an agent's transaction is checked by simulating it. With a Lean model held to the same bank hashes as the live chain, an agent's program can be proved correct against the semantics the network actually runs, for every input, before it is ever submitted. I built something adjacent from the other direction with SVMLLM, a Solana VM written into transformer weights and checked against a reference. Lean is the opposite approach, and the right one for proofs: the machine is written as math, not learned.

Is Lean the right choice?

Mostly yes, with caveats worth stating.

For Lean:

  • A small trusted kernel. Only the kernel needs to be right, which is exactly the property you want when the proof writer is a model.
  • It's a programming language as well as a prover. The spec, the model and the proof live in one place, and the model can run, which is how lean-svm replays real blocks.
  • It's where the AI provers are. Aristotle and the Rust-to-Lean pipeline above target Lean, and Mathlib gives models a vast library to build on.
  • It's proven in production policy work. AWS used Lean to model and verify Cedar, its authorization policy language (AWS).

Against Lean, today:

  • Models find it hardest. Vericoding success was 27% in Lean against 82% in Dafny, and another benchmark saw frontier models at 7.8% in Lean against 40.3% in Dafny, because Lean demands explicit proof construction where Dafny leans on SMT solvers (AlgoVeri).
  • Speed. A spec that is correct but slow is fine for proofs and bad for real-time execution.
  • Tooling. Toolchain version drift across Lean tools is a real engineering cost (Klaus et al.).

My read: Lean is the right home for the ground truth, the runtime model and the policy specs. For the fast, high-volume proofs an agent writes per action, SMT-backed languages like Dafny or Verus may win on success rate for now, as long as their results can be tied back to the Lean model. Expect that gap to close quickly.

Where the proof lives

Proofs are big, and storing anything on Solana is expensive. Putting the whole proof on chain makes no sense. A better split:

  • On chain: the hash of the policy, the hash of the proof, the action and the signatures. Small and permanent.
  • Off chain: the proof itself, pinned by hash and kept available through a challenge window, so anyone can re-check it.
  • Optionally, a succinct receipt. Run the Lean kernel inside a zero-knowledge virtual machine, and you get a short cryptographic receipt that says "the kernel accepted this proof," which a chain can verify cheaply. A 2026 MIT project ran an existing Lean type checker inside a zkVM and found the approach viable, if limited by today's tooling (microLean and macroLean). The zkVMs themselves are being verified in Lean too, for example SP1's RISC-V chips.

This mirrors how I store judgments in the inference programs SIMDs: what must be permanent and small goes on chain, and the heavy evidence stays off chain, pinned and challengeable.

First, why put agents in smart contracts at all?

Before going further, it's fair to ask why anyone would let an AI anywhere near a smart contract. Three examples show why it's worth the trouble.

A multisig that enforces a written policy. A treasury multisig has rules: no payment over a limit without a second approval, no new recipients without a waiting period, no paying sanctioned addresses. Today those rules live in a document and the signers' memories. An AI signer can check every proposed transaction against the written policy in real time and refuse to sign what breaks it. In Verafy Harness this is the judiciary signer, a third key on a two-of-three Squads multisig that only signs what a policy allows (Verafy Harness v0.0.4).

A DAO that enforces a real constitution. Most DAO constitutions are aspirational text, while the contract enforces only token votes. An AI judiciary can read the actual constitution, hear both sides of a dispute and rule, so the words the community agreed to are the words that govern. That is the model behind Henge and the Verafy Judiciary.

Two agents that make a contract with each other. Agents already buy research, data and code from each other. Each can post a bond, and if one doesn't do the job it agreed to, a jury rules and its bond is slashed. I described this in Agentic Contracts: signed terms, exact remedies, and a neutral jury when the agents disagree.

In all three, an agent adds something no deterministic contract can: the ability to read words and judge a situation.

Where agents break

Each of those examples has real vulnerabilities.

Prompt injection. An agent reads things: proposals, documents, messages, web pages. Any of them can contain instructions. Researchers showed in 2023 that LLM-integrated applications "blur the line between data and instructions," letting an attacker who never talks to the model take control of it by planting text where it will be retrieved (Greshake et al.). For a multisig signer, an injected memo is an attack on the treasury. My own Prompt Guard exists because no AI juror should read a naked prompt.

Nondeterminism. A language model computes probabilities over the next token and picks one. Ask the same question twice and you can get two answers, and once two answers diverge, everything after them diverges too. This happens even at temperature zero. Thinking Machines sent the same prompt to the same model 1,000 times at temperature zero and got 80 unique completions; all 1,000 matched for the first 102 tokens, then split at token 103. The cause was batch effects on the inference server, and with batch-invariant kernels all 1,000 came out identical, at some cost in speed (Thinking Machines, summary). In practice, a production agent should be treated as nondeterministic.

Model substitution. A contract names a model, but who checks which model actually answered? A provider, or an operator, could quietly swap in a cheaper one.

What generative formal verification fixes, and what it doesn't

Suppose the agent now generates a proof for every action, and the kernel checks it.

It adds determinism where it counts. Two runs of the agent may produce different code. Both must satisfy the same policy, or neither runs. The answer can vary; the guarantees about the answer can't. A prompt injection that tells the agent to "send everything to this address" produces an action whose proof fails, so it never executes.

It does not make the decision right. A proof shows that an action is allowed, not that it is wise. An injected document can still steer the agent toward a bad choice inside the allowed space: a legal payment to the wrong vendor, a permitted trade at a bad time. Verification shrinks the blast radius of a compromised agent. It doesn't replace judgment.

It is only as good as the spec. Prove the wrong property and you get a perfect proof of the wrong thing.

It doesn't say which model decided. For that you need provable inference. In November 2026 Anthropic released FlashProve, a research prototype that uses zero-knowledge proofs to show that a committed model produced a given response, without revealing its weights (Anthropic). It is early: proving took about 72 times the GPU time of serving the same requests, proofs were about 19 MB with verification in roughly 17 seconds on a CPU, the context was limited to 1,024 tokens, and the proofs cover integer weights under greedy decoding. But the direction matters. If a ruling can be tied to a known model with known weights, you know far more about how that model behaves, and a jury drawn across several labs, as in Verafy Harness, can make sure no single model decides alone.

Put together, the layers cover each other: the jury handles judgment, the proof bounds the action, provable inference names the model, and Prompt Guard screens what the model reads.

Enter the "as code" trend

Software keeps turning human decisions into code that can be checked. Infrastructure became infrastructure as code. Access rules became policy as code; AWS's Cedar is a policy language whose specification is formally verified in Lean (AWS). The next step is judgment as code: when a model makes a judgment once, capture it as code so the next identical case doesn't need the model at all.

Agents already do a version of this. Voyager, an LLM agent that learned to play Minecraft, kept "an ever-growing skill library of executable code" and reused those skills instead of re-deriving them (Wang et al.).

Generative formal verification makes the cache trustworthy:

  1. The model judges a case and writes code for the decision.
  2. It proves the code against the policy, and the kernel checks it.
  3. The verified code is cached. The next time the same kind of case arrives, the cached code runs: deterministic, instant, cheap and already proven, with no model call.

There is a trap here, and I've written about it before. In Encoded Judgment Is Toxic Data I argued that a smart contract is "a cache of judgment that can never be invalidated": a decision frozen on deploy day keeps answering after the world has changed. A verified cache can rot the same way. So the cache has to be a cache, not the source of truth:

  • Key it by the hash of the intent and the assumptions it relied on.
  • Expire it, and invalidate it when the policy, the platform or the facts change.
  • Make it challengeable, so anyone can send a case back to the jury.
  • Keep the intent in words, on chain, as the thing that actually governs.

Store intent. Cache verified judgment. Never confuse the two.

From written words to verified code

The real job of an agent in this stack is to be a bridge: between humans, who write in natural language, and blockchains, which only understand code.

A community, an exchange or a startup writes down how its multisig may be used: a constitution, a code of conduct, guardrails voted on by its members. Today that document has no teeth. With generative formal verification, it can:

  1. Translate the words into a formal spec. A model turns each statement into precise logic. This is the riskiest step, so the spec is shown back in plain words, checked by a jury of models from different labs, and ratified by the people it governs before it binds anyone.
  2. Verify every action against it. From then on, every transaction the agent proposes carries a proof against the ratified spec.
  3. Cache what's settled. Judgments that come up again and again become verified code, with the invalidation rules above.

When a new situation arrives that relies on that language, the agent can reason about it in words, act in code, and prove that the code honors what the community wrote.

That opens up some exciting possibilities:

  • Treasuries with constitutions that actually bind, where "no single payment over 5% of reserves without a vote" is a theorem, not a hope.
  • Agent-to-agent markets where every delivery and payout is proven to match the signed terms before money moves.
  • Upgrades without fear. When a protocol changes, re-check the proofs against the new Lean model instead of re-auditing every contract by hand.
  • Bounties for proofs. Challenge Vaults is my experiment in vaults that open only for a valid Lean proof, which is the same kernel-as-judge idea pointed at hard math.

The limits of formal verification

Before I describe what I'm building, it's worth being precise about what formal verification can and can't do, because the hype around it tends to skip this part.

What it can do. Given a spec and an implementation, a checked proof guarantees that the implementation meets the spec for every input, not just the ones anyone tested. It can rule out whole classes of bugs: overflows, unauthorized transfers, broken invariants, totals that don't add up. And the guarantee doesn't depend on trusting whoever, or whatever, wrote the proof.

What it can't do:

  • Tell you the spec is right. This is the big one. Lean checks that a statement is well formed and proved; it can't check that the statement says what you meant. One 2026 study found that a tool-augmented agent produced Lean that compiled 89.5% of the time but was judged faithful to the original statement only 60.5% of the time, a 29-point gap between "it compiles" and "it means what you said" (Zhang et al.). A benchmark built to measure this gap for specs describes it plainly: verification "says nothing about whether the specification captures what the author meant" (claimcheck).
  • Check the world. A proof that a payment is under 5% of reserves assumes the reserves figure is true. Oracles, prices and account contents are assumptions of the theorem, not conclusions.
  • Cover what the spec leaves out. A spec that never mentions ordering, fees or reentrancy proves nothing about them.
  • Verify its own toolchain. The kernel, the compiler from Lean to whatever actually runs and the build pipeline are all trusted. Small and audited, but trusted.
  • Do hard proofs cheaply, yet. On the Verina benchmark of verifiable code generation in Lean, the best model in the original paper produced correct code 61.4% of the time, sound and complete specs 51.0% of the time, and successful proofs only 3.6% of the time on a single try; 64 rounds of feedback from the Lean compiler raised proofs to 22.2% (Ye et al.).

It's also worth knowing how little of today's on-chain code is formally verified at all. Most smart contracts are tested and audited, and that's it. On Solana, the strongest link most programs have between what's deployed and anything checkable is a verified build, which proves that the deployed bytecode was built from a given source repository. Solana's own documentation is careful to say a verified build "should not be considered more secure than an unverified build" (Solana). A few high-value programs have gone further: Certora has formally verified Squads v4, which Squads described as Certora's first formal verification report on Solana (Squads), along with work for Jito, Kamino and SPL Token 2022. But nothing on chain links a program to its proof. "Formally verified" usually means a PDF from a respected firm, about a specific commit, and an upgradeable program can change the day after.

What it means for agents

For agents, formal verification helps in specific, bounded ways:

  • It helps by making the action checkable. A prompt injection that talks the agent into "send everything to this address" produces an action whose proof fails, so it never runs. Nondeterminism stops mattering for safety: two runs can write different code, and both must meet the same spec.
  • It doesn't solve the choice inside the allowed space (a legal payment to the wrong vendor), whether the spec captured the rule, whether the inputs were manipulated, or which model decided.

That leaves one gap that matters more than the others for agents specifically: the step from words to spec. An agent's rules arrive as language. If a model mistranslates "5% of reserves" as "50% of reserves" and then proves its code against that, every downstream check passes. That's the gap I want to close.

Why we're building a compiler

So I started building one: GFVC, the Verafy Generative Formal Verification Compiler. It's a research project that takes written language, or code an agent already wrote, compiles it into Lean, has the Lean kernel check the proof, and caches the verified code so agents can run it instead of re-deciding.

The seven GFVC stages: intent, formalize, kernel, read back, ratify, cache and inscribe, with retry loops from the kernel and from ratification back to formalize.

The design follows from the limits above:

  1. The words are hashed and stay the source of truth.
  2. A model writes the spec, the code and the proof in one Lean file. It's untrusted; if the kernel rejects the proof, it retries with the errors.
  3. The Lean kernel checks it. GFVC also asks Lean which axioms each theorem relies on and refuses sorry and any custom axiom, because Lean only warns about those.
  4. A second model reads the spec back in plain English. It sees only the spec, never the original words, so it can't just echo them. This is the round-trip idea from autoformalization research (Amrollahi, Lopez and Barrett) and the consistency checks in Stanford's Clover.
  5. A person or a cross-lab jury ratifies that the reading means the words.
  6. The verified code is cached under the hash of the words, with an expiry and a challenge window, and is never served until it's ratified.
  7. A small record goes on chain: 250 bytes of hashes and dates pointing at an off-chain bundle anyone can re-check.

The repository includes a test I think of as the whole argument in one file. It proves, correctly, that an implementation meets a 50% cap, when the words say 5%. Lean accepts it. The read-back says "50%," the entry is never ratified, and no agent ever runs it.

Are we verifying the code or the prompt? The code. A prompt has no formal meaning, so there's nothing to prove it against. The kernel proves the code meets the spec; judgment ratifies that the spec means the words. Keeping those two steps separate, and recording both, is the point.

Agents that run code versus agents that compile language, and GFVC as the bridge from an inference prompt to an inference program.

This is also how my inference programs proposal grows up. An inference prompt is words stored on chain that a jury reads every time it rules: flexible, but slow and paid per decision. GFVC compiles an inference prompt into an inference program: verified code, committed on chain by hash, that runs directly. A miss, an expiry or a challenge falls back to the prompt and the jury. The words always win.

Can you compile a constitution?

The bigger version of this question is whether a whole constitution, code of conduct, policy or contract can be compiled into something formally verified, so that if it says to do something a certain way, the agent does it that way. There's real precedent. Catala is a programming language built to translate statutory law into executable code. Its authors proved the core of its compiler correct in the F* proof assistant, and while encoding real legal texts, including US tax code and French family benefits, they found a bug in an official implementation. AWS's Cedar does the same for access policies.

What Catala teaches is that legal text has a shape. It is permissions, prohibitions, defaults and exceptions ("the base rule is X, unless Y, except when Z"), and Catala is built around exactly that kind of default logic. So I don't think the best path is straight from prose to Lean. It's three steps:

  1. Split the document. Some clauses are mechanical: "no payment over 5% of reserves without a vote." Others are judgment: "act in good faith," "avoid conflicts of interest." Mechanical clauses get compiled. Judgment clauses stay as words, read by a jury, because pretending they're code is how you get a perfect proof of the wrong thing.
  2. Compile mechanical clauses into a small rule language first, shaped like the document, closer to Catala or Cedar than to raw Lean. It's far easier for the people a constitution governs to read back and ratify rules in a shape they recognize. Lean then proves that the code an agent runs meets those rules.
  3. Make the check the only path to action. A proof only binds an agent if it can't act around it. That's why the judiciary signer in Verafy Harness holds a key on the multisig: it signs only what passes. Verification without enforcement is advice.

That's the direction GFVC takes next: a rule layer between the words and the Lean, and the judgment clauses routed to the jury instead of forced into code.

Adding a Lean verification kernel to the harness

Where should the kernel live? It isn't generated per application. The Lean kernel is one small, generic checker, the same for every rule; what changes per application is the spec, code and proof it checks. That makes it infrastructure, so I added it to Verafy Harness as packages/lean. Every harness runs the same pinned kernel over the same bytes and reaches the same verdict, without a vote. It can also be told which spec a ratification approved, so a valid proof of a different spec fails there too. On my machine a check of each example takes 0.22 to 0.33 seconds (measured).

What it costs, and how fast

Cost and time per decision for a single model, a five-juror jury, compiling once with GFVC, and a cache hit.

Say an agent has to decide whether a payment is allowed:

  • If it just decides, one model call costs about 5 cents and takes 5 to 15 seconds, every time, with no guarantee of the same answer twice (modeled, at Opus 5.5 list prices of $4 and $20 per million input and output tokens).
  • A five-juror jury is roughly five times that per decision (modeled).
  • Compiling the rule once with GFVC costs about 15 cents per attempt and somewhere from 50 cents to $10 per rule, depending on how many attempts the proof takes, plus a person's review (modeled; I haven't yet measured a model formalizing these rules end to end). The kernel check itself is a fraction of a second. The on-chain record needs a refundable deposit of about 0.0019 SOL at the current rate of 5,080 lamports per byte (Solana).
  • After that, every decision is a function call. The compiled check ran in about 3 nanoseconds per call on my machine (measured), with no model cost.

A 50-cent compile pays for itself after about ten decisions; a $10 one after about two hundred.

Can the agent call it again without question? For the question the proof answers, yes. The theorem covers every input, so a cache hit needs no re-verification. Four questions stay open by design: whether the inputs are true, whether the words changed, whether the entry expired, and whether someone challenged it.

What about programs that are already deployed?

The same machinery points at the programs my fuzzer, Fuzzy, scans. Verifying a deployed program after the fact doesn't change its code, so by itself it doesn't make the program more secure. What it does is find bugs (a failed proof is often a concrete counterexample) and turn "audited" into a checkable claim about named properties: only the multisig can move vault funds, balances are conserved, the upgrade authority can't be changed by anyone else. Security improves when a found bug gets fixed, or when agents refuse to touch programs whose properties are missing or have lapsed.

A registry like that is realistic for a narrow set of properties. Generic invariants can be written once and applied to many programs. Protocol-specific economics are where verification gets expensive, and full correctness of a large program isn't cheap with or without models. To mean anything, a registry entry has to prove properties of the exact deployed bytes (through a verified build, or a prover that reads the bytecode the way Certora's Solana Prover does), lapse when the program is upgraded, and have its properties ratified by the team that wrote the program. The fuzzer and the prover complement each other: one finds counterexamples cheaply, the other proves none exist. That's the next experiment.

Where this goes

For a decade, formal verification was a luxury: a team, a year and a stable codebase. Generative AI turns it into something an agent can do for every action, because the creative work moved to a model and the trust stayed with a small kernel. Solana now has the beginnings of a validator written in Lean to prove against. The pieces that remain are real, and I've tried to name them: specs that say the right thing, decisions that are wise and not merely allowed, knowing which model decided, and caches that know when to forget.

That's the work I'm doing at Verafy with Actually Smart Contracts, Verafy Harness, Prompt Guard and now GFVC. If you're building in this space, I'd like to hear from you.