Smart Contract Design Pattern for Processing Logically Coherent Transaction Types

被引:6
作者
Gorski, Tomasz [1 ]
机构
[1] Univ Gdansk, Inst Comp Sci, Wita Stwosza 57, PL-80308 Gdansk, Poland
来源
APPLIED SCIENCES-BASEL | 2024年 / 14卷 / 06期
关键词
blockchain; smart contract; object-oriented programming; functional programming; design pattern; ARCHITECTURE;
D O I
10.3390/app14062224
中图分类号
O6 [化学];
学科分类号
0703 ;
摘要
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.
引用
收藏
页数:17
相关论文
共 45 条
  • [1] A formal verification approach for composite smart contracts security using FSM
    Almakhour, Mouhamad
    Sliman, Layth
    Samhat, Abed Ellatif
    Mellouk, Abdelhamid
    [J]. JOURNAL OF KING SAUD UNIVERSITY-COMPUTER AND INFORMATION SCIENCES, 2023, 35 (01) : 70 - 86
  • [2] A Three-Layered Approach for Designing Smart Contracts in Collaborative Processes
    Bagozi, Ada
    Bianchini, Devis
    De Antonellis, Valeria
    Garda, Massimiliano
    Melchiori, Michele
    [J]. ON THE MOVE TO MEANINGFUL INTERNET SYSTEMS: OTM 2019 CONFERENCES, 2019, 11877 : 440 - 457
  • [3] TABS: Transforming automatically BPMN models into blockchain smart contracts
    Bodorik, Peter
    Liu, Christian Gang
    Jutla, Dawn
    [J]. BLOCKCHAIN-RESEARCH AND APPLICATIONS, 2023, 4 (01):
  • [4] Standardizing Smart Contracts
    Capocasale, Vittorio
    Perboli, Guido
    [J]. IEEE ACCESS, 2022, 10 : 91203 - 91212
  • [5] Understanding Code Reuse in Smart Contracts
    Chen, Xiangping
    Liao, Peiyong
    Zhang, Yixin
    Huang, Yuan
    Zheng, Zibin
    [J]. 2021 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER 2021), 2021, : 470 - 479
  • [6] A survey on smart contract vulnerabilities: Data sources, detection and repair
    Chu, Hanting
    Zhang, Pengcheng
    Dong, Hai
    Xiao, Yan
    Ji, Shunhui
    Li, Wenrui
    [J]. INFORMATION AND SOFTWARE TECHNOLOGY, 2023, 159
  • [7] ethereum, Upgrading smart contracts
  • [8] Gamma E., 1995, DESIGN PATTERNS ELEM, Vfirst
  • [9] A Recommender System for Robust Smart Contract Template Classification
    Gec, Sandi
    Stankovski, Vlado
    Lavbic, Dejan
    Kochovski, Petar
    [J]. SENSORS, 2023, 23 (02)
  • [10] github, AdapT v2.0 Smart Contract Design Pattern, GitHub Repository