Smart Contract Design Pattern for Processing Logically Coherent Transaction Types
Source abstract
Abstract
Recent research shows that the source code of smart contracts is often cloned. The processing of related types of transactions in blockchain networks results in the implementation of many similar smart contracts. The rules verifying transactions are therefore duplicated many times. The article introduces the AdapT v2.0 smart contract design pattern. The design pattern employs a distinct configuration for each transaction type, and verification rule objects are shared among configurations. The redundancy of logical conditions was eliminated at two levels. Firstly, it is possible to combine similar smart contracts into one. Secondly, a configuration in a smart contract reuses verification rule objects at runtime. As a result, only one object is instantiated for each verification rule. It allows for the effective use of operating memory by the smart contract. The article presents the implementation of the pattern using object-oriented and functional programming mechanisms. Applying the pattern ensures the self-adaptability of a smart contract to any number of transaction types. The performance tests were carried out for various numbers of verification rules in a smart contract and a different number of checked transactions. The obtained evaluation time of 10,000,000 transactions is less than 0.25 s.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Blockchain Technology Applications and Security
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
Institute of Computer Science, University of Gdańsk, Wita Stwosza 57, 80-308 Gdańsk, Poland
References (45)
Show source-provided references
1. An overview on smart contracts: Challenges, advances and platforms10.1016/j.future.2019.12.019 ↗
2. A Review on Recent Progress of Smart Contract in Blockchain10.1109/ACCESS.2022.3174052 ↗
3. Challenges and Common Solutions in Smart Contract Development10.1109/TSE.2021.3116808 ↗
4. Gamma, E., Helm, R., Johnson, R., and Vlissides, J. (1995). Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley Professional. [1st ed.].
5. Blockchain software patterns for the design of decentralized applications: A systematic literature review10.1016/j.bcra.2022.100061 ↗
6. Parallel and Asynchronous Smart Contract Execution10.1109/TPDS.2021.3095234 ↗
7. Proxy smart contracts for zero trust architecture implementation in Decentralised Oracle Networks based applications10.1016/j.comcom.2023.04.022 ↗
8. Kim, K., Ryu, J., Lee, H., Lee, Y., and Won, D. (2023). Distributed and Federated Authentication Schemes Based on Updatable Smart Contracts. Electronics, 12.10.3390/electronics12051217 ↗
9. (2024, February 07). Upgrading Smart Contracts in Ethereum. Available online: https://ethereum.org/en/developers/docs/smart-contracts/upgrading/.
10. A survey on smart contract vulnerabilities: Data sources, detection and repair10.1016/j.infsof.2023.107221 ↗
11. Górski, T. (2022). Reconfigurable Smart Contracts for Renewable Energy Exchange with Re-Use of Verification Rules. Appl. Sci., 12.10.3390/app12115339 ↗
12. Smart Contract Development: Challenges and Opportunities10.1109/TSE.2019.2942301 ↗
13. A systematic literature review of blockchain and smart contract development: Techniques, tools, and open challenges10.1016/j.jss.2020.110891 ↗
14. Gas-expensive patterns detection to optimize smart contracts10.1016/j.asoc.2023.110542 ↗
15. Mandarino, V., Pappalardo, G., and Tramontana, E. (2022, January 16–18). Some Blockchain Design Patterns for Overcoming Immutability, Chain-Boundedness, and Gas Fees. Proceedings of the 3rd Asia Conference on Computers and Communications (ACCC), Shanghai, China.10.1109/ACCC58361.2022.00018 ↗
16. Elastic and cost-effective data carrier architecture for smart contract in blockchain10.1016/j.future.2019.05.042 ↗
17. Aroc: An Automatic Repair Framework for On-Chain Smart Contracts10.1109/TSE.2021.3123170 ↗
18. Gec, S., Stankovski, V., Lavbič, D., and Kochovski, P. (2023). A Recommender System for Robust Smart Contract Template Classification. Sensors, 23.10.3390/s23020639 ↗
19. Visual and User-Defined Smart Contract Designing System Based on Automatic Coding10.1109/ACCESS.2019.2920776 ↗
20. TABS: Transforming automatically BPMN models into blockchain smart contracts10.1016/j.bcra.2022.100115 ↗
21. Shen, X., Li, W., Xu, H., Wang, X., and Wang, Z. (2023). A Reuse-Oriented Visual Smart Contract Code Generator for Efficient Development of Complex Multi-Party Interaction Scenarios. Appl. Sci., 13.10.3390/app13148094 ↗
22. Solidity Code Generation From UML State Machines in Model-Driven Smart Contract Development10.1109/ACCESS.2022.3162227 ↗
23. Multiple access control scheme for EHRs combining edge computing with smart contracts10.1016/j.future.2021.11.002 ↗
24. Honari, K., Rouhani, S., Falak, N.E., Liu, Y., Li, Y., Liang, H., Dick, S., and Miller, J. (2023). Smart Contract Design in Distributed Energy Systems: A Systematic Review. Energies, 16.10.3390/en16124797 ↗
25. LoC—A new financial loan management system based on smart contracts10.1016/j.future.2019.05.040 ↗
26. Saim, M., Mamoon, M., Shah, I., and Samad, A. (2022, January 25–27). E-Voting via Upgradable Smart Contracts on Blockchain. Proceedings of the International Conference on Futuristic Technologies (INCOFT), Belgaum, India.10.1109/INCOFT55651.2022.10094482 ↗
27. Blockchain smart contracts for supply chain finance: Mapping the innovation potential in Australia-China beef supply chains
28. From Domain-Specific Language to Code: Smart Contracts and the Application of Design Patterns10.1109/MS.2020.2993470 ↗
29. Standardizing Smart Contracts10.1109/ACCESS.2022.3202550 ↗
30. Formal Verification of Blockchain Smart Contracts via ATL Model Checking10.1109/ACCESS.2022.3143145 ↗
31. A formal verification approach for composite smart contracts security using FSM
32. Enhancing Ethereum smart-contracts static analysis by computing a precise Control-Flow Graph of Ethereum bytecode10.1016/j.jss.2023.111653 ↗
33. Pierro, G.A., Tonelli, R., and Marchesi, M. (2020). An Organized Repository of Ethereum Smart Contracts’ Source Codes and Metrics. Future Internet, 12.10.3390/fi12110197 ↗
34. Chen, X., Liao, P., Zhang, Y., Huang, Y., and Zheng, Z. (2021, January 9–12). Understanding Code Reuse in Smart Contracts. Proceedings of the IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER), Honolulu, HI, USA.10.1109/SANER50967.2021.00050 ↗
35. Code Cloning in Smart Contracts on the Ethereum Platform: An Extended Replication Study10.1109/TSE.2022.3207428 ↗
36. Singh, I., and Lee, S.-W. (2021, January 20–24). Self-Adaptive Security for SLA Based Smart Contract. Proceedings of the IEEE 29th International Requirements Engineering Conference Workshops (REW), Notre Dame, IN, USA.10.1109/REW53955.2021.00069 ↗
37. Architectural View Model for an Integration Platform
38. Verification of Architectural Views Model 1+5 Applicability10.1007/978-3-030-45093-9_60 ↗
39. Modeling of Smart Contracts in Blockchain Solution for Renewable Energy Grid10.1007/978-3-030-45093-9_61 ↗
40. Panetto, H., Debruyne, C., Hepp, M., Lewis, D., Ardagna, C., and Meersman, R. (2019). On the Move to Meaningful Internet Systems: OTM 2019 Conferences, Springer. OTM 2019; Lecture Notes in Computer Science.10.1007/978-3-030-33246-4 ↗
41. Vionis, P., and Kotsilieris, T. (2024). The Potential of Blockchain Technology and Smart Contracts in the Energy Sector: A Review. Appl. Sci., 14.10.3390/app14010253 ↗
42. Integration Flows Modeling in the Context of Architectural Views10.1109/ACCESS.2023.3265210 ↗
43. (2024, January 29). AdapT v2.0 Smart Contract Design Pattern, GitHub Repository. Available online: https://github.com/drGorski/AdapT/releases/tag/v2.0.
44. (2024, February 07). Solana Network. Available online: https://solana.com.
45. Building Maintainable Software Using Abstraction Layering10.1109/TSE.2021.3119012 ↗