# Application of Blockchain Technology in Water Rights Trading in the Irrigation Area under the Internet-of-Things Environment

Authors: Yang Li; Jiancang Xie; Jianghua Yang; Jian Ren; Nan Zhai
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Water rights trading is an important way to solve the shortage of water resources. Combined with the characteristics of water resources and the requirements of the market economy, the organic combination of the government and the market should be strengthened. Through the establishment of a water rights system and a water rights trading market, the implementation of water rights trading will be promoted. Due to the decentralized and distributed structure, blockchain technology greatly reduces its intermediary cost in the application process. The tamper-resistant timestamp feature can realize data tracking and information anticounterfeiting, and flexible programming attributes can promote the specification of market order. Firstly, the reasons for water rights trading are studied, and the water rights trading system is analyzed. It is found that the system has the problems of the cumbersome transaction process and high transaction costs. According to the characteristics of water rights trading, the alliance chain Hyperledger Fabric is selected as the underlying network system of the trading system. Secondly, combined with water rights trading, Hyperledger Fabric multichannel technology is used to design a three-channel accounting method, and the chain code for water rights trading is designed and implemented based on the Go language. CouchDB is adopted to store key-value data, and Ubuntu, Docker, and Docker Compose are used to construct an operating environment of the chain code. Finally, the proposed system is tested. The test findings reveal that the distributed water volume of experimental area 1 is 41.8368 million m3, the current water volume is 23.831 million m3, and the quota management water volume is 20.432 million m3. The distributed water volume in area 2 is 40.4605 million m3, the current water volume is 4317.64 m3, and the quota management water volume is 77.4795 million m3. The distributed water volume in area 3 is 65.6928 million m3, the current water volume is 77.472 million m3, and the quota management water volume is 64.412 million m3. The water rights trading system based on Hyperledger Fabric can record each transaction data, which can be stored in each node, and the data stored in each node are the same. The proposed scheme provides a certain reference for the application of blockchain technology in water rights trading in irrigation areas.


---

## Body

## 1. Introduction

Nature is a necessary condition for people’s life and economic and social progress, a basic nature, a strategic economic and social capital, and a key control function of the Earth’s ecological environment. Due to the prominent contradiction between the supply and demand of water resources in China, the awareness of water conservation in the whole society is generally not strong, the water management is extensive, and the phenomenon of waste is serious. The contradiction between the supply and demand of water resources in China’s northwest inland areas is also more prominent. For the allocation and utilization of water resources among various water rights subjects, serious and frequent conflicts of interest have arisen [1, 2]. The most stringent water resource management system, dual control over the quantity and intensity of natural resource consumption, and the “reverse pressure” to build an energy-saving society in an all-round way will promote the development of the international natural resource rights exchange mechanism into an effective solution to international water use indicators and water consumption. It is very critical to dynamically adjust the time, quantity, and quality of natural resources and to manage the property rights and use management of natural resources [3, 4]. The process of water rights trading takes the “water rights holder” as the main body of the market. Through the transaction process of water use rights, the use of water rights has become a flexible resource with market value. And through the socialist market mechanism, the water rights holders with lower water benefits can save social water by taking into account the opportunities and costs of social water use or transfer part of the water rights to the water users with higher intermediate benefits of social water use, so that new or potential water users have more opportunities to obtain the required natural resources and thus achieve the purpose of improving the overall benefit of social water use. The process of water rights trading is essentially the sale and purchase of use rights. The purchase price of water rights will deduct the costs and expenses of the later construction water price, to reflect the original functional characteristics and scarcity of water natural resources, that is, the resource production cost of social water resources. Water rights trading establishes the basic price, which will change with the fluctuation of various factors such as market supply and demand, competition, and so on, resulting in the final transaction price. To avoid the failure of the commodity trading market, which leads to the deviation of the transaction price from the actual price of the water rights market, the relevant authorities are required to formulate reference prices for water rights and interests trade when necessary to ensure the smooth operation of the trading market [5, 6].Researchers have also carried out a lot of research work in the corresponding fields. Ni et al. [7] pointed out that the water rights system is a vital economic means to solve the problems of water shortage and uneven spatial distribution. To ensure that the water rights trading price is formed in the market competition, and considering the principles of “fairness” and “efficiency,” it is necessary to establish a reference price suitable for China’s water rights trading. They used the water resources value model and the improved price ceiling model to determine the upper and lower thresholds of the reference price of water rights trading, established the price model, and conducted an empirical analysis. Du [8] proposed that, with the increasingly serious problems of water security and water shortage in the Yellow River Basin, establishing a fair and efficient water rights distribution system is an important way to improve the efficiency of water resources utilization and achieve high-quality development. To this end, a national-level canal system-irrigated area farmers’ two-level water rights allocation model is implemented. The Gini coefficient method was used to construct a water rights allocation model for farmers in line with the principle of equity. The method fully taps the water-saving potential of the irrigation area, improves the fairness of the initial water rights distribution, and can provide a scientific basis for the development of the water rights distribution of irrigation water users in the Yellow River irrigation area. Jiang et al. [9] established a simulation model of water resource allocation in the pond irrigation area in view of the importance and complexity of water resource regulation in the pond irrigation system in the Jianghuai hilly and gully area. Setiaji et al. [10] argue that the Internet of Things (IoT) has played a critical role in enhancing the intelligence already deployed in agriculture. Smart farming is an emerging concept because IoT sensors are able to aggregate information about their agricultural fields in real-world environments. They aim to investigate the state-of-the-art implementation of IoT-based agricultural monitoring systems worldwide. To sum up, water resource value accounting is not only a vital theoretical issue in the science of water resources, but also one of the basic issues in the study of water rights transaction price. Based on the emergy theory, it is an effective method to calculate the value of water resources, especially for the evaluation and compensation of the value of regional water resources. However, the current research using this method fails to fully consider market factors; that is to say, there is still a lack of research on the value transfer formed by the flow of water resources between different industries. At present, some achievements have been made in the research on the formation mechanism of the water rights transaction price, but most experts believe that its formation mechanism is not perfect, the market adjustment mechanism has not fully played its role, and the composition of transaction prices cannot fully reflect the value of water resources, and further research is needed.The objective of water rights trading is to make water rights a highly liquid capital with market transaction prices. The main purpose of implementing the water rights exchange system is that the water rights holders with less water benefit can transfer the water rights to the water rights holders with higher water efficiency. On the one hand, it can induce the transferor of the right to use water to pay more attention to the cost of water use. On the other hand, it can make the supply and demand side obtain more valuable natural resources, thereby improving the comprehensive benefit of water use for the whole society. At present, the Chinese theoretical circles have carried out a lot of discussions on the water rights trading model, and many new research results have also appeared. However, because these results mainly provide suggestions from the system and management aspects, and in terms of technology, there are relatively few studies on the quality and efficiency of accelerated water rights trading, so that the basic technical problems of water rights trading have not been able to fundamentally achieve a major breakthrough and improvement. In response to this, it is necessary to take the initiative to learn from and introduce the latest scientific research results, to improve the efficiency and benefit of the water rights trading process on the basis of technology. The key point is to further study the practical application of blockchain technology on account of the theory and practice of water resources supervision research and analyze the possibility of using blockchain technology in water resources supervision, to improve water rights trading and promote the advancement of water resource management efficiency.The research on water rights management is very industry-specific work. It adopts the research method of combining theory and practice to extensively collect and retrieve relevant results from domestic water rights management pilots. On the basis of drawing on and using existing experience, combined with the characteristics of water rights management at the current stage, the distribution and dynamic adjustment of water resources are fully realized. The basic framework system of water rights management is proposed from the aspects of initial water rights distribution, water rights transaction management, and water market supervision. The research is guided by the Scientific Outlook on Development, follows the research principles of combining theory and practice and qualitative and quantitative research, and combines theoretical and practical issues to discuss and improve the scientificity of these results.The innovation lies in combining regional economic development planning and ecological environmental protection goals. Based on the concept of “determining land with water and development with water,” starting from the systematic relationship of “agricultural water saving-economic development-ecological environment,” the water rights transactions model is constructed, and the available water-saving benefits are calculated. Under the new development concept, water resources are rationally allocated by exploring the way of water rights trading. The contribution is that, starting from the main path of agricultural water-saving in agricultural management, it integrates the initial water rights allocation, the comprehensive reform of agricultural water price, and the water rights trading model. A technical integration scheme for agricultural water management in irrigation areas has been initially constructed. The implementation ideas of agricultural water-saving management have been clarified, and certain results have been achieved.The first chapter describes the core concepts and theoretical basis of water rights management.The second chapter discusses the relationship between water rights transactions and the blockchain system and uses blockchain technology to implement the water rights transaction price model.The third chapter studies the chain code business logic of the water rights trading system and designs the Hyperledger Fabric chain code.The fourth chapter makes an in-depth analysis of the experimental results.The fifth chapter summarizes the results and points out the deficiencies and future research directions.


