Next Article in Journal
A Safety Evaluation Method for Converter Station Operation Based on Dynamic Fuzzy Theory
Previous Article in Journal
Flexible DC Optimization Control Technology Based on Zonal Interconnection of Urban Power Grids
Previous Article in Special Issue
A Deep Learning Approach for Fault-Tolerant Data Fusion Applied to UAV Position and Orientation Estimation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Variable-State-Trigger: A Formal Model of Smart Contracts Based on Conditional Response and Finite State Automata and Its Application

College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 210000, China
*
Authors to whom correspondence should be addressed.
These authors contributed equally to this work.
Electronics 2024, 13(23), 4680; https://doi.org/10.3390/electronics13234680
Submission received: 30 October 2024 / Revised: 23 November 2024 / Accepted: 25 November 2024 / Published: 27 November 2024

Abstract

:
As one of the technical elements supporting the blockchain to realize decentralized autonomous organizations, smart contracts are crucial for understanding the inherent properties of blockchain systems through formal research. Most existing formal models of smart contracts focus primarily on static properties, lacking the depiction of dynamic processes such as conditional responses and internal state migration during contract execution, which complicates effective supervision. In this paper, a novel formal model of smart contracts, based on finite state automata, named Variable-State-Trigger (VST), is proposed, which presents state migration and conditional response mechanisms during smart contract execution. The VST model is verified to portray both the static and dynamic properties of smart contracts, providing new avenues for effective supervision during contract execution. Moreover, the VST model is used to illustrate the life cycle of a UAV mission smart contract, demonstrating its feasibility. With the growing integration of blockchain and emerging technologies, smart contracts have found applications in various fields, including drone swarm coordination. In this context, smart contracts enable secure, decentralized management and automation of interactions between autonomous drones, ensuring compliance with predefined conditions and enhancing the reliability of complex drone operations. The VST model can be extended to such applications, offering dynamic supervision and enhancing the coordination efficiency in decentralized autonomous drone systems.

1. Introduction

With the introduction of Bitcoin [1] in 2008, blockchain came into the limelight as a distributed, asymmetric encrypted peer-to-peer network. Bitcoin transactions rely on Bitcoin scripts to take place on a decentralized peer-to-peer network. Bitcoin scripts are a stack-based, non-Turing-complete scripting language that defines the basic rules of Bitcoin transactions and is the prototype of a blockchain smart contract. Since then, a number of decentralized cryptocurrencies, typified by Bitcoin, have enabled the use of blockchain in finance. In 2015, Ethereum [2] was launched, which is the first blockchain platform supporting Turing-complete language programming. Ethereum users can write smart contracts in languages such as Solidity to automate the transaction process. Subsequently, platforms such as Hyperledger [3] and EOS [4] were released, and their common feature is that they rely on smart contracts to automate interactions between nodes on a decentralized/weakly centralized peer-to-peer network. Thanks to Turing-complete language programming, such interactions are capable of handling computations of almost arbitrary complexity.
With the introduction of smart contracts, blockchain is no longer limited to the financial sector but is also used in the Internet of Industry [5], logistics [6], healthcare [7], legal [8], vulnerability detection [9], privacy protection [10], and other fields [11], showing great application value. One emerging application area is the coordination of drone swarms. Drone swarms, consisting of multiple autonomous drones working together, require secure and reliable decentralized coordination to efficiently carry out tasks such as surveillance, search and rescue, or delivery services. Smart contracts can be leveraged in this context to automate and manage the interactions between individual drones, ensuring that certain conditions, such as task allocation, communication protocols, and resource sharing, are executed without central authority. By applying blockchain-based smart contracts, the operations of drone swarms become tamper-proof and can execute autonomously based on predefined rules, improving operational transparency, security, and fault tolerance in dynamic and potentially adversarial environments.
In order to better realize the application of blockchain technology in combination with traditional industries, more and more researchers [12,13,14] have focused their work on smart contracts themselves in recent years.
A smart contract is defined as a computer program running in a distributed system whose rules are pre-set and whose states are conditionally correlated to facilitate the exchange of information, value, and asset ownership among distributed nodes, and that can encapsulate, verify, and execute complex behaviors [15]. Zheng [16] assumes that the smart contract life cycle is divided into four stages: creation, deployment, execution, and completion. A life-cycle approach to understanding smart contracts can assist in gaining a more thorough understanding of how they work. At present, the main research directions around smart contracts in academia are smart contract security issues [17,18,19], smart contract applications [20,21], mechanism design [22,23], and formalization [24].
Among these, formalization includes formal specification and formal verification, two important research elements. Formal research on smart contracts is a mathematical description of what a smart contract is and what it does, which can solve a series of problems such as functional verification, privacy, security, scalability, bug bounties, the Oracle problem, blockchain consensus, etc. [25]. Existing research on the formalization of smart contracts has focused on formal verification, i.e., formal tools/frameworks to help troubleshoot vulnerabilities in smart contracts and reduce the risk of malicious attacks. However, few studies have analyzed the state migration of smart contracts from a microscopic perspective, resulting in a lack of detail on the internal execution logic of smart contracts, which makes it difficult to effectively supervise the process of contract execution as a black box.
At the same time, most of the existing formal models of smart contracts are based on specific application areas, with insufficient abstraction and a lack of generality to provide theoretical support for general research on smart contracts. Therefore, this paper analyzes the internal execution logic of smart contracts based on finite state automata and a conditional response mechanism and proposes a general formal model of smart contracts, the Variable-State-Trigger (VST) model, which is shown in Figure 1. More importantly, this paper introduces the application of the VST model in the field of lightweight communication for drones, and will focus on introducing an intelligent contract for drone communication, created based on the VST model in the sixth part. This work is pioneering in the field of drone communication and formalization of smart contracts. The contributions of this paper are as follows.
Contributions:
  • This paper innovatively combines theorem proving and finite state automata to describe smart contracts. In general, finite state automata can clearly express the state migration process of smart contracts. Microscopically, the conditional trigger mechanism of smart contracts can be explained by means of theorem proof.
  • This paper represents the smart contract conditional response mechanism based on the graph structure, so as to modularize the smart contract so that it can be used for smart contract supervision, vulnerability detection, etc.
  • This paper expounds on the formal role of the proposed VST model in the practical application field of drone communication, which is innovative.
This paper is structured as follows: Section 2 lists the existing research on the formalization of smart contracts; Section 3 defines smart contracts formally and gives the basic definition of the VST model; Section 4 analyzes the micro-conditional response mechanism; Section 5 uses a rigorous mathematical proof method to verify the true property of the VST model; and Section 6 takes a UAV mission contract written in natural language as an example and analyzes the VST model’s ability to interpret real contracts and verify its feasibility.

2. Related Work

