1 Introduction

Traditionally, through intermediaries, we have developed trust within our society. We often use third-party entities because we believe that they will store and protect our goods and send the correct amount to the right person when we require it. By diverting trust to decentralized systems, blockchain substitutes the need for intermediaries. Blockchain technology seeks to resolve this by allowing non-trusting participants without the intervention of a trustworthy third party to reach a consensus on their transactions and communications. It is possible to understand blockchain as a distributed ledger that preserves the record of all transactions that have ever taken place in the blockchain network. The foundational advancement behind the first decentralized e-payment system, Bitcoin, is blockchain. Beyond financial apps, blockchain has grown to support a range of decentralized applications. Many of these implementations depend on smart contracts being executed on top of the blockchain. A smart contract is a computer program that encodes a non-trusting party arrangement and is implemented based on some pre-defined rules [1]. As part of a network exchange, a smart contract is implemented or performed on blockchain networks. It is the miners' duty, specific forms of blockchain network users, to deploy new contracts and implement existing ones. Based on the computing costs needed to execute the contracts, miners get paid for this work. This study aims to describe and recognize the peer-reviewed research on smart contract technology that has been published. This work conducts a comprehensive analysis of recent developments in smart contracts. We plan to analyze applications related to blockchain-based smart contracts, find general challenges, and provide a possible way to solve them. Based on the above discussion, the following are the significant contributions of this paper.

  • An overview of blockchain technology and smart contracts is briefly highlighted and analyzed.

  • Existing blockchain and smart contract-based studies are explored, and their advantages, disadvantages are explained.

  • Various smart contract decentralized platforms are analyzed based on multiple parameters, and basic building blocks are summarized.

  • Present a systematic and comprehensive review of recent applications of smart contracts.

  • Identify the challenges associated with smart contracts based on blockchain and find potential ways to resolve the identified problems.

Furthermore, we agreed to adopt the systematic research method to search for related papers in the significant science databases and create a classification map. The plan designed helps to understand the topics of interest better and to find holes for future work.

This paper's framework is as follows. The approach used to perform the systematic mapping analysis, including the description of the research issues, is presented in Sect. 2. Context details on blockchain and smart contract technology are given in Sect. 3. The comparative analysis and description of related papers/studies are illustrated in Sect. 4. We address and answer the study questions in Sects. 5, 6, and 7. The article ends in Sect. 8.

2 Research methodology

This section presents scientific and systematic literature to give a transparent and reproducible review of applications based on the smart contract. The systematic review is applied to explore the related issues to smart contacts within the blockchain technique. The review process involved pinpointing and exploring the research papers to answer the research questions based on smart contracts' current issues. The whole review process can be divided into various steps, shown below in Fig. 1, which illustrates all phases of our systematic review.

Fig. 1
figure 1

Systematic review process

The presented methodological approach consists of the following essential steps:-

  1. 1.

    Planning the review A review protocol has been developed to frame the research questions answered by the systematic review. The research questions are the objectives that we keep in mind to address the systematic review's demands. Development of review protocol encompasses designing an appropriate strategy to search relevant studies, formulating criteria for inclusion–exclusion, deciding data extraction, and synthesis methods.

  2. 2.

    Conducting the review Identify various studies from the scientific journals by accessing their quality in terms of inclusion–exclusion criteria, data extraction, and synthesizing the data. Relevant search criteria help to identify appropriate candidate articles to cater to the need for review. Based on the suggested criteria, individual candidate studies are considered relevant or not relevant for the review.

  3. 3.

    Reporting the results The review results are summarized by mapping the research questions with the selected articles and categorizing them theme-wise. The developed review protocol results have been reported by identifying the smart contract's platforms, applications, challenges, and solutions from the selected papers. We address and answer the research questions in 5, 6, and 7 Sections.

The first phase of the systematic review process focused on identifying the current research issues on blockchain-based smart contracts. As we found, smart contracts are one of the applications of blockchain adopted for the exchange of assets, shares, and monetary values without any middleman and conflict. But perhaps some issues are related to smart contracts, which need attention for making ready for use in the business world. Some critical issues we have identified from the research papers and articles are framed in research questions. Table 1 represents the research issues and motivation towards the exploration of research done to resolve issues.

Table 1 Research issues of smart contracts

2.1 Selection and analysis of relevant research work

To conduct our systematic review, various online journal databases are used, including Scopus, Science Direct, Web of Science, ACM Digital Library, SpringerLink, and Google Scholar. The term "smart contract," "smart contract applications," "smart contract tools," "smart contract platforms," "smart contract challenges," and "blockchain" are searched in all document titles. Additional searches based on including "issues/challenges related to the smart contract," "advances in the smart contract," "smart contract domains," and "applications of blockchain." The study analyses approx. 183 papers, which are mainly published between 2015 and May 2020. The exploration aims to find the answer to research issues framed in our research questions. Figure 2 describes the screening process of extracted documents. The presented reference database search and selection approach consists of the following essential steps:

  1. 1.

    Identification This step is considered a keyword-based search strategy to find out the relevant studies. After forming search strings, the most essential and appropriate documents were selected for the proposed study. In total, 902 studies were extracted after exhaustively searching the mentioned databases and going through the reference sections of the studies extracted from the electronic libraries.

  2. 2.

    Screening After obtaining sufficient literature, refinement of the documents focused on the inclusion–exclusion criteria. The screening process firstly eliminated the duplicate and non-English articles. Then, extracted documents are analyzed based on title, abstract, and conclusion and removed that lie outside the proposed study's scope. In total, 506 articles were eliminated in the screening process.

  3. 3.

    Eligibility In this step, the full text of the extracted documents was considered to check the applicability based on the study's proposed theme. The documents that are relevant and could answer research questions are included. The documents focused on technical details, not having abstracts, and relevance to our research objective are excluded. For instance, papers that discuss the ethical issues of the blockchain and smart contracts were eliminated.

  4. 4.

    Inclusion The proposed study considered approx. 183 articles, including journal/conference papers, book chapters, and excluding websites. The online website references are explicitly searched on the databases after getting details from the selected papers.

