Abstract
Smart contracts (SCs) are software systems that monitor and partially control the execution of legal contracts to ensure compliance with the contracts’ terms and conditions, which essentially are sets of obligations and powers, triggered by events. Such systems often exploit Internet-of-Things technologies to support their monitoring functions and blockchain technology to ensure the integrity of their data. Enterprise-level blockchain platforms (such as Hyperledger Fabric) and public ones (such as Ethereum) are popular choices for SC development. However, usually, legal experts are not able to directly encode contract requirements into SCs. Symboleo is a formal specification language for legal contracts that was introduced to address this issue. Symboleo uses an ontology that defines legal concepts such as parties, obligations, powers, and assets, with semantics expressed with state machines. This paper proposes a tool that automatically translates Symboleo specifications into smart contract code for Hyperledger Fabric. Towards this end, we have extended the current Symboleo IDE, implemented the ontology and semantics by using the modelling language Umple, and created a reusable library. The resulting Symboleo2SC tool generates Hyperledger Fabric code exploiting this library. This code is a complete translation and does not require further development. Symboleo2SC was evaluated with five sample contracts. These were converted to SCs for contract monitoring and control purposes. Symboleo2SC helps simplify the SC development process, saves development effort, and helps reduce risks of coding errors.
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-024-01187-9/MediaObjects/10270_2024_1187_Fig1_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-024-01187-9/MediaObjects/10270_2024_1187_Fig2_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-024-01187-9/MediaObjects/10270_2024_1187_Fig3_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-024-01187-9/MediaObjects/10270_2024_1187_Fig4_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-024-01187-9/MediaObjects/10270_2024_1187_Fig5_HTML.png)
Similar content being viewed by others
Notes
Autonomy Through Cyberjustice Technologies (ACT) project 2021–2026, https://www.ajcact.org/en/.
First Workshop on Frontiers of Digital Enforceable Contracts (FDEC) online, JURIX 2020, https://www.ajcact.org/en/2020/12/03/fdec-2020-appel-a-presentations/.
D. Amyot: From Legal Contracts to Smart Contracts using Symboleo. Law, Society & AI Seminar HEC Paris, France, 2022, https://lawsocietyandai.wp.imt.fr/event/from-legal-contracts-to-smart-contracts-using-symboleo/.
References
Abbas, M., Rashid, M., Azam, F., Rasheed, Y., Anwar, M.W., Humdani, M.: A model-driven framework for security labs using blockchain methodology. In: 2021 IEEE International Systems Conference (SysCon), pp. 1–7. IEEE, USA (2021). https://doi.org/10.1109/SysCon48628.2021.9447125
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, pp. 1–15. ACM, USA (2018). https://doi.org/10.1145/3190508.3190538
Astigarraga, T., Chen, X., Chen, Y., Gu, J., Hull, R., Jiao, L., Li, Y., Novotny, P.: Empowering business-level blockchain users with a rules framework for smart contracts. In: Pahl, C., Vukovic, M., Yin, J., Yu, Q. (eds.) Service-Oriented Computing, pp. 111–128. Springer, Berlin (2018). https://doi.org/10.1007/978-3-030-03596-9_8
Baquero, P., Restrepo Amariles, D., Amyot, D.: Addressing the compliance gap in data supply chains: Smart contracts as a compliance technology. Law & Society Annual Meeting, virtual, Chicago, USA (2021). https://www.lawandsociety.org/wp-content/uploads/2021/05/Program-Book-2021.pdf
Bettini, L.: Implementing Domain Specific Languages with Xtext and Xtend, 2nd edn. Packt Publishing (2016)
Crawford, S.E.S., Ostrom, E.: A grammar of institutions. Am. Polit. Sci. Rev. 89(3), 582–600 (1995). https://doi.org/10.2307/2082975
Curty, S., Härer, F., Fill, H.G.: Design of blockchain-based applications using model-driven engineering and low-code/no-code platforms: a structured literature review. Softw. Syst. Model. 1–39 (2023). https://doi.org/10.1007/s10270-023-01109-1
Dwivedi, V., Norta, A.: Auto-generation of smart contracts from a domain-specific XML-based language. In: Satapathy, S.C., Peer, P., Tang, J., Bhateja, V., Ghosh, A. (eds.) Intelligent Data Engineering and Analytics, pp. 549–564. Springer, Singapore (2022). https://doi.org/10.1007/978-981-16-6624-7_54
Feldt, R., Magazinius, A.: Validity threats in empirical software engineering research-an initial survey. In: Proceedings of the 22nd International Conference on Software Engineering & Knowledge Engineering (SEKE’2010), pp. 374–379. Knowledge Systems Institute Graduate School (2010). http://www.robertfeldt.net/publications/feldt_2010_validity_threats_in_ese_initial_survey.pdf
Frantz, C.K., Nowostawski, M.: From institutions to code: Towards automated generation of smart contracts. In: 2016 IEEE 1st International Workshops on Foundations and Applications of Self* Systems (FAS*W), pp. 210–215. IEEE, USA (2016).https://doi.org/10.1109/FAS-W.2016.53
Gao, Z., Jiang, L., **a, X., Lo, D., Grundy, J.: Checking smart contracts with structural code embedding. IEEE Trans. Softw. Eng. 47(12), 2874–2891 (2021). https://doi.org/10.1109/TSE.2020.2971482
Griffo, C., Almeida, J.P.A., Guizzardi, G.: Conceptual modeling of legal relations. In: Trujillo, J.C., Davis, K.C., Du, X., Li, Z., Ling, T.W., Li, G., Lee, M.L. (eds.) Conceptual Modeling, pp. 169–183. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-00847-5_14
Gruber, T.R.: A translation approach to portable ontology specifications. Knowl. Acquis. 5(2), 199–220 (1993). https://doi.org/10.1006/knac.1993.1008
Hamdaqa, M., Met, L.A.P., Qasse, I.: iContractML 2.0: A domain-specific language for modeling and deploying smart contracts onto multiple blockchain platforms. Inf. Softw. Technol. 144, 106762 (2022). https://doi.org/10.1016/j.infsof.2021.106762
Heimbach, L., Wattenhofer, R.: Sok: Preventing transaction reordering manipulations in decentralized finance (2022). https://doi.org/10.48550/ARXIV.2203.11520
Jurgelaitis, M., Drungilas, V., Čeponienė, L., Vaičiukynas, E., Butkienė, R., Čeponis, J.: Smart contract code generation from platform specific model for Hyperledger Go. In: Rocha, Á., Adeli, H., Dzemyda, G., Moreira, F., Ramalho Correia, A.M. (eds.) Trends and Applications in Information Systems and Technologies, pp. 63–73. Springer, Berlin (2021). https://doi.org/10.1007/978-3-030-72654-6_7
Khan, S.N., Loukil, F., Ghedira-Guegan, C., Benkhelifa, E., Bani-Hani, A.: Blockchain smart contracts: applications, challenges, and future trends. Peer-to-peer Network. Appl. 14(5), 2901–2925 (2021). https://doi.org/10.1007/s12083-021-01127-0
Lethbridge, T.C., Forward, A., Badreddin, O., Brestovansky, D., Garzon, M., Aljamaan, H., Eid, S., Husseini Orabi, A., Husseini Orabi, M., Abdelzad, V., Adesina, O., Alghamdi, A., Algablan, A., Zakariapour, A.: Umple: model-driven development for open source and education. Sci. Comput. Program. 208, 102665 (2021). https://doi.org/10.1016/j.scico.2021.102665
López-Pintado, O., García-Bañuelos, L., Dumas, M., Weber, I., Ponomarev, A.: Caterpillar: a business process execution engine on the Ethereum blockchain. Softw. Pract. Exp. 49, 1162–1193 (2019). https://doi.org/10.1002/spe.2702
López-Pintado, O., Dumas, M., García-Bañuelos, L., Weber, I.: Interpreted execution of business process models on blockchain. In: 2019 IEEE 23rd International Enterprise Distributed Object Computing Conference (EDOC), pp. 206–215. IEEE, USA (2019). https://doi.org/10.1109/EDOC.2019.00033
Mao, D., Wang, F., Wang, Y., Hao, Z.: Visual and user-defined smart contract designing system based on automatic coding. IEEE Access 7, 73131–73143 (2019). https://doi.org/10.1109/ACCESS.2019.2920776
Mavridou, A., Laszka, A.: Designing secure Ethereum smart contracts: a finite state machine based approach. In: Meiklejohn, S., Sako, K. (eds.) Financial Cryptography and Data Security, pp. 523–540. Springer, Berlin (2018). https://doi.org/10.1007/978-3-662-58387-6_28
Mavridou, A., Laszka, A., Stachtiari, E., Dubey, A.: Verisolid: correct-by-design smart contracts for Ethereum. In: Goldberg, I., Moore, T. (eds.) Financial Cryptography and Data Security, pp. 446–465. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32101-7_27
Mizzi, A., Ellul, J., Pace, G.J.: Macroprogramming the blockchain of things. In: 2018 IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), pp. 1673–1678. IEEE, USA (2018). https://doi.org/10.1109/Cybermatics_2018.2018.00279
Mizzi, A., Ellul, J., Pace, G.J.: Porthos: macroprogramming blockchain systems. In: 2019 10th IFIP International Conference on New Technologies, Mobility and Security (NTMS), pp. 1–5. IEEE, USA (2019).https://doi.org/10.1109/NTMS.2019.8763784
Nakamoto, S.: Bitcoin: a peer-to-peer electronic cash system (2008). http://bitcoin.org/bitcoin.pdf
Parvizimosaed, A.: Symboleo: specification and verification of legal contracts. Ph.D. thesis, University of Ottawa, Canada (2022). https://doi.org/10.20381/ruor-28399
Parvizimosaed, A., Roveri, M., Rasti, A., Amyot, D., Logrippo, L., Mylopoulos, J.: Model-checking legal contracts with SymboleoPC. In: Proceedings of the 25th International Conference on Model Driven Engineering Languages and Systems, MODELS’22, pp. 278–288. ACM, New York (2022). https://doi.org/10.1145/3550355.3552449
Parvizimosaed, A., Sharifi, S., Amyot, D., Logrippo, L., Mylopoulos, J.: Subcontracting, assignment, and substitution for legal contracts in Symboleo. In: Dobbie, G., Frank, U., Kappel, G., Liddle, S.W., Mayr, H.C. (eds.) Conceptual Modeling, pp. 271–285. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-62522-1_20
Parvizimosaed, A., Sharifi, S., Amyot, D., Logrippo, L., Roveri, M., Rasti, A., Roudak, A., Mylopoulos, J.: Specification and analysis of legal contracts with Symboleo. Softw. Syst. Model. 21(6), 2395–2427 (2022). https://doi.org/10.1007/s10270-022-01053-6
Rasti, A.: From Symboleo to smart contracts: a code generator. Master’s thesis, University of Ottawa, Canada (2022). https://doi.org/10.20381/ruor-28394
Rasti, A., Amyot, D., Parvizimosaed, A., Roveri, M., Logrippo, L., Anda, A.A., Mylopoulos, J.: Symboleo2SC: From legal contract specifications to smart contracts. In: Proceedings of the 25th International Conference on Model Driven Engineering Languages and Systems, MODELS’22, pp. 300–310. ACM, New York (2022). https://doi.org/10.1145/3550355.3552407
Rasti, A., Anda, A.A., Alfuhaid, S., Parvizimosaed, A., Amyot, D., Roveri, M., Logrippo, L., Mylopoulos, J.: Supplementary material: automated generation of smart contract code from legal contract specifications with Symboleo2SC (2023). https://doi.org/10.5281/zenodo.7897970
Reyna, A., Martín, C., Chen, J., Soler, E., Díaz, M.: On blockchain and its integration with IoT. Challenges and opportunities. Future Gener. Comput. Syst. 88, 173–190 (2018). https://doi.org/10.1016/j.future.2018.05.046
Sánchez-Gómez, N., Torres-Valderrama, J., García-García, J., Gutiérrez, J.J., Escalona, M.: Model-based software design and testing in blockchain smart contracts: a systematic literature review. IEEE Access 8, 164556–164569 (2020). https://doi.org/10.1109/ACCESS.2020.3021502
Shanahan, M.: The event calculus explained. In: Artificial Intelligence Today, pp. 409–430. Springer, Berlin (1999). https://doi.org/10.1007/3-540-48317-9_17
Sharifi, S., Parvizimosaed, A., Amyot, D., Logrippo, L., Mylopoulos, J.: Symboleo: towards a specification language for legal contracts. In: 2020 IEEE 28th International Requirements Engineering Conference (RE), pp. 364–369. IEEE, USA (2020).https://doi.org/10.1109/RE48521.2020.00049
Sharifi, S.S.: Smart contracts: from formal specification to blockchain code. Master’s thesis, University of Ottawa, Canada (2020). https://doi.org/10.20381/ruor-25092
Skotnica, M., Klicpera, J.A., Pergl, R.: Towards model-driven smart contract systems—code generation and improving expressivity of smart contract modeling. In: CIAO! Doctoral Consortium, EEWC Forum 2020, pp. 1–15 (2020). http://ceur-ws.org/Vol-2825/paper1.pdf
Solidity Team: Solidity (2023). https://soliditylang.org/
Szabo, N.: Smart contracts: building blocks for digital markets. EXTROPY J. Transhumanist Thought 16(1), 50–53 (1996). https://archive.org/details/extropy-16/page/50/mode/1up?view=theater
Tateishi, T., Yoshihama, S., Sato, N., Saito, S.: Automatic smart contract generation using controlled natural language and template. IBM J. Res. Dev. 63(2/3), 6:1-6:12 (2019). https://doi.org/10.1147/JRD.2019.2900643
Tran, A.B., Lu, Q., Weber, I.: Lorikeet: a model-driven engineering tool for blockchain-based business process execution and asset management. In: BPM 2018 Dissertation Award, Demonstration, and Industrial Track, pp. 56–60 (2018). http://ceur-ws.org/Vol-2196/BPM_2018_paper_12.pdf
Tran, A.B., Xu, X., Weber, I., Staples, M., Rimba, P.: Regerator: a registry generator for blockchain. In: CAiSE-Forum-DC, pp. 81–88 (2017). http://ceur-ws.org/Vol-1848/CAiSE2017_Forum_Paper11.pdf
Uschold, M., Gruninger, M.: Ontologies: principles, methods and applications. Knowl. Eng. Rev. 11(2), 93–136 (1996). https://doi.org/10.1017/S0269888900007797
Wood, G.: Ethereum: a secure decentralised generalised transaction ledger. Ethereum Project Yellow Paper 151(2014), 1–32 (2014). https://gavwood.com/paper.pdf
Wöhrer, M., Zdun, U.: Domain specific language for smart contract development. In: 2020 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), pp. 1–9. IEEE, USA (2020). https://doi.org/10.1109/ICBC48266.2020.9169399
Zheng, Z., **e, S., Dai, H.N., Chen, W., Chen, X., Weng, J., Imran, M.: An overview on smart contracts: challenges, advances and platforms. Futur. Gener. Comput. Syst. 105, 475–491 (2020). https://doi.org/10.1016/j.future.2019.12.019
Zhu, Y., Song, W., Wang, D., Ma, D., Chu, W.C.C.: TA-SPESC: toward asset-driven smart contract language supporting ownership transaction and rule-based generation on blockchain. IEEE Trans. Reliab. 70(3), 1255–1270 (2021). https://doi.org/10.1109/TR.2021.3054617
Acknowledgements
This work was partially funded by an NSERC Strategic Partnership Grant titled Middleware Framework and Programming Infrastructure for IoT Services, by SSHRC’s Partnership Grant Autonomy Through Cyberjustice Technologies, and by the ORF-RE project CyPreSS: Software Techniques for the Engineering of Cyber-Physical Systems. S. Alfuhaid is supported by the KSA King AbdulAziz University. M. Roveri is partially supported by the PNRR project FAIR—Future AI Research (PE00000013), under the NRRP MUR program funded by the NextGenerationEU, by the project MUR PRIN 2020—RIPER—Resilient AI-Based Self-Programming and Strategic Reasoning—CUP E63C22000400001, and by the European Union under Horizon Europe Programme—Grant Agreement 101070537—CrossCon. We are also thankful to the anonymous reviewers for their constructive and useful comments.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by N. Bencomo, M. Wimmer, H. Sahraoui, and E. Syriani.
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Rasti, A., Anda, A.A., Alfuhaid, S. et al. Automated generation of smart contract code from legal contract specifications with Symboleo2SC. Softw Syst Model (2024). https://doi.org/10.1007/s10270-024-01187-9
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10270-024-01187-9