🤖 AI Summary
To address the high on-chain execution overhead and inflexible layering of smart contracts, this paper proposes a blockchain-onchain/offchain cooperative computing framework based on finite state machines (FSMs). First, it integrates separation-of-concerns principles with FSM modeling to enable patterned decomposition of contract logic and automatic identification of migratable code fragments. Second, it formally defines offchain migration patterns—including their syntactic structure and precise triggering conditions—for the first time. Third, it employs model-driven development (MDD) to automatically generate bidirectional interaction interfaces that guarantee state consistency and security. Evaluated on the Ethereum testnet, the framework reduces gas consumption by 37%, significantly alleviating on-chain computational load. This work establishes the first systematic, formally verifiable methodology for modeling and generating lightweight smart contract executions, supporting rigorous offchain migration while preserving correctness and trustworthiness.
📝 Abstract
Blockchain benefits are due to immutability, replication, and storage-and-execution of smart contracts on the blockchain. However, the benefits come at increased costs due to the blockchain size and execution. We address three fundamental issues that arise in transferring certain parts of a smart contract to be executed off-chain: (i) identifying which parts (patterns) of the smart contract should be considered for processing off-chain, (ii) under which conditions should a smart-contract pattern to be processed off-chain, and (iii) how to facilitate interaction between the computation off and on-chain. We use separation of concerns and FSM modeling to model a smart contract and generate its code. We then (i) use our algorithm to determine which parts (patterns) of the smart contract are to be processed off-chain; (ii) consider conditions under which to move the pattern off-chain; and (iii) provide model for automatically generating the interface between on and off-chain computation.