Currently, research on blockchain technology and smart contracts encompasses a variety of approaches to enhance security, functionality, and scalability. AlSobeh’s work, “OSM: leveraging model checking for observing dynamic behaviors in aspect-oriented applications”, employs model checking techniques to scrutinize the dynamic behaviors within aspect-oriented applications, providing insights into their complex interactions [26]. Xu et al. contribute to the field with “Adding generic role- and process-based behaviors to smart contracts using dynamic condition response graphs”, where they introduce a method to enrich smart contracts with role- and process-based behaviors, enhancing their adaptability and responsiveness to changing conditions [27].
In the domain of blockchain system verification, AlSobeh and Magableh present “BlockASP: a framework for AOP-based model checking blockchain system”, which utilizes aspect-oriented programming to facilitate model checking and ensure the integrity of blockchain systems [28]. Lekidis and Katsaros integrate data-driven security with model checking and self-adaptation in “Integrating data-driven security, model checking, and self-adaptation for IoT systems using BIP components”, showcasing the potential of these techniques in enhancing IoT system resilience [29].
Dinh et al. offer a comprehensive view of blockchain systems in “Untangling blockchain: a data processing view of blockchain systems”, dissecting the technology’s data processing mechanisms and their implications [30]. Zheng et al. address data sharing challenges in “Scalable and privacy-preserving data sharing based on blockchain”, proposing solutions that maintain privacy while facilitating data sharing at scale [31].
Zhang et al. introduce a reputation-based mechanism in “A reputation-based mechanism for transaction processing in blockchain systems”, aiming to optimize transaction processing through trust evaluation among nodes [32]. Wu et al. present “VQL: efficient and verifiable cloud query services for blockchain systems”, a system that ensures the efficiency and verifiability of cloud queries, crucial for maintaining data integrity in blockchain applications [33].
Finally, Gao et al. delve into the security vulnerabilities of the Bitcoin system with “Power adjusting and bribery racing: novel mining attacks in the Bitcoin system”, highlighting innovative attack vectors and their implications for cryptocurrency mining security [34].
In summary, these studies represent a diverse array of approaches to advancing blockchain technology and smart contract applications, focusing on aspects such as security enhancement, functional expansion, privacy preservation, and system scalability, demonstrating the multifaceted nature of research in this domain.

3. VST Model Overview

In this section, we introduce a conditional response mechanism based on finite state automata to describe the dynamic process of state migration of smart contracts from a microscopic perspective. The Variable-State-Trigger (VST) model is a formal specification of the smart contract and describes three core properties of the smart contract: Variable, State, and Trigger. The parameters involved in the VST model are shown in Table 1.
The environment, V, in which the smart contract, C, is located can be quantified as a | I | -dimensional vector, and each component, v i , is called an environment variable. The smart contract, C, is subjected to changes in the environment variables and undergoes state migration in a finite state space, S, which contains | J | instantaneous states. I , J are sets of indicators for the environment, V, and state set, S, respectively. The conditional response mechanism, T, consists of | X | modules T x , T x is a directed acyclic graph consisting of vertices, t, and edges, e, and X is the set of indicators of T.
Definition 1.
Smart Contract, C
A smart contract C : = ( V , S , T ) is a triple consisting of:
  • A vector V = ( v 1 , v 2 , , v i , , v | I | ) ;
  • A set S = { s j | s j = f ( V j ) , j J } ;
  • A set T = { T 1 , T 2 , , T x , , T | X | } , T x = ( τ x , E x ) , τ x = { t j | t j = ( s j , V j ) , s j S } , E x = { e m n | e m n = < t m , t n > , t m , t n τ } .
In Definition 1, the environment variable, v i , is a component of the multidimensional vector V. The state s j is a function on V, using V j to denote a particular environment that induces the state s j . The trigger, t j , is represented by the binary ( s j , V j ) , in the sense that the variable environment is V j , and the instantaneous state of the smart contract, C, is represented as s j . The conditional response path, e m , n , is a directed edge from vertex t m to vertex t n in the directed acyclic graph T x , in the sense that the trigger condition t n occurs only if the trigger condition t m has already occurred.
Definition 2.
The environment of a smart contract, C, can be quantified as a multidimensional vector V = ( v 1 , v 2 , , v i , , v | I | ) , where each component, v i , is called an environmental variable.
To explain more concretely the environment of the smart contract, C, the multidimensional vector V = ( v 1 , v 2 , , v i , , v | I | ) can be represented by a data table, as shown in Table 2. For each component, v i , in addition to symbols and key-value pairs, it also has meta-attributes: key variable/dummy variable.
Definition 3.
States
The value range of the function s j = f ( V j ) is { s 0 , s c p l , s b r k , s f i n , s f a i } .
The state set, S, consists of |j| instantaneous states, s * ; “states” contain two forms: stable states and intermediate states. The stable states include the initial state, s 0 , the completion state, s f i n , and the failure state, s f a i ; The intermediate states include the success state, s c p l , and the default state, s b r k . The value of any instantaneous state, s * , is equal to some steady state or intermediate state, but the environment, V * , that induces different instantaneous states varies.
There are intra-state migration and inter-state migration in the VST model, as shown in Figure 2.
Definition 4.
Inter-state migration
If s * = f ( V * ) s * * = f ( V * * ) satisfies V * V * * , s * s * * , this migration process → is called inter-state migration.
The reason for the above two different forms of state migration is that there are several key variables and key points in the multidimensional vector V = ( v 1 , v 2 , , v k ) , there are several key variables and corresponding key points, and inter-state migration is caused when and only when the value of the key variables changes to the key point; otherwise, only intra-state migration is caused. In other words, the intra-state migration is related to all variables in the multidimensional vector V, while the inter-state migration is only related to the key variables in the multidimensional vector V.
Definition 5.
Key variables
If a change in the value of one or more components of a vector causes inter-state migration, then these components are called key variables, i.e., if s * = f ( V * ) s * * = f ( V * * ) satisfies V * = ( v 1 , v 2 , , v m , , v k ) , V * * = ( v 1 , v 2 , , v m * , , v k ) , v m v m * , s * s * * , then v m is called a key variable.
Definition 6.
Dummy variables
If any change in the value of one or more components of a vector does not cause inter-state migration, then these components are called dummy variables, i.e., if s * = f ( V * ) s * * = f ( V * * ) satisfies V * = ( v 1 , v 2 , , v m , , v k ) , V * * = ( v 1 , v 2 , , v m * , , v k ) , v m v m * , s * = s * * , then v m is called a dummy variable.
It is worth noting that the range of key variables and dummy elements changes dynamically with the state migration of the smart contract. That is, at state s * , it is assumed that v m is the key variable that affects the migration of the current state to the next state, but when the state migrates to s * * , v m no longer affects the future state migration, i.e., the dummy element.
Definition 7.
key points and key set
If a change in the value of a key variable reaches a certain point and causes inter-state migration, then this point is called a key point, and the set of these key points is called a key set, i.e., when s = f ( V ) satisfies V = ( v 1 , v 2 , , v m , , v k ) , v m is a key variable in V, if p R satisfies lim v m p f ( V ) lim v m p + f ( V ) , then p is called a key point, and the set of values like p is called a key set.
Definition 8.
Legal interval
An interval is called a legal interval if the value of a key variable varying arbitrarily within that interval does not cause the state to migrate from s c p l to s b r k .
Definition 9.
Illegal interval
An interval is called an illegal interval if the value of a key variable changing within that interval causes the state to migrate to s b r k .
i.e., when s * = f ( V * ) s * * = f ( V * * ) satisfies s * = s c p l , V * = ( v 1 , v 2 , , v m , , v k ) , V * * = ( v 1 , v 2 , , v m * , , v k ) , v m is a key variable in V * , v m * = a , if an interval A satisfies a A , f ( V * * ) = s * = s c p l , then A is called a legal interval, and its complement set A ˜ is called an illegal interval.
Stable state. When the execution of the smart contract is completed, the contract migrates to the stable state, i.e., inter-state migration such as s c p l s f i n , s b r k s f a i occurs. At this point, the environment, V, no longer changes. When the environment, V, of the smart contract, C, no longer changes, C migrates from the intermediate state to the stable state: if the instantaneous state s * = s c p l and the stable state s = s f i n , the contract, C, executes successfully; if the instantaneous state s * = s b r k and the stable state s = s f a i , the execution of the contract, C, fails. The migration of a smart contract, C, from an intermediate state to a stable state still follows the conditions of inter-state migration. This process has a special key variable, v s t a l e , whose role is to listen to whether the environment, V, stops changing, and if the environment, V, stops changing then v s t a l e reaches the key point and causes the inter-state migration, which also marks the contract, C, reaching the stable state.
Definition 10.
Conditional response mechanism
The conditional response mechanism, T, of the smart contract, C, consists of several conditional response modules, T x , and each module, T x , is a directed acyclic graph, including the vertex set, τ, and the edge set, E, where the vertex set contains the following vertex types.
  • t 0 = ( s 0 , V 0 ) ;
  • t c p l = ( s c p l , V c p l ) ;
  • t b r k = ( s b r k , V b r k ) ;
  • t f i n = ( s f i n , V f i n ) ;
  • t f a i = ( s f a i , V f a i ) .
