# A Blockchain-Based Framework for Developing Traceability Applications towards Sustainable Agriculture in Vietnam

Authors: Duc-Hiep Nguyen; Nguyen Huynh-Tuong; Hoang-Anh Pham
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Recently, many governments in the world have been focusing on building sustainable agriculture to improve the life quality of farmers and significantly increase their income. In Vietnam, however, the farmers still face the problems of “good harvest–low prices, and vice versa” and lack capital for scaling or transforming the production model. One of the main reasons for this phenomenon is that the price of agricultural products does not depend on farmers’ efforts but is based on the purchase price of the trader or the market price. Besides, the farmers also maintain farming habits based on regional culture or follow trendy and profitable agricultural products. Those production strategies make this type of product oversupplied, leading to a down in price shortly, so the farmers’ income will decrease. The above problems stem from the lack of information and communication tools between actors in the agricultural value chain, especially between cooperatives, farmers, and consumers. This paper presents a Blockchain-based framework for developing a traceability solution as an effective method of communication between actors in the agricultural value chain toward a sustainable agricultural model. The proposed approach helps to fully convey the production and distribution of agricultural products and the ability to verify traceability information, thereby helping to increase prices and protect the brand of agricultural products.


---

## Body

## 1. Introduction

Vietnam is an agricultural country with a rich and diverse product range and many regional specialties. Besides, Vietnam is one of the countries with great potential for agricultural development and leading agricultural export globally. Although the number of agricultural, forestry, and fishery production organizations in Vietnam has increased, their small scale and low investment make production and business efficiency not high. The lack of product consumption or intense consumption fluctuation over time, the phenomenon of “good harvest - low price,” makes most agricultural firms barely cover costs. Therefore, reinvesting is difficult, leading to capital deficiency to expand the production scale and improve business efficiency.Vietnamese farmers are disproportionately paid for their efforts in small and medium-scale businesses. When they want to improve this, they do not have enough funding or access to capital to expand the production scale. Meanwhile, many countries are moving towards establishing sustainable agriculture to improve the lives of farmers. According to the United States Department of Agriculture (USDA) [1], sustainable agriculture is an agricultural production process that protects the environment, expands the Earth’s natural resources, and improves soil fertility. In particular, sustainable agriculture aims to increase income for farms, promote environmental protection and production management, improve farmers’ life quality, and satisfy human food and fiber needs.There have been many approaches to solve the above problems of farmers. Each method has different advantages and disadvantages and is suitable for various goals of sustainable agriculture. For instance, the methods proposed in [2, 3] aim to improve transparency in the supply chain, while the methods in [4, 5] aim to increase the sales volume and enhance trade compliance. Our study will focus on the most practical purposes that directly affect the lives of farmers, which are increasing income for farmers and improving the life quality of farming families and communities. Specifically, building a sustainable agricultural model solves two topical issues of Vietnam’s agricultural industry, such as (1) the problem of good harvest, low price - bad harvest, high price; and (2) the problem of capital deficiency for expanding business. These two problems generally stem from the lack of information and exchange methods between actors in the agricultural value chain, especially between cooperatives, farmers, and consumers.Currently, cooperatives and farmers do not directly interact with consumers but mainly deal with traders. Therefore, they cannot grasp consumers’ needs to adjust production plans or improve quality accordingly. More importantly, the lack of information leaves them with no basis to set prices for their agricultural products. The inability to communicate with consumers makes it impossible for them to prove the product quality is commensurate with the cost. In other words, the selling price of the product does not reflect the farmers’ effort but is based on the purchase price of the trader or the market price. Depending on traders and having to sell copper at market value makes farmers only earn enough to cover expenses, leading to no motivation to make more efforts to improve product quality.Besides, the current farming habits of cooperatives and farmers in Vietnam are still based on regional practices or chasing trendy agricultural products that bring high profits. Therefore, it leads to an increase in supply, suddenly exceeding the market’s consumption capability, leading to a sharp drop in selling prices. Meanwhile, consumers get difficulty buying high-quality agricultural products amid growing concerns about food safety. According to IBM’s report, 71% of consumers are willing to pay 37% more for products with traceability and transparent information [6]. Additionally, the Covid-19 epidemic also changes users’ behavior from “in person” to “online” shopping, making it even more difficult for consumers to choose safe and clean agricultural products. Thus, it can be seen that there is a vast gap between supply (farmers) and demand (consumers) in terms of information.Consequently, it is necessary to have a tool to support bidirectional communication between farmers and consumers to solve the two aforementioned problems for sustainable agriculture in Vietnam. This tool can provide consumers with information about products, cultivation, and distribution processes and send consumers’ feedback to the producer. We find that an electronic traceability solution is an appropriate approach. With a traceability system, cooperatives and farmers provide consumers with transparent information about products and quality certification to create a competitive advantage, affirm the product quality commensurate with the price, and build a trusted brand. On the other hand, consumers have enough information to choose and buy products having transparent information and origin.With technological advancements, digital systems are being developed with transformative technologies to improve food traceability’s speed, accuracy, and effectiveness. One of the most significant limitations is that the current solutions do not demonstrate complete transparency and ensure user accountability when recording traceability information [7]. Meanwhile, Blockchain has been receiving increased interest due to its success in the financial sector and its ability to prohibit data alterations from even the internal system. Technically, Blockchain is a public ledger that records the whole transaction history on a peer-to-peer computer network of the time. All collaborative entities within an ecosystem will share a common ledger that provides data immutability and indisputable accountability for boosting data transparency. Consequently, applying Blockchain technology in agriculture will improve the current traceability process [8–14].Many existing studies investigate the challenges and benefits of adopting Blockchain. Among them, two survey studies [15, 16] are the most outstanding ones in the smart manufacturing sector. The authors presented twelve valuable metrics (M1 to M12) that help analyze the differences between various studies on Blockchain adoption. Our study focuses on two metrics, M6 and M12, while other metrics such as M1, M5, M7, and M8 can be achieved based on inherent dominant features of Blockchain and smart contracts. This paper proposes a Blockchain-based framework for developing a digital traceability solution as a transparent and reliable communication between actors in an agricultural value chain toward building sustainable agriculture in Vietnam. Another contribution is to propose an enterprise Blockchain platform to build a traceability software solution. This means that there will be no relation to cryptocurrency, leading to not being limited by legal constraints in Vietnam. The experimental results also indicate that enterprise Blockchain platforms have suitable properties for deploying Blockchain-based applications in the agricultural sector.