## 2. Water Rights Trading and Blockchain System

### 2.1. The Theory of Water Rights and the General Situation of the Research Area

The term water rights originates from the concept of property rights and related theories, namely, the property rights of water resources. As far as the definition of water rights is concerned, the theoretical circle has not yet reached a unified consensus. The definition of water rights in China’s academic circles can be roughly divided into three theories: one element, two elements, and multiple elements. China’s land law and water law have made specific regulations on the ownership of natural resources, and asset owners also belong to the country, which provides a direction for the rational distribution of natural resources in China. The concept of land monism is also recognized by many Chinese civil law researchers, and its nature is a new type of usufruct or quasi-property right. The distribution methods and models of the original water rights and interests in most countries are also the distribution methods of the ownership of natural resources. Under the background that the ownership is completely owned by the state, due to the need to reexamine the monism, and according to laws and regulations, the relevant national natural resource supervision and management agencies can allocate the original water rights and interests between different regions, different levels, and different industries in the country, so its distribution is actually the state’s distribution method for the use of natural resources. In addition to the basic property rights such as the nature of income, exclusivity, finiteness, and exchangeability, water rights are obviously dynamic and hierarchical compared with other natural resource rights [11, 12]. The allocation of water rights is not a one-time process, but a dynamic behavior. In different periods of social development, agriculture, industry, life, and ecology have different demands on water resources. Under the principle of priority in the west of the United States, water users will lose their water rights when they use water improperly or not. Mexico adjusts water rights every 10 years, which reflects the dynamic nature of water resources property rights. The multilevel definition of water rights refers to the top-down distribution process of water rights in the central-local, local-community, community-water users or in the basin-province-city-county-township-water user [1, 13].Water rights trading has its unique characteristics, such as initial allocation after water rights trading, calculation of variable water rights, water rights that change with seasonal changes, and whether water rights can be traded twice. These are all questions that must be considered. Before using the blockchain network for sharing, countermeasures must be considered. (1) Initial allocation of water rights: The initial water rights in water rights trading must be carried out by the water conservancy department, and the initial water rights must comply with five basic principles. After the initial allocation of water rights, the water user obtains the water rights license, and its use period is usually 3 years [14–16]. After the expiry, the water conservancy department will reissue the water right certificate in the light of the actual situation. Using the blockchain network, the user’s data is regularly managed. (2) Regular dynamic management: In some areas, due to seasonal changes, the amount of water will vary greatly. Therefore, dynamic management of water resources is required to make better use of water resources. After using blockchain technology, data can be updated frequently to achieve precise distribution [17, 18]. Figure 1 shows the water use procedures in the water rights market in the irrigation area, and Figure 2 indicates the procedure of water rights trading in the canal irrigation area.Figure 1
Water use procedures in the water rights market in the irrigation area.Figure 2
The procedure of water rights trading in the canal irrigation area.The market-type transaction process includes three links: transaction application, transaction review, and posttrade water volume change. The specific procedures are as follows: (1) The water farmers or water use groups submit the demand for sale or purchase to the water user association. (2) The water user association examines whether the transaction application meets the conditions. (3) If the review is passed, the association will log in to the platform to submit the application form for water volume trading; if the review fails, it will refuse to submit the application form. (4) The association submits the application for completion of the transaction and waits for the approval of the superior administrative unit. The specific review steps are as follows: (1) The water user association submits the application form, which is first reviewed by the township water resources management office, and the follow-up operation is continued after the review is passed. If it is not approved, the application form will not participate in this round of market transactions. Meanwhile, the association will be notified to modify the application form information until the transaction conditions are met. (2) After the approval of the township water resources management office, the water management station in the irrigation area will review the transaction application form. After the approval, the application form will be transferred to the irrigation area water rights trading center for further review. Otherwise, the water volume transaction application form will not be able to participate in the market-type transaction, and the water user association will be notified to modify the application form information. (3) After the water management station in the irrigation area is approved, the application form will be reviewed by the water rights trading center in the irrigation area. After approval, it waits for market transactions. Otherwise, the association will be informed to revise the information on this form. (4) The irrigation area water rights trading center has passed the review; it will wait for the market-type transaction. (5) The trading center will carry out water rights trading at the specified time to complete this round of market transactions. At the same time, the water volume data of the seller’s association is locked, waiting for payment confirmation, and the water volume data is transferred.After the transaction is successful, the process of water distribution is expressed in Figure2. (1) After the market is successfully matched, the water user association that has reached the water volume transaction will go to the corresponding water rights trading center to pay and settle the bill within the specified time. (2) The system background of the irrigation area water rights trading center is logged in, the corresponding transaction records are found, and the payment action is confirmed. (3) The system confirms the payment, and the seller’s association reduces the amount of water sold. At the same time, the reduced water volume is allocated to the water volume account of the buyer’s association. (4) The confirmation of payment and water allocation are completed. This round of market-type transactions is completed.Helan County is located in the middle of the Qingtongxia irrigation area in Ningxia, through which Hanyan Canal, Huinong Canal, Tangtan Canal, and Xigan Canal pass. In 2020, the irrigated area is 40,000 hm2, and the effective irrigation area is 39,000 hm2 [19, 20]. In the same year, the total amount of water drawn by Helan County is 555.0 million m3, and the total amount of water consumption confirmed is 469.3 million m3, of which agricultural water consumption is 432.0 million m3, ecological water consumption is 09.3 million m3, industrial water consumption is 18.0 million m3, and domestic water consumption is 100 million m3. The available surface water of the Yellow River is 278.0 million m3 [21, 22].