Fig. 2
figure 2

Selection of relevant documents

Table 2 depicts the analysis of the selected article based on publication sources with their respective numbers.

Table 2 Publication sources of the selected papers

2.2 Review result

This section presents the systematic review process results by categorizing the selected studies with the identified questions. Table 3 presents the mapping of identified research questions with the selected studies. Table 4 depicts the distribution of academic papers category-wise selected for the review process. The detailed explanation and comparative analysis results of research questions are presented in 5, 6, and 7 Sections.

Table 3 Mapping of research questions with the references
Table 4 Category-wise academic papers distribution

Figure 3 represents publication density year-wise for the smart contracts. After 2015, the research in smart contracts is tremendously increased, and it is maintained to date. Most of the papers are review papers and show the applications of smart contracts. Some documents also raise the issues and hurdles coming in the implementation of various applications in different domains.

Fig. 3
figure 3

Publications year wise

3 Background studies

3.1 Blockchain technology

The developments in cryptography and distributed computing have introduced a modern computer technology called blockchain in the past decade. Blockchain is a distributed ledger that replicates and exchanges data through peer-to-peer networks. Blockchain was initially introduced by an unknown person, Satoshi Nakamoto, who created bitcoin to trade digital currencies without third parties [152] directly. Nakamoto developed the paradigm of a network of nodes working to maintain a decentralized and secure database. The blockchain platform is the methodology behind cryptocurrencies—a shared public database or a continuously updated registry of all transactions [181]. Blockchain, as the title suggests, is an ordered list of blocks. By referencing the previous block's hash, each block distinguishes by the hash sequence and ties to the preceding block. The only anomaly is the first block (called "Genesis block"), which does not have the previous block's hash value, known as the ancestor block. Blockchain can be regarded as both a technical breakthrough and financial advancement [12]. It provides a solution to any problem where a trustworthy ledger is required in a decentralized setting where it is impossible to trust actors, humans, and computers completely. The blockchain is a series of procedures and cryptographic mechanisms applied to a shared network to secure data storage within a distributed database composed of authenticated blocks encapsulating the data. The trust factor is a core feature of blockchain technology. Through blockchain, the cryptographically open-source code is used to manage the trust. Using encoding methods, each data block is safely handled in a secure layer. The data is passed to the miners, who verify it by solving mathematical puzzles and attaining consensus. The three key principles ensuring the system's functionality are (1) blocks and hashing, (2) mining, and (3) consensus [64, 120, 121]. The architecture of the blockchain is illustrated in Fig. 4.

Fig. 4
figure 4

Blockchain architecture

3.2 Smart contract

The smart contract idea was developed a long time ago, but it was introduced recently. The idea of a smart contract was articulated about twenty years ago by a cryptographer scholar, Nick Szabo [153, 154]. The fundamental principle is to insert contractual concepts into computer components such as liens, trusts, etc. He proposed four fundamental principles of contract design: evaluation, validation, privacy, and enforceability. Based on Szabo's concept, contracting parties should evaluate their success, check whether the contract was performed or violated. Also, the smart contract protects all parties' privacy and distributes the details as much as is required, and eventually, it would execute automatically. Nevertheless, the necessary architecture and specifications were not available at that time. The concept remained only an abstract term; today, smart contract deployment has become realistic by advancing blockchain technology. Smart contracts are a package of codes that encode and replicate real-world contractual agreements in the computer domain. A basic principle for contracts is to create a legal agreement between two or more parties that each party must meet its contractual obligations. The important consideration is that the contract will be governed by a legitimate administrative entity (organization). Smart contracts are eliminating the trustworthy third parties, that is, the mediators between contract members. They manage the mediators by using automatic execution of programs in a blockchain network, decentralized and evaluated by the network nodes. The smart contract also allows transactions between untrusted parties without (i) mediator commission fees, (ii) trusted-party dependency, and (iii) the counterparties' need for mutual interaction.

Smart contracts comprise a contract space, a balance, and code. It can be generated and granted access to any node in a network simply by publishing a transaction to the blockchain. When included in the blockchain, the smart contract code is fixed and cannot be changed. A network of miners who are accountable for managing the blockchain runs smart contracts. Miners achieve agreement on the smart contract's implementation result and upgrade the blockchain accordingly. Once implemented, each contract is assigned a 160-bit address and is executed using this address if a transaction is generated. The smart contract used various platforms for the development of applications. Ethereum is the largest and most important platform for developing decentralized applications, ranging from predicting markets and identity systems to other economic applications. Bitcoin is also a blockchain software that Nakamoto first created. Bitcoin offered a modern, improved exchange of money, emerging markets, and new independent decentralized organizations [65]. While Bitcoin's primary purpose is to transfer capital, its blockchain's immutability and openness have facilitated the creation of protocols that implement smart contracts. Many smart contracts store the blockchain data via the Bitcoin scripting language [87]. Apart from Bitcoin and Ethereum, there are continually evolving numbers of alternative systems derived from or are separate from the initial Bitcoin network and provide enhancements and innovative solutions for different impediments encountered in the former.