In Definition 10, the vertices t 0 , t f i n , t f a i denote the trigger conditions for the stable states s 0 , s f i n , s f a i , respectively, and the vertices t c p l , t b r k denote the trigger conditions for the intermediate states s c p l , s b r k , respectively.

4. Microscopic Conditional Response

In order to describe the conditional response mechanism of a smart contract from a microscopic perspective, t = ( s , V ) is introduced as a trigger into the VST model. Several triggers, t, and conditional response paths, e, form a directed acyclic graph, T x , and several directed acyclic graphs, T x , form the conditional response mechanism of a smart contract, C. Unlike the state migration graphs of finite state automata, there is no loop in the directed acyclic graphs, which can clearly show the start–end, and are more advantageous in describing complex logic structures than the state migration graphs with loops. Statically, T, as a collection of directed acyclic graphs, can clearly and intuitively show the conditional response structure of the contract, C, i.e., the encoding logic; dynamically, the trigger, t, can record the environment, V, when the smart contract, C, reaches the specified state, s, and the dynamic path returns to the user, t, during the contract execution, providing an idea for effective supervision of smart contracts. In this section, we introduce the micro-conditional response mechanism from a syntax-logical structure-modularity writing idea.

4.1. Grammar

Definition 10 introduces five types of triggers t: t 0 , t c p l , t b r k , t f i n , t f a i . Since the conditional response mechanism of a smart contract works mostly in the intermediate state, the contract can be executed properly when and only when t = t c p l , so the form t i (i denotes a letter or a non-zero number) is used below to refer to t c p l , t 0 , t b r k t f i n , t f a i without special specification, and t f a i is marked separately.
The meaning of the trigger t 0 is to listen to the address of the smart contract, C, to see if it receives a call request from the user, and if the user issues a call to C, then t 0 is triggered and the contract, C, starts execution. The meaning of the trigger t i is that the smart contract, C, is executed normally and all key variables in the environment, V, are in the legal interval. As shown in Figure 3, when t i is triggered s i = s c p l , if t i is triggered then t j = ( s c p l , V j ) cannot be triggered, and no arbitrary t k = ( s c p l , V k ) is triggered, meaning that one or some key variables in the environment, V, change into an illegal interval, and t b r k is triggered, signifying that the smart contract, C, is temporarily suspended. It is worth noting that each t i can point to t b r k ,while the t b r k which t i points to is not consistent with the t b r k which t j points to. Although s i = s c p l = f ( V i ) = f ( v 1 , v 2 , , v i , , v | I | ) is equivalent to s j = s c p l = f ( V i ) = f ( v 1 , v 2 , , v j , , v | I | ) , the key variables of V i are partly different from V j ,which means that the trigger of state migration s i s i b r k is distinct from s j s j b r k (according to Definition 5).
t f i n marks the successful execution of a smart contract, C. A smart contract may have multiple clauses, which may be relatively independent of each other or may affect each other. t f i n means that, after all the required clauses have been invoked, the environment, V, no longer changes, and the instantaneous state of the smart contract is s c p l , and then the contract will migrate to the stable state, s f i n .
The meaning of t f a i is that the execution of the smart contract, C, ends in failure. After t b r k is triggered, if the environment, V, does not change any more, then C will migrate from the hung state, s b r k , to the failed state, s f a i .

4.2. Logical Structure

Smart contracts are mainly presented in the form of program code, and there are three main logical structures in programming: sequential structure, selection structure, and cyclic structure. Naturally, directed acyclic graphs can describe sequential and selective structures, but not cyclic structures directly. However, the microscopic conditional response mechanism of the VST model can overcome this problem, and the directed acyclic graph, T x , can explain the loop structure in smart contracts well.
As shown in Figure 4, when t i , t j , t k form a loop structure, there are.
  • t i t j , t j t k , t k t i ;
  • t i = ( s i , V i = ( , V i m , ) ) ;
  • t j = ( s j , V j = ( , V j m , ) ) ;
  • t k = ( s k , V k = ( , V k m , ) ) .
It is well known that dead loops are meaningless in computer programming, so any loop structure must have a counter, v c , to control the number of loops in order to prevent the contract program from falling into a dead loop. Suppose v i m , v j m , v k m are the key variables of V i , V j , V k , respectively, then the loop progression between the trigger conditions t i , t j , t k can be replaced by a trigger condition t i j k = ( s c p l , V i j k ) instead, where v i m , v j m , v k m , v c are the key variables of the multidimensional vector V i j k . In other words, microscopically t i t j , t j t k , t k t i corresponding to s i s j , s j s k , s k t i , the migration process between the three instantaneous states can actually be interpreted as an intra-state migration of s i j k = s c p l , which fuses the three instantaneous states.

4.3. Modularization

Definition 11.
Dimension
The set V t ^ of all event parameters of a trigger, t, is called the dimension of t.
Definition 12.
Each DAG T x T in a smart contract consisting of consecutive triggers is called a module.
There may be multiple clauses in a smart contract, and the modularity is designed to discuss the possible relationships between the clauses of a smart contract. In a smart contract, the following two relationships between different modules may exist.
  • Mutually independent:
    Module T x completion does not cause module T y execution, and module T y completion does not cause module T x execution.
  • Strictly progressive:
    Module T x completion causes module T y execution, and module T y completion does not cause module T x execution.