### 2.2. Overview of Blockchain Technology

Blockchain is one of the most popular new technologies in recent years, first born in Bitcoin. Bitcoin is currently the most successful blockchain application. A blockchain is a chronological order of blocks. Each block contains the hash value of the previous block. If the content of the block is changed, the hash value of the block will change. All subsequent blocks of this block must be changed. And in a distributed network, it is impractical to change the data stored by all nodes, so the blockchain has the property that it cannot be tampered with. A complete blockchain system includes encryption, Peer-to-Peer (P2P), workload verification, and other technologies. Encryption technology ensures that the data chain cannot be tampered with. P2P establishes a distributed system on the basis of blockchain and solves the consistency problem through proof of workload [23, 24].According to the access mechanism, blockchain can be divided into the public chain, alliance chain, and private chain. (1) In an open public chain, any node can enter and exit at any time without any authority. All nodes are noncentralized, without any personal or organizational constraints, and rely entirely on encryption algorithms to ensure their security. The most typical examples are Ethereum and Bitcoin. (2) Only members within the alliance can participate, and the use of the alliance usually requires the support of certification agencies. Members who enter the alliance will be certified, and each node must be authenticated to join. It can be used between different alliances. The alliance chain can read and write to nonalliance members by developing the Application Programming Interface (API). Typical alliance chain applications are Super Magic and R3Corda. (3) Private chain means that all write permissions are in one organization, and the organization can set rules at will in a specific environment. Some institutions can even change the trading rules. Used internally in the company, to exchange the speed of business, some noncentral functions are sacrificed. Through the introduction of the public chain and the alliance chain, it can be found that the alliance chain has the right to manage, and the controllability and scalability of the system are relatively good. (1) Since random water rights trading will have a certain impact on the ecological environment, water rights trading is usually dominated by the government, with the participation of other water rights agencies and the majority of users. Users must go through formal identity verification before entering the trading system, and the initial water rights information must be formally authenticated, so they must have corresponding permissions to manage. (2) Since the water rights data will change with the seasons, the government must dynamically update the water resources, and the alliance chain is a dynamic management method; therefore, it is chosen. (3) The public chain is usually a single blockchain, and its data exists in one chain, so it is not practical to design such a blockchain. The alliance chain hyperspace database adopts a logical multichannel method, allowing multiple links to exist in parallel, and can store data at the same time. Water rights trading can be specially designed using this feature of the alliance chain super protocol. Consequently, water rights trading is more suitable for the alliance chain. On this basis, the growth of the water rights trading system is carried out using Hyperledger Fabric. The schematic diagram of the blockchain structure is displayed in Figure3.Figure 3
Schematic diagram of the blockchain structure.Through the above interpretation of the concept of blockchain, it can be seen that its application in transaction management has the following typical characteristics. First, open consensus: When applying blockchain technology, any transaction subject can participate in the node, and each node can obtain a copy of the consensus. Then, the maintenance of the entire blockchain is achieved through a consensus mechanism that is jointly followed. Even if a node is lost in the middle, it will not interfere with the integrity of other nodes. Second, decentralization and trustless: It has the characteristics of decentralization. The entire blockchain does not need a central management agency, and there is no need to build a mutual trust mechanism between different nodes. It obtains trust through P2P and digital signature methods. All nodes abide by the operating rules of the blockchain and cannot deceive other nodes. Third, the transaction process is transparent. The rules of the blockchain are open to the entire network, and all transaction behaviors are broadcast to all nodes in the blockchain, so the transaction process is very transparent. Due to the trustless nature of the blockchain, transaction entities can hide their identities during transactions; that is, anonymous transactions can be realized between each entity. At last, it cannot be tampered with. When blockchain technology is applied to the field of transaction settlement, it also has a significant advantage; that is, it cannot be tampered with. All nodes in the blockchain have copied data. Even if one node modifies the data, it cannot propagate the modification to other nodes, which greatly ensures the transparency of the transaction process. Moreover, the nodes in the blockchain are linked through cryptography and timestamps, so each transaction record has a high degree of traceability, which is of obvious significance for transaction management and ensuring transaction fairness. Through using blockchain technology, it is possible to record the application and demonstration of water rights before the transaction, such as confirmation, transaction and transfer, and other information. On this basis, effective supervision of the water rights trading process can be achieved. Because of the technical characteristics of the blockchain, the dynamic flow information of water resources can be monitored, and misconduct in the transaction process can be effectively controlled. Furthermore, blockchain technology has the characteristics of open and transparent transactions and traceability of transaction information, which provides strong data support for ensuring the implementation of the main responsibilities of all parties in the process of water rights transactions.