4 Related work

So far, several surveys and methodologies conducted by different authors across the globe, which considered different applications of smart contracts [8, 8, 9, 9, 115, 136, 172]. Considering the literature surveys, most of them explore blockchain technology applications, whereas others use smart contract techniques. Several general studies of blockchain technology, such as [10, 116] or survey articles, concentrate on a particular feature such as security [11] or decentralized applications [82, 137], or unique applications such as healthcare [117, 118] or IoT [119] are accessible. Nonetheless, none especially researched smart contract applications.

As per our knowledge, only a few surveys are there, which considered multiple smart contract domains. But there is no proper explanation and analysis of applications of a smart contract. Examples of these studies include the smart contract usage in many fields like medical [2, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 79, 135, 176], supply-chain [3, 54, 54, 55, 55], IoT [4,5,6, 56, 80, 114, 170], identity mechanism [7, 57,58,59, 136, 171], data management [8, 60, 61, 115, 172], and more [9, 62, 81]. While there is yet another study on smart contracts [11], it is restricted to the network and security part of Ethereum. Although there are many studies on blockchain technologies [63], we contend that there is little focus on surveys based on smart contract-enabled applications. Smart contract applications are not entirely explained in many review papers [138]. Indeed, some studies aimed at the smart contract application and include the applications' privacy and security challenges. These reviews consider only a few applications [83] and mainly focus on security [84,85,86]. Some surveys also consider blockchain's particular area and include the details of challenges and advancements [139]. Other reviews consider the smart contract's privacy problems [86]. Furthermore, other studies, such as [83], are based on the challenges and recent progress in the smart contract and the brief discussion of applications. Our paper presents the smart contract subject analysis, which examines comprehensive facets, requirements, applications, drawbacks, and solutions in this area. Table 5 presents a comparison of existing literature reviews and survey papers. The existing studies lack a detailed and comprehensive analysis of state-of-the-art applications allowed by smart contracts and their challenges.

Table 5 Comparison of related work
Table 6 Smart contract platforms

All the earlier studies under consideration discuss the security challenges and plan to incorporate smart contracts in different environments. This article investigates the use of blockchain technology-based smart contracts as a whole without being specific to particular applications, thus addressing its current trends, classifications, and open issues that have not been discussed in the prior surveys. We are aiming to provide a detailed overview of the usage of smart contracts in different application areas. To the best of our understanding, our research surpasses all the current studies more systematically in terms of the core principle of a smart contract for IoT, healthcare, cloud computing, multimedia, supply chain management, insurance, and artificial intelligence.

5 Platform overviews and key concepts

Smart contracts have recently been developed on platforms based on blockchains. Such frameworks provide easy interfaces for developers to create smart contract applications. Many of these can endorse smart contracts across a variety of existing blockchain platforms as shown in Table 6. In this paper we discuss the most influential smart contract systems in the following sections: Ethereum [155], Hyperledger Fabric [13], Nem [156], Corda [157], Stellar [162], Waves [163], Cardano [164], Neo [158], EOS [159], Rootstock [160], Tendermint [161], and Quorum [165]. We chose them primarily because of the importance of growing social and technological maturities, as suggested in [122].

5.1 Ethereum

Ethereum is a distributed network designed to implement smart contracts [155]. Unlike Bitcoin's script system, which is incomplete turing, Ethereum created Turing complete languages like Mutan, Serpent, and Solidity [167] to offer generic use cases other than cryptocurrency applications. Ethereum compiles, runs, and loads software codes into Ethereum Virtual Machine (EVM) for smart contracts written in Solidity, Serpent, and Mutan languages. Also, Ethereum is based on an account-based data model that recognizes the users using a digital wallet. Similar to Bitcoin, Ethereum uses a proof of work algorithm that is also computing-intensive. Ether (ETH) is used instead of Bitcoins to account for the difficulty of solving puzzles performed by miners. Gas serves as an internal cost to execute a contract given ETH's volatile value. Informally, a transaction's overall cost can be calculated using gas limit/gas price. The gas limit determines the acceptable amount of Gas that must be used to generate a block, and gas price is the cost of a gas unit (in ETH). Users must spend different amounts of Gas to verify their sales sooner or later (i.e., large quantities of Gas helps in a fast verification). Since PoW is computationally costly, energy can be wasted for meaningless mining tasks by block. It is planned when the mining method is used for practical activities, such as solving mathematical problems and performing machine learning exercises.

5.2 Hyperledger fabric

Hyperledger Fabric is now a collaborative blockchain and smart contracts platform [13]. Like Ethereum, which operates a virtual machine (i.e., EVM) for smart connections, Hyperledger embraces Docker containers for application deployment. Unlike virtual machines (VMs), Containers support smart contract implementations with lower latency while lacking isolation (i.e., programs executing on top of one operating system in one container). Hyperledger embraces standard, high-level programming languages such as Java and Go (aka Golang) rather than creating Ethereum's smart contract languages. Likewise, Hyperledger is now Turing complete. The data model is adopted as a key-value pair. The Hyperledger blockchain network (private or consortium) is allowed because Fabric serves general business applications. The users must be approved by Certificate Authorities (CAs) to access the network. Since the network includes various functions, several forms of CAs coexist. The Enrolment Credential Authority (ECA), for example, requires users to connect for blockchains. After the customer has authenticated, he/she will ask the Transaction Certificate Authority (TCA) for transaction certificates. Inside the authorized blockchain network, consensus can be achieved quickly. The Fabric takes advantage of Practical Byzantine Fault Tolerance (PBFT), which involves multi-round voting between authorized entities. PBFT depends on multi-round communication between nodes, which can lead to delays in time. To solve this problem, more powerful consensus algorithms should be created.