## 2. The Proposed Framework

Storing data on the Blockchain will be executed by sending an interactive transaction to the smart contract. In the agricultural product traceability context, each task in the production farming process will be recorded and stored on Blockchain, leading to massive transactions proportional to the number of users. The proposed framework is designed according to the following objectives.(1)
Improving transaction processing capability: Due to the limitation of the Blockchain platform in terms of the maximum number of transactions processed at a time and the processing time of a block of data [17], the proposed system will be designed to combine similar data into the same transaction or minimize the number of transactions sent to the Blockchain for ensuring the processing performance and accommodating a large number of users.(2)
Ensuring data transparency and privacy: By leveraging the transparent property of Blockchain technology, all traceable data will be stored so that all participants can trace and authenticate on the Blockchain [18]. However, some parts of the data will be encrypted to ensure privacy, especially business-related confidential data.Figure1 depicts the overall architecture of the proposed framework based on a 4-layer model that is a revision of our previous work [19]. This framework enables us to develop a traceability software suite including various modules (e.g., administration, data collection, and traceability portal) according to different users’ roles via core services at the application layer. These modules will directly interact with each other and revolve around a Blockchain platform. Regarding the three remaining layers, the Blockchain data processing layer combined with the core services module at the application layer will act as a bridge between software applications and the smart contract layer. Meanwhile, the smart contract layer will handle the business logic, and the data will be stored at the Blockchain network layer.Figure 1
The overall architecture of the proposed framework.


### 2.1. Application Layer

The application layer consists of a software suite and a group of core services. The software suite includes mobile apps and web-based applications, which enable business owners (i.e., producers or manufacturers) to preconfigure farm descriptions such as crop information, production processes, and raw materials. In addition, the business owner can describe the number of employees in the business, employee identification information, and a separate action account for each employee. Meanwhile, employees (i.e., farmers) use their activated accounts to record daily production activities based on information preconfigured by the business owner. Moreover, a traceability portal will display the traceable information according to the QR code on the product scanned by end-users.Each product will be identified with a unique code represented in a QR code printed into a stamp and then affixed to the physical product. This method has the advantage of being low cost, suitable for the vast majority of products, and accessible to people who are not very familiar with high technologies (such as farmers). However, this cheap method cannot completely solve the anti-counterfeiting of things because QR codes can be easily copied and pasted on poor-quality products, which means multiple products have the same QR code (i.e., same identifier). To overcome this problem, when scanning the QR code, users will know the genuine distribution locations of the product, along with information on whether the product has been sold or not? Then, users will rely on the difference in the place of purchase (not in the official list that the QR code gives) or the product’s status (sold or unsold) to avoid buying the counterfeiting products. Additionally, as an innovative method proposed by Leng et al. [20], composing biological features or edible chemical signatures (besides the physical QR, RFID, and NFC) may be helpful for things counterfeiting in a distributed agriculture context.Each core service is a collection of related APIs and shares some common tasks. Designing core services can take advantage of inheritance, reduce programming effort, and ensure the consistency of the software system. These core services will communicate directly with the Blockchain data processing layer, send transactions to the Blockchain network for storing data, and interact with smart contract entities.(i)
Account Allocation service provides APIs so that other software modules can create digital objects (e.g., user accounts or production objects) in the database and smart contract entities (e.g., for storing digital identifiers).(ii)
ID Allocation service is trusted for other software modules to request for assigning identifiers to objects. The processing requests from the software will be asynchronous, leading to there can be many requests to generate new identifiers at the same time. Besides, the difference in processing time between the software application and the Blockchain network is also why the identifiers may overlap. Therefore, this service must ensure uniqueness, structure, and a secure coding system.(iii)
Traceability service provides APIs related to the traceability business, such as APIs for managing production areas, production objects, and production logging, or APIs for other tasks related to QR code stamps management.(iv)
Preorder service provides APIs that allow actors in the agricultural value chain to preorder agricultural products.


