A novel blockchain architecture based on network functions virtualization (NFV) with auto smart contracts

Network Function Virtualization (NFV) is considered to be a hopeful technology for supporting blockchain with many features like flexible networks and intelligent equipment. NFV decreases the expenses incurred on the maintenance and operation of assets that are generated through expenses, in addition to capital expenditures based on the isolate the physical devices from the main tasks executed by that equipment. Blockchain currency transfers or technology is the most powerful security tool that ensures the security of data. The prominent challenges in NFV are the processes of transition, vendor compatibility, network management, rapid growth, and security. The software industry and skills of networking are experiencing fast expansion and deployment of the Network Functions Virtualization (NFV) approach, jointly in blockchain and cloud networks. In this paper, a novel method is offered to virtualize the work of the blockchain based on the NFV with auto work of the smart contract between virtual nodes based on cloud computing. By blending NFV with Blockchain, all of the above-mentioned challenges have been overcome by moving to software environments through creating virtual nodes, as well as smooth interaction among them and managing the transactions between nodes and clients, indicating ideal network management. Through the proposed work, a throughput of up to 20% is obtained by applying NFV compared to not applying NFV to the blockchain. In addition, the costs of the hardware are eliminated and eventually a secure environment is used which distances the system from virtual attacks.


Introduction
Virtualization is considered as the main preparing technology that is the reason for the modern development of cloud computing in addition to edge computing [6], [7]. Such a fast spread enables its access to the field of global systems through computing and storage infrastructure [8]. While the domain across the cloud and the source or destination is often huge, the services of cloud computing may possibly not offer the guaranty of least time required between user action and the rejoinder. This problem needs to be treated based on Edge computing [9], which deliberately diffuses computing devices nearer to sources so as to achieve maximum productivity of enhancing the quality of service (QoS) for applications that need heavy mathematical calculation in addition to low latency [10], [11]. One of the most important concepts which represent an actual application of the term virtualization means is Network Function Virtualization (NFV). NFV separates the network functions from the hardware and enables them to run in software [4]. NFV provides virtualized management of network functions including network address translation, firewalling, domain name service, and caching, while introducing a fully virtualized infrastructure that includes network components such as virtual servers and virtual storage. With NFV, operators can reduce time to market a new service and respond quickly to customer needs. As mentioned, NFV refers to the process of conversion of networks that were previously based on the hardware in its work to networks whose work is based on the software. Given that such approaches are applied in IT virtualization, a major aim to make a network virtualization is to offer a layer of abstraction amidst physical components and the activities whose work is based on those components.
Lately, the virtualization of networks has actively been utilized in Internet study or the survey of Industrial Internet Consortium, like G-Lab and 4WARD [12], [13]. This mainly aims towards managing the strength of the existing Internet for essential infrastructure alterations. The virtualization of networks was regarded as a part of the significantly hopeful technologies for the time to come for the Internet [14]. In a special case, the term NFV was introduced via a network service group of providers in the middle of 2012. The goal of the providers of these services is to make them more comprehensible and accelerate the procedure of adding modern or novel functions to the network. There are many institutes that took the initiative to advance the NFV like European Telecommunications Standards Institute (ETSI) [15]. Kuribayashi and Shin-ichi [24] suggested a deployment algorithm for the virtual firewall with virtual routing functions for reducing the cost of the network. Finally, some virtualization strategies are proposed to treat the difficulties in the current DLT systems [25]. There are some researchers who offered a new virtualization way to process the challenges that are escorted to the Distributed Ledger Technology (DLT) in blockchain [1].
Blockchain is a type of network whose distribution facilitates the development of technologies such as cryptocurrency and the internet of value. The block chain is a technology which offers the possibility of creating a ledger that is distributed through a computer network without the need for a central server or database. For this reason, the computing power presented by the nodes in the network is used to introduce information and to protect it against making modifications that have not been authorized. As a consequence, the blockchain offers the possibility of reaching very high levels of security when compared to other technologies [3], [17], [2]. Blockchain depends on the concept of decentralization in storage. Decentralization in data storage means the presence of more than one server or database, working at the same time to meet the users' requests as quickly as possible, and this explains the development of the increasing speed of Internet applications The most important feature that distinguishes blockchain from other techniques is that it uses the smart contract protocol. Smart contracts are a computer protocol that enables the exchange of data, real estate, or any asset that can be traded without any intermediary. All transactions performed in these contracts are converted into computer code, stored, and controlled by users on the blockchain network. Smart contracts are contracts governed by specific rules and standards which are implemented with prior programming [18] with no need for intermediaries or a third party interference. This means that they represent electronic understandings which are written via electronic devices. These understandings are made by a computer as a set of electronically programmed instructions with advanced technology, as with the Blockchain technology. The latter depends on mathematical algorithms and covers all information related to the rights and duties of each party. As for this work, a new perspective and a modern concept are presented about the architecture of Blockchain. This is reached by building a special Blockchain and applying virtual network functions to it in two aspects: the first in LocalHost [20] and the second by using Amazon Web Services (AWS) [19]. This contributes to the disposal of physical parts used within it, in addition to obtaining some software parts in a virtual form (like creating keys and hash functions), and obtaining a virtual ledger. Eventually, a fully virtual blockchain will be obtained via auto generated.