5.3 Nem

Nem was introduced on 31 March 2015 [156]. Nem is developed in Java, one of the world's most commonly used developing language. It makes it super open because programmers do not need to know a specific language like Solidity, Golang, etc. Also, Java is mature and has fewer security vulnerabilities than the latest languages, such as Solidity. Nem recently launched the Catapult or Mijin v.2 upgrades, which has made it the safest smart contract platform, according to various security experts. It is a technological breakthrough that unlocks fresh opportunities for the use of a blockchain network. Nem's greatest selling point is that it is extremely scalable. Also, while Ethereum can handle about 15 transactions a second, Nem can handle the 100's. This is because these developers are gradually jumping from other systems such as Ethereum.

5.4 Corda

Like numerous Ethereum applications, Corda [157] is specialized in digital-monetary applications, and it supports the preservation and sharing of historical records with the help of a ledger. Corda supports programming languages such as Java and Kotlin, which run on top of the Java Virtual Machine (JVM). Meanwhile, to help the verifiability, Corda is Turing incomplete. In comparison, the transaction-based model is utilized in Corda. Corda usually encourages shared networks where businesses set up a network to exchange digital assets privately. Consensus could be easily reached on private networks with blockchain. Corda embraces the Raft consensus mechanism [166]. Mutual agreement in Raft may be created by choosing a supervisor, log replication, and security protection. Corda uses the point-to-point exchange approach instead of communicating globally in blockchains. Consumers ought to present the message recipients and the essential details that are to be transferred.

5.5 Stellar

Stellar [162] is a developer forum for digital-currency use cases, similar to Corda. Stellar is faster relative to Ethereum and more available. Meanwhile, Stellar can serve a range of languages such as PHP, Golang, Python, and JavaScript. Stellar operates device instructions on top of Docker pods, similar to Fabric's, thereby decreasing overhead. For example, one stellar transaction's execution cost is just $0.0000002 and can be almost overlooked. In comparison, the execution period for a single transaction in stellar is average, around 5 s, compared to 3.5 min in Ethereum. Stellar is thus a perfect medium for financial applications. Similar to Ethereum, Stellar embraces the application architecture as the account-based platform. Stellar built its consensus protocol—Stellar Consensus Protocol (SCP) [162]. As Stellar is permissioned, it is easy to reach consensus via SCP.

5.6 Waves

The Waves Platform [163] is a public blockchain platform worldwide, founded in 2016. Waves Foundation aims to recreate the DNA of technology worldwide by offering a digital platform, delivering easy-to-use, fully usable resources to make blockchain accessible to anybody who can benefit from it. The Waves platform uses blockchain technology primarily to support the issuance, trade, and exchange of digital assets or tokens. Proof-of-Stake is to be used as a consensus algorithm. In June 2016, Waves Network completed its Initial Coin Offering, garnering over $16 million (BTC 30 000).

5.7 Cardano

Cardano is a layered architecture smart contract network that offers scalability and protection features [164]. Cardano is a blockchain of the third generation which aims to introduce scalability and interoperability into the blockchain network. Compared to other smart contract platforms, there is one exciting quality that makes Cardano unique. The majority of the other smart contract systems are coded through the imperial language of programming. Cardano uses Haskell for its source code and is a structured language for programming. Cardano uses Plutus for its smart contracts and is also a functional language. Plutus is a turing incomplete language. Cardano follows the account-based data model.

5.8 Neo

Neo, also known as Antshares, is also referred to as the Chinese Ethereum [158]. Neo is a non-profit community-based blockchain initiative that uses blockchain technologies and digital identity to digitize properties. It simplifies digital asset management through smart contracts and realizes a smart economy using a distributed network. Neo follows the account-based data model. Neo is developed in Java, Python, and C# programming languages. It supports the delegated Byzantine Fault Tolerance (dBFT) consensus algorithm. Neo's key goal is to be a distributed network for the smart economy. A smart economy is an integration of digital assets, digital identity, and smart contracts.

5.9 EOS

EOS [159] is planned to make decentralized applications scalable. Rather than supporting a single consensus algorithm, EOS incorporates Byzantine Fault Tolerance (BFT) and Delegated Stake Proof (DPOS) algorithms to benefit the consensus mechanisms. Delegates should be chosen at each round by stakeholders to create a new block, and BFT should decide to make the block permanent among those delegates chosen. Compared to Bitcoin, EOS follows the account-based model, but it also allows human-readable names to reference all accounts. Instead of customizing a program execution as per the virtual machine such as Ethereum, EOS supports Wasm to implement a smart contract.

5.10 Rootstock (RSK)

