<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Italian Symposium on Advanced Database Systems, June</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Reasoning about Smart Contracts via LTL Encoding</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Valeria Fionda</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gianluigi Greco</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marco Antonio Mastratisi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>DeMaCS, University of Calabria</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2022</year>
      </pub-date>
      <volume>1</volume>
      <fpage>9</fpage>
      <lpage>22</lpage>
      <abstract>
        <p>Smart contracts are programs that automatically execute on blockchains when some conditions are verified. They encode the legally relevant events needed to satisfy the terms of an agreement and are usually defined by using procedural languages, even if some recent proposals investigated the possibility of using logic formalisms. However, existing logic-based initiatives are rather limited since they only enable the formal checking of properties of a single smart contract, totally neglecting its possible interactions with other smart contracts running on the same blockchain. This paper proposes a framework, called SCRea, that works on a set of smart contracts specified as Linear Temporal Logic (LTL) formulas. SCRea enables to reason about smart contracts considered individually or by considering them as running cooperatively or competitively on the same blockchain.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Smart Contracts</kwd>
        <kwd>Linear Temporal Logic</kwd>
        <kwd>Reasoning</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Distributed Ledger Technologies (DLT) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] ofers an infrastructure for the synchronized and shared
management of data regulated via consensus algorithms. The blockchain is a particular type of DLT
in which values of data are stored in a “chain of blocks”. Examples of implementations of blockchain
are Bitcoin [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and Ethereum [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] (exchange of cryptocurrency). DLTs allow for the deployment and
execution of smart contracts [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]: programs stored within the distributed register, that are automatically
executed when certain conditions occur. The efect of the execution of a smart contract may be the
alteration of the state of the register or the activation of other contracts. Some examples of smart contract
application include banking functions (e.g. Savings), decentralized markets (e.g. EtherMarket), prediction
markets (e.g., Augur,), distribution of music royalties (e.g., Ujo) and encoding of virtual property (e.g.,
a‘Ascribe).
      </p>
      <p>
        Smart contracts in blockchains are typically programmed in a procedural language specific of the host
DLT platform, such as Solidity[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] for Ethereum, or general purpose such as Javascript, Java, Golang,
and Python. Some initiatives exist in the literature for the formalization of smart contracts using a logic
declarative language (e.g., [
        <xref ref-type="bibr" rid="ref2 ref3 ref4">2, 3, 4</xref>
        ]). However, they only enable the formal checking of the correctness
and some other properties of a single smart contract independently from the other smart contracts
running on the same blockchain and the state of the blockchain itself.
      </p>
      <p>
        We try to fill this gap by focusing on the application of linear temporal logic on finite traces (LTL  )
[
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], with past operators, as a high-level logical tool for the formalization, validation and resolution
of any conflicts in the execution of smart contracts running on the same blockchain infrastructure. In
our framework, called SCRea, each smart contract is characterized by a set of preconditions and an
efect, where efects are visible on the blockchain when the smart contract is activated or, at most, at
the subsequent time instant. SCRea will enable, given a set of smart contracts, to verify whether the
execution of each of them is compatible with the execution of the others. If so, the framework also allows
to establish a particular order of execution that ensures that the preconditions of each smart contract are
verified before its execution.
      </p>
      <p>We also studied the applicability of SCRea for the identification of conflict situations at runtime by
dealing with one execution trace. In the domain of smart contracts, the term trace denotes a sequence
of events executed by a blockchain or a sequence of function or event invocations issued by one or
more smart contracts. The availability of information at runtime helps dynamic verification techniques
to mitigate one of the main obstacles in the analysis of smart contracts: the need to model a complex
blockchain execution environment.</p>
      <p>The rest of the paper is organized as follows. In Section 2 we introduce some preliminary definitions.
The encoding of smart contracts in linear temporal logic is discussed in Section 3 while Section 4 reports
about reasoning problems that are enabled by our encoding. The SCRea framework is described in
Section 5 and Section 6 will conclude the paper.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Linear Temporal Logic on Finite Traces with Past Operators</title>
      <p>
        Linear temporal logic, denoted by LTL, is a modal logic introduced in the 1970s [
        <xref ref-type="bibr" rid="ref10 ref9">9, 10</xref>
        ]. Since then, it has
found applications in several fields of artificial intelligence and computer science, including planning [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ],
robotics and control theory [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], the management of business processes [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] and temporal querying of
data [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. LTL is a modal logic whose modalities are temporal operators related to events that occur at
particular time instants on an ordered timeline. Classically, LTL formulas are interpreted on infinite
traces, but there are some applications where is more appropriate to focus on interpretations on finite
traces [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. Indeed, a liner temporal logic endowed with this semantics, denoted by LTL , has been
recently studied [
        <xref ref-type="bibr" rid="ref15 ref17 ref18">15, 17, 18</xref>
        ].
      </p>
      <p>Syntax. Let’s  be a set of propositional variables. An LTL formula  is built on variables in  using
boolean connectives ∧, ∨, ¬ as well as a number of time operators of two categories: future and past
temporal operators. For our purposes we will focus on a specific fragment of LTL  which includes the
future operator X (next) and the past operators Y (previous), H (always in the past), P (in the past), S
(since). Moreover, we assume that the negation is atomic in  in the sense that it is applied directly
only to propositional variables. More formally, the formula  is constructed according to the following
grammar, where  is any variable in  :
 ::=  | ¬ | ( ∧  ) | ( ∨  ) | ( ) |  ( ) | ( ) |  ( ) | (  
)
Semantics. A finite trace defined on the variables in  is a sequence  =  0,  1, ... − 1 that associates
with each  ∈ {0, 1, ...− 1} a state   ⊆  consisting of all propositional variables that are assumed to be
true in the time instant . The length of  (its number of time instants) is denoted by ( ). Given a finite
trace  , we define that an LTL  formula  evaluate true in  at the time instant  ∈ {0, 1, ...( )-1}
inductively as follows:
∙ ,  | =  if and only if  ∈  ;
∙ ,  | = ¬ if and only if  ∈/  ;
∙ ,  | = ( 1 ∧  2) if and only if ,  | =  1 and ,  | =  2;
∙ ,  | = ( 1 ∨  2) if and only if ,  | =  1 or ,  | =  2;
∙ ,  | = ( ′) if and only if  &lt; ( ) − 1 and ,  + 1| =  ′;
∙ ,  | =  ( ′) if and only if  &gt; 0 and ,  − 1| =  ′;
∙ ,  | = ( ′) if and only if for each  such that 0 ≤  ≤  it’s true that ,  | =  ′;
∙ ,  | =  ( ′) if and only if exists  such that 0 ≤  ≤  and ,  | =  ′;
the condition/action  occurs
the condition/action  does not occurs
the conditions/actions 1 and 2 occurs
the conditions/actions 1 or 2 occurs
in the next step the condition/action ′ must apply/be executed
in the previous step the condition/action ′ must be valid/have
been executed
in the past there must be an instant in which the condition/action
′ was valid/was performed
in the past the condition/action ′ has been verified/has always
been performed
in the past there is an instant in which 2 has been verified/
executed, and from that moment the condition/action 1 has
always been verified/executed
∙ ,  | = ( 1   2) if and only if exists  such that 0 ≤  ≤  and ,  | =  2 and for any k such
that  ≤  ≤  it’s true that ,  | =  1.</p>
      <p>When ,  -1 |=  we say that  is a model of  and  is satisfiable.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Encoding Smart Contracts in Linear Temporal Logic</title>
      <p>Our goal is to use the fragment of linear time logic on finite traces with past operators described in
the Section 2 to reason on smart contracts. From this perspective, the time operators are interpreted as
reported in Table 1. In our encoding, each smart contract is a pair ⟨, ⟩, where: (i)  are the preconditions,
i.e. an LTL formula using past operators only; (ii)  is the efect, i.e. a propositional formula or an LTL 
formula using future operators only. Since  are the preconditions that activate the smart contract and 
the efect of its execution, the smart contract will be expressed by the LTL  formula  = ( → ), i.e.,
every time the preconditions  occurs then the smart contract must be executed and, thus, its efect 
must be visible. In the smart contracts domain, a trace  denotes a sequence of events executed by a
blockchain platform or a sequence of function or event invocations issued by one or more smart contracts.
If a trace  satisfies a smart contract ⟨, ⟩ it means that it satisfies the LTL  formula  = ( → )
encoding it.</p>
      <p>Example 1. Let’s consider a simple smart contract within the sharing economy context to access
multimedia contents. The contract consists of the following clause: if a user requests a content for which
he has previously paid, that content must be transferred to him. The propositional variables encoding
events are:  (he user requests the content),  (the user pays for the content)
and  (the content is transmitted to the user). The precondition of the smart contract
is  =  ∧  (), that is when the user requires a content it must be checked
that he already payed for it. The efect is the transmission of the content to the user which is considered
to be made in the time instant immediately following the request:  = (). The smart
contract will then be codified by the following formula:  = ((∧ ()) →
()).</p>
    </sec>
    <sec id="sec-4">
      <title>4. Reasoning about Smart Contracts</title>
      <p>Using LTL to encode smart contracts allows to reason over (group of) smart contracts by exploiting its
reasoning capabilities. In this section we will discuss several reasoning problems on smart contracts.</p>
      <sec id="sec-4-1">
        <title>4.1. Reasoning Problems on a Single Smart Contract</title>
        <p>In this section we discuss three reasoning problems that can be defined if considering a single smart
contract.</p>
        <p>
          Model checking. A major issue when dealing with a smart contract is model verification or model
checking. The goal is to verify if a given trace  , encoding the events registered by a blockchain, is a
model of a given smart contract ⟨, ⟩ encoded by the formula LTL  = ( → ). This corresponds
to check whether the smart contract has been executed (i.e., the efects of its execution are visible on the
blockchain) every time its preconditions have been satisfyied. Checking if a trace is a model of a smart
contract can be done in polynomial time w.r.t the length of the formula  [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ].
        </p>
        <p>Example 2. Let’s consider the smart contract discussed in Example 1 consisting in the LTL
formula  = (( ∧  ()) → ()) and the trace  1 =
{}, {}, {}. It’s easy to see that  1 is a model of  .
Instead, the trace  2 = {, } is not a model of  since the precondition of the
smart contract is satisfied but the content is not transmitted to the user.</p>
        <p>Satisfiability. Satisfiability is the problem of establishing whether a smart contract ⟨, ⟩ encoded by
the LTL formula  = ( → ) admits a satisfying trace  in which it has been executed at least once.
This corresponds to check whether the LTL formula  () ∧ ( → ) admits a model.
Example 3. The smart contract discussed in Example 1 is satisfiable, and examples of traces that satisfy
it are:
 1={}, {}, {}
 2={, }, {}
 3={}, {}, {}, {}, {}.
Satisfiability at runtime. Satisfiability at runtime is the problem of verifying whether a smart contract
⟨, ⟩ (encoded by the LTL formula  = ( → )) is satisfiable given a partial trace  . In particular,
it is the problem of verifying whether there exists a completion  =    of   (obtained by adding to
  a subtrace   consisting of a certain number of states) such that the trace  obtained is a model of the
formula  () ∧ ( → ).</p>
        <p>Example 4. Consider again the smart contract discussed in Example 1 and the partial trace   =
{}, {}. This smart contract can be satisfied at runtime starting from  ,
and examples of completions of   are:
 1={}, {}, {}
 2={}, {}, {}, {}, {}</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Reasoning Problems on a Set of Smart Contracts</title>
        <p>The previous section considered reasoning problems defined on individual smart contracts. It is also
interesting in the context of blockchains to consider problems defined on a set of smart contracts, which
are supposed to operate and interact in the same blockchain infrastructure.</p>
        <p>Model checking. Given a set of smart contracts {⟨1, 1⟩, ⟨2, 2⟩, ..., ⟨, ⟩} encoded by the LTL
formulas  1 = (1 → 1),  2 = (2 → 2),... ,   = ( → ), the goal is to verify if a
given trace  is a model of  1,  2, ...,  . To this end, we can use the same approach used for the
model checking of a single smart contract, but defining appropriately the LTL  formula encoding the
set. In particular, since no smart contracts must be violated by the trace, we can consider the formula
 =  1 ∧  2 ∧ ... ∧  .</p>
        <p>Example 5. Consider the smart contract consisting of the following clause: if a user shares a content that
has been previously transmitted to him, thus violating contractual terms, that user will be deleted from the
system. The propositional variables used for the encoding are: ℎ (the user shares the
content),  (the content is transmitted to the user) and   (the user is deleted from
the system). The precondition of the smart contract is  = ℎ ∧  (). The
efect is the deletion of the user from the system which is considered to be made in the time instant
immediately following the sharing  = ( ). The smart contract is encoded by the following formula:
 2 = ((ℎ ∧  ()) → ( )). If we consider that  2 and the
smart contract discussed in Example 1 (consisting of the LTL formula  1 = (( ∧
 ()) → ())) are running on the same blockchain; we can perform
model checking by considering the LTL formula 
=  1 ∧  2. Let’s consider the following trace:  =
smart contracts formalized by it.
{}, {}, {}, {}, {,
ℎ}, { }. It is easy to verify that  satisfies  and it’s compliant with the two
Consistency of a set of smart contracts. If we consider a set of smart contracts running on the
same blockchain, another relevant problem is to verify their consistency, i.e. if it is possible that all
smart contracts can sooner or later be executed or if they are incompatible with each other, meaning
that the execution of one of them makes another smart contract never executable. The goal is to
check if there is a trace  in which all the smart contracts in the set have been executed at least
⋀︀
once. Let’s consider a set of smart contracts {⟨1, 1⟩, ..., ⟨, ⟩} encoded by the LTL formulas
 1=(1 → 1), . . . ,  =( → ). Then, the LTL formula for consistency checking is 
∈{1,...,}(( → ) ∧  ()), that is, the conjunction of the formulas encoding the individual smart
contracts plus the check that the preconditions of each smart contract have been satisfied at least once
=
(using the  () subformulas).
ℎ} { }.</p>
        <sec id="sec-4-2-1">
          <title>Example 6.</title>
          <p>Consider the set of smart contracts discussed in Example 5.</p>
          <p>This set
of smart contracts is consistent, in fact
we found
a trace satisfying this set.</p>
          <p>Let:
 ′1′=(( ∧  ())→() and  ′2′=((ℎ ∧
 ())
sistency of the set is:</p>
          <p>→
 (ℎ ∧  ()).</p>
          <p>( ).</p>
          <p>The LTL formula allowing to check the
con=
( ′1′) ∧ ( ′2′) ∧  ( ∧  ()) ∧</p>
          <p>A trace that satisfies

is the following: 
=
{}, {}, {}, {}, {,</p>
        </sec>
        <sec id="sec-4-2-2">
          <title>Example 7.</title>
          <p>Consider the two smart contracts within the sharing economy environment
⟨1=( ∧ (¬)), 1=⟩ and ⟨2= (  ∧
(¬)), 2=). The smart contract ⟨1, 1⟩ establishes that if the owner of
a content ask for its deletion () and previously such content has not been declared
not deletable ((¬)), the content is deleted from the system. Instead, the smart contract
⟨2, 2⟩ states that if a content is requested to be made permanent in the system ( )
and has not been previously deleted ((¬)) then it is marked as not deletable. It is easy
to see that this set of smart contracts is not consistent since the execution of one smart contract prevents
the precondition of the other to be ever satisfied.</p>
          <p>Consistency at runtime. Consistency at runtime is the problem of checking if a set of smart contracts
{⟨1, 1⟩, ..., ⟨, ⟩} can be satisfied starting from a partial trace  , that is to verify whether there
exists a completion  =   of   (obtained by adding to   a subtrace  ) such that all smart contracts
in the set are executed at least once. To solve such a problem the encoding of the set of smart contracts
in LTL is the same as discussed for the standard consistency checking. However, the partial trace  
must be completed by adding indicator variables  to register the satisfaction of preconditions.
Example 8. Consider again the set of smart contracts discussed in Example 6 and the partial trace
 ={}, {}. The completion of   corresponds to the addition of the
indicator variable 1 in the last state, i.e.,  ={}{, 1}. The set of smart contracts
is consistent at runtime starting from  , and examples of completions of   are:
 1={}, {, 1}, {, ℎ, 2}, { }
 2={}, {, 1}, {}, {, , ℎ,
1, 2}, {,  }</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. SCRea: Smart Contracts Reasoner</title>
      <p>
        In this section we introduce the Smart Contracts Reasoner (SCRea) that works on smart contracts
encoded in LTL and exploits boolean satisfiability for solving the reasoning tasks introduced in the
previous section. The proposed reasoner is based on a SAT (boolean satisfiability) rewrite technique
that recalls the approach followed by (incremental) model checking methods for bounded LTL [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. The
conceptual architecture of SCRea is shown in Figure 1. The input to the system is the LTL formula
encoding a single smart contract or a group of smart contracts (see, Section 4).
      </p>
      <p>
        The first component is the Parser which constructs the parse tree ( ) associated with the input
formula  . Starting from the parse tree, the SAT rewriting technique rewrites  into an equivalent
propositional formula Φ, which is satisfiable if, and only if,  can be satisfied by a model of maximum
length . To verify if Φ, is satisfiable, the reasoner can use any existing SAT solver (e.g., Glucose
[
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]). In particular, ( ) is given as input to the Encoder module which produces a SAT translation of
the formula by initially considering a model length =1. Then, whenever no model of Φ is found,  is
doubled and the process is repeated until  exceeds the upper limit  given as input to the Encoder. If
the SAT solver finds a model  for a SAT formula Φ, , the Decoder module translates  into a trace 
(having length at most ) which satisfies  . Note that  is set by the user and could be less than the
minimum length of any model of  , so the reasoner acts as a correct, although not complete, solver.
      </p>
      <sec id="sec-5-1">
        <title>5.1. Encoder and Decoder Modules</title>
        <p>Given an LTL formula representing one or a set of smart contracts, for its SAT encoding a crucial
role is played by the parse tree of a formula ( ) = (, ,  ) that is a tree (, ) with a node labeling
function  :  → {∧, ∨, , , , , } ∪ {, ¬| ∈  } inductively defined as follows:
∙ For any literal  ∈ {, ¬} with  ∈  , () = ({}, ∅,  ) and  () = .
∙ If ( )=(, ,  ), with  ∈ {1, 2}, it is an analysis tree having as root the vertex  ∈  and if
 ∈ ∧, ∨ is a boolean connective or  =  then ( 1 2) = ({} ∪ 1 ∪ 2, {(, 1), (, 2)} ∪
1 ∪ 2,  ) is the analysis tree which has as roots the new node , with 1 and 2 as its two
children, and where  is such that  () =  and its restriction on  coincides with  .
∙ If ( ′)=( ′, ′,  ′) is an analysis tree having the root ′ and if  ∈ {, , ,  } is a time
operator, then (( ′))=({} ∪  ′, {(, ′)} ∪ ′,  ) is the tree rooted in the new node  whose
only child is ′ and where  is such that  ()= and its restriction on  ′ coincides with  .</p>
        <p>To explain the encoding approach used by the reasoner to construct Φ, , let us first note that, given
a trace  , each node  ∈  of the parse tree ( ) = (, ,  ) can easily be equipped with a set (,  )
of all time instants in which the sub-formula   associated with vertex  holds in  . In particular,
such sets can be computed by structural induction on the parse tree according to the semantics of the
diferent temporal operators. Then, the basic idea we use to construct the formula Φ, is to imitate
the construction of the sets (,  ). Formally, we first define the variables [0], ..., [ − 1] that will
be used to encode the last time instant of the model. Intuitively, Φ, will be defined in such a way
that there exists an index  ∈ {0, ...,  − 1}, such that [] evaluates true (respectively, false) whenever
 ≥  (respectively,  &lt; ). The instant  indicates the last time instant of a model of  – more formally,
whenever Φ, is satisfiable, there exists a model of  of length  ≤ . Then, we associate the variables
[0], ..., [ − 1] to each node  of ( ). Intuitively, [] is meant to check if the formula encoded in
the parse tree rooted at node  is satisfied at instant . In the following expressions, we use two additional
variables [− 1] and [], whose value will actually be a constant that will be fixed depending on the
type of node .</p>
        <p>Then, the SAT encoding is the formula Φ,</p>
        <p>= ⋀︀∈ (Φ ∧ [-1] ∧ [-1]) ∧ ⋀︀=− 02([] →
[ + 1]) ∧ ⋀︀=− 02([] → ⋀︀([] ↔ [ + 1])) and, for all  ∈  , Φ = [0] ↔ Φ0 ⋀︀=− 11(¬[-1] →
([] ↔ Φ)), where:
∙ if  () ∈ {, ¬}, then Φ = ⋀︀′∈, (′)≡¬  () ¬′[] ∧ ⋀︀′∈, (′)≡  () ′[];
∙ if  ()=∧ or  ()=∨, then Φ=1[] ()2[], where 1 and 2 are the right/left children of ;
∙ if  ()=, then Φ=′[ + 1] ∧ ¬[], where ′ is the child of  and [] is the constant false;
∙ if  ()= , then Φ=′[ − 1], where ′ is the child of  and [− 1] is the constant false;
∙ if  ()= , then Φ=′[] ∨ [ − 1], where ′ is the child of  and [− 1] is the constant false;
∙ if  ()=, then Φ=′[] ∧ [ − 1], where ′ is the child of  and [− 1] is the constant true;
∙ if  ()=, then Φ=(2[] ∧ 1[]) ∨ (1[] ∧ [ − 1]), where 1 and 2 are the left and right
children of  and [− 1] is the constant false.</p>
        <p>We note, for the sake of completeness, that Φ, is rewritten (in polynomial time) in conjunctive normal
form, before being passed to the solver. Moreover, by construction, it is possible to establish that Φ, is
satisfiable if, and only if,  can be satisfied by a model  with ( ) ≤ . When SCRea finds a model
 for a SAT formula Φ, , the decoder module is responsible for the building of the trace  that satisfies
the smart contract  . In particular, starting from  it is possible to construct the trace  satisfying  by
implementing the following steps: (i) If [] ∈  and there is no [] ∈  with  &lt;  then the decoder
constructs a trace  with  states; (ii) For every  such that  () =  and every  such that [] ∈ 
then the decoder adds  to  [].</p>
      </sec>
      <sec id="sec-5-2">
        <title>5.2. SCRea at runtime</title>
        <p>In this section we will discuss how the reasoner can be applied to solve reasoning problems at runtime.
To work at runtime it is necessary to slightly modify the architecture of SCRea. In particular, the
Encoder module must also receive in input the partial trace   which contains the events recorded on
the blockchain up to the current time instant. In this case, the parameter  concerns the additional
number of states (i.e., sets of events) that can happen after those already present in  . Moreover, if
SCRea is meant to work on a set of smart contracts   must be preprocessed to add indicator variables.
In this paper we proposed a framework, based on the encoding of smart contracts in Linear Temporal
Logic on finite traces, that enables various reasoning tasks on a single and on a set of smart contracts
running on the same blockchain. The proposed framework, called SCRea, is the first tool developed with
the aim of checking the consistency of a set of smart contracts that are supposed to cooperate in same
blockchain infrastructure and it is able to work at runtime on a running blockchain system. As a first line
for future research, we are planning to implement our framework on an existing blockchain infrastructure
to test its efectiveness on a real system. As a limitation of the proposed framework we want to point out
that LTL is based on a propositional logic and, thus, has some limitations in expressiveness. Therefor, a
second line for future research regards the extension of the proposed framework with a more powerful
logic such as first-order temporal logic that will increase SCRea’s expressive power.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Douglis</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stavrou</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2020</year>
          ).
          <article-title>Distributed Ledger Technologies</article-title>
          .
          <source>IEEE Internet Comput.</source>
          ,
          <volume>24</volume>
          (
          <issue>3</issue>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Idelberger</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Governatori</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Riveret</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sartor</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>Evaluation of Logic-Based Smart Contracts for Blockchain Systems</article-title>
          .
          <source>In Proc. of RuleML</source>
          , pp.
          <fpage>167</fpage>
          -
          <lpage>183</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Hu</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhong</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          (
          <year>2018</year>
          ).
          <article-title>A Method of Logic-Based Smart Contracts for Blockchain System</article-title>
          .
          <source>In Proc. of ICDPA</source>
          , pp.
          <fpage>58</fpage>
          -
          <lpage>61</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Stancu</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dragan</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2020</year>
          ).
          <article-title>Logic-Based Smart Contracts</article-title>
          .
          <source>In Proc. of WorldCIST</source>
          , pp.
          <fpage>387</fpage>
          -
          <lpage>394</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Nakamoto</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          (
          <year>2008</year>
          ).
          <article-title>Bitcoin: A peer-to-peer electronic cash system</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Wood</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>Ethereum: A secure decentralised generalised transaction ledger</article-title>
          .
          <source>Ethereum project yellow paper</source>
          ,
          <volume>151</volume>
          (
          <year>2014</year>
          ),
          <fpage>1</fpage>
          -
          <lpage>32</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Szabo</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          (
          <year>1997</year>
          ).
          <article-title>The idea of smart contracts</article-title>
          .
          <source>Nick Szabo's Papers and Concise Tutorials</source>
          ,
          <volume>6</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Dannen</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          (
          <year>2017</year>
          ).
          <source>Introducing Ethereum and Solidity</source>
          (p.
          <fpage>185</fpage>
          ). Berkeley: Apress.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Pnueli</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>1977</year>
          ).
          <article-title>The Temporal Logic of Programs</article-title>
          .
          <source>In Proc. of FOCS</source>
          , pp.
          <fpage>46</fpage>
          -
          <lpage>57</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Pnueli</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>1981</year>
          ).
          <article-title>The Temporal Semantics of Concurrent Programs</article-title>
          .
          <source>Theoretical Computer Science</source>
          ,
          <volume>13</volume>
          ,
          <fpage>45</fpage>
          -
          <lpage>60</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Calvanese</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>De Giacomo</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vardi</surname>
            ,
            <given-names>M. Y.</given-names>
          </string-name>
          (
          <year>2002</year>
          ).
          <article-title>Reasoning about actions and planning in ltl action theories</article-title>
          .
          <source>In Proc. of KR</source>
          , pp.
          <fpage>593</fpage>
          -
          <lpage>602</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Ding</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Smith</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Belta</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rus</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>Optimal Control of Markov Decision Processes With Linear Temporal Logic Constraints</article-title>
          .
          <source>IEEE Transactions on Automatic Control</source>
          ,
          <volume>59</volume>
          (
          <issue>5</issue>
          ),
          <fpage>1244</fpage>
          -
          <lpage>1257</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Fionda</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guzzo</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2020</year>
          ).
          <article-title>Control-Flow Modeling with Declare: Behavioral Properties, Computational Complexity, and Tools</article-title>
          .
          <source>IEEE Trans. Knowl</source>
          . Data Eng.,
          <volume>32</volume>
          (
          <issue>5</issue>
          ), pp.
          <fpage>898</fpage>
          -
          <lpage>911</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Chekol</surname>
            ,
            <given-names>M.W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fionda</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pirrò</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          (
          <year>2017</year>
          ).
          <article-title>Time Travel Queries in RDF Archives</article-title>
          .
          <source>In Proc. of MEPDaW</source>
          , pp.
          <fpage>28</fpage>
          -
          <lpage>42</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Fionda</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Greco</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          (
          <year>2018</year>
          ).
          <article-title>LTL on Finite and Process Traces: Complexity Results and a Practical Reasoner</article-title>
          .
          <source>J. Artif. Intell. Res., 63</source>
          , pp.
          <fpage>557</fpage>
          -
          <lpage>623</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Pesic</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bosnacki</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Van der Aalst</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          (
          <year>2010</year>
          ).
          <article-title>Enacting Declarative Languages Using LTL: Avoiding Errors and Improving Performance</article-title>
          .
          <source>In Proc. of SPIN</source>
          , pp.
          <fpage>146</fpage>
          -
          <lpage>161</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <surname>De Giacomo</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vardi</surname>
            ,
            <given-names>M. Y.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>Linear Temporal Logic and Linear Dynamic Logic on Finite Traces</article-title>
          .
          <source>In Proc. of IJCAI</source>
          , pp.
          <fpage>854</fpage>
          -
          <lpage>860</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Zhang,
          <string-name>
            <given-names>L.</given-names>
            ,
            <surname>Pu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Vardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. Y.</given-names>
            ,
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <surname>J.</surname>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>LTLf satisfiability checking</article-title>
          .
          <source>In Proc. of ECAI</source>
          , pp.
          <fpage>513</fpage>
          -
          <lpage>518</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Biere</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Heljanko</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Junttila</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Latvala</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Schuppan</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          (
          <year>2006</year>
          ).
          <article-title>Linear Encodings of Bounded LTL Model Checking</article-title>
          .
          <source>Logical Methods in Computer Science</source>
          ,
          <volume>2</volume>
          (
          <issue>5</issue>
          ),
          <fpage>1</fpage>
          -
          <lpage>64</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <surname>Audemard</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Simon</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          (
          <year>2009</year>
          ).
          <article-title>Predicting Learnt Clauses Quality in Modern SAT Solvers</article-title>
          .
          <source>In Proc. of IJCAI</source>
          , pp.
          <fpage>399</fpage>
          -
          <lpage>404</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>