For convenience, the relationship between module T x and module T y can be formalized as ¬ T x R T y if they meet the mutually independent clause. R T × T represents the relationship between modules. The relationship between module T x and module T y can be formalized as T x R T y if they meet the strictly progressive clause.
Definition 13.
Let the initial vertices of the modules T x and T y be t x 0 and t y 0 , respectively, and their termination vertices be t x e and t y e , respectively. If the module T x and the module T y satisfy:
V x e ^ V y 0 ^ V x e ^ V y e ^ V x 0 ^ V y e ^
Then the module T x and the module T y are said to be mutually independent ¬ T x R T y .
If the module T x and the module T y satisfy:
V x e ^ V y 0 ^ = V x e ^ V x e ^ V y 0 ^ V y e ^ V x 0 ^ V y e ^
Then the module T x and the module T y are said to be strictly progressive T x R T y .
As shown in Figure 5 and Figure 6, let the module T x start with a green sphere and end with a blue sphere, and the module T y start with an orange sphere and end with a yellow sphere. Only the event parameters of each vertex are written in parentheses, and the parameters marked in red are the key variables of that vertex. As shown in the Figure 5, { a , b , c } { a , b , d } { a , b , c } , while { a , b , d } { a , b , c } { a , b , d } , so the module T x and the module T y are independent of each other; as shown in Figure 6, { a , b , c } { a , b , c , d } = { a , b , c } , { a , b , c } { a , b , c , d } , while { a , b , c , d } { a , b , c } { a , b , c , d } , thus module T x and module T y are strictly recursive.
The strictly recursive relationship between modules provides feasibility for the implementation of the complementary terms. If T 1 , T 2 satisfy t 1 e = t b r k , v 1 e ^ v 2 0 ^ = v 1 e ^ , v 1 e ^ v 2 0 ^ , v 1 e ^ v 2 0 ^ v 2 e ^ , then T 2 is said to be a supplementary clause to T 1 , that is, if the relevant clause in T 1 is violated, the relevant clause in T 2 can be invoked to make the intelligent. The contract can be executed smoothly by calling T 2 to migrate its instantaneous state to s c p l .
In the module, there is a special existence called the supervision module. The responsibility of the supervision module is to monitor the environment, V, and the state, S, of the smart contract. Assuming there is a key variable time. Once the state of the smart contract is s b r k , the smart contract does not migrate to s c p l within time, the state of the smart contract migrates to s f a i , and the smart contract fails to run. The supervision module can effectively solve the problem that the loss causes by malicious contracts or the vulnerabilities in the contract itself cannot be terminated.

5. Theoretical Analysis

In the previous section, finite state automata are used to illustrate the state transition process of smart contracts from a macro perspective, and the conditional response mechanism is introduced to analyze the reasons for smart contract state transition from a micro perspective. Nevertheless, given the reality property of the VST model, the feasibility of the model needs to be demonstrated. Below we will introduce the theorem of the VST model and give the proof process. In this section, three theorems will be presented. The importance of Theorems 1 and 2 is to explain what is the condition for the state migration of the smart contract. The importance of Theorem 3 lies in proving the completeness of the conditional corresponding mechanism theory.
Theorem 1.
A necessary and sufficient condition for the inter-state migration s c p l s b r k is that the value of at least one key variable changes to an illegal interval.
Proof. 
  • Sufficiency
  • Let the current state be:
    s * = f ( ( v 1 , v 2 , , v m , , v k ) ) = s c p l
Assuming there exists a previous state:
s * = f ( ( v 1 , v 2 , , v m , , v k ) ) = s c p l
there exists an intra-state migration s * s * . According to Definition 8, there exists a key variable v m = a , v m = a satisfies a , a A , and A is a legal interval. Let set p be a key point and a < p . According to Definitions 7–9, the two ends of a key point are the legal interval and the illegal interval.
When v m * = b , b A ˜ , b p , there exists:
f ( ( v 1 , v 2 , , v m , , v k ) ) f ( ( v 1 , v 2 , , v m * , , v k ) ) )
the current state s * = f ( ( v 1 , v 2 , , v m , , v k ) ) = s c p l , and there exists a new state s * * = f ( ( v 1 , v 2 , , v m * , , v k ) ) = s b r k , s * s * * . According to Definition 4, there exists an inter-state migration s c p l s b r k .
  • Necessity
There exists an inter-state migration s c p l s b r k , according to Definition 4, there exists key variables.
Assuming no key variables change to a value within an illegal interval, and, according to Definition 6, there exists an intra-state migration s c p l s c p l .
s c p l s c p l contradicts s c p l s b r k ,
v m = a , a A ˜ , A ˜ is the illegal interval of a key variable v m . □
Theorem 2.
The inter-state migration s b r k s c p l happens if and only if the values of all key variables change to values within the legal interval.
Proof. 
  • Sufficiency
Let us set the current state:
s * = f ( ( v 1 , v 2 , , v m , , v k ) ) = s b r k
According to Definition 9, v m = a , a A ˜ , A ˜ is the illegal interval of a key variable v m .
Let set p be a key point and b p , when v m * = b , b A , b > p , there exists:
f ( ( v 1 , v 2 , , v m , , v k ) ) f ( ( v 1 , v 2 , , v m * , , v k ) ) )
the current state s * = f ( ( v 1 , v 2 , , v m , , v k ) ) = s b r k , and there exists a new state s * * = f ( ( v 1 , v 2 , , v m * , , v k ) ) = s c p l   or   s f a i s * s * * . If the status is s f a i , it means that the call to the compensation module failed. Smart contract execution failed. v m * is a key variable of controlling the inter-state migration s b r k s f a i . The other key variables become dummy variables.
If the status is s c p l , v m * is a key variable of controlling the inter-state migration s b r k s c p l . The key variable that controls the inter-state migration s b r k s f a i becomes a dummy variable.
According to Definition 4, there exists an inter-state migration s b r k s c p l .
  • Necessity
There exists an inter-state migration s b r k s c p l , and, according to Definition 5, there exists key variables.
Assuming v m = a , a A ˜ , A ˜ is the illegal interval of a key variable v m , according to Definition 9, there exists an intra-state migration s b r k s b r k .
s b r k s b r k contradicts s b r k s c p l ,
And no key variables change to a value within an illegal interval, i.e., the values of all key variables change to within the legal interval.
To sum up, the original proposition holds. □
Theorem 3.
There are only two relations between module T x and module T y that are mutually independent and strictly recursive.
Proof. 
Let the initial vertices of module T x and module T y be t x 0 and t y 0 , respectively, and their end vertices be t x e and t y e . We may wish to list all the combinations to prove them one by one.
Firstly, let the current combination of their relationships be:
V x e ^ V y 0 ^ = V x e ^ V y e ^ V x 0 ^ = V y e ^
The termination node of the current module T x has the same dimension as the initial vertex of module T y , and the termination node of module T y and the initial vertex of module T x describe the same trigger event. So, the two modules form a huge cyclic graph. For module T x , it is a one-way path from the initial vertex to the terminal vertex, but since the terminal vertex of module T x is the initial vertex of module T y , they will continue to loop, which does not match the actual meaning and does not exist.
Secondly, let the current combination of their relationships be:
V x e ^ V y 0 ^ = V x e ^ V x e ^ = V y 0 ^ V y e ^ V x 0 ^ V y e ^
Since the termination node of module T x and the initial node of module T y have the same dimension, they describe the same event. Therefore, module T x and module T y are actually the same module, and there is no relationship between modules.
Finally, let the current combination of their relationships be:
V x e ^ V y 0 ^ V x e ^ V y e ^ = V x 0 ^ V y e ^ V x 0 ^ = V y e ^
According to the Definition 13, module T y and module T x are strictly progressive.
To sum up, the original proposition holds. □

