# MDA-Based Approach for Blockchain Smart Contract Development
## 1 Introduction
This approach is called Model-Driven Architecture (MDA) [13], which defines guidelines for the development of Computation-Independent Model (CIM), Platform-Independent Model (PIM), and Platform-Specific Model (PSM), which can further be used for generating code for the implementation platform of choice. The application of MDA principles in smart contract development can help solve the issues related to rapid technology change, emerging new platforms and technologies, and the need to verify the smart contract solution before its deployment [5; 12; 14]. Although smart contract development using modelling is a relatively new field and there is no unified approach, several proposals on model-driven smart contract development have been outlined [11; 12; 15; 16]. Additionally, MDA is also used as a basis for several proposed smart contract development processes [17; 18; 19; 20], but these proposals are in conceptual stages, and most of them do not fully employ MDA techniques, such as model-to-model transformations, and are mainly tailored for one implementation platform. Therefore, in this paper, we propose an MDA-based method, MDAsmartCD (MDA-based Smart Contract Development). The presented method is a continuation of the research described in [21; 22], where we proposed algorithms for different types of model transformations: code generation from Unified Modeling Language (UML) sequence diagrams to Hyperledger Go [21], and transformations from PIM (encompassing UML state machine diagrams for behaviour description) to Ethereum PSM and afterwards to Solidity code [22]. The proposed MDAsmartCD method supports the complete MDA life cycle (encompassing the revised versions of previously proposed algorithms) and demonstrates the application of specification reusability by supporting two different implementation platforms. The aim of this paper is to demonstrate how the application of the MDA-based method can be used to automate the development of smart contracts. The proposed method covers the definition of CIM, PIM, two instances of PSM, and model transformations (model-to-model and model-to-text) for producing smart contract code in the Hyperledger Fabric platform Go and the Ethereum platform Solidity languages. The main novelty of our method is the support of requirement and design phases of smart contract development, ultimately resulting in a generated smart contract code that can be used during implementation. MDAsmartCD also supports multiple platforms, which was demonstrated using Hyperledger Fabric and Ethereum, but the set of supported platforms can further be extended following the method principles. The method was applied by implementing the business process of issuing hackathon certificates in smart contracts for both the Hyperledger Fabric and Ethereum blockchain platforms. The rest of the paper is structured as follows. The second section overviews the related work in terms of model-driven approaches for blockchain-based solutions and smart contract development, placing a heavier emphasis on MDA-based approaches. The third section presents the proposed MDA-based method, consisting of UML metamodel extensions and proposed model definition and transformation activities. The fourth section presents the application of the proposed approach for a certificate issuing in the context of a hackathon organisation and outlines the results of proposed transformations, as well as the produced smart contract execution results. The results of the application of the approach, its advantages, and its limitations are discussed in the fifth section.