RSK [160] runs on Bitcoin while enabling quicker execution of transactions. For instance, RSK may ensure within 20 s that the transaction is being executed. Additionally, RSK is compliant with Ethereum (such as the use of Solidity to execute contracts). It supports Turing complete contracts. In reality, RSK built its virtual computers for smart contract management. RSK has built its PoW-based consensus method to support lightweight implementation while decreasing the overhead. Unlike Corda and Stellar, RSK has been primarily suggested to support currency applications. Since it runs on top of Bitcoin, RSK has a benefit, i.e., it is better than other systems independent of blockchains.

5.11 Tendermint

Tendermint is an open-source initiative that takes a strategy distinct from other blockchain technologies [161]. Tendermint, at its core, provides a blockchain consensus platform and peer-to-peer networking features that can be accessed by an Application BlockChain Interface (ABCI). Therefore, the blockchain can be written in any programming language to make all "application-level" decisions, such as structuring to execute transactions independent of the coordination mechanisms underlying them. Distinguished approved nodes engage in the consensus protocol by taking turns proposing and voting on the next block in a two-step process. The framework will suggest a currency and denote each node's voting power in that currency, thereby effectively enforcing a consensus of Proof-of-Stake. However, the consensus protocol's dependence on timeouts renders it a "weakly synchronous" one defined by other sources as unsuitable for distributed applications that are publicly hosted. Using Tendermint for the content blockchain project allows the freedom to agree and build certain functionality such as smart deployment contracts even without dealing with low-level networking and consensus protocols.

5.12 Quorum

Quorum is a corporate version of Ethereum [165]. Quorum is suitable for any program involving high-speed and high-performance analysis of private transactions within a network of established participants. Quorum addresses common issues about the implementation of blockchain technologies within and outside the financial sector. Quorum is a shared ethereum application 'geth' fork with several protocol-level changes to meet market requirements. The Quorum project's primary purpose is to develop an ethereum enterprise client that empowers businesses to embrace blockchain technology and benefit from it. Since Quorum is an open-source project, its codebase is open to analysis from everyone, which encourages trust in the software. Further, open-sourcing improve acceptance and encourages developers from different sectors to participate in this platform's growth.

6 Smart contract applications

Smart contracts have a wide variety of uses, from the Internet of Things to multimedia. In specific, we generally categorize large smart contract implementations domain-wise. We explain them in more detail in the further sections.

6.1 Insurance

Applying smart contracts may decrease overhead processing and save costs in the insurance sector, especially claim handling [123]. The preparation and settlement of an insurance claim can take months because of a lack of automatic administration. It is troublesome for insurance providers and adds to compliance charges, gluts, and inefficiency. Smart contracts will automatically streamline the mechanism by automatically initiating a demand when such events occur, such as motor insurance [14]. The smart contract automates the motor insurance process by sharing legit information in the distributed network, improving the claim process and efficiency, and decreasing claims processing time and cost. As shown in Fig. 5, a smart contract defines code to set up the terms and conditions for all the participants. In this process, a smart contract acts as a central part for all policy stakeholders and automatically executes them whenever events trigger the involved stakeholder. Table 7 summarises the various insurance system applications.

Fig. 5
figure 5

Smart contract-based insurance system

Table 7 Insurance system applications

6.2 Supply chain management

Management of the supply chain includes the passage of goods from raw material to complete products. Smart contracts may monitor ownership rights as products pass through the supply chain at any given moment, verifying who is responsible for the commodity. The monitoring of products from producers to warehouses, from warehouses to retailers, and retailers to suppliers, has been much simpler. Each delivery process stage verifies the finished product until it reaches the customer. When an object is delayed or misplaced, it is easy to search the smart contract to figure out exactly where it will be. When any stakeholder fails to comply with the contract terms, for example, if a manufacturer refuses to deliver a package on time, it will be transparent. Smart contracts make supply chains more transparent to smooth out the transfer of goods and restore trust in commerce. For example, Fig. 6 represents the blockchain-based supply chain management architecture for tracing product details. Blockchain technology is often used to record product status at each phase of its lifecycle. It helps to track products starting from the initial stage and strengthen supply chain operations.

Fig. 6
figure 6

Smart contract-based product tracking system

Additionally, the blockchain participants are given unique identifiers, or digital signatures, to sign the blocks and add product details with RFID tags to the blockchain. This would eliminate execution errors and improve traceability. The output flow from smart contract to mobile application helps users track the finished product at each stage of the delivery process by using the smart contract's utility. If an item is delayed or lost, the smart contract can be consulted to find out exactly where it should be. If any stakeholder fails to meet the contract terms, for instance, if a supplier did not ship on time, it would be clear for every party to see. Making supply chains more transparent via smart contracts helps smooth out goods' movement and restore trust in trade. Table 8 summarizes the analysis of supply chain applications that focus on smart contracts and blockchain technology.

Table 8 Supply chain applications

6.3 Internet of things

The Internet of Things is the most exciting technique that serves various use cases, including supply chain systems, production tracking systems, stores, access controls, databases, e-health services [144,145,146]. IoT's key goal is to incorporate "digital" things into the internet and offer consumers specific services [147]. Implicitly, IoT was developed to automate the various business processes. The potentials of IoT can be increased with the incorporation of smart contracts. For example, industrial manufacturing. Most of the existing manufacturers adopt a centralized approach to their IoT ecosystems. The firmware updates can only be obtained manually by different IoT devices on the central server by querying the server. Smart contracts give the problem an automated solution [91]. The smart contract stores the hash values of firmware updates and is executed on the distributed blockchain network. Resources are greatly saved as the smart contracts are used to access the firmware information directly. Also, smart contracts can give benefits to the IoT E-business model. The conventional business system also needs a trusted authority to complete the transfer, acting as an intermediary. This centralized payment, though, is expensive and can't completely leverage IoT benefits. In [18], it was suggested that Distributed Autonomous Corporations (DACs) manage purchases, in which there are no conventional roles such as governments or payment firms involved. Because of smart contract implementation, it works automatically without any intervention. Table 9 presents the analysis of IoT applications that focus on blockchain technology and smart contract.

