Skip to main content

Formal Verification: Establishing Mathematical Trust in Smart Contracts

by: Patrick Azzopardi

Patrick is the co-founder and CEO of Dowsers. Before launching the company, he built a career as an entrepreneur in strategy consulting and mergers & acquisitions, while also acting as a business angel. He previously worked at Deloitte and Arthur Andersen.

Patrick holds a Master’s degree in Banking, Finance, and Monetary Economics, which underpins his strong understanding of the challenges surrounding cryptocurrencies and stablecoins.

LinkedIn


1) Problem

Smart contracts have created a brand-new operating model for financial services by enabling their execution on a blockchain without intermediaries. 

However, the complexity of smart contracts converts each defect into a structural vulnerability. Exploits have already generated losses measured in billions of dollars and have slowed institutional adoption. 

With the bold move of the USA toward cryptocurrencies and blockchain applications, vulnerabilities in the code of smart contracts cannot be tolerated anymore.

To move trillions of dollars on the blockchain, DeFi builders must now ensure their smart contracts strictly behaves as intended.

2) Solution

Formal Verification (FV) provides that assurance, by applying mathematical proof techniques to demonstrate conformance to specification. 

FV is already the standard in critical safety industries like nuclear plants, space rockets, airplanes and automated metro systems, where failure is unacceptable and can lead to catastrophes such as a nuclear reactor core meltdown, a collision between trains, a crash of an airplane. 

In 2024, the US Director of Cybersecurity underscored FV as indispensable to national software security. 

“While formal methods have been studied for decades, their deployment remains limited. Further innovation in approaches to make formal methods widely accessible is vital to accelerate broad adoption. Doing so enables formal methods to serve as another powerful tool to give software developers greater assurance that entire classes of vulnerabilities are absent.”

In 2025, the French financial regulator endorsed FV for smart contract certification.

“When compared with other analytical methods, formal verification provides a higher degree of assurance regarding the integrity of the code. In addition, the potential of formal verification methods lies in their capacity to be automated, which in theory can allow for unrestricted scaling.”

3) Definition 

Unlike testing, which can reveal the presence of errors, FV proves their absence and establishes correctness within the boundaries of an explicit specification and model.

Practically, FV translates software into formal logic and proves that it satisfies explicitly defined properties. 

FV is structured around the two main families of security properties. Safety properties define what must never occur. Liveness properties define what must eventually occur.

Several verification methods underpin FV, each backed by mature tooling. 

Model checking, both bounded and unbounded, systematically explores reachable states to prove safety/liveness or produce counterexamples. Deductive verification proves programs against contracts (pre/postconditions, invariants) via weakest-precondition calculi and VC generation with precise bit-vector reasoning for crypto code. 

SAT/SMT solving discharges large constraint sets at scale. 

Interactive theorem proving constructs machine-checked end-to-end proofs for complex properties. 

Complementary techniques such as symbolic execution and equivalence checking generate concrete counterexamples and ensure source/bytecode alignment.

4) Process

FV comprises several key stages, covering a much broader spectrum than traditional testing.

Formal Modeling consists of mathematically describing the functional specifications and security requirements of the system, in alignment with the developer’s expectations. It eliminates ambiguity, defines a rigorous analysis process, and provides a solid foundation for understanding the system’s behavior and security.

Tools mathematically prove that the smart contract satisfies its specifications and upholds a set of critical properties, such as the absence of undesirable behaviors, thereby ensuring the system’s security.

Static Analysis automatically examines the source code of the smart contract without executing it, in order to detect programming errors, identify potential vulnerabilities, and correct security issues before deployment on the blockchain.

Dynamic Analysis evaluates the functional and non-functional characteristics of a smart contract during execution. This type of analysis can be carried out during development, testing, or even after deployment in a production environment. 

Observing the runtime behavior of a smart contract allows for the identification of bugs, the detection of performance bottlenecks, and the validation that the contract operates as intended under various conditions. 

This method is essential for debugging, performance optimization, and verifying compliance with functional specifications in real-world contexts.

5) Use Case in DeFi

Formal verification is a Blue Ocean technology for the smart contract security of cryptocurrencies, fungible / non fungible tokens and decentralized financial protocols. 

FV prevents several categories of risks, which may arise from various types of errors in the code, whose feared events can be divided into four categories : withdraw, block, loss and change.

Withdraw means that digital assets are transferred from the smart contract to an unintended/unauthorized address, diminishing the contract’s balance. 

Block happens if digital assets remain in the smart contract but are inaccessible when they should be available. 

Loss occurs when digital assets may still be in the smart contract, but there is an irreversible loss of value. 

Change indicates that parameters, roles, state, or rules of the smart contract are modified without authorization or adequate control

5) Comparison with Alternative Methods

FV surpasses and/or complements other techniques. 

Manual Audits provide contextual expertise, architectural insight, and risk prioritization. They remain useful but are not exhaustive and are difficult to scale. 

On the contrary, FV contributes logical exhaustiveness to the most critical properties and converts judgements into verifiable guarantees.

Testing and Fuzzing execute selected or random cases but are constrained by the exponential growth of execution paths and states and limit the coverage of risks. 

On the contrary, FV reasons over all relevant states within the defined specification and thereby eliminates whole classes of defects.

Artificial Intelligence can classify artefacts, rank patterns, and assist reviewers. Their outputs are probabilistic and depend on data quality. 

On the contrary, FV is deterministic and provides binary outcomes: a property is either satisfied or it is not, with counterexamples available when it is not. 

That said, it is powerful to combine all the techniques.

AI can triage, manual audit can reason about design, and FV can establish the guarantees that matter for safety and liveness, and fuzzing can demonstrate counter examples.

6) Summary 

Formal Verification

  • Translation of software into mathematical language.

  • Modelling security problems in the form of mathematical equations.

  • Mathematical proof of the presence or absence of vulnerabilities.

Advantages

  • Proven software security technology over decades.

  • Reliability & provability.

  • Speed & high scalability.

7) Conclusion

As demonstrated by Edsger Dijkstra (Turing Award 1972), program testing can be a very effective way to show the presence of bugs, but it is hopelessly inadequate for showing their absence.

Formal verification was invented to mathematically prove that complex systems behave as intended. It was first applied to prevent catastrophic failures in safety-critical industries like automated metros, aerospace and nuclear plants.

As Larry Fink says : “tokenization is democratization every stock, every bond, every fund, every asset can be tokenized; if they are, it will revolutionize investing.”

Scaling formal verification is an essential mission to provide mathematical trust in the security of digital assets on the blockchain.


All opinions expressed by the writers are solely their current opinions and do not reflect the views of FinancialColumnist.com, TET Events.