Blockchain
As has been mentioned before, decentralization is one of the basic concepts on which the blockchain technology depends, as the system depends on a group of nodes, each computer or server in this system represents a node that performs several tasks such as storing transaction information, the timing of its occurrence, and the addresses of the blocks connected to it. By keeping several copies of the financial transaction file in different nodes around the world that anyone can access, there is no longer a need for a trusted third party to act as an intermediary to manage transactions between people. The application of blockchain involves a total of six layers [26]. At the present time, Blockchain is of rather high complexity and requires years to develop become more simplified and comprehendible. It is necessary to divide the Blockchain into several technical layers, as follows: • Application Layer: The mission of the Application Layer is to develop Block chain solutions to be used across various applications and industries.
• Models Layer: The task of models layer is to facilitate smart contracts, as it is responsible for creating work flows and determining the manner through which the users interacts with the system.
• Contracts Layer: While the model layer deals with the workflow, the contract layer deals with the contract itself. Given the financial ramifications to the undefined or well-executed contract layer, much attention should be paid for ensuring the correct issuing of contracts, free from any potential vulnerabilities.
• System Layer: The system layer includes of the basic components required for maintaining the Blockchain itself, like the consensus protocol and its associated sub-systems.
• Data Layer: The data layer is responsible for managing the information that is stored on the Block chain, both inside the transmitted chain and the data base (off-chain).
• Network Layer: The network layer in Blockchain network topology features P2P networking, client connectivity, connectivity strategies, and user behavior.
The important step that should be taken into consideration to accommodate the direct effects of regulatory and commercial [16] blockchain application is the understanding of its architecture. Since the blockchain is a part of the information technology, an information technology architecture can be provided. This consists of three layers (Table 1) in a sequential form, each of which complements the other. Hardware of the Blockchain. The network of the blockchain is indicated via the many nodes which depend on the computational power to add a strong footprint. It is characterized by applications to participate in the consensus (confirming and saving transactions of that particular blockchain).
In next section, a brief explanation will be provided about the traditional architecture of the blockchain as shown in Figure 1,and compared to the innovative work known as the virtual blockchain as shown in Figure 2.

Proposed virtual blockchain
This section offers the architecture of the blockchain in two phases, namely the traditional and virtual phase. It is followed by an auto smart contract structure. Finally, a new approach towards auto smart contract is applied. Figure 2 illustrates the architecture of a virtual blockchain. The components include the networking, computing, and storage. Each resource includes its internal contents, which refer to the encryption and consensus. Virtual resources reduce or dispense with the use of physical devices. This abstraction is obtained by implementing NFV as a virtual layer. This separates the virtual resources from the main physical devices. The virtual machines might be used as alternatives to the computing and storage hardware or software. The representation of networks is either through nodes or others in order to obtain virtual networks. A clear task to the virtual node is hosting or routing, which indicates that its components are software. In addition, networks can also be represented by a virtual link, which is a logical and relational link between nodes. It is shown as an explicit hardware link accompanied by dynamically changeable characteristics.

Virtual blockchain based NFV tool
The first experiment in this work was to add NFV directly to the environment designed by the authors, which is provided by the Amazon Web service. This means that there is a total of three virtual nodes, after which the virtual blockchain is obtained, as shown in Figure 3. As illustrated in the figure above, the proposed system was implemented through five steps, which can be summarized in the following way:

Building a private blockchain
In this step, a private blockchain is built consisting of three nodes, each of which holds a copy of the records. These records can only be updated with the consent of all parties within the network, knowing that these records are secure and can be shared. It was built with all the specifications as a simulation of the well-known Blockchain. This means that a distributed ledger is built from peer-to-peer, which is secure, encrypted and written only (Append only). It is immutable as it cannot be tampered or changed, and can only be updated through the Consensus protocol.

Uploading the blockchain to AWS
Before uploading the system to AWS, there are axioms that have been made. Starting off by creating an account and logging in, the services that fit with the present work are entered, which is Elastic Compute Cloud (EC2). EC2 is a web service which offers a secure, scalable computing amplitude in the cloud. A new virtual machine is created, after which the private blockchain is updated based on the load balancer which can set multi-process and multi-ports for uploaded programs.

Setup NFV orchestration on AWS
Based on the Amazon EC2 and Amazon S3, the NFVI layer is built and the virtualization approach may work as either VMs or containers on the storage infrastructure or computation. Based on [21], [22], [23] the NFV is installed tot the AWS, after which it is used to implement the blockchain and obtain the virtual version.