Table 9 IoT applications

6.4 Healthcare

Existing healthcare networks suffer from numerous issues such as fragmented data, data accuracy, interoperability, and privacy issues. By suggesting a framework [67, 126] or implementing a smart contract-enabled system using blockchain [2, 49, 49, 50, 50, 68, 79], many works aim to resolve these issues. These work focus on user identity management, access control, and sharing of medical data using various available blockchain platforms such as Ethereum [68, 111, 135], and Hyperledger [49, 50]. Kuo et al. [117] also explore key blockchain advantages for various healthcare applications such as record processing, insurance claim procedure, clinical testing, or Healthcare database development. As shown in Fig. 7, the blockchain-based healthcare model designs the smart contract to register the application users and allow them to share, access, and validate the healthcare data through the blockchain network.

Fig. 7
figure 7

Application model for blockchain-based healthcare application

Table 10 presented the selected studies emphasizing smart contracts, or at least the blockchain concept has been addressed in the architecture.

Table 10 Healthcare applications

6.5 Multimedia

Violations of privacy and authorship are significant issues within the entertainment sector. Musicians, photographers, writers, and other artists are deprived of their royalties because their intellectual property is dishonestly exploited. Having a public authorship list on a blockchain is an innovative example of how smart contracts change affairs. Each time material is used for advertising activities, such as an album, a copyright fee would be paid to that album's owner. A lot of people are involved in making an album. Therefore it can be hard to determine who has the copyright and who is entitled to payment because the current processes are not working well. This has led to confusion about entitlement, undoubtedly giving some contributors more than is due to others' detriment, while some don't get anything. Through tracking ownership rights in a shared blockchain network, smart contracts will guarantee that the payments go to the intended beneficiary. Smart contracts offer many benefits for many sectors, decreasing excessive risks and time consuming while increasing efficiency. By principle, they are more effective and trustworthy than conventional contract law, and since all acts are reported and checked, they are often considered to provide better protection. Also, the use of smart contracts can protect the property rights of multimedia. For example, the smart contract can store the customer's wallet address and product id, and the same data is used to encode the digital product. In the case of unauthorized transfer of products without the creator's permission, the administrator utilizes the associated product and customer information to find its original creator. Table 11 presents a comparative analysis of various multimedia applications.

Table 11 Multimedia applications

6.6 Cloud computing

Cloud computing is a popular platform for giving consumers access to a common processing and storage resource pool [74]. Customers may usually purchase services from trustworthy cloud service providers (CSPs). However, it is challenging to test CSPs' trustworthiness, as CSPs frequently partner with external enterprises to make more money. In [24], the authors suggested a smart-contract and game-theory approach. This approach's central concept lets two cloud servers query a database to do a single operation. In this approach, smart contracts are designed to induce uncertainty, deception, and mistrust amongst clouds. Then customers may conveniently decide the logical clouds which do not conspire and steal. The analysis was also carried out to validate this plan's feasibility. In the cloud computing environment, brokers are commonly used to provide services to users. In this process, the broker reviews the user requests to find out suitable services. This scheme required both the cloud service providers and users to trust the broker. If the broker has been hacked, both sides are insecure. In [75], the authors recently proposed a solution to prohibit brokers from using smart contracts. The core concept behind their strategy is to use distributed agreements [25] to identify users' needs. The various cloud storage applications are summarized in Table 12.

Table 12 Cloud applications

6.7 Identity management

Centralized approaches raise personal identity several issues, including the privacy of consumers and untrusted third parties. Also, they can generally not provide a single identity for different organizations to adopt. Accordingly, personal usage details may be open to other third parties grappling with the new identities. As shown in Fig. 8, a smart contract is designed to authenticate the IoT device's identity based on the stored information. The architecture utilized the blockchain structure to store and verify the IoT devices' details and improve the system's security and accuracy. Table 13 analyses the various smart contract-based identity management applications.

Fig. 8
figure 8

Smart contract based identity management system

Table 13 Identity management applications

6.8 Record management

One of the key applications of blockchain is to provide a secure, tamper-proof, and trustable ledger for the management of records. Many applications, such as IoT, supply chain, medical, and cloud storage, have identified this blockchain feature. The use of blockchain technologies and smart contracts in academic studies was often considered for data management applications. Table 14 summarizes the various related applications.

Table 14 Record management applications
Table 15 Summary of challenges and advances in smart contracts

7 Challenges and future directions

While a smart contract is a revolutionary development, many challenges do remain to be addressed. We identified the smart contract's major challenges and summarized them in Table 15. The recent developments in overcoming these problems are presented in Sect. 7.2.

7.1 Challenges

Readability The smart contracts mainly used programming languages such as Solidity, Go, Kotlin, and Java. Then, they compile and execute source codes. Thus systems have different types of codes in different time intervals. Therefore it remains a major challenge to make programs readable in any form.