### 2.2. Blockchain Data Processing Layer

Conventionally, data will be confirmed almost instantaneously in traditional software systems, while Blockchain transactions will have a certain delay depending on how long a data block is created and confirmed on the network via a consensus mechanism, leading to challenges in data synchronization and performance guarantee. Besides, it is not easy to create transactions, addresses, or interactions directly on the Blockchain due to demands on technical skills. Therefore, we design the Blockchain data processing layer as a communication bridge for processing data to avoid data conflicts arising when users perform relevant functions on the Blockchain network. As shown in Figure1, this layer provides three groups of functions developed in the form of APIs that interact with smart contract entities deployed on Blockchain networks.(i)
Transaction Processing and Management module provides APIs to perform transaction information retrieval, transaction initialization, block information retrieval, and other related information. These APIs help users without much knowledge of Blockchain technology but still interact with the Blockchain network.(ii)
Data Query module provides APIs to perform data retrieval (e.g., user information, Blockchain address, or events generated by smart contracts) on the Blockchain network. These APIs help some actors participating in the ecosystem not necessarily become a node in the Blockchain system, which helps to eliminate redundant data and reduces the workload on database synchronization.(iii)
Key Management and Smart Contracts module provides APIs to help manage the secret keys and smart contract entities of whole accounts in the system. The most challenging issue is to provide a simple, transparent, and reliable mechanism to manage the secret keys for low-tech users. It must ensure that only authentic users can know and use their secret keys while the key’s manager cannot impersonate and manipulate them.


### 2.3. Smart Contract Layer

Smart contracts are used to describe the business processes and digitize objects participating in the value chain. Each object or group of objects will be digitized by a smart contract and interact with others. Each smart contract will be assigned a unique address for deploying on the Blockchain network. Transactions will be generated and sent to the corresponding contract address for recording or retrieving the object’s identification, description, and related information. Our proposed model organizes eight smart contracts into three groups, including Master, Object Identity, and Object Diary Contracts, as depicted in Figure2.Figure 2
The architecture of Smart Contract layer in the proposed framework.First, the contracts in theMaster Contracts group play a general executive role for the entire Blockchain system architecture.(i)
Factory contract will create an instance of the corresponding object identity contract depending on the information provided by the user.(ii)
Escrow contract describes the conditions between the two parties when making a preorder. Once a purchase is made in advance, all transaction information will be modeled into an instance based on this contract.(iii)
Data Storage contract stores important information about the Blockchain system, which keeps the Blockchain platform from being dependent on a centralized system and minimizes the risk of data loss.Second, the contracts in the Object Identity Contracts group are used to map physical objects to digital ones in the system on the Blockchain platform. Three contract types with different variable descriptions and functions represent three different types of objects in the real world.(i)
Entity Credential contract is used to digitalize the identities of real-world users, including farmers, producers, and consumers. Each user will have a corresponding instance of the contract and store his/her identity information. Each instance is identified by a Blockchain address, registered, and stored in the Data Storage contract.(ii)
Nonfungible Asset contract is used to supplement the Fungile Asset contract for describing the quantities of products having similar characteristics and relationships.(iii)
Fungible Asset contract is used to digitalize physical products such as agricultural products in our case study. These agricultural products will generate new contracts if they have different characteristics.Third, the contracts in theObject Diary Contracts group are responsible for creating and keeping operations related to objects on the Blockchain platform.(i)
Crop Diary contract represents a production crop, including farming activities for an agricultural product. This contract will be tied to a Fungible Asset contract.(ii)
Stamp Activation contract records the timestamps of activating the QR code stamp for harvested agricultural products and the Blockchain address of the next recipient in the ecosystem.


### 2.4. Blockchain Network Layer

