A Formally Verified Lightning Network
Grzegorz Fabiański, Rafał Stefański, Orfeas Stefanos Thyfronitis Litos
TL;DR
The paper addresses the question of whether the Lightning Network can guarantee funds safety for honest users. It builds a formal, Why3-based implementation of a two-party LN fragment over a simplified Bitcoin model and proves a machine-checkable funds-security property under a worst-case adversarial model, using idealized digital signatures and a modular, invariant-driven proof. Key contributions include a complete LN-focused implementation in Why3, a formal definition of funds ownership via an Evaluator, and a blueprint for extending the verification to more realistic LN features like HTLCs and multi-hop networks. The work provides a rigorous, end-to-end correctness argument for LN funds safety and offers a reusable framework for formal verification of blockchain-based protocols with clear separation between implementation details and security properties, potentially guiding production LN deployments.
Abstract
In this work we use formal verification to prove that the Lightning Network (LN), the most prominent scaling technique for Bitcoin, always safeguards the funds of honest users. We provide a custom implementation of (a simplification of) LN, express the desired security goals and, for the first time, we provide a machine checkable proof that they are upheld under every scenario, all in an integrated fashion. We build our system using the Why3 platform.