Virtual blockchain
This result was obtained by applying the aforementioned NFV. A total of three virtual nodes have been obtained containing all of the transactions, keys, and the hash function. Eventually, this shows a virtual Blockchain which was obtained as all nodes contain a copy of this Blockchain.

Virtual blockchain based built NFV
In the second experiment, the NFV is programmed using one of the well-known programming languages and added it to the Amazon Web service. All nodes were called, and thus virtual nodes were generated. As a result, a virtual blockchain is obtained, as shown in Figure 4. The same mechanisms illustrated in Figure 3 are implemented in this part, except for the construction of NFV which was implemented by means of a code Algorithm 1. The nodes which contain a copy of the blockchain were called. As a result, a virtual copy of the nodes and the blockchain is obtained. In addition, an architecture has been obtained which is called an NFV-blockchain architecture.

Algorithm 1: NFV for recall Nodes Algorithm
Step 1 − Parse the yaml file Step 2 − Create the mininet nodes Step 3 − Configure the Blockchain Step 4 − Configure the nodes Step 5-Return the node of the blockchain if the blockchain exists (from Step 3).

Auto Smart contract
Technological transformations and digital features in the legal field have cast a shadow over various transactions, especially modern contracting methods such as the Smart Contract. The latter is an information program that seeks to implement the contract in an automatic manner without the intervention or mediation of others. Such application approaches to the work of automated machines all imply the adoption of more advanced technologies.
Smart contracts are a technology built using the blockchain, through which an automated legal contract can be created which is held within the blockchain. Through the present work, in which smart contracts are the main factor, several self-operating smart contracts have been obtained by default. This means that they exist in the presence of the virtual blockchain. The automatic smart contract ( Figure 5) contains the smart contract parties, in addition to the subject of agreement, and most importantly the terms of agreement that are programmed and placed according to the terms that have been agreed upon between the parties to the agreement. Finally, smart contracts allow the exchange of data, property, stocks or other assets, without the services of intermediaries. As for the present work, the obtaining of a virtual blockchain via the NFV application is accompanied by obtaining both automatic smart contracts as shown in Algorithm 2, and virtual nodes. if (Node is registered in the nodes list) then 5 return Transaction is done 6 else 7 return Transaction Not Found 8 end 9 End function

Evaluation metrics
Using the following metrics, the evaluation of the system performance can be based on the final output of running many nodes of the blockchain. In addition to that, it illustrates the numerical comparison of the terms below both with and without the application of NFV, as shown in Tables (2 -3).

 Throughput
It indicates the number of complete transactions per second equation (1). An assigned work can be customized for many clients to increase the throughput of the blockchain.
Th=t * count (Rs) (1) Where t refers to the time in seconds.

 Latency
It indicates the latent period for each transaction, whereby there are 7 transactions per seconds [27].

 Scalability
It refers to the variations in throughput and latency while the number of nodes starts growing in a synchronized way to the assigned work that is required.

 Cost
As compared to traditional blockchain environments, and taking into consideration factors like their complexity and management methodology, the cost do indeed exist, but they depends on the required reservation in the cloud, in addition to the duration and capacity. This means that the cost is nil for the devices because the reliance was mainly upon virtual machines through the use of network function virtualization. As for the default reservation, whether it is a cloud or a server, the annual price ranges between 290 -3000 dollars annually.
Various speeds have been displayed via many blockchains for deploying, recalling, and implementing smart contracts. The main goal of this work is to observe the latency of throughput, which describes all transactions per second. Through the time from xi to xj, the equation (2), calculates the transactions (Rs) for the nodes k.
Transactions Per Second k = / Then A= Transactions Per Second k / (xsc/c). In the table below, a significant difference is observed in the rate of throughput by relying on Virtual Operations (NFV) in a flexible environment such as the blockchain environment. The Figures (6, 7) refer to the throughput of the private blockchain as compared to the time and number of nodes. It has been observed that there is a contrasting difference between the two figures below, whereby the first refers to the implementation of the system without NFV and the second refers to the system as implemented using NFV. There is a two-second difference in each transaction, which leads to a significant difference in the escalation of time as well as the escalation of nodes.

Conclusion
NFV is considered to be a remarkable development in the network industry, particularly regarding the observed tendency towards building the bases of a huge number of organizations in the future. In this paper, an explanation is presented for the manner of implementing NFV in a blockchain. A straightforward and public NFV-blockchain architecture is offered to tackle the problems of scalability, security, and cost in blockchain networks. Through virtualizing blockchain technology, it becomes potential to be effective, scalable and flexible within blockchain environments. Additionally, a business perspective is provided via the implementation of NFV to the current architecture. This particularly provided the ability to introduce many income possibilities in the services of the chain. As a conclusion, the confirmation is made that applying NFV coupled with blockchain network can lead to thrilling opportunities. The results indicate that a throughput of up to 20% has been obtained by applying NFV, accompanied with a speed of implementation of up to 50%. Finally, a great throughput has been obtained with the time difference through the application of NFV.