### 2.3. Alliance Chain Hyperledger Fabric

Fabric, as a typical consortium chain, usually completes authentication tasks or information authentication tasks through Fobric-ca nodes. The Certification Authority (CA) node mainly controls the identity information of personnel on the Fabric network. Nowadays, the Fabric system mainly completes the identification and management of identity information through the digital certificate mechanism, but the Public Key Infrastructure (PKI) technology principally provided by the CA node is the control of personal identity certificate information, such as generation, cancellation, etc. [25–28].The whole system is mainly segmented into four layers from bottom to top:(1)
Network layer: For all system managers, build a blockchain cluster and operate it.(2)
Consensus mechanism and authorization management: Through the management of alliances and teams, the management of certificates and the configuration of consensus management mechanisms are realized.(3)
Smart contract service layer: It is mainly for developers of smart contract services, providing related service codes for chain code transactions.(4)
WEB application layer: developed for upper-layer business applications, mainly providing databases, front-end components, etc.The architecture diagram of the alliance chain is illustrated in Figure4.Figure 4
The architecture diagram of the alliance chain.The blockchain application system based on Fabric l.0 can be divided into the Platform as a service (PaaS) layer and the Software-as-a-Service (SaaS) layer in terms of architecture. Through functional layering, the maintainability of the application can be greatly improved and the development cost can be reduced. Figure5 indicates the blockchain application system [29–31].Figure 5
The blockchain application system.


### 2.4. Cost Composition and Calculation of Water Rights Trading Price

The computation of the total price of water is displayed in the following equation:(1)C=Cj+Cy+Cx+Cm+Cb,C is the total price of water rights trading in the modern ecological irrigation area; Cj means the construction cost of the modern ecological irrigation area; Cy refers to the operation and maintenance fee of the modern ecological irrigation area; Cx expresses the renovation cost of the modern ecological irrigation area; Cm stands for the agricultural risk compensation; Cb indicates the ecological compensation.The calculation of the water transaction price is shown in the following equation:(2)P=CW×T,P represents the annual transaction price, W signifies the total transaction water volume, and T shows the time of water rights trading.The cost calculation can be written in the following equation:(3)Cj=TgWj×Wz,Cj denotes the construction cost, Tg stands for the estimated investment, Wj is the traded water volume, and Wz is the tradable water volume.The operation and maintenance fee of water facilities is as follows:(4)Cy=k×Cj.The maintenance fee is expressed byCy, and Cy is the construction cost of the water-saving project.The computation of agricultural risk compensation is demonstrated in equations (5) and (6):(5)As=WsDj,(6)Cm=As×Bc,As denotes the reduced irrigated area, As illustrates the agricultural water consumption squeezed by industrial water, Dj indicates the irrigation quota, Cm is the agricultural risk compensation fee, and Bc demonstrates the income difference.The ecological compensation is calculated according to equation:(7)Cb=Cj×m,Cb is the compensation, m is the supplementary coefficient, and Cj is the construction cost.The enumeration of tradable water volume is indicated in the following equation:(8)Wz=ΔWj×δ,Wz refers to the tradable water volume, ΔWj is the saved water volume, and δ means the coefficient.


## 2.1. The Theory of Water Rights and the General Situation of the Research Area