Code correctness It is almost difficult to make changes after smart contracts have been implemented on blockchains. Therefore, assessing the validity of smart contracts before the formal release is vitally necessary. However, it is complicated to test smart contracts' validity due to the difficulty of designing smart contracts.

Performance expectancy refers to how much innovation in technology is considered superior to the technology currently in use. Because smart contracts exist on the blockchain, companies may understand the advantages inherent in the blockchain's decentralized existence. Consequently, transparency, immutability, and quick handling of transactions are potential benefits that can be realized compared to legacy technologies. To simplify manual operations, the prospect of embedding business logic in smart contracts is of utmost importance. Although all experts agreed that smart contracts could promote different domain solutions, a trade-off between scalability, cost, and security was noted. Given this trade-off, the anticipated result can be seen as an advantage for businesses. The use of smart contracts, in particular, can lead to a crucial competitive advantage over rivals [182].

Dynamic control flow While the distributed smart contracts are unchangeable, it is not assured that smart contracts' control flow would be immutable. A smart contract may communicate with other contracts in particular (e.g., movement of funds to the contract or forming a new contract). When designing the contract, the control flow of the smart contract has to be specifically planned. Over time, the presence of smart contracts will result in a larger number of interconnected contracts. Therefore, it is challenging to predict contract behaviors. Additionally, most current approaches focus on identifying possible dynamic flow control issues in systems while not necessarily guaranteeing the execution system's stability. So checking whether the execution environment is reliable is also essential.

Execution efficiency Miners execute smart contracts in sequence. In other terms, once the existing contract is ended, a miner does not execute another contract. The serialization implementation ultimately restricts the performance of the system. However, implementing smart contracts concurrently is difficult because of the mutual data between several smart contracts. Meanwhile, it is also essential to increase the reliability of smart contract execution. Also, checking the contract data without a proper medium is essential to improve the execution efficiency as it eliminates the need to redeploy a new contract.

Lack of privacy The privacy risk originated from concealing the business logic under the smart contract code. In [31], the authors identified that the Ethereum is designed to be safe only bytecode, and users are afraid to trust the contract about the unpublished source code. Moreover, due to software decoding the bytecode [32], contract protection has been put at risk.

Unknown call issue Many Solidity functions activate the callee/recipient's fallback function [11] when the signature function may not suit all of the features available in a Solidity contract. Hackers use primitives such as call, send, or delegate functions to transfer Ether to an address that does not exist by invoking the fraudulent fallback contract function. One of Ethereum's common assaults exploited the weakness [177]. The attack required participants to donate Ether in a simplified way to finance their choice of contracts and then utilize them to remove the capital [178].

Unorder of exception In [11], authors recorded two forms in which anomalies were handled. First, the execution was halted, and side effects were reversed along with all the Gas use. Second, the exception was passed through the chain restoring all the called contracts' adverse effects until it arrived at "call" with all Gas utilization. In [179], the authors reported that calling functions' return values were not checked in Solidity developers, as exceptions returned "0" when a call failed. In addition to this problem, [33] presented that around 27.9% of contracts calling other smart contracts by using the "send" function do not examine the return values.

Gas exception and typecast issue The "Gas" denotes the transaction execution costs. It is the measurement amount of Ether when a transaction is initiated [173]. If during the transaction execution, Gas is exhausted, then the transaction will be revoked, and the sender has to bear all the miners' Gas costs [33]. In Ethereum, we can set the amount of Gas required for execution to not exceed the maximum limit (that is 2300) [11]. The problem is uncertainty [168] that arises due to the insufficient amount of Gas available when calling external functions [169].

Re-entrancy Re-entrancy was the most serious issue of smart contracts abused to render the DAO threat [179]. This revolved around the handing over power in an agreement between the two. In [173], the authors demonstrated the "withdraw" feature that collected money from an account by submitting money to a recipient and then changed the account balance. In [34] and [151], authors referred to this problem as critical and provided examples of attacks associated with money withdrawal.

Perceived technical capability This can be defined as leveraging technological capabilities to create a competitive edge. Companies need to comprehend blockchain and smart contracts to understand how they can be used for IoT, supply chain, and storage sectors. Additionally, smart contract programming can be complex, and organizations must trust developers to write secure code as per their requirements. Reaching experienced and respected developers may be challenging. Companies with good technical skills are more likely to overcome emerging technology challenges and achieve a competitive edge.

Programming smart contracts In programming smart contracts, [11] and [168] emphasized security as one of the key challenges. For example, in attempts to steal Ether from users, some documented attacks (Rubixi/GovernMental/DAO contracts) abused smart contracts' immutability. Security and usability issues were quite significant among the many problems listed in [35], as a blockchain guarantees data confidentiality and authenticity to ensure that blockchain-based applications are comfortable. There is also economic difficulty when programming smart contracts, in addition to security and reliability.

The most prestigious example is the expense of installing and running Ethereum's smart contracts, i.e., the Gas prices. The cost problem comes from the Ethereum system's architecture (the Solidity Compiler and the EVM), where programming directives written in Solidity and converted by the EVM into byte code are becoming too costly. The developers' most costly errors when programming smart contracts are writing and reading from permanent disk memory. That is understandable, as when data is placed in the network, it is kept in a permanent archive distributed across thousands of nodes. In [180], authors established that smart contracts in a functional language (Idris) and the use of an automated form method to detect compile-time errors minimize both the probability of programming errors and the need for checks. However, because they encode very detailed smart contract behavior properties, it brings a high Gas cost because programs become very large and therefore contain redundant operations in the resulting code.

