Skip to main content

News

Lithe: A Formally Verifiable EVM Language Built for AI Agents

Lithe, a new EVM language developed by AI agents, offers smaller bytecode, formal verification, and enhanced security for smart contracts.

X LinkedIn
Thematic editorial illustration
Editorial illustration; not a product screenshot or event photograph

Lithe, a new smart contract language for the Ethereum Virtual Machine (EVM), has been introduced as a tool designed and built by AI agents. Developed in just 12 days using the Recur agent workflow tool, Lithe features smaller bytecode, built-in formal verification, and enhanced security mechanisms. According to Celestia Labs, the language aims to address common vulnerabilities in smart contracts while improving efficiency and auditability.

Addressing Smart Contract Vulnerabilities

One of the key motivations behind Lithe's development is the prevalence of security flaws in existing smart contracts. A 2024 OWASP review found that access-control flaws accounted for two-thirds of $1.42 billion in losses, with Solidity often relying on conventions that both humans and AI models can overlook. Lithe mitigates these risks by embedding security rules directly into its compiler, making it easier to identify and prevent errors such as missing caller checks.

Unlike Solidity, which allows state-changing calls to execute before a function completes, Lithe ensures that every entry point represents a single state transition. This design prevents vulnerabilities like the reentrancy bug that caused the 2016 Ethereum DAO hack. For example, Lithe's defer keyword delays external calls until the current state is fully updated, ensuring consistency and security.

Formal Verification and Auditability

Lithe integrates formal verification into its workflow through the lithe prove tool, which checks deployed bytecode against developer-written specifications. This process ensures that contracts behave as intended across all inputs and call orders. Additionally, tools like lithe abi-tree and lithe footprint provide detailed insights into function paths, state changes, and error declarations, simplifying the auditing process.

The language also enforces strict rules for error handling. External functions must declare all potential errors using the raises keyword, and any omission results in a compilation failure. These features make Lithe contracts easier to verify and less prone to exploitation.

Performance Benchmarks

In benchmarks comparing Lithe to Solidity's solc compiler and Paradigm's Solar compiler, Lithe demonstrated significant performance advantages:

  • Bytecode size: 40% smaller than optimized solc builds and 7% smaller than Solar's size-focused builds.
  • Deployment gas costs: 34% lower for OpenZeppelin's ERC-20 contracts and 41% lower for ERC-721 contracts compared to solc.
  • Transaction gas costs: Approximately 2.5% lower than solc, on par with Solar.
  • Compile time: 0.6 seconds for 51 benchmark contracts, faster than Solar (0.7 seconds) and solc (3.2 seconds).

Built by Agents, for Agents

Lithe was developed entirely by AI agents using Recur, which enabled agents to plan, code, and review tasks collaboratively. The project involved writing approximately 140,000 lines of Rust and 20,000 lines of Lithe, a language the agents had no prior experience with. The compiler is designed to assist agents by providing actionable diagnostics and JSON-formatted analysis of contract behavior.

Lithe is already operational on the Ethereum mainnet, where it has been used to migrate Modularium's NFT contracts. These contracts achieved byte-identical outputs to their Solidity counterparts while reducing rendering gas consumption by 65–79%. Additionally, 40 specification files for these contracts were formally verified using lithe prove.

Future Applications

Celestia Labs envisions Lithe playing a critical role in building secure blockchain infrastructure and applications. While still experimental, the language offers a promising solution for developers seeking to create efficient, verifiable, and secure smart contracts. Developers can explore Lithe through its playground, documentation, and GitHub repository.

Sign in to save this article Free account: build your research collection and return to read it anytime.