Operational Semantics for Crystality: A Smart Contract Language for Parallel EVMs

Ziyun Xu, Hao Wang, Meng Sun

Abstract: The increasing demand for scalable blockchain has driven research into parallel execution models for smart contracts. Crystality is a novel smart contract programming language designed for parallel Ethereum Virtual Machines (EVMs), enabling fine-grained concurrency through Programmable Contract Scopes and Asynchronous Functional Relay. This paper presents the first formal structural operational semantics for Crystality, providing a rigorous framework to reason about its execution. We mechanize the syntax and semantics of Crystality in the theorem-proving assistant Coq, enabling formal verification of correctness properties. As a case study, we verify a simplified token transfer function, demonstrating the applicability of our semantics in ensuring smart contract correctness. Our work lays the foundation for formally verified parallel smart contracts, contributing to the security and scalability of blockchain systems.

Introduction

The Ethereum Virtual Machine (EVM) has become the de facto standard for smart contract execution. However, its sequential execution model—where transactions are processed one by one—imposes a significant ceiling on throughput. As decentralized applications (DApps) scale, this bottleneck results in network congestion and high transaction fees. While parallel execution models offer a solution, they introduce complexities in state management and concurrency control.

Crystality is a novel language designed specifically for parallel EVMs, utilizing state partitioning and asynchronous calls to enable high-performance execution. This paper provides the formal structural operational semantics for Crystality, mechanized in the Coq theorem prover, to ensure that parallel contracts are mathematically sound and bug-free.

The Challenge of Parallelism in Smart Contracts

Existing blockchains struggle with parallelism due to inefficient concurrency control and a lack of language-level support. Traditional models often rely on coarse-grained locking or optimistic execution that suffers from frequent rollbacks. Furthermore, languages like Solidity do not provide developers with the tools to explicitly define parallelizable state.

Crystality addresses these issues through Programmable Contract Scopes and Asynchronous Functional Relay. However, without a formal semantic model, reasoning about the correctness of these features—especially in the presence of potential race conditions—is nearly impossible. Formal semantics move the language from intuitive descriptions to a precise mathematical foundation.

Formalizing Crystality

The core contribution of this work is the development of a Structural Operational Semantics (SOS) for Crystality. This formalization provides a precise mathematical framework for how code execution modifies the blockchain state. A key aspect of this formalization is the definition of scopes. As shown in Figure 1, Crystality defines three distinct scopes: @address, @engine, and @global.

Figure 1: Grammar definition for contract scopes in Crystality.

These scopes dictate how state variables can be accessed by functions. The interaction between function scopes and state variable scopes is governed by a strict access control matrix, which ensures data integrity in a parallel environment.

Figure 2: Read (R) and Write (W) permissions for different function and state variable scopes.

As illustrated in Figure 2, functions scoped to @address have broad read/write access to address-specific and engine-local state, but can only read global state. Conversely, @global functions are restricted to global state updates. This partitioning allows the execution engine to determine which transactions can run concurrently without interference, effectively "zooming in" on relevant state partitions while keeping the rest of the blockchain constant.

Asynchronous Functional Relay and the Mempool

Crystality introduces "relays" to handle cross-partition calls. Unlike standard synchronous calls that block execution, a relay returns immediately and schedules the work for later execution, possibly on a different engine. To model this, the authors formalized the mempool (denoted as $\Omega_i$) as an explicit part of the system state. This allows for rigorous reasoning about how asynchronous transactions move between different execution engines and eventually update the ledger, a layer often ignored in traditional language semantics.

Mechanization and Case Study

To move beyond theoretical proofs, the semantics were mechanized in the Coq theorem prover. This computer-checked framework allows for the verification of complex properties that are prone to human error. The mechanization covers the entire language syntax and the transition rules for state updates.

The applicability of the semantics was demonstrated through a case study of a simplified ERC20 token transfer. Using the Coq framework, the authors proved a fundamental safety property: a transfer succeeds (updating balances and creating a relay) if and only if the sender has sufficient funds; otherwise, the state remains unchanged. This "correctness-by-construction" approach ensures that critical financial logic is robust against parallel execution bugs.

Conclusion and Future Directions

This work establishes the first formal foundation for Crystality, enabling the verification of parallel smart contracts. While the current model provides a robust framework for functional correctness, future work will integrate gas models to account for execution costs and state reverts. Additionally, the authors plan to extend the framework to prove security properties against common vulnerabilities like reentrancy and front-running in parallel contexts. Ultimately, this research paves the way for a verified compiler, ensuring that high-level parallel logic is faithfully translated into secure EVM bytecode.

Summary updated

BibTeX
@inproceedings{xu2025operational,
  author = {Ziyun Xu and Hao Wang and Meng Sun},
  title = {{Operational Semantics for Crystality: A Smart Contract Language for Parallel EVMs}},
  booktitle = {TASE},
  year = {2025},
  doi = {10.1007/978-3-031-98208-8\_18},
}
Figure