The term water rights originates from the concept of property rights and related theories, namely, the property rights of water resources. As far as the definition of water rights is concerned, the theoretical circle has not yet reached a unified consensus. The definition of water rights in China’s academic circles can be roughly divided into three theories: one element, two elements, and multiple elements. China’s land law and water law have made specific regulations on the ownership of natural resources, and asset owners also belong to the country, which provides a direction for the rational distribution of natural resources in China. The concept of land monism is also recognized by many Chinese civil law researchers, and its nature is a new type of usufruct or quasi-property right. The distribution methods and models of the original water rights and interests in most countries are also the distribution methods of the ownership of natural resources. Under the background that the ownership is completely owned by the state, due to the need to reexamine the monism, and according to laws and regulations, the relevant national natural resource supervision and management agencies can allocate the original water rights and interests between different regions, different levels, and different industries in the country, so its distribution is actually the state’s distribution method for the use of natural resources. In addition to the basic property rights such as the nature of income, exclusivity, finiteness, and exchangeability, water rights are obviously dynamic and hierarchical compared with other natural resource rights [11, 12]. The allocation of water rights is not a one-time process, but a dynamic behavior. In different periods of social development, agriculture, industry, life, and ecology have different demands on water resources. Under the principle of priority in the west of the United States, water users will lose their water rights when they use water improperly or not. Mexico adjusts water rights every 10 years, which reflects the dynamic nature of water resources property rights. The multilevel definition of water rights refers to the top-down distribution process of water rights in the central-local, local-community, community-water users or in the basin-province-city-county-township-water user [1, 13].Water rights trading has its unique characteristics, such as initial allocation after water rights trading, calculation of variable water rights, water rights that change with seasonal changes, and whether water rights can be traded twice. These are all questions that must be considered. Before using the blockchain network for sharing, countermeasures must be considered. (1) Initial allocation of water rights: The initial water rights in water rights trading must be carried out by the water conservancy department, and the initial water rights must comply with five basic principles. After the initial allocation of water rights, the water user obtains the water rights license, and its use period is usually 3 years [14–16]. After the expiry, the water conservancy department will reissue the water right certificate in the light of the actual situation. Using the blockchain network, the user’s data is regularly managed. (2) Regular dynamic management: In some areas, due to seasonal changes, the amount of water will vary greatly. Therefore, dynamic management of water resources is required to make better use of water resources. After using blockchain technology, data can be updated frequently to achieve precise distribution [17, 18]. Figure 1 shows the water use procedures in the water rights market in the irrigation area, and Figure 2 indicates the procedure of water rights trading in the canal irrigation area.Figure 1
Water use procedures in the water rights market in the irrigation area.Figure 2
The procedure of water rights trading in the canal irrigation area.The market-type transaction process includes three links: transaction application, transaction review, and posttrade water volume change. The specific procedures are as follows: (1) The water farmers or water use groups submit the demand for sale or purchase to the water user association. (2) The water user association examines whether the transaction application meets the conditions. (3) If the review is passed, the association will log in to the platform to submit the application form for water volume trading; if the review fails, it will refuse to submit the application form. (4) The association submits the application for completion of the transaction and waits for the approval of the superior administrative unit. The specific review steps are as follows: (1) The water user association submits the application form, which is first reviewed by the township water resources management office, and the follow-up operation is continued after the review is passed. If it is not approved, the application form will not participate in this round of market transactions. Meanwhile, the association will be notified to modify the application form information until the transaction conditions are met. (2) After the approval of the township water resources management office, the water management station in the irrigation area will review the transaction application form. After the approval, the application form will be transferred to the irrigation area water rights trading center for further review. Otherwise, the water volume transaction application form will not be able to participate in the market-type transaction, and the water user association will be notified to modify the application form information. (3) After the water management station in the irrigation area is approved, the application form will be reviewed by the water rights trading center in the irrigation area. After approval, it waits for market transactions. Otherwise, the association will be informed to revise the information on this form. (4) The irrigation area water rights trading center has passed the review; it will wait for the market-type transaction. (5) The trading center will carry out water rights trading at the specified time to complete this round of market transactions. At the same time, the water volume data of the seller’s association is locked, waiting for payment confirmation, and the water volume data is transferred.After the transaction is successful, the process of water distribution is expressed in Figure2. (1) After the market is successfully matched, the water user association that has reached the water volume transaction will go to the corresponding water rights trading center to pay and settle the bill within the specified time. (2) The system background of the irrigation area water rights trading center is logged in, the corresponding transaction records are found, and the payment action is confirmed. (3) The system confirms the payment, and the seller’s association reduces the amount of water sold. At the same time, the reduced water volume is allocated to the water volume account of the buyer’s association. (4) The confirmation of payment and water allocation are completed. This round of market-type transactions is completed.Helan County is located in the middle of the Qingtongxia irrigation area in Ningxia, through which Hanyan Canal, Huinong Canal, Tangtan Canal, and Xigan Canal pass. In 2020, the irrigated area is 40,000 hm2, and the effective irrigation area is 39,000 hm2 [19, 20]. In the same year, the total amount of water drawn by Helan County is 555.0 million m3, and the total amount of water consumption confirmed is 469.3 million m3, of which agricultural water consumption is 432.0 million m3, ecological water consumption is 09.3 million m3, industrial water consumption is 18.0 million m3, and domestic water consumption is 100 million m3. The available surface water of the Yellow River is 278.0 million m3 [21, 22].


## 2.2. Overview of Blockchain Technology