6. Application

In the context of the widespread application of distributed network technology, lightweight blockchain shows unique advantages in improving network security and credibility. Figure 7 shows the operational framework of a lightweight blockchain-based distributed unmanned aerial vehicle (UAV) self-organizing network. This framework uses the consensus mechanism of blockchain and smart contracts to achieve the statistics and update of global credibility by real-time monitoring the behavior of UAV nodes. UAV nodes form a self-organizing network by connecting with each other. In this network, the credibility of nodes is dynamically evaluated by their data-forwarding behavior. After the evaluation result is verified by the consensus mechanism, it is automatically executed through the smart contract, and the global trust view is finally updated. This process fully reflects the ability of blockchain technology to improve transparency and trust in distributed systems. On this basis, the smart contract, as one of the core components of the system, further simplifies the complex processes in network operation. Smart contracts can automatically implement pre-set rules and protocols, such as the incentive mechanism for resource sharing between UAVs or the automatic isolation of faulty nodes. In this section, the VST model is used to describe the life cycle of a smart contract in four phases: creation, deployment, execution, and completion, and the following will illustrate how smart contracts play a practical role in UAV networks through specific application scenarios.

6.1. Creation

The creation phase of a smart contract is the process by which a software engineer transforms a traditional contract into a smart contract code that can be recognized and executed by a computer through a programming language. Generally, creating a smart contract involves defining variables, describing state, and setting conditional response rules. In the VST model, this process can be described as the instantiation of a multidimensional vector V, V S corresponding rules, and a directed acyclic graph set T. In conjunction with a common UAV mission contract, we need to perform natural language processing on the contract, extracting its entities, relations and logical structures, and recording and saving the attributes involved in the contract.
Declaration. The first step to create a smart contract is to extract the variables needed for the smart contract from the natural language contract, and declare the key-value pairs. In the UAV mission contract shown in Figure 8, the variables to be declared are shown in Table 3. After declaring the variables, it is necessary to define the state-variable mapping relationship, i.e., to define the instantaneous state that can cause the trigger condition, as shown in Table 4. After the first two steps are completed, the trigger conditions of the smart contract can be declared and a directed acyclic graphical set representing the structure of the trigger conditions of a smart contract can be drawn. The trigger condition declaration of an example UAV mission contract is shown in Table 5, and its directed acyclic graph set is shown in Figure 9. Thus, the process of creating a smart contract from a traditional contract under the VST model is formally completed.

6.2. Deployment

After a smart contract is created, it is packaged and deployed on the chain by a consensus node (miner). The existing technology first stores the contract code directly to the contract address, then the contract address is asymmetrically encrypted, packaged into blocks, and deployed to the main chain. The deconstructed VST model can store the multidimensional vector set, V, state set, S, and graph set, T (split into module T x , point set τ x , and edge set E x ) independently.

6.3. Execution

In the execution phase of a smart contract, the contract invoker initiates a transaction to the contract address, and the consensus node (miner) runs the smart contract to be executed in the local sandbox environment. The local sandbox accesses the state of the world through the prophecy machine, and returns the result to the contract invoker after execution, as shown in Figure 10.
In the VST model, since the environment, V, state set, S, and graph set, T, of the smart contract are stored independently in advance, the clause steps of the smart contract can be monitored during the execution process. When a clause is called, the module and vertex corresponding to the clause are returned to the caller in real time, and the instantaneous state of the contract and the corresponding variable key-value pairs are listened to. After the execution of the contract is completed, the result of the computation, the corresponding state and the variable key-value pairs to achieve the result are returned to the caller, as shown in Figure 11. Thus, the execution phase of a smart contract under the VST model has been transformed from a black-box process to a white-box process.
This transformation means that the execution of smart contracts is no longer an opaque black box, but has become a transparent white box, where every step of the execution can be monitored and verified. This enhancement in transparency is crucial for the security and reliability of smart contracts, as it allows developers and users to monitor the execution status of the contract in real time, and to identify and correct potential issues promptly.
Compared with traditional deployment of smart contracts, the VST model offers greater transparency and monitorability, which is one of its main contributions and a key feature that distinguishes it from conventional smart contract deployment. In this way, the VST model enhances the auditability and verifiability of smart contracts, providing new safeguards for the secure execution of smart contracts.
In this example UAV mission contract, if Party B modifies Party A’s drone without Party A’s consent during the task period, Party B must compensate Party A for the damage to the equipment as required. As shown in Figure 8, under the VST model, the above clauses correspond to Module4 and Module5, which are strictly recursive, and Module5 is a supplement to Module4. When Party B renovates Party A’s house without Party A’s consent, the trigger condition is t 4 t b r k , followed by t b r k t 6 . At this point, a supplement to the example UAV mission contract is executed.

6.4. Completion

A contract is completed when the smart contract no longer executes any of its terms. In the VST model, the “completion phase” of a contract refers to a stable state that reflects not only the success of the execution of the contract, but also the instantaneous state in which the contract has reached a stable state. In the VST model, there are two steady states, s f i n and s f a i , for smart contracts. Each contract has a separate listening module, T e n d , which contains three vertices, t e n d , t f i n , t f a i , as shown in Figure 12.
When the smart contract is no longer executing any clause, t e n d is triggered, and the termination state of the last executed module is checked: if the state is s c p l , t f i n is triggered, i.e., the contract reaches a stable completion state, s f i n ; if the state is s b r k , t f a i is triggered, i.e., the contract reaches a stable default state, s f a i .

6.5. Conditional Response Path

In the VST model, after the execution of a smart contract, a conditional response path is returned to the user, which is the set of all triggers triggered during the execution of the contract. Unlike the pre-declared T-chart at the time of contract creation, the condition response path returned after contract execution records the environment and state under which the completion/failure condition was reached. Thus, for both developers and users, each contract call makes experimental sense: suppose that under contract version C v 1 , user a completes the contract with t f i n = ( s f i n , V 1 ) , and user b completes the contract with t f i n = ( s f i n , V 2 ) ; under contract version C v 2 , user a completes the contract with t f i n = ( s f i n , V 3 ) , while user b completes the contract with t f i n = ( s f i n , V 4 ) . Suppose some key variables in V 1 have better values than V 2 , and some key variables in V 4 have better values than V 3 . Then, for user a, it seems that the contract version C v 1 better satisfies his interests, while, for user b, the opposite is true; for the developer, it becomes a mechanism design problem to adjust the predefined parameters at each step, balance the preferences of user a and user b, and improve the smart contract so that it can satisfy the interests of most users.
Specifically in the UAV mission contract example in this section, if the contract is executed and the conditional response path is t 4 = ( a , b , 2021.06 . 01 2022.05 . 31 , T ) ,   t 5 = ( a , b , 2021.06 . 01 2022.05 . 31 , T , F ) ,   t 6 = ( a , b , 2021.06 . 01 2022.05 . 31 , T , F , T , 1000 ) , this means that b made alterations to the house while renting a’s property, but a did not agree to the alterations and ordered b to return the house to its original condition and pay 1000. If the owner, a, does not want to modify the drone in the next task period, he/she can improve the contract template, for example, setting the compensation to 10,000 in advance, which increases the user’s modification cost and reduces the possibility of users modifying the drone. Such a change in the contract is to some extent more favorable to the interests of the first party.