There are currently numerous Blockchain networks, among which the well-known ones are Bitcoin, Ethereum, Binance Smart Chain, and Cardano. Each Blockchain network will solve a specific problem, but the most current ones are for finance and payment. A Blockchain network suitable for developing decentralized software applications (dApp) must support programming via smart contracts to support developing decentralized software applications. According to CoinMarketCap’s recent statistics, more than one hundred Blockchain projects currently support smart contracts in various programming languages. However, most Blockchain networks will be designed to be compatible with the Ethereum virtual machine (EVM) due to the completeness and efficiency of the Ethereum network.It should be noted that public Blockchain networks will require cryptocurrency as a transaction processing fee to maintain the network. For example, it takes about $0.05 for a simple cryptocurrency transaction (e.g., the transaction for recording farming diaries) in the Polygon Blockchain network, even though it is one of the cheapest transaction fees. Thus, public Blockchain networks are inappropriate choices for implementing traceability solutions. Instead, we will choose an enterprise Blockchain network [21, 22], in which Blockchain nodes will be deployed and operated by an organization. The primary goal is to store data on the Blockchain network transparently without using cryptocurrencies as transaction fees.


## 2.1. Application Layer

The application layer consists of a software suite and a group of core services. The software suite includes mobile apps and web-based applications, which enable business owners (i.e., producers or manufacturers) to preconfigure farm descriptions such as crop information, production processes, and raw materials. In addition, the business owner can describe the number of employees in the business, employee identification information, and a separate action account for each employee. Meanwhile, employees (i.e., farmers) use their activated accounts to record daily production activities based on information preconfigured by the business owner. Moreover, a traceability portal will display the traceable information according to the QR code on the product scanned by end-users.Each product will be identified with a unique code represented in a QR code printed into a stamp and then affixed to the physical product. This method has the advantage of being low cost, suitable for the vast majority of products, and accessible to people who are not very familiar with high technologies (such as farmers). However, this cheap method cannot completely solve the anti-counterfeiting of things because QR codes can be easily copied and pasted on poor-quality products, which means multiple products have the same QR code (i.e., same identifier). To overcome this problem, when scanning the QR code, users will know the genuine distribution locations of the product, along with information on whether the product has been sold or not? Then, users will rely on the difference in the place of purchase (not in the official list that the QR code gives) or the product’s status (sold or unsold) to avoid buying the counterfeiting products. Additionally, as an innovative method proposed by Leng et al. [20], composing biological features or edible chemical signatures (besides the physical QR, RFID, and NFC) may be helpful for things counterfeiting in a distributed agriculture context.Each core service is a collection of related APIs and shares some common tasks. Designing core services can take advantage of inheritance, reduce programming effort, and ensure the consistency of the software system. These core services will communicate directly with the Blockchain data processing layer, send transactions to the Blockchain network for storing data, and interact with smart contract entities.(i)
Account Allocation service provides APIs so that other software modules can create digital objects (e.g., user accounts or production objects) in the database and smart contract entities (e.g., for storing digital identifiers).(ii)
ID Allocation service is trusted for other software modules to request for assigning identifiers to objects. The processing requests from the software will be asynchronous, leading to there can be many requests to generate new identifiers at the same time. Besides, the difference in processing time between the software application and the Blockchain network is also why the identifiers may overlap. Therefore, this service must ensure uniqueness, structure, and a secure coding system.(iii)
Traceability service provides APIs related to the traceability business, such as APIs for managing production areas, production objects, and production logging, or APIs for other tasks related to QR code stamps management.(iv)
Preorder service provides APIs that allow actors in the agricultural value chain to preorder agricultural products.


## 2.2. Blockchain Data Processing Layer

Conventionally, data will be confirmed almost instantaneously in traditional software systems, while Blockchain transactions will have a certain delay depending on how long a data block is created and confirmed on the network via a consensus mechanism, leading to challenges in data synchronization and performance guarantee. Besides, it is not easy to create transactions, addresses, or interactions directly on the Blockchain due to demands on technical skills. Therefore, we design the Blockchain data processing layer as a communication bridge for processing data to avoid data conflicts arising when users perform relevant functions on the Blockchain network. As shown in Figure1, this layer provides three groups of functions developed in the form of APIs that interact with smart contract entities deployed on Blockchain networks.(i)
Transaction Processing and Management module provides APIs to perform transaction information retrieval, transaction initialization, block information retrieval, and other related information. These APIs help users without much knowledge of Blockchain technology but still interact with the Blockchain network.(ii)
Data Query module provides APIs to perform data retrieval (e.g., user information, Blockchain address, or events generated by smart contracts) on the Blockchain network. These APIs help some actors participating in the ecosystem not necessarily become a node in the Blockchain system, which helps to eliminate redundant data and reduces the workload on database synchronization.(iii)
Key Management and Smart Contracts module provides APIs to help manage the secret keys and smart contract entities of whole accounts in the system. The most challenging issue is to provide a simple, transparent, and reliable mechanism to manage the secret keys for low-tech users. It must ensure that only authentic users can know and use their secret keys while the key’s manager cannot impersonate and manipulate them.


