# KindHML: formal verification of smart contracts based on Hennessy-Milner logic

Crypto.world

> Existing smart contract vulnerability scanners look for known bug patterns (reentrancy, overflows) and miss flaws in business logic that unfold across multiple transactions, such as liquidity attacks…

**arXiv**: 2604.14038

**Published**: 2026-04-15

**Authors**: Massimo Bartoletti, Angelo Ferrando, Enrico Lipparini, Vadim Malvone

## AI summary

## Overview

**Research area:** Formal methods and security for blockchain smart contracts (cs.CR), specifically temporal-logic-based verification of Solidity contracts.

**Technical level:** Advanced. The paper assumes familiarity with labelled transition systems, modal/temporal logic (Hennessy–Milner logic), model checking, and smart contract execution semantics.

**Scope:** The paper introduces CHML, a first-order temporal logic tailored to smart contracts, and KindHML, a fully automated toolchain that translates a fragment of Solidity plus CHML specifications into Lustre and verifies them with the Kind 2 model checker.

## What This Paper Is About

Existing smart contract vulnerability scanners look for known bug patterns (reentrancy, overflows) and miss flaws in business logic that unfold across multiple transactions, such as liquidity attacks and front-running. The authors argue that capturing these requires reasoning about temporal properties over sequences of transactions, which current verification tools for Solidity (including SolCMC and the Certora Prover) cannot express.

The paper's goal is to provide a specification language expressive enough for such properties and a fully automated pipeline that checks whether a contract satisfies them.

## Key Contributions

1. **CHML, a novel temporal logic for smart contracts.** It extends first-order Hennessy–Milner logic with domain-specific constructs: a modal operator over transactions of the form ⟨e_s : C.e_f(e_1, …, e_k) $ e_v⟩φ that constrains sender, contract, procedure, parameters and transferred value; an `old(e)` operator to refer to the pre-transition state (enabling relational properties); and a `reverted` predicate. CHML is typed, with base types `bool`, `int`, `address` plus `proc` and `args`.
2. **A fully automated toolchain.** The approach encodes an expressive fragment of Solidity and CHML specifications into Lustre, the specification language supported by the Kind 2 model checker, and uses Kind 2 to decide whether the contract respects the specification.
3. **Diagnostic feedback via execution traces.** When a property violation is found, KindHML produces a concrete execution trace leading the contract to a state from which the desired asset exchange is unrealisable.
4. **An empirical evaluation** on a benchmark of smart contracts and temporal properties capturing complex attack scenarios; the authors claim KindHML is the first tool capable of verifying front-running properties of smart contracts.

## Main Findings

- **Expressiveness gap in existing tools:** The authors state that CHML can express liquidity and front-running properties that are out of scope for existing smart contract verification tools, including industrial tools such as SolCMC and the Certora Prover, as well as academic tools.
- **Motivating evidence from prior empirical work:** The paper cites an analysis showing that existing vulnerability detection tools could have prevented only about 8% of $2.3 billion in total losses from attacks, and only when those attacks exploited well-known vulnerabilities such as reentrancy. It also cites total historical attack losses exceeding 6 billion dollars.
- **Logic errors dominate high-impact incidents:** The authors argue that many high-impact incidents stem from logic errors in protocol logic or economic rules, which fall outside the scope of pattern-based vulnerability detectors.
- **Effectiveness claim:** The results are stated to show that the approach can effectively verify non-trivial temporal properties of smart contracts and detect violations beyond the reach of existing analysis tools.
- **Use cases demonstrating scope:** The evaluation is framed around a Bank contract (credits mapping, deposit/withdraw), a Bet contract (oracle, rate, join/win/set), and a Vault contract (owner, recovery key, withdraw/finalize/cancel with wait times), with properties such as "any user with a positive credit can always extract ETH" and "front-running a user's deposit has no effect on the user's credits."
- **Quantitative benchmark size and performance numbers:** Not reported in the provided (truncated) content. The paper states only that effectiveness and performance were evaluated on a benchmark of smart contracts and temporal properties; specific counts, timings and success rates are not available here.