Blockchain is one of the most popular new technologies in recent years, first born in Bitcoin. Bitcoin is currently the most successful blockchain application. A blockchain is a chronological order of blocks. Each block contains the hash value of the previous block. If the content of the block is changed, the hash value of the block will change. All subsequent blocks of this block must be changed. And in a distributed network, it is impractical to change the data stored by all nodes, so the blockchain has the property that it cannot be tampered with. A complete blockchain system includes encryption, Peer-to-Peer (P2P), workload verification, and other technologies. Encryption technology ensures that the data chain cannot be tampered with. P2P establishes a distributed system on the basis of blockchain and solves the consistency problem through proof of workload [23, 24].According to the access mechanism, blockchain can be divided into the public chain, alliance chain, and private chain. (1) In an open public chain, any node can enter and exit at any time without any authority. All nodes are noncentralized, without any personal or organizational constraints, and rely entirely on encryption algorithms to ensure their security. The most typical examples are Ethereum and Bitcoin. (2) Only members within the alliance can participate, and the use of the alliance usually requires the support of certification agencies. Members who enter the alliance will be certified, and each node must be authenticated to join. It can be used between different alliances. The alliance chain can read and write to nonalliance members by developing the Application Programming Interface (API). Typical alliance chain applications are Super Magic and R3Corda. (3) Private chain means that all write permissions are in one organization, and the organization can set rules at will in a specific environment. Some institutions can even change the trading rules. Used internally in the company, to exchange the speed of business, some noncentral functions are sacrificed. Through the introduction of the public chain and the alliance chain, it can be found that the alliance chain has the right to manage, and the controllability and scalability of the system are relatively good. (1) Since random water rights trading will have a certain impact on the ecological environment, water rights trading is usually dominated by the government, with the participation of other water rights agencies and the majority of users. Users must go through formal identity verification before entering the trading system, and the initial water rights information must be formally authenticated, so they must have corresponding permissions to manage. (2) Since the water rights data will change with the seasons, the government must dynamically update the water resources, and the alliance chain is a dynamic management method; therefore, it is chosen. (3) The public chain is usually a single blockchain, and its data exists in one chain, so it is not practical to design such a blockchain. The alliance chain hyperspace database adopts a logical multichannel method, allowing multiple links to exist in parallel, and can store data at the same time. Water rights trading can be specially designed using this feature of the alliance chain super protocol. Consequently, water rights trading is more suitable for the alliance chain. On this basis, the growth of the water rights trading system is carried out using Hyperledger Fabric. The schematic diagram of the blockchain structure is displayed in Figure3.Figure 3
Schematic diagram of the blockchain structure.Through the above interpretation of the concept of blockchain, it can be seen that its application in transaction management has the following typical characteristics. First, open consensus: When applying blockchain technology, any transaction subject can participate in the node, and each node can obtain a copy of the consensus. Then, the maintenance of the entire blockchain is achieved through a consensus mechanism that is jointly followed. Even if a node is lost in the middle, it will not interfere with the integrity of other nodes. Second, decentralization and trustless: It has the characteristics of decentralization. The entire blockchain does not need a central management agency, and there is no need to build a mutual trust mechanism between different nodes. It obtains trust through P2P and digital signature methods. All nodes abide by the operating rules of the blockchain and cannot deceive other nodes. Third, the transaction process is transparent. The rules of the blockchain are open to the entire network, and all transaction behaviors are broadcast to all nodes in the blockchain, so the transaction process is very transparent. Due to the trustless nature of the blockchain, transaction entities can hide their identities during transactions; that is, anonymous transactions can be realized between each entity. At last, it cannot be tampered with. When blockchain technology is applied to the field of transaction settlement, it also has a significant advantage; that is, it cannot be tampered with. All nodes in the blockchain have copied data. Even if one node modifies the data, it cannot propagate the modification to other nodes, which greatly ensures the transparency of the transaction process. Moreover, the nodes in the blockchain are linked through cryptography and timestamps, so each transaction record has a high degree of traceability, which is of obvious significance for transaction management and ensuring transaction fairness. Through using blockchain technology, it is possible to record the application and demonstration of water rights before the transaction, such as confirmation, transaction and transfer, and other information. On this basis, effective supervision of the water rights trading process can be achieved. Because of the technical characteristics of the blockchain, the dynamic flow information of water resources can be monitored, and misconduct in the transaction process can be effectively controlled. Furthermore, blockchain technology has the characteristics of open and transparent transactions and traceability of transaction information, which provides strong data support for ensuring the implementation of the main responsibilities of all parties in the process of water rights transactions.


## 2.3. Alliance Chain Hyperledger Fabric

Fabric, as a typical consortium chain, usually completes authentication tasks or information authentication tasks through Fobric-ca nodes. The Certification Authority (CA) node mainly controls the identity information of personnel on the Fabric network. Nowadays, the Fabric system mainly completes the identification and management of identity information through the digital certificate mechanism, but the Public Key Infrastructure (PKI) technology principally provided by the CA node is the control of personal identity certificate information, such as generation, cancellation, etc. [25–28].The whole system is mainly segmented into four layers from bottom to top:(1)
Network layer: For all system managers, build a blockchain cluster and operate it.(2)
Consensus mechanism and authorization management: Through the management of alliances and teams, the management of certificates and the configuration of consensus management mechanisms are realized.(3)
Smart contract service layer: It is mainly for developers of smart contract services, providing related service codes for chain code transactions.(4)
WEB application layer: developed for upper-layer business applications, mainly providing databases, front-end components, etc.The architecture diagram of the alliance chain is illustrated in Figure4.Figure 4
The architecture diagram of the alliance chain.The blockchain application system based on Fabric l.0 can be divided into the Platform as a service (PaaS) layer and the Software-as-a-Service (SaaS) layer in terms of architecture. Through functional layering, the maintainability of the application can be greatly improved and the development cost can be reduced. Figure5 indicates the blockchain application system [29–31].Figure 5
The blockchain application system.


## 2.4. Cost Composition and Calculation of Water Rights Trading Price

The computation of the total price of water is displayed in the following equation:(1)C=Cj+Cy+Cx+Cm+Cb,C is the total price of water rights trading in the modern ecological irrigation area; Cj means the construction cost of the modern ecological irrigation area; Cy refers to the operation and maintenance fee of the modern ecological irrigation area; Cx expresses the renovation cost of the modern ecological irrigation area; Cm stands for the agricultural risk compensation; Cb indicates the ecological compensation.The calculation of the water transaction price is shown in the following equation:(2)P=CW×T,P represents the annual transaction price, W signifies the total transaction water volume, and T shows the time of water rights trading.The cost calculation can be written in the following equation:(3)Cj=TgWj×Wz,Cj denotes the construction cost, Tg stands for the estimated investment, Wj is the traded water volume, and Wz is the tradable water volume.The operation and maintenance fee of water facilities is as follows:(4)Cy=k×Cj.The maintenance fee is expressed byCy, and Cy is the construction cost of the water-saving project.The computation of agricultural risk compensation is demonstrated in equations (5) and (6):(5)As=WsDj,(6)Cm=As×Bc,As denotes the reduced irrigated area, As illustrates the agricultural water consumption squeezed by industrial water, Dj indicates the irrigation quota, Cm is the agricultural risk compensation fee, and Bc demonstrates the income difference.The ecological compensation is calculated according to equation:(7)Cb=Cj×m,Cb is the compensation, m is the supplementary coefficient, and Cj is the construction cost.The enumeration of tradable water volume is indicated in the following equation:(8)Wz=ΔWj×δ,Wz refers to the tradable water volume, ΔWj is the saved water volume, and δ means the coefficient.


## 3. Design and Implementation of the Chain Code of Hyperledger Fabric in the Water Rights Trading System

### 3.1. The Business Logic of the Chain Code of the Water Rights Trading System