## 2.3. Smart Contract Layer

Smart contracts are used to describe the business processes and digitize objects participating in the value chain. Each object or group of objects will be digitized by a smart contract and interact with others. Each smart contract will be assigned a unique address for deploying on the Blockchain network. Transactions will be generated and sent to the corresponding contract address for recording or retrieving the object’s identification, description, and related information. Our proposed model organizes eight smart contracts into three groups, including Master, Object Identity, and Object Diary Contracts, as depicted in Figure2.Figure 2
The architecture of Smart Contract layer in the proposed framework.First, the contracts in theMaster Contracts group play a general executive role for the entire Blockchain system architecture.(i)
Factory contract will create an instance of the corresponding object identity contract depending on the information provided by the user.(ii)
Escrow contract describes the conditions between the two parties when making a preorder. Once a purchase is made in advance, all transaction information will be modeled into an instance based on this contract.(iii)
Data Storage contract stores important information about the Blockchain system, which keeps the Blockchain platform from being dependent on a centralized system and minimizes the risk of data loss.Second, the contracts in the Object Identity Contracts group are used to map physical objects to digital ones in the system on the Blockchain platform. Three contract types with different variable descriptions and functions represent three different types of objects in the real world.(i)
Entity Credential contract is used to digitalize the identities of real-world users, including farmers, producers, and consumers. Each user will have a corresponding instance of the contract and store his/her identity information. Each instance is identified by a Blockchain address, registered, and stored in the Data Storage contract.(ii)
Nonfungible Asset contract is used to supplement the Fungile Asset contract for describing the quantities of products having similar characteristics and relationships.(iii)
Fungible Asset contract is used to digitalize physical products such as agricultural products in our case study. These agricultural products will generate new contracts if they have different characteristics.Third, the contracts in theObject Diary Contracts group are responsible for creating and keeping operations related to objects on the Blockchain platform.(i)
Crop Diary contract represents a production crop, including farming activities for an agricultural product. This contract will be tied to a Fungible Asset contract.(ii)
Stamp Activation contract records the timestamps of activating the QR code stamp for harvested agricultural products and the Blockchain address of the next recipient in the ecosystem.


## 2.4. Blockchain Network Layer

There are currently numerous Blockchain networks, among which the well-known ones are Bitcoin, Ethereum, Binance Smart Chain, and Cardano. Each Blockchain network will solve a specific problem, but the most current ones are for finance and payment. A Blockchain network suitable for developing decentralized software applications (dApp) must support programming via smart contracts to support developing decentralized software applications. According to CoinMarketCap’s recent statistics, more than one hundred Blockchain projects currently support smart contracts in various programming languages. However, most Blockchain networks will be designed to be compatible with the Ethereum virtual machine (EVM) due to the completeness and efficiency of the Ethereum network.It should be noted that public Blockchain networks will require cryptocurrency as a transaction processing fee to maintain the network. For example, it takes about $0.05 for a simple cryptocurrency transaction (e.g., the transaction for recording farming diaries) in the Polygon Blockchain network, even though it is one of the cheapest transaction fees. Thus, public Blockchain networks are inappropriate choices for implementing traceability solutions. Instead, we will choose an enterprise Blockchain network [21, 22], in which Blockchain nodes will be deployed and operated by an organization. The primary goal is to store data on the Blockchain network transparently without using cryptocurrencies as transaction fees.


## 3. Implementation

We adopt JavaScript language with the Nodejs Framework to implement modular software on the server side. Meanwhile, desktop applications are implemented using JavaScript’s ReactJS framework, compatible with the server side, and can speed up the response to user requests. Besides, we utilize MongoDB as the database because MongoDB is a NoSQL database management system appropriate for storing and querying large volumes of data with high access speed.


### 3.1. Blockchain Network Selection

