# MDA-Based Approach for Blockchain Smart Contract Development
## 5 Discussion and Conclusions  
The paper presents an MDA-based method for smart contract development (MDAsmartCD) which, when compared to other MDA-based methods, covers the complete set of MDA proposed models, uses Unified Modeling Language (UML) through all the models; utilises not only smart contract structure definition but also behaviour specification using a state machine, interaction specification, and opaqueBehavior code embeddings; and produces smart contract code for two implementation platforms. The model-driven development principles prominent in the proposed method support requirement specification, design, and code production activities, thus placing a heavier focus on earlier development phases than straight-up implementation. In MDAsmartCD, the Blockchain CIM, PIM, and PSM definitions are based on the UML, and transitions between different abstraction levels are automated by model-to-model transformations. The transformation from Blockchain PIM to Blockchain PSM is fully automated and capable of producing a model that not only directly maps the Blockchain PIM defined elements with implementation platform concepts, but also appends additional elements based on the specified behaviour or the implementation platform specifics. In order to produce a more comprehensive smart contract, the definition of models requires manual extensions by the developer, as is the case of Blockchain PIM definition, but moving forward, the transformations from the Blockchain PIM to two different Blockchain PSMs, and ultimately to two different implementation languages, are capable of producing smart contract code with little to no developer intervention. Code generation using model-to-text transformation is fully automated and can be used to generate compilable and executable code ready for deployment on Ethereum and Hyperledger Fabric blockchains. As demonstrated by the experiment, when following the same workflow scenario, the deployed smart contracts behave identically and record analogous results in blockchain data storage. While the presented model-driven development approach can automate the design and implementation of smart contracts, the method and its evaluation have several limitations. The application of the method was demonstrated by creating _HackChain_, a hackathon certificate issuing solution; still, the method implementation could additionally undergo a usability study as the method requires additional efforts in terms of model specification. The evaluation of generated code is also limited, as a single static code analysis tool cannot be used for analysis of both smart contracts. Although the Slither tool performs an extensive analysis, it only supports the Solidity programming language. For that reason, an additional static code analysis was performed for Go chaincode using the HFCCT tool, which is capable of analysing Go chaincode but detects only a limited set of common types of vulnerabilities and issues. Although the process of modelling is not as straightforward as implementation, it allows the development of a generic model that can be used to generate multiple platform-specific models. Furthermore, smart contract model specification at different abstraction layers also encourages the developer to validate the smart contract design at several key points in the development process, thus facilitating the development of more robust smart contracts. Modelling also encourages the reusability of models not only when the blockchain technology is updated but allows development to pivot to an entirely different platform if it is supported by the method. The multiplatform aspect was demonstrated using two different platforms, but the set of platforms can be extended further following the guidelines provided by the method. Currently, the scope of the MDAsmartCD method deals with the smart contract code production starting from requirement specification, design, and proceeding to the implementation, but it can be extended to cover even more development phases.