The process of chain code review of water rights trading is exhibited in Figure6. Water users can sell water rights publicly on the water rights trading platform and then send the sale and purchase information to the endorsement node, which then verifies the identity and confirms the information. Only the transaction data that satisfies the chain code rules can proceed to the next step; otherwise, the request will be returned. After the review is passed, the original endorsement node will return the verified data to the original transaction request node and sign the endorsement and other related information at the node. After the user node receives the endorsement, it transmits the endorsed transaction information to the sorting consultation service node and sorts the message content in accordance with the partition topic. After completing the classification service, multiple data packets are encapsulated into the same data block, and then the data block is allocated to the main node by the sequence node. Meanwhile, the system chain code of the node is verified, and after confirmation, the blockchain is submitted to the “blockchain account.”Figure 6
The process of chain code review of water rights trading.


### 3.2. Confirmed Transaction of Water Rights through Chain Code Review

In the process of water rights certification, the buyer and the seller negotiate according to the listing information. After the negotiation, the buyer put forward a request for the price of water to the seller and then sent the content of the contract to the seller, and the seller signed the transaction information after confirming the transaction information. The signed water resource value confirmation information is sent to the endorsement node. The endorsement node will check and verify the transaction process and give feedback about the approved process to the seller. After the seller receives sufficient support, the transaction process will be submitted to the ordering service node. By classifying each business node, multiple transactions are packaged into the same data block, and these data are distributed to the main nodes, as indicated in Figure7.Figure 7
Block architecture.The designed architecture can be separated into three layers, which are the blockchain storage layer, the blockchain network layer, and the application layer. The application layer is further split into a transaction input module, a consensus node display module, and an account information display module. The main function of the blockchain network layer in the middle of the architecture is to broadcast transaction information and block information. The blockchain storage layer at the bottom of the architecture is responsible for storing verified final block information. It mainly improves the application layer and network layer of the blockchain, and the constructed framework uses the application layer to interact with users. The network layer formed by the blockchain network is built, and then the transaction information is processed through the nodes participating in the consensus in the built blockchain network. The design of the application layer can be grouped into two parts, one is the access interface part, and the other is the general function part. The access interface is mainly that the subject of the transaction uses the application layer to input transaction information, and the function of the general module part is to provide users with general functions. The internal composition of the blockchain network is a distributed deployment authentication node composed of all miner nodes. The function of the miner node in the blockchain is to find out and verify the transaction information and workload proof between the transaction nodes. In the designed model, the transaction role on the entire chain can be considered as the existence of miner authentication nodes in the blockchain network. At the beginning, these nodes apply to become consensus nodes through the system and connect with nodes with consensus behavior in the network. Eventually, a network at the bottom of the blockchain is formed together, and a blockchain network is simulated.


### 3.3. The Configuration of the Experimental Environment

Installation environment: Ubuntu16.04, Docker version 17.12.0-c, Docker Compose 1.23.1, Golang 1.10.3, Hyperledger Fabric 1.4, etc. Docker Compose is a tool for rapidly deploying distributed applications [32, 33]. The experimental data are demonstrated in Table 1.Table 1
Data of China’s water rights trading platform.
No.BuySellWater volumePriceTime limit1B1A112500.6252B2A225500.625The data in Table1 comes from https://www.cwex.org.cn/publiccms/webfile/znews/index.html.


## 3.1. The Business Logic of the Chain Code of the Water Rights Trading System

The process of chain code review of water rights trading is exhibited in Figure6. Water users can sell water rights publicly on the water rights trading platform and then send the sale and purchase information to the endorsement node, which then verifies the identity and confirms the information. Only the transaction data that satisfies the chain code rules can proceed to the next step; otherwise, the request will be returned. After the review is passed, the original endorsement node will return the verified data to the original transaction request node and sign the endorsement and other related information at the node. After the user node receives the endorsement, it transmits the endorsed transaction information to the sorting consultation service node and sorts the message content in accordance with the partition topic. After completing the classification service, multiple data packets are encapsulated into the same data block, and then the data block is allocated to the main node by the sequence node. Meanwhile, the system chain code of the node is verified, and after confirmation, the blockchain is submitted to the “blockchain account.”Figure 6
The process of chain code review of water rights trading.


## 3.2. Confirmed Transaction of Water Rights through Chain Code Review

In the process of water rights certification, the buyer and the seller negotiate according to the listing information. After the negotiation, the buyer put forward a request for the price of water to the seller and then sent the content of the contract to the seller, and the seller signed the transaction information after confirming the transaction information. The signed water resource value confirmation information is sent to the endorsement node. The endorsement node will check and verify the transaction process and give feedback about the approved process to the seller. After the seller receives sufficient support, the transaction process will be submitted to the ordering service node. By classifying each business node, multiple transactions are packaged into the same data block, and these data are distributed to the main nodes, as indicated in Figure7.Figure 7
Block architecture.The designed architecture can be separated into three layers, which are the blockchain storage layer, the blockchain network layer, and the application layer. The application layer is further split into a transaction input module, a consensus node display module, and an account information display module. The main function of the blockchain network layer in the middle of the architecture is to broadcast transaction information and block information. The blockchain storage layer at the bottom of the architecture is responsible for storing verified final block information. It mainly improves the application layer and network layer of the blockchain, and the constructed framework uses the application layer to interact with users. The network layer formed by the blockchain network is built, and then the transaction information is processed through the nodes participating in the consensus in the built blockchain network. The design of the application layer can be grouped into two parts, one is the access interface part, and the other is the general function part. The access interface is mainly that the subject of the transaction uses the application layer to input transaction information, and the function of the general module part is to provide users with general functions. The internal composition of the blockchain network is a distributed deployment authentication node composed of all miner nodes. The function of the miner node in the blockchain is to find out and verify the transaction information and workload proof between the transaction nodes. In the designed model, the transaction role on the entire chain can be considered as the existence of miner authentication nodes in the blockchain network. At the beginning, these nodes apply to become consensus nodes through the system and connect with nodes with consensus behavior in the network. Eventually, a network at the bottom of the blockchain is formed together, and a blockchain network is simulated.


## 3.3. The Configuration of the Experimental Environment

