<!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 />
    <article-meta>
      <title-group>
        <article-title>ChorChain: A Blockchain-Based Framework for Executing and Auditing BPMN Choreographies</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Flavio Corradini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessandro Marcelletti</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrea Morichetta</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrea Polini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Barbara Re</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Francesco Tiezzi</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Camerino</institution>
          ,
          <addr-line>Camerino</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Florence</institution>
          ,
          <addr-line>Florence</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <fpage>132</fpage>
      <lpage>136</lpage>
      <abstract>
        <p>Adopting the BPMN standard and, in particular, its choreography diagrams is promising to increase business possibilities. Their adoption in practice has been challenging and faced complex hurdles due to the lack of concrete support for the choreography execution, and the absence of distributed infrastructures allowing the involved participants to trust each other. To overcome these challenges, we propose ChorChain, a novel model-driven framework based on Blockchain technology. It supports the whole lifecycle of choreographies, from their modelling to their distributed execution and auditing. The feasibility and efectiveness of the framework are assessed through experiments conducted on the Rinkeby Ethereum Testnet.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;ChorChain</kwd>
        <kwd>BPMN</kwd>
        <kwd>Choreography</kwd>
        <kwd>Blockchain</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Nowadays, a prominent modelling language to describe distributed collaborative systems is
the BPMN standard [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. BPMN provides choreography diagrams, a flow-chart based notation
that permits to describe system interactions in terms of the exchange of messages from a global
perspective, without exposing the internal behaviour of the participants. Despite the wide
acceptance of BPMN from both industry and academia, in practice until now the usage of such
diagrams has been mainly confined to the design phase. Indeed, there is a lack of concrete
support for the other phases, in particular in relation to choreography execution. In addition,
the full adoption of choreography specifications for the engineering of distributed systems
has been hindered by the dificulty of ensuring trust among the distributed participants [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ],
which indeed will engage in cooperation only if they trust each other. We aim to address
the above issues by leveraging blockchain technology, as envisioned in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Blockchain is an
emerging technology for decentralised and transactional data sharing across a network of
untrusted participants. It guarantees the integrity and immutability of data without relying on
a central authority or any particular participant. Thus, blockchain enables the development
of new forms of distributed systems, where all participants have a clear view of the ongoing
system execution and can have tangible proof of the actions performed by the counterpart [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
In particular, in our choreography-based setting, blockchain technology is exploited to allow
choreography participants to achieve trust without a central authority, by enabling the auditing
of the choreography execution in a non-repudiable manner. In this way, for example, it can
be checked that a given participant has actually sent/received a given message as specified in
the choreography. The main challenges in relation to the development of choreography-based
distributed systems on top of the blockchain are: (i) the need to fill the gap between the
highlevel description given by the choreography, and the low-level one given by the code deployed
and executed on the blockchain, without annoying the end-user with convoluted technicalities;
and (ii) to support the whole life-cycle of choreographies.
      </p>
      <p>We face these challenges by providing a model-driven framework, called ChorChain, for
the development of trustable choreography-based systems. ChorChain exploits blockchain
technology, in particular Ethereum, as the base for executing BPMN choreographies. The
framework supports the full lifecycle of choreographies, from their modelling to their publishing
and instantiation, until their deployment and execution in the Ethereum blockchain. In particular,
ChorChain supports the automatic generation of smart contracts (i.e., programs to be run over
the blockchain), which is completely transparent to the final user, and the controlled execution
of the choreography, which allows only the sequence of actions prescribed by the specification.
The smart contract executed in the blockchain, indeed, is specifically generated to implement
the choreography workflow, thus forcing the correct behaviour of each participant. Moreover,
the smart contract generated by ChorChain can manage payments in Ether specified in the
choreography model. In addition, the guarantees on data stored in the blockchain allow the
auditing of exchanged messages during the choreography execution, without the need for a
monitoring infrastructure.</p>
    </sec>
    <sec id="sec-2">
      <title>2. ChorChain Innovations and Main Features</title>
      <p>
        ChorChain acts as a Business Process Management System for tamper-proof choreographies
execution, diferentiating from approaches available in the literature with similar objectives
(e.g., those introduced in [
        <xref ref-type="bibr" rid="ref5 ref6">5, 6</xref>
        ]). In particular, diferences relate to the modelling abstraction
adopted (i.e., choreographies, neither processes nor collaborations), the usability of the resulting
tool, and the comprehensive functionalities covering the whole choreography lifecycle.
      </p>
      <p>ChorChain is accessible via web browser and the main phases with their features are
synthesised below. When entering the tool, it is necessary to register and login. To ease access to
the platform, the user can exploit the Metamask browser plugin (https://metamask.io/), which
provides a web interface for managing Ethereum accounts. The account selected in Metamask
then constitutes the identifier of the participant during the ChorChain usage.
Modelling. The modelling phase is the starting point of the choreography lifecycle. To support
it, ChorChain integrates the modelling environment chor-js (https://github.com/bptlab/chor-js)
directly in the front end, which is based on AngularJS. The modelling area ofers several
functionalities, such as the creation, the import, the export and the saving of a model in the
ChorChain repository. To derive a blockchain-based infrastructure, supporting a
choreographybased system at run-time, ChorChain provides a panel where the user can specify a list of
parameters for the exchanged messages and data; this information is included in the .bpmn file
and is completely portable and compatible with other modellers.</p>
      <p>Publishing, Instantiation and Subscription. After the model is saved inside the ChorChain
repository, it is accessible in a dedicated page via an intuitive user interface. Here the user
can generate a new instance for a specific model generated by him/her or by other users.
During the instantiation, it is possible to select optional roles and limit the visibility to selected
parties. Once created, the choreography instance will be kept in a “suspended” state while
waiting for all mandatory roles to subscribe. The subscription is done by selecting the role to
cover in the choreography. This will automatically associate the user’s Ethereum account to
the role identifying him/her also in the smart contract. When a choreography instance has
no more vacant mandatory roles, ChorChain considers the partnership complete and starts
the generation of the Solidity smart contract. After the generation, the contract is deployed
automatically on the blockchain.</p>
      <p>Execution. In order to enable the participants interaction, ChorChain provides an execution
page accessible to each participant (see Fig. 1). The execution page shows the current state of
the execution and the active actions with the respective forms that are dynamically constructed
for executing them. Notably, the execution form is visible only to the participant in charge of
performing such activity. ChorChain also provides the automatic execution via REST API to
permit the interactions by external services.</p>
      <p>Auditing. The proposed auditing strategy provided by ChorChain is choreography-centric,
as it relies on the retrieval of information related to a choreography model and in relation to
the execution of possible instances (see Fig. 2). The objective is to enable the assessment of
constraints related to data exchanged by the participants in a choreography instance, as well as
time and gas-related aspects with respect to a choreography instance execution. The combined
usage of enforcement and auditing mechanisms can highly increase accountability and trust
in a multi-organisational interaction context. ChorChain provides three main auditing pages:
(i) general auditing, (ii) personal auditing and (iii) querying auditing. In the first case, it is
possible to retrieve information for all the choreographies deployed in the blockchain, in the
second the system will show a focus just on the instances in which the user requesting the
auditing is involved, and the last one is for expert users and permits the definition and execution
of custom queries based on the GraphQL language.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Evaluation of ChorChain</title>
      <p>
        The ChorChain tool was evaluated and reviewed under diferent aspects. In particular, we
tested ChorChain using diferent approaches and case studies based on real worlds scenarios.
For each case study, the related choreography was executed using the ChorChain tool in the
Ethereum Rinkeby testnet, generating a complete track of the performed operations. We used
a total of 4 diferent case studies that we synthesise below with their description, the links to
their execution inside the blockchain and the pointers to additional information.
Online Purchase1: it describes the process of acquiring goods between a buyer and a seller.
The process handles the ofer for a good, the payment and the final shipment to the buyer [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
Bike Rental2: it describes a rental process involving a customer, requesting a bike, a bike center,
ofering diferent rent possibilities, and an optional insurer providing insurance policies in
conjunction with the bike rental [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        Supply Chain3: it describes the message exchange of a supply chain. Specifically, a bulk buyer
starts by placing an order with the manufacturer, who orders the materials from a middleman.
The latter then forwards the request to a supplier and arranges also the transportation by means
of a special carrier [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        Incident Management4: it describes the processing of a help request by a customer made to a
1https://rinkeby.etherscan.io/address/0x251d5c389f9ab2b5ac705fd26b71ecfb167e5ed6
2https://bit.ly/Shortest_Path and https://bit.ly/Longest_Path
3https://bit.ly/Sup_Chain
4https://bit.ly/IncidentMan
software manufacturer. The key account manager tries to handle the request and, in the negative
case, forwards this issue to diferent support agents, until to reach the software developer for
receiving a solution [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        ChorChain was evaluated by using 30 synthetically generated choreographies. The
experiments were conducted on models to measure the efectiveness of the approach by isolating and
executing all the BPMN choreography elements supported. Specifically, each model was tested
with a growing number of elements in order to capture the incremental trend of costs [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In
such experiments, we observed that each new message added to the model costs on average
around 123,000 units of gas in the deployment. Each pair of gateways, consisting of a split and a
join, impacts around 108,000 units of gas and the transactions range from a minimum of 201,000
to a maximum of 582,000 units of gas.
      </p>
      <p>
        Finally, ChorChain usability was assessed by experiments involving students at the University
of Camerino at the 1st year of the MSc in Computer Science. All of the 12 participants have got
a BSc degree in Computer Science and have taken two semester courses at master level about
business process modelling and enterprise software infrastructure. We provided a scenario
referring to an Internship process flow in which a company, the university ofice and a student
interact in order to publish, select, assign and complete a given internship. ChorChain obtained
quite good results in the integration and usage; the interested reader can see the details in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
    </sec>
    <sec id="sec-4">
      <title>4. Screencast and Website</title>
      <p>The ChorChain tool, as well as its source code, examples and tutorial document are
available at http://pros.unicam.it/chorchain/, while a screencast is available at https://youtu.be/
_RV7r9xbx9w. In particular, the screencast shows a typical scenario where the user models,
deploys, executes and audits a bike rental scenario. ChorChain can be redistributed and/or
modified under the terms of the MIT License.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>F.</given-names>
            <surname>Corradini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Morichetta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Polini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Re</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Tiezzi</surname>
          </string-name>
          ,
          <article-title>Collaboration vs</article-title>
          .
          <source>choreography conformance in BPMN 2</source>
          .
          <article-title>0: From theory to practice</article-title>
          , in: EDOC, IEEE,
          <year>2018</year>
          , pp.
          <fpage>95</fpage>
          -
          <lpage>104</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Gemino</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wand</surname>
          </string-name>
          ,
          <article-title>Complexity and clarity in conceptual modeling: comparison of mandatory and optional properties</article-title>
          ,
          <source>Data &amp; Knowledge Engineering</source>
          <volume>55</volume>
          (
          <year>2005</year>
          )
          <fpage>301</fpage>
          -
          <lpage>326</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F.</given-names>
            <surname>Corradini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Marcelletti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Morichetta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Polini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Re</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Tiezzi</surname>
          </string-name>
          ,
          <article-title>Engineering trustable choreography-based systems using blockchain</article-title>
          , in: SAC, ACM,
          <year>2020</year>
          , pp.
          <fpage>1470</fpage>
          -
          <lpage>1479</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Mendling</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            <surname>Weber</surname>
          </string-name>
          , et al.,
          <article-title>Blockchains for business process management - challenges and opportunities</article-title>
          ,
          <source>ACM Transactions on Management Information Systems</source>
          <volume>9</volume>
          (
          <year>2018</year>
          )
          <fpage>1</fpage>
          -
          <lpage>16</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Carminati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Rondanini</surname>
          </string-name>
          , E. Ferrari,
          <article-title>Confidential business process execution on blockchain</article-title>
          , in: Web Services, IEEE,
          <year>2018</year>
          , pp.
          <fpage>58</fpage>
          -
          <lpage>65</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.</given-names>
            <surname>García-Bañuelos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ponomarev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dumas</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Weber</surname>
          </string-name>
          ,
          <article-title>Optimized execution of business processes on blockchain</article-title>
          ,
          <source>in: Business Process Management</source>
          , volume
          <volume>10445</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2017</year>
          , pp.
          <fpage>130</fpage>
          -
          <lpage>146</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>F.</given-names>
            <surname>Corradini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Marcelletti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Morichetta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Polini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Re</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Tiezzi</surname>
          </string-name>
          ,
          <article-title>Engineering trustable and auditable choreography-based systems using blockchain</article-title>
          ,
          <source>ACM Transactions on Management Information Systems</source>
          <volume>13</volume>
          (
          <year>2022</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>