# What is formal verification in smart contracts?

URL: https://shield.quillaudits.com/learn/glossary/formal-verification/

Formal verification is proving, with mathematical tools, that a contract satisfies a written specification for every possible input and state. A test shows the code works for the cases it tried, while a proof shows that no case breaks the property, as long as the specification says what you meant ([ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/)).

Last updated 3 December 2026. 2 minute read. By the QuillAudits Team.

## How does formal verification differ from testing?

| Approach | Covers | Result |
| --- | --- | --- |
| Unit tests | The inputs you chose | Passes for those cases |
| [Fuzzing](https://shield.quillaudits.com/learn/glossary/fuzzing/) | Many generated inputs | No failure found in the runs made |
| Formal verification | Every input and reachable state | Proved, a counterexample, or no answer in time |

ethereum.org groups the tools into specification languages, program verifiers such as the Certora Prover, the Solidity SMTChecker and KEVM, and theorem provers ([ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/)). Trail of Bits lists Halmos, Certora and KEVM as formal verification tools for checking [invariants](https://shield.quillaudits.com/learn/glossary/invariant/) ([Trail of Bits](https://blog.trailofbits.com/2025/02/12/the-call-for-invariant-driven-development/)).

## What does a property look like?

The simplest specification is an `assert`. With the CHC engine turned on (`--model-checker-engine=chc`), the SMTChecker built into the compiler tries to prove every assertion for all inputs, treating `require` conditions as assumptions ([Solidity docs](https://docs.soliditylang.org/en/latest/smtchecker.html)).

**A cap written as an assertion the SMTChecker can try to prove (illustrative, not audited code)** `CappedVault.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract CappedVault {
    uint256 public constant CAP = 1_000_000 ether;
    uint256 public totalDeposits;

    function deposit(uint256 amount) external {
        require(totalDeposits + amount <= CAP, "over cap");
        totalDeposits += amount;
        assert(totalDeposits <= CAP); // must hold for every amount and every earlier state
    }
}
```

## Where does formal verification fall short?

A proof is only as good as its specification: a property nobody wrote is never checked, and [ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/) stresses that the specification must describe the behavior you expect and that writing one takes skill and time. The Solidity docs also warn that a reported bug can be a false positive caused by abstractions in the checker, and that the solver can time out without an answer ([Solidity docs](https://docs.soliditylang.org/en/latest/smtchecker.html)). A practical split is to prove the few properties whose failure would lose funds and to test the rest.

## FAQ

### Is formal verification the same as symbolic execution?

They overlap without being the same thing. [Symbolic execution](https://shield.quillaudits.com/learn/glossary/symbolic-execution/) is one technique some verifiers use, exploring paths with symbolic inputs, while formal verification is the goal of proving a property for all inputs, which can also rely on model checking or theorem proving.

## Sources

- [Formal verification of smart contracts, ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/) · checked 3 December 2026
- [The call for invariant-driven development, Trail of Bits](https://blog.trailofbits.com/2025/02/12/the-call-for-invariant-driven-development/) · checked 3 December 2026
- [SMTChecker and formal verification, Solidity documentation](https://docs.soliditylang.org/en/latest/smtchecker.html) · checked 3 December 2026