Installation environment: Ubuntu16.04, Docker version 17.12.0-c, Docker Compose 1.23.1, Golang 1.10.3, Hyperledger Fabric 1.4, etc. Docker Compose is a tool for rapidly deploying distributed applications [32, 33]. The experimental data are demonstrated in Table 1.Table 1
Data of China’s water rights trading platform.
No.BuySellWater volumePriceTime limit1B1A112500.6252B2A225500.625The data in Table1 comes from https://www.cwex.org.cn/publiccms/webfile/znews/index.html.


## 4. Experimental Results and Analysis

### 4.1. Analysis of Water Distribution

Figure8 indicates the main crops in each irrigation area, and Figure 9 refers to the results of water rights distribution.Figure 8
The main crops in each irrigated area ((a) March results; (b) September results).
(a)(b)Figure 9
Results of water rights distribution ((a) March results; (b) September results).
(a)(b)In Figures8 and 9, the meanings of 1–4 are the types of crops, wherein 1 is others, 2 is seedling, 3 is grape, and 4 is cotton.Figure8 denotes that, in March, the water demand of the seedling is less than that of grapes and cotton. In September, the water demand of the seedling is less than that of grapes and cotton, but the overall water storage is more than the water demand in March; the water demand in different regions is basically distributed between 4500 and 6000 m3/hm2. In Figure 9, the distributed water volume of area 1 is 41.8368 million m3, the current water volume is 23.831 million m3, and the quota management water volume is 20.432 million m3. The distributed water volume in area 2 is 40.4605 million m3, the current water volume is 4317.64 m3, and the quota management water volume is 77.4795 million m3. The distributed water volume in area 3 is 65.6928 million m3, the current water volume is 77.472 million m3, and the quota management water volume is 64.412 million m3.


### 4.2. The Test Results of the Chain Code of Water Rights Trading

The expected outcomes of the water rights trading data are demonstrated in Figure10.Figure 10
Expected outcomes of water rights trading data ((a) the first test outcomes; (b) the second test outcomes).
(a)(b)In Figure10, the chain code can review the initiated transactions, and only the transactions that conform to the chain code can call it, while for transactions that do not conform to the chain code, the reason for the error is returned. Chain code can replace pure manual audit function. Once the chain code review is completed, the data of water rights trading will be entered into the blockchain account within seconds, which greatly simplifies the transaction process and improves transaction efficiency. The water rights trading system based on Hyperledger Fabric can record each water rights trading and can disperse the transaction data in different nodes, and each node saves the same data, thus ensuring the credibility of the transaction and avoiding the water authority to back up the transaction data.


## 4.1. Analysis of Water Distribution

Figure8 indicates the main crops in each irrigation area, and Figure 9 refers to the results of water rights distribution.Figure 8
The main crops in each irrigated area ((a) March results; (b) September results).
(a)(b)Figure 9
Results of water rights distribution ((a) March results; (b) September results).
(a)(b)In Figures8 and 9, the meanings of 1–4 are the types of crops, wherein 1 is others, 2 is seedling, 3 is grape, and 4 is cotton.Figure8 denotes that, in March, the water demand of the seedling is less than that of grapes and cotton. In September, the water demand of the seedling is less than that of grapes and cotton, but the overall water storage is more than the water demand in March; the water demand in different regions is basically distributed between 4500 and 6000 m3/hm2. In Figure 9, the distributed water volume of area 1 is 41.8368 million m3, the current water volume is 23.831 million m3, and the quota management water volume is 20.432 million m3. The distributed water volume in area 2 is 40.4605 million m3, the current water volume is 4317.64 m3, and the quota management water volume is 77.4795 million m3. The distributed water volume in area 3 is 65.6928 million m3, the current water volume is 77.472 million m3, and the quota management water volume is 64.412 million m3.


## 4.2. The Test Results of the Chain Code of Water Rights Trading

The expected outcomes of the water rights trading data are demonstrated in Figure10.Figure 10
Expected outcomes of water rights trading data ((a) the first test outcomes; (b) the second test outcomes).
(a)(b)In Figure10, the chain code can review the initiated transactions, and only the transactions that conform to the chain code can call it, while for transactions that do not conform to the chain code, the reason for the error is returned. Chain code can replace pure manual audit function. Once the chain code review is completed, the data of water rights trading will be entered into the blockchain account within seconds, which greatly simplifies the transaction process and improves transaction efficiency. The water rights trading system based on Hyperledger Fabric can record each water rights trading and can disperse the transaction data in different nodes, and each node saves the same data, thus ensuring the credibility of the transaction and avoiding the water authority to back up the transaction data.


## 5. Conclusion

Water rights trading is the key to solving the problems of water use indicators and water use efficiency, dynamically adjusting the optimal allocation of water resources, and realizing the management of water resources property rights. The proposed application of blockchain technology can simplify the process of water rights trading and reduce its costs. The alliance chain Hyperledger Fabric is selected as the underlying system of the water rights trading system, allowing water users to conduct point-to-point water rights transactions under appropriate supervision, while minimizing the third-party impact caused by water rights transactions. A “three-channel” shared bookkeeping mode under the water rights trading scenario is proposed. The water rights management department initializes and updates the initial water rights and variable water rights in channel 1, and water users trade and list in channel 2, and actually conducts water rights transactions in channel 3. The analysis of the technical characteristics of blockchain indicates that the application of this technology can effectively solve the current problems in water resources management, but there are still some problems that need to be improved and further studied. Clear water rights and reasonable agricultural water prices provide the foundation for the construction of the water rights trading market. However, the process of realizing agricultural water savings is bound to be accompanied by more capital and technical investment, and farmers, as the relevant stakeholders of agricultural water management, are affected to a certain extent. In the process of promoting the optimal allocation of regional water resources, with the gradual improvement of the construction of the water trading market, how to establish an effective agricultural water-saving compensation mechanism through a market-oriented approach is the next research problem, including the incentive mechanism for farmers to save water, the benefit distribution of water rights transaction value, and how to promote industrial compensation for agricultural infrastructure construction.



---

*Source: 8700730-2022-08-12.xml*