## Methodology in Plain English

The authors first define a small, purified version of Solidity with a precise mathematical semantics: a blockchain state maps each address to a storage, a transaction is a labelled state transition, and execution is deterministic, with failed `require` conditions rolling back the transaction. Contracts are sets of procedures; the language includes domain-specific constructs such as `transfer`, `balance`, `sender`, `value` and `this`.

They then define CHML over sequences of blockchain states rather than single states, so specifications can compare before and after a transaction (via `old(e)`), quantify over addresses, amounts and procedures, and describe a transaction only partially — for example, asking whether *some* transaction exists that increases a user's balance, rather than naming the exact transaction as classical HML would require.

To make this checkable, they translate both the contract and the CHML properties into Lustre, feed the result to the Kind 2 model checker, and let Kind 2 either confirm the property or return a counterexample, which KindHML presents as a concrete execution trace. A type checker in the tool enforces well-typedness of contracts and specifications. The whole pipeline — translation and verification — is integrated into a single toolchain, with the toolchain and experimental data released publicly on GitHub.

## Why This Matters

**Impact on research:** The work pushes smart contract verification from pattern-based bug finding toward specification of temporal, cross-transaction properties, and shows how a general-purpose model checker (Kind 2, via Lustre) can be repurposed as a backend for contract verification. It also contributes a reusable logical framework (CHML) for expressing relational and quantificational properties over transaction sequences.

**Real-world applications:**

- **DeFi protocol auditing:** checking that liquidity remains available so honest users can always withdraw, a class of flaw the authors note has been exploited to steal or permanently freeze assets.
- **Front-running analysis:** reasoning about adversarial transaction ordering, for example verifying that an adversary who front-runs a user's deposit cannot affect that user's credits.
- **Wallet and vault design:** validating state-machine contracts with time-locked withdrawals and recovery keys (the Vault use case) against properties about which actions remain enabled when.
- **Debugging during development:** using counterexample traces to locate business-logic errors before deployment, which matters because deployed contract code is immutable and cannot be patched.

**Industry relevance:** The paper positions its expressiveness against tools already used in practice — SolCMC (shipped with the Solidity compiler) and the Certora Prover (described as a leading tool in the smart contract auditing industry) — which is the comparison an auditing firm or protocol team would care about.

## Future Directions

- **Scaling the evaluation:** the provided content reports the benchmark qualitatively but not its size or performance figures, leaving open how the encoding scales to larger contracts and richer property sets.
- **Broadening the Solidity fragment:** the current approach covers a "purified" subset of Solidity; extending the encoding to more of the language (and its type system) is a natural next step.
- **Beyond the model checker backend:** whether alternative backends or encodings could improve automation and counterexample quality is left open.
- **Wider property classes:** the authors present liquidity and front-running as headline targets; generalizing CHML to other economic and multi-party invariants (for example in the Bank and Bet use cases) is a direction the framework invites.

## Target Audience

Researchers in formal methods, program verification and blockchain security; smart contract auditors and security engineers familiar with Solidity; and tool developers interested in encoding domain-specific temporal logics into synchronous dataflow languages such as Lustre for model checking. Readers without a background in modal logic or model checking will find the technical core of the paper demanding.

## Authors’ abstract

Smart contracts deployed on blockchains such as Ethereum routinely manage large amounts of assets, making their security critical. Empirical studies show that real-world attacks often exploit flaws in the business logic of contracts that unfold across multiple transactions, such as liquidity or front-running attacks. Detecting these attacks requires reasoning about expressive temporal properties beyond the capabilities of existing analysis tools. In this paper, we present an…

[The full abstract on arXiv](https://arxiv.org/abs/2604.14038)

[Read the original paper](https://arxiv.org/abs/2604.14038)

---

Canonical: https://crypto.world/paper/kindhml-formal-verification-of-smart-contracts-based-on-hennessy-milner-2604.14038