By investigating several suitable Blockchain platforms, we choose VBChain since it supports various EVM-compatible Blockchain networks and famous open-source codes such as Open Ethereum or Hyperledger Besu. In this study’s scope, we deploy our application software modules on a preconfigured Blockchain network with the setting parameters summarized in Table1.Table 1
VBChain’s configuration for deploying our application software module.
VBChain∗DescriptionBlockchain Node’s source codeOpen Ethereum (https://openethereum.github.io/)ConsensusProof of authority (PoA) [23]#Validator node3The min. Processing time per block15 (seconds)The max. Gas per block240.000.000∗https://vietnamblockchain.asia/.


### 3.2. Smart Contracts’ Implementation

Smart contracts are implemented based on common standards of the Ethereum community called Ethereum Request for Comment (ERC) to ensure the system’s compatibility with other decentralized applications. As depicted in Figure3, all smart contracts in the proposed framework (see Figure 1) inherit a common smart contract entity according to the ERC-165 standard. In detail, the master contracts, including Factory, Escrow, and Data Storage, will be first deployed on the Blockchain network to operate the whole system. Then, the object identity contracts will be created on the Blockchain network once an object (e.g., a user account, product type, crop diary, or stamp activation) is created in the software application. The object identifier contracts, including Entity Credential, Nonfungible Asset, and Fungible Asset, are described as follows:(i)
Entity Credential contract utilizes ERC-735 for structured storage and verifying claims about that user (such as identifiers). Meanwhile, it adopts ERC-725 to manage user-related access keys and smart contracts.(ii)
Nonfungible Asset contract uses ERC-721 to digitalize a real-world object into a digital one on the Blockchain network. Each group of objects (with the same description) will be digitized as an entity of an ERC-721-based smart contract, and the objects in the same group are distinguished by a unique identifier.(iii)
Fungible Asset contract uses ERC-20 to describe the number of agricultural products on the Blockchain network. An entity of this contract will be attached to an instance of a Nonfungible Asset contract on the Blockchain network.Figure 3
The diagram of smart contract implementation.


## 3.1. Blockchain Network Selection

By investigating several suitable Blockchain platforms, we choose VBChain since it supports various EVM-compatible Blockchain networks and famous open-source codes such as Open Ethereum or Hyperledger Besu. In this study’s scope, we deploy our application software modules on a preconfigured Blockchain network with the setting parameters summarized in Table1.Table 1
VBChain’s configuration for deploying our application software module.
VBChain∗DescriptionBlockchain Node’s source codeOpen Ethereum (https://openethereum.github.io/)ConsensusProof of authority (PoA) [23]#Validator node3The min. Processing time per block15 (seconds)The max. Gas per block240.000.000∗https://vietnamblockchain.asia/.


## 3.2. Smart Contracts’ Implementation

Smart contracts are implemented based on common standards of the Ethereum community called Ethereum Request for Comment (ERC) to ensure the system’s compatibility with other decentralized applications. As depicted in Figure3, all smart contracts in the proposed framework (see Figure 1) inherit a common smart contract entity according to the ERC-165 standard. In detail, the master contracts, including Factory, Escrow, and Data Storage, will be first deployed on the Blockchain network to operate the whole system. Then, the object identity contracts will be created on the Blockchain network once an object (e.g., a user account, product type, crop diary, or stamp activation) is created in the software application. The object identifier contracts, including Entity Credential, Nonfungible Asset, and Fungible Asset, are described as follows:(i)
Entity Credential contract utilizes ERC-735 for structured storage and verifying claims about that user (such as identifiers). Meanwhile, it adopts ERC-725 to manage user-related access keys and smart contracts.(ii)
Nonfungible Asset contract uses ERC-721 to digitalize a real-world object into a digital one on the Blockchain network. Each group of objects (with the same description) will be digitized as an entity of an ERC-721-based smart contract, and the objects in the same group are distinguished by a unique identifier.(iii)
Fungible Asset contract uses ERC-20 to describe the number of agricultural products on the Blockchain network. An entity of this contract will be attached to an instance of a Nonfungible Asset contract on the Blockchain network.Figure 3
The diagram of smart contract implementation.


## 4. Results and Discussion

### 4.1. Pilot Deployment

We develop a prototype of traceability software, as shown in Figure4, to demonstrate and evaluate the proposed framework. Our traceability software solution has been deployed at the Kata Farm Group, located in Dak Lak province, Vietnam, for six months with the recorded information as follows.(i)
Standardize and digitize 291 production objects(ii)
Record 3746 production logs(iii)
Perform 92 stamp activations with a total of 5823 stamps affixed to the final product.(iv)
Generate a total of 4131 transactions on the Blockchain networkFigure 4
The architecture of a prototype of traceability software solution based on the proposed framework.


### 4.2. Transaction Fee Evaluation

Table2 summarizes a sample process, including the main steps to create products with activated stamps so that users can trace the origin information. As seen, it takes seven transactions to complete the stamp activation step; the total GAS fee for processing these seven transactions is 10,967,832; and the consuming storage space is 3,793 Bytes (i.e., 3.7 KB). Then, we conduct a comparison with several EVM-compatible Blockchain platforms to evaluate the transaction fee.Table 2
A breakdown of transaction processing costs for a sample product.
Tasks∗ registration(1) product creation(2) crop creation(3) production diary∗ stamp activationTotal#Transactions111317GAS fee4,820,5224,629,425142,2161,116,464259,20510,967,832Storage (bytes)1,6793362061,2013713,793As shown in Table3, the cheapest transaction fee (on Polygon Network) is about $0.68, while the most expensive cost (on the public Ethereum) is much higher, about $2,926 for a sample case study in Table 2. However, in practice, users will create a massive number of transactions to record farming diaries of various products and seasons. Consequently, the transaction fee will be a significant barrier for users intending to adopt traceability software on the Blockchain. Thus, we suggest adopting an Enterprise Blockchain platform to deploy the traceability software without any transaction fee.Table 3
Transaction fee comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkNative tokenNoETHBNBMATICNative token price∗No∼ $2,900∼$401∼$1.24Standard GAS price092∗ 10−9 ETH5∗ 10−9 BNB50∗ 10−9 MATICTotal transaction fee for 10,967,832 GAS0∼$2,926∼$22$0.68∗Reference price at April 28th, 2022 from CoinMarketCap.


### 4.3. Processing Performance and Storage Usage Evaluation

The transaction processing time (txps) [24] can be considered the Blockchain networks’ performance, calculated as the number of transactions in a block divided by a block’s processing time. Table 4 summarizes the comparison results of several popular EVM-compatible Blockchain networks. Binance Smart Chain has the best performance with 23 txps, which is better than the currently configured VBChain with 14 txps. However, the theoretical processing speed of enterprise Blockchain networks should be much faster than public Blockchain networks because it adopts a smaller number of nodes and the consensus rules with some centralized factors rather than fully decentralization [25]. Therefore, we can investigate further to find the best configuration of VBChain with better performance.Table 4
Processing performance comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkBlock time (second)151432GAS limit per block240,000,00030,000,00080,000,00020,000,000GAS used per sample transaction1,116,464Maximum transaction per block214267117Transaction per second14.261.8523.668.5In addition to transaction costs and processing time, storage usage should be considered when applying Blockchain technology [11]. Since all data recorded on the Blockchain network will grow larger and larger over time. Table 5 summarizes the daily storage usage inferred from the processing capability in Table 4, assuming that the system operates at 100% capacity. Accordingly, VBChain can process 1232064 transactions per day and consume 1411 MB of storage space. This result is reasonable because the faster the processing speed is, the more storage usage is.Table 5
Storage usage comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkTransaction per second (Table4)14.261.8523.668.5Transaction per day1,232,064159,8402,044,244734,400Data size per sample transaction1201 bytesMaximum data storage per day1,411 MB183 MB2,341 MB841 MB


### 4.4. The Data Security Issues in the Off-Chain Information Flow

Most conventional software solutions deployed across multiple enterprises will store customer data in the same centralized database. This forces enterprises to share data with at least the software vendor, and the security of the data will depend on the software provider’s capability. Meanwhile, in our proposed approach, each enterprise will have a private database storing only its data. However, before storing data in the enterprise’s database, this data will be hashed and stored on the Blockchain network (shared by all businesses) via smart contracts. This approach helps stakeholders proactively choose and adopt appropriate methods to ensure data security while still retaining the ability to verify the correctness of data by using uneditable hashes stored on the Blockchain network. Additionally, the proposed approach can avoid single-point database failure, which means that other enterprises’ data will still be safe when one’s database is hacked or exploited.


## 4.1. Pilot Deployment

We develop a prototype of traceability software, as shown in Figure4, to demonstrate and evaluate the proposed framework. Our traceability software solution has been deployed at the Kata Farm Group, located in Dak Lak province, Vietnam, for six months with the recorded information as follows.(i)
Standardize and digitize 291 production objects(ii)
Record 3746 production logs(iii)
Perform 92 stamp activations with a total of 5823 stamps affixed to the final product.(iv)
Generate a total of 4131 transactions on the Blockchain networkFigure 4
The architecture of a prototype of traceability software solution based on the proposed framework.


## 4.2. Transaction Fee Evaluation

Table2 summarizes a sample process, including the main steps to create products with activated stamps so that users can trace the origin information. As seen, it takes seven transactions to complete the stamp activation step; the total GAS fee for processing these seven transactions is 10,967,832; and the consuming storage space is 3,793 Bytes (i.e., 3.7 KB). Then, we conduct a comparison with several EVM-compatible Blockchain platforms to evaluate the transaction fee.Table 2
A breakdown of transaction processing costs for a sample product.
Tasks∗ registration(1) product creation(2) crop creation(3) production diary∗ stamp activationTotal#Transactions111317GAS fee4,820,5224,629,425142,2161,116,464259,20510,967,832Storage (bytes)1,6793362061,2013713,793As shown in Table3, the cheapest transaction fee (on Polygon Network) is about $0.68, while the most expensive cost (on the public Ethereum) is much higher, about $2,926 for a sample case study in Table 2. However, in practice, users will create a massive number of transactions to record farming diaries of various products and seasons. Consequently, the transaction fee will be a significant barrier for users intending to adopt traceability software on the Blockchain. Thus, we suggest adopting an Enterprise Blockchain platform to deploy the traceability software without any transaction fee.Table 3
Transaction fee comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkNative tokenNoETHBNBMATICNative token price∗No∼ $2,900∼$401∼$1.24Standard GAS price092∗ 10−9 ETH5∗ 10−9 BNB50∗ 10−9 MATICTotal transaction fee for 10,967,832 GAS0∼$2,926∼$22$0.68∗Reference price at April 28th, 2022 from CoinMarketCap.


## 4.3. Processing Performance and Storage Usage Evaluation

The transaction processing time (txps) [24] can be considered the Blockchain networks’ performance, calculated as the number of transactions in a block divided by a block’s processing time. Table 4 summarizes the comparison results of several popular EVM-compatible Blockchain networks. Binance Smart Chain has the best performance with 23 txps, which is better than the currently configured VBChain with 14 txps. However, the theoretical processing speed of enterprise Blockchain networks should be much faster than public Blockchain networks because it adopts a smaller number of nodes and the consensus rules with some centralized factors rather than fully decentralization [25]. Therefore, we can investigate further to find the best configuration of VBChain with better performance.Table 4
Processing performance comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkBlock time (second)151432GAS limit per block240,000,00030,000,00080,000,00020,000,000GAS used per sample transaction1,116,464Maximum transaction per block214267117Transaction per second14.261.8523.668.5In addition to transaction costs and processing time, storage usage should be considered when applying Blockchain technology [11]. Since all data recorded on the Blockchain network will grow larger and larger over time. Table 5 summarizes the daily storage usage inferred from the processing capability in Table 4, assuming that the system operates at 100% capacity. Accordingly, VBChain can process 1232064 transactions per day and consume 1411 MB of storage space. This result is reasonable because the faster the processing speed is, the more storage usage is.Table 5
Storage usage comparison.
CriteriaPlatformEnterprise blockchain (VBChain)EthereumBinance smart chainPolygon networkTransaction per second (Table4)14.261.8523.668.5Transaction per day1,232,064159,8402,044,244734,400Data size per sample transaction1201 bytesMaximum data storage per day1,411 MB183 MB2,341 MB841 MB


## 4.4. The Data Security Issues in the Off-Chain Information Flow

Most conventional software solutions deployed across multiple enterprises will store customer data in the same centralized database. This forces enterprises to share data with at least the software vendor, and the security of the data will depend on the software provider’s capability. Meanwhile, in our proposed approach, each enterprise will have a private database storing only its data. However, before storing data in the enterprise’s database, this data will be hashed and stored on the Blockchain network (shared by all businesses) via smart contracts. This approach helps stakeholders proactively choose and adopt appropriate methods to ensure data security while still retaining the ability to verify the correctness of data by using uneditable hashes stored on the Blockchain network. Additionally, the proposed approach can avoid single-point database failure, which means that other enterprises’ data will still be safe when one’s database is hacked or exploited.


## 5. Conclusions

Thanks to Blockchain technology, the proposed framework can provide transparent information helping actors in the agricultural value chain have a reliable communication method in the digital environment, leading to mutual benefits for all parties toward sustainable agriculture in Vietnam. Applying Blockchain technology in traceability will help protect related stakeholders when something goes wrong. For example, farmers can prove the product’s quality or government agencies can handle wrongdoing with reliable and undeniable evidence. The traceability information stored in the Blockchain will be a reliable reconciliation since this information is immutable and transparent without being manipulated by any individual or organization. Any actor can conduct a verification process in the system.We have also analyzed, evaluated, and compared EVM-compatible Blockchain platforms in terms of technology application. The results indicate that an enterprise Blockchain platform is suitable for practical application in Vietnam because it does not use cryptocurrency to pay transaction fees, so it is not limited by legal constraints in Vietnam.In the future, we will study incorporating IoT devices [26] to help manufacturers collect data automatically, save human resources, or combine with AI solutions to support information standardization and detect “scans” at suspicious times and places to warn consumers promptly. Additionally, as proposed and demonstrated in [27], the optimization and self-learning ability of Blockchain applications are critical for realizing system sustainability, which is an essential metric of Blockchain technology adoption in the agriculture sector. We will digitalize and integrate the farming process dedicated to each product type to optimize farming activities by adopting AI algorithms in data analytics.Although most existing approaches adopting Blockchain technology aim to enhance data security and transparency to support traceability. However, Blockchain itself also has security issues elaborated and presented systematically in [28], which give some considerable directions in our further studies.



---

*Source: 1834873-2022-07-14.xml*