Privacy issues The privacy issues increase when the organizations are not sure about risks associated with their digital industry assets. Network bottleneck, manipulation of data, Sybil attacks, or badly written code of smart contracts are vulnerabilities and threats to organizations. This may hamper the status of the organization if threats turn evident. Security and privacy actions should be managed and achieved. It is tedious for organizations to evaluate associated threats, carry out control strategies, and execute continuous monitoring to keep the risk minimal.

7.2 Recent advances

Recover source code It is seen in [36] that over 77 percent of smart contracts have not released available source codes, all of which include more than $3 billion in US dollars. The unavailability of source code makes the formal auditors of smart contracts elusive. In [36], the authors proposed a reverse engineering tool, “Erays” to process compiled smart contracts to address the problem. This reverse engineering method turns hex-encoded contracts into readable human pseudo-codes.

Human readable execution Although several projects aim to provide smart contract developers with high-level languages, these smart contracts are translated into other types, such as bytecode in EVM. In most cases, when stored on the blockchain and executed, two parties in the transaction have to accept the contracts. To overcome this problem, in [134], the authors suggested an intermediate-level language called IELE. IELE has a common Low-Level Virtual Machine (LLVM) syntax [106] that gives compilers high-level information during compilation time, communication time, run time, and idle time.

Re-entrancy Several plans have recently sought to overcome any of the above problems. Obsidian [37] has been recommended to fix re-entrancy attacks and money leakage issues. Obsidian exploits called states to permit continuity checking and state change inspection to mend re-entrancy vulnerability. An empirical method of data processing was suggested to discourage illegal digital currencies from stealing from the leak. In [38], the authors proposed to remove re-entrancy vulnerabilities by banning the nesting of calling within contract functions. Liu et al. [39] proposed that the Fuzz check on smart contracts be carried out by iteratively creating random but varied transactions to find bugs in re-entrancy.

Bytecode analysis Bytecode level analysis needs only the compiled smart contract bytecodes, which are much easier to access. How to use such bytecodes to identify security threats has been an important topic of science. In [40], OYENTE was explicitly suggested to define possible security vulnerabilities, including mishandled exceptions and time-stamp-dependent issues. The rule-based representations for high-level bytecode analysis are produced based on the control graph generated by OYENTE [41]. In comparison, the smart contract delivery and management framework (SmartDEMAP) was introduced by Knecht and Stiller [42] to solve the trust issue during contract creation and implementation. Additionally, SmartDEMAP can also be fitted with other application quality assurance devices such as automatic bug-finders. Smart contracts can be applied in this manner only after the trustful requirements have been met.

Graph-based analysis Charlier et al. [43] suggested a multidimensional method to forecast smart contract interactions. This method especially incorporates stochastic processes and tensors to replicate current interactions and thus forecasts potential contract interactions. Additionally, the work in [44] presents a heuristic indicator of immutability in the control flow. This approach has, in particular, been evaluated on a call graph of all Ethereum smart contracts. Evaluating the call graph shows that two (out of five) smart contracts involve at least one-third party confidence.

System for execution EVMFuzz [174] was suggested to find bugs in the smart contract execution system. EVMFuzz continuously creates seed contracts for multiple executions of EVM to identify as many contradictions as possible among execution outcomes. With cross-referencing outputs, this approach will ultimately reveal vulnerabilities.

Serialization of execution To fill this void, Dickerson et al. [45] suggested a Software Transactional Memory-based solution that would require miners to execute contracts parallel. This strategy's core concept is to treat every smart contract's invocation as a speculative atomic action. Conflicts that happened during simultaneous executions will quickly be rolled back in this manner. Also, the study at [46] simultaneously explored smart contracts. In this article, market problems such as atomicity, interference, alignment, and capital control were well discussed. In [175], the authors suggested using constructive Computer Transactional Memory Systems to improve smart contract execution. The miner also saves a block graph of transactions into the database when performing contract transactions concurrently using multi-threading. The validators then re-execute the smart contract at the same time as the specified block graph. If the result is true otherwise, the block is appended to the blockchain.

Contract inspection The contents of the contract cannot be changed after deployment. What will designers do if they are asked to change certain values not outlined initially? One easy approach is to change and redeploy the smart contract. The redeployment of smart contracts can, however, result in more costs. In [40, 183], the authors proposed using the reification of memory architecture to recompile a compiled document's binary form. Meanwhile, [40, 183] work suggested the decompilation capabilities [47], in which the system would introspect without redeploying the smart contract.

8 Conclusion

This review outlines a discussion of smart contract enable applications. Specifically, we first present an outline of blockchain technology and smart contract. Then, we present a comparative analysis of various smart contract platforms. Next, we discuss the smart contract use cases, list various implementation areas of each application, and perform a comparative analysis. Meanwhile, we also identify the general challenges of the deployment of smart contract applications. Moreover, we also discuss the solutions for the identified challenges. This article would provide guidelines for designing safe and reliable smart contract applications and supporting blockchain technology growth. Smart contracts are growing rapidly with blockchain technologies, but a range of issues need to be tackled. Many emerging smart contract discussions focus on protection and safety issues, while the emergence of blockchain and smart contract implementations often poses new challenges. However, identifying and detecting these issues would need considerable effort in information development and data processing aspects. Filling this gap, therefore, is of great importance for the development of smart contracts.