7. Conclusions

This paper creatively proposes a formal model of a blockchain smart contract—VST model, focusing on the definition and interpretation of state migration and the trigger condition response mechanism of smart contracts under the VST model. In terms of model validation, this paper verifies the feasibility of the VST model by instantiating a real UAV mission contract into a programmable smart contract form.
Unlike the traditional formal model, the VST model defines the conditional response mechanism of the smart contract, and analyzes the execution logic of the smart contract from a microscopic perspective, which is more capable of explaining the possible supplementary clauses and hierarchical clauses in the traditional contract, and facilitates the implementation of the construction from the smart contract. The VST model supports the deployment of the smart contract environment, state, and trigger conditions to the blockchain, which facilitates the supervision of the contract state and condition response paths during contract execution and helps developers improve smart contracts.
Moving forward, we plan to integrate the system model from Wu’s work [33] to enhance our framework’s data handling capabilities.Addressing the potential vulnerabilities raised, we will analyze the novel attacks from Gao’s work [34] to strengthen our model against such threats. Our future research will focus on ensuring the VST model’s robustness against blockchain attacks, thus safeguarding the system’s integrity.

Author Contributions

Conceptualization, Y.X. and S.L.; methodology, X.Y.; validation, B.H.; formal analysis, Y.X. and S.L.; writing original draft preparation, X.Y. and B.H.; writing review and editing, F.H. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Natural Science Foundation of China, under Grant 62203219 and 62176122.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. Technical Report, Manubot. 2008. Available online: https://static.upbitcare.com/931b8bfc-f0e0-4588-be6e-b98a27991df1.pdf (accessed on 24 November 2024).
  2. Wood, G. Ethereum: A secure decentralised generalised transaction ledger. Ethereum Proj. Yellow Pap. 2014, 151, 1–32. [Google Scholar]
  3. Androulaki, E.; Barger, A.; Bortnikov, V.; Cachin, C.; Christidis, K.; De Caro, A.; Enyeart, D.; Ferris, C.; Laventman, G.; Manevich, Y.; et al. Hyperledger fabric: A distributed operating system for permissioned blockchains. In Proceedings of the Thirteenth EuroSys Conference, Porto, Portugal, 23–26 April 2018; pp. 1–15. [Google Scholar]
  4. Guerreiro, S.; van Kervel, S.J.; Babkin, E. Towards Devising an Architectural Framework for Enterprise Operating Systems. In Proceedings of the 8th International Joint Conference on Software Technologies, ICSOFT 2013, Reykjavik, Iceland, 29–31 July 2013; pp. 578–585. [Google Scholar]
  5. Bruel, A.; Godina, R. A smart contract architecture framework for successful industrial symbiosis applications using blockchain technology. Sustainability 2023, 15, 5884. [Google Scholar] [CrossRef]
  6. Korpela, K.; Hallikas, J.; Dahlberg, T. Digital supply chain transformation toward blockchain integration. In Proceedings of the 50th Hawaii International Conference on System Sciences, Waikoloa Village, HI, USA, 4–7 January 2017. [Google Scholar]
  7. Azaria, A.; Ekblaw, A.; Vieira, T.; Lippman, A. Medrec: Using blockchain for medical data access and permission management. In Proceedings of the 2016 2nd International Conference on Open and Big Data (OBD), Vienna, Austria, 22–24 August 2016; pp. 25–30. [Google Scholar]
  8. De Filippi, P.; Hassan, S. Blockchain technology as a regulatory technology: From code is law to law is code. arXiv 2018, arXiv:1801.02507. [Google Scholar] [CrossRef]
  9. Liu, L.; Tsai, W.T.; Bhuiyan, M.Z.A.; Peng, H.; Liu, M. Blockchain-enabled fraud discovery through abnormal smart contract detection on Ethereum. Future Gener. Comput. Syst. 2022, 128, 158–166. [Google Scholar] [CrossRef]
  10. Feng, Q.; He, D.; Zeadally, S.; Khan, M.K.; Kumar, N. A survey on privacy protection in blockchain system. J. Netw. Comput. Appl. 2019, 126, 45–58. [Google Scholar] [CrossRef]
  11. Zacky, M.I.; Helmi, S.; Della Cella, I. Smart contracts on the blockchain: Design, use cases, and prospects. Blockchain Front. Technol. 2023, 3, 54–73. [Google Scholar] [CrossRef]
  12. Feist, J.; Grieco, G.; Groce, A. Slither: A static analysis framework for smart contracts. In Proceedings of the 2019 IEEE/ACM 2nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), Montreal, QC, Canada, 27 May 2019; pp. 8–15. [Google Scholar]
  13. Liu, Z.; Qian, P.; Wang, X.; Zhu, L.; He, Q.; Ji, S. Smart contract vulnerability detection: From pure neural network to interpretable graph feature and expert pattern fusion. arXiv 2021, arXiv:2106.09282. [Google Scholar]
  14. Wu, H.; Zhang, Z.; Wang, S.; Lei, Y.; Lin, B.; Qin, Y.; Zhang, H.; Mao, X. Peculiar: Smart contract vulnerability detection based on crucial data flow graph and pre-training techniques. In Proceedings of the 2021 IEEE 32nd International Symposium on Software Reliability Engineering (ISSRE), Wuhan, China, 25–28 October 2021; pp. 378–389. [Google Scholar]
  15. Yuan, Y.; Wang, F. Blockchain Theory and Method; Tsinghua University Press: Beijing, China, 2019. [Google Scholar]
  16. Zheng, Z.; Xie, S.; Dai, H.N.; Chen, W.; Chen, X.; Weng, J.; Imran, M. An overview on smart contracts: Challenges, advances and platforms. Future Gener. Comput. Syst. 2020, 105, 475–491. [Google Scholar] [CrossRef]
  17. Li, X.; Jiang, P.; Chen, T.; Luo, X.; Wen, Q. A survey on the security of blockchain systems. Future Gener. Comput. Syst. 2020, 107, 841–853. [Google Scholar] [CrossRef]
  18. Delmolino, K.; Arnett, M.; Kosba, A.; Miller, A.; Shi, E. Step by step towards creating a safe smart contract: Lessons and insights from a cryptocurrency lab. In Proceedings of the International Conference on Financial Cryptography and Data Security, Christ Church, Barbados, 26 February 2016; pp. 79–94. [Google Scholar]
  19. Ruan, N.; Sun, H.; Lou, Z.; Li, J. A General Quantitative Analysis Framework for Attacks in Blockchain. IEEE ACM Trans. Netw. 2022, 31, 664–679. [Google Scholar] [CrossRef]
  20. Khan, S.N.; Loukil, F.; Ghedira-Guegan, C.; Benkhelifa, E.; Bani-Hani, A. Blockchain smart contracts: Applications, challenges, and future trends. Peer-Netw. Appl. 2021, 14, 2901–2925. [Google Scholar] [CrossRef] [PubMed]
  21. An, J.; Wang, Z.; He, X.; Gui, X.; Cheng, J.; Gui, R. PPQC: A blockchain-based privacy-preserving quality control mechanism in crowdsensing applications. IEEE ACM Trans. Netw. 2022, 30, 1352–1367. [Google Scholar] [CrossRef]
  22. Wang, S.; Ouyang, L.; Yuan, Y.; Ni, X.; Han, X.; Wang, F.Y. Blockchain-enabled smart contracts: Architecture, applications, and future trends. IEEE Trans. Syst. Man Cybern. Syst. 2019, 49, 2266–2277. [Google Scholar] [CrossRef]
  23. Liu, Y.; Fang, Z.; Cheung, M.H.; Cai, W.; Huang, J. An incentive mechanism for sustainable blockchain storage. IEEE ACM Trans. Netw. 2022, 30, 2131–2144. [Google Scholar] [CrossRef]
  24. Liu, Z.; Liu, J. Formal verification of blockchain smart contract based on colored petri net models. In Proceedings of the 2019 IEEE 43rd Annual Computer Software and Applications Conference (COMPSAC), Milwaukee, WI, USA, 15–19 July 2019; Volume 2, pp. 555–560. [Google Scholar]
  25. Singh, A.; Parizi, R.M.; Zhang, Q.; Choo, K.K.R.; Dehghantanha, A. Blockchain smart contracts formalization: Approaches and challenges to address vulnerabilities. Comput. Secur. 2020, 88, 101654. [Google Scholar] [CrossRef]
  26. AlSobeh, A. OSM: Leveraging Model Checking for Observing Dynamic behaviors in Aspect-Oriented Applications. arXiv 2024, arXiv:2403.01349. [Google Scholar] [CrossRef]
  27. Xu, Y.; Slaats, T.; Düdder, B.; Hildebrandt, T.T. Adding Generic Role- and Process-based Behaviors to Smart Contracts using Dynamic Condition Response Graphs. In Proceedings of the 2023 IEEE/ACM International Conference on Software and System Processes (ICSSP), Melbourne, Australia, 14–15 May 2023; pp. 70–80. [Google Scholar] [CrossRef]
  28. AlSobeh, A.M.; Magableh, A.A. BlockASP: A Framework for AOP-Based Model Checking Blockchain System. IEEE Access 2023, 11, 115062–115075. [Google Scholar] [CrossRef]
  29. Lekidis, A.; Katsaros, P. Integrating data-driven security, model checking, and self-adaptation for IoT systems using BIP components. In Proceedings of the Companion Proceedings—24th International Conference on Model-Driven Engineering Languages and Systems, MODELS-C 2021, Fukuoka, Japan, 10–15 October 2021; pp. 761–766. [Google Scholar] [CrossRef]
  30. Dinh, T.T.A.; Liu, R.; Zhang, M.; Chen, G.; Ooi, B.C.; Wang, J. Untangling blockchain: A data processing view of blockchain systems. IEEE Trans. Knowl. Data Eng. 2018, 30, 1366–1385. [Google Scholar] [CrossRef]
  31. Zheng, B.K.; Zhu, L.H.; Shen, M.; Gao, F.; Zhang, C.; Li, Y.D.; Yang, J. Scalable and privacy-preserving data sharing based on blockchain. J. Comput. Sci. Technol. 2018, 33, 557–567. [Google Scholar] [CrossRef]
  32. Zhang, J.; Cheng, Y.; Deng, X.; Wang, B.; Xie, J.; Yang, Y.; Zhang, M. A reputation-based mechanism for transaction processing in blockchain systems. IEEE Trans. Comput. 2021, 71, 2423–2434. [Google Scholar] [CrossRef]
  33. Wu, H.; Peng, Z.; Guo, S.; Yang, Y.; Xiao, B. VQL: Efficient and verifiable cloud query services for blockchain systems. IEEE Trans. Parallel Distrib. Syst. 2021, 33, 1393–1406. [Google Scholar] [CrossRef]
  34. Gao, S.; Li, Z.; Peng, Z.; Xiao, B. Power adjusting and bribery racing: Novel mining attacks in the bitcoin system. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, London, UK, 11–15 November 2019; pp. 833–850. [Google Scholar]
Figure 1. VST-based smart contract creation diagram.
Figure 1. VST-based smart contract creation diagram.
Electronics 13 04680 g001
Figure 2. State migration for VST models.
Figure 2. State migration for VST models.
Electronics 13 04680 g002
Figure 3. Relationship between trigger conditions, t i . (Arrows represent the progression of states).
Figure 3. Relationship between trigger conditions, t i . (Arrows represent the progression of states).
Electronics 13 04680 g003
Figure 4. The loop structure in T x . (Arrows represent the progression of states).
Figure 4. The loop structure in T x . (Arrows represent the progression of states).
Electronics 13 04680 g004
Figure 5. Mutuallyindependent.
Figure 5. Mutuallyindependent.
Electronics 13 04680 g005
Figure 6. Strictly progressive. (Arrows represent the progression of states).
Figure 6. Strictly progressive. (Arrows represent the progression of states).
Electronics 13 04680 g006
Figure 7. Lightweight application of blockchain on UAV cluster.
Figure 7. Lightweight application of blockchain on UAV cluster.
Electronics 13 04680 g007
Figure 8. Example of UAV mission contract.
Figure 8. Example of UAV mission contract.
Electronics 13 04680 g008
Figure 9. A set of directed acyclic graphs representing the trigger condition structure of an example UAV mission contract. (Arrows represent the progression of states).
Figure 9. A set of directed acyclic graphs representing the trigger condition structure of an example UAV mission contract. (Arrows represent the progression of states).
Electronics 13 04680 g009
Figure 10. Traditional smart contract execution process.
Figure 10. Traditional smart contract execution process.
Electronics 13 04680 g010
Figure 11. Smart contract execution process under VST model.
Figure 11. Smart contract execution process under VST model.
Electronics 13 04680 g011
Figure 12. Module T e n d .
Figure 12. Module T e n d .
Electronics 13 04680 g012
Table 1. Parameter symbol list.
Table 1. Parameter symbol list.
SymbolsImplication
CSmart Contract
VEnvironment
SSmart Contract State Set
TConditional Response Mechanism
vEnvironment Variables
sInstantaneous State
T x Conditional Response Module
tTriggers
eConditional Response Path
Table 2. The environment in which smart contracts operate.
Table 2. The environment in which smart contracts operate.
Environment VariablesData StorageMeta-Attributes
v 0 a t t r i b u t e 0 :valuekey variable/dummy variable
v 1 a t t r i b u t e 1 :valuekey variable/dummy variable
v 2 a t t r i b u t e 2 :valuekey variable/dummy variable
v | I | a t t r i b u t e | I | :valuekey variable/dummy variable
Table 3. Declaration of V.
Table 3. Declaration of V.
VariablesKey-Value Pairs
v 0 Whether the contract is called: T/F
v 1 Party A (Principal)
v 2 Party B (Executor)
v 3 Task location: [specific location or area]
v 4 Task time: [specific date and time]
v 5 Communication bandwidth fee: XX$
v 6 Task collaboration start time XX$
v 7 Additional data package value-added service fee: XX$
v 8 Whether received a communication reply: T/F
v 9 Whether the next stage of tasks continue to be executed: T/F
v 10 Whether the drone parameter reset: T/F
v 11 Drone maintenance cost: XX$
v 12 Drone Health Status: T/F
v 13 Whether to terminate task: T/F
v 14 Liquidated damages: XX$
v 15 Whether there is any dispute during the task period: T/F
v 16 Whether the task can be redone: T/F
v 17 Whether the smart contract state is s c p l when the listener module is called: T/F
Table 4. Declaration of S.
Table 4. Declaration of S.
Instantaneous StatesKey Variables
s 0 ( v 0 )
s 1 ( v 1 , v 2 , v 3 , v 4 )
s 2 ( v 1 , v 2 , v 5 , v 6 )
s 3 ( v 2 , v 4 , v 7 )
s 4 ( v 1 , v 2 , v 4 , v 8 )
s 5 ( v 1 , v 2 , v 4 , v 8 , v 9 )
s 6 ( v 1 , v 2 , v 4 , v 8 , v 9 , v 10 , v 11 )
s 7 ( v 1 , v 2 , v 4 , v 12 )
s 8 ( v 1 , v 2 , v 4 , v 12 , v 13 )
s 9 ( v 1 , v 2 , v 4 , v 12 , v 13 , v 14 )
s 10 ( v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 , v 8 , v 9 , v 10 , v 11 , v 12 , v 13 , v 14 , v 15 )
s 11 ( v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 , v 8 , v 9 , v 10 , v 11 , v 12 , v 13 , v 14 , v 15 , v 16 )
s 12 ( v 1 , v 2 , v 4 , v 17 )
s b r k ( v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 , v 8 , v 9 , v 10 , v 11 , v 12 , v 13 , v 14 , v 15 , v 16 , v 17 )
s f a i ( v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 , v 8 , v 9 , v 10 , v 11 , v 12 , v 13 , v 14 , v 15 , v 16 , v 17 )
s f i n ( v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 , v 8 , v 9 , v 10 , v 11 , v 12 , v 13 , v 14 , v 15 , v 16 , v 17 )
Table 5. Declaration of T.
Table 5. Declaration of T.
TriggersStates and VariablesMeanings
t 0 ( s 0 * , ( v 0 * ) ) Contracts are called.
t 1 ( s 1 * , ( v 1 * , v 2 * , v 3 * , v 4 * ) ) Party A will provides the drone to Party B to carry out the task for X months.
t 2 ( s 2 * , ( v 1 * , v 2 * , v 5 * , v 6 * ) ) Party B needs to pay Party A a monthly drone communication bandwidth fee $.
t 3 ( s 3 * , ( v 2 * , v 4 * , v 7 * ) ) Party B has to pay for additional data package value-added service fees during the task period.
t 4 ( s 4 * , ( v 1 * , v 2 * , v 4 * , v 8 * ) ) Party B modifies or retrofits the parameters of Party A’s unmanned aerial vehicle during the task period.
t 5 ( s 5 * , ( v 1 * , v 2 * , v 4 * , v 8 * , v 9 * ) ) Party A is agreeable to Party B’s parameter modifications and modifications during the task period.
t 6 ( s 6 * , ( v 1 * , v 2 * , v 4 * , v 8 * , v 9 * , v 10 * , v 11 * ) ) Party B did not compensate Party A for the damage to the drone equipment, nor replied to the default settings of the drone.
t 7 ( s 7 * , ( v 1 * , v 2 * , v 4 * , v 12 * ) ) Termination of the task between Party A and Party B during the task period.
t 8 ( s 8 * , ( v 1 * , v 2 * , v 4 * , v 12 * , v 13 * ) ) Party A and Party B signed a task termination plan.
t 9 ( s 9 * , ( v 1 * , v 2 * , v 4 * , v 12 * , v 13 * , v 14 * ) ) A party forcibly terminating a contract is required to pay X amount of liquidated damages.
t 10 ( s 10 * , ( v 1 * , v 2 * , v 3 * , v 4 * , v 5 * , v 6 * , v 7 * , v 8 * , v 9 * , v 10 * , v 11 * , v 12 * , v 13 * , v 14 * , v 15 * ) ) During the task period, Party A and Party B have conflicts they need to negotiate.
t 11 ( s 11 * , ( v 1 * , v 2 * , v 3 * , v 4 * , v 5 * , v 6 * , v 7 * , v 8 * , v 9 * , v 10 * , v 11 * , v 12 * , v 13 * , v 14 * , v 15 * , v 16 * ) ) During the task period, Party A and Party B negotiated and resolved the conflict.
t 12 ( s 12 * , ( v 1 * , v 2 * , v 4 * , v 17 * ) ) When the task calls the listener module, the task state is s c p l .
t b r k ( s b r k , ( v 1 * , v 2 * , v 3 * , v 4 * , v 5 * , v 6 * , v 7 * , v 8 * , v 9 * , v 10 * , v 11 * , v 12 * , v 13 * , v 14 * , v 15 * , v 16 * , v 17 * ) ) Task status is in default, pending.
t f a i ( s b r k , ( v 1 * , v 2 * , v 3 * , v 4 * , v 5 * , v 6 * , v 7 * , v 8 * , v 9 * , v 10 * , v 11 * , v 12 * ,
v 12 * , v 13 * , v 14 * , v 15 * , v 16 * , v 17 * ))
Task status is stable failure status.
t f i n ( s c p l , ( v 1 * , v 2 * , v 3 * , v 4 * , v 5 * , v 6 * , v 7 * , v 8 * , v 9 * , v 10 * , v 11 * , v 12 * , v 13 * , v 14 * , v 15 * , v 16 * , v 17 * ) ) Task is finished.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Liu, S.; Xu, Y.; Yang, X.; Hui, B.; Hu, F. Variable-State-Trigger: A Formal Model of Smart Contracts Based on Conditional Response and Finite State Automata and Its Application. Electronics 2024, 13, 4680. https://doi.org/10.3390/electronics13234680

AMA Style

Liu S, Xu Y, Yang X, Hui B, Hu F. Variable-State-Trigger: A Formal Model of Smart Contracts Based on Conditional Response and Finite State Automata and Its Application. Electronics. 2024; 13(23):4680. https://doi.org/10.3390/electronics13234680

Chicago/Turabian Style

Liu, Shangqi, Yuntao Xu, Xingyu Yang, Bozhi Hui, and Feng Hu. 2024. "Variable-State-Trigger: A Formal Model of Smart Contracts Based on Conditional Response and Finite State Automata and Its Application" Electronics 13, no. 23: 4680. https://doi.org/10.3390/electronics13234680

APA Style

Liu, S., Xu, Y., Yang, X., Hui, B., & Hu, F. (2024). Variable-State-Trigger: A Formal Model of Smart Contracts Based on Conditional Response and Finite State Automata and Its Application. Electronics, 13(23), 4680. https://doi.org/10.3390/electronics13234680

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop