Main chain DAG block chain network model for food big data
By designing a main-chain DAG blockchain architecture and an improved Merkle Patricia tree, the food supply chain data storage model is optimized, solving the problems of low efficiency and limited parallel processing capabilities of high-throughput food data storage, and achieving efficient and secure food data storage and traceability, which is suitable for multi-node data interaction scenarios in the food supply chain.
Patent Information
- Application Number
- CN202510883429.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-29
- Publication Date
- 2025-10-14
AI Technical Summary
Existing blockchain technology has problems in high-throughput food data storage, such as low efficiency, limited parallel processing capabilities, complex consensus process and network performance bottlenecks. It is difficult to meet the high-frequency, multi-node data interaction requirements of the food supply chain, affecting food safety and data integrity.
A blockchain architecture based on the main chain DAG was designed. Combining the characteristics of food supply chain data, an improved Merkle Patricia tree and a special block header design were adopted to optimize the block storage model. Efficient data dissemination and verification were achieved through the P2P network and Gossip protocol. The parallel processing capability of the main chain DAG was utilized, combined with the consensus mechanism of enterprise entity nodes and food supervision nodes, to build a high-throughput storage solution suitable for food big data.
It realizes efficient and secure food data storage and traceability, improves the system's concurrent processing capabilities and data query efficiency, ensures data integrity and traceability, is suitable for different types of food data storage and traceability, and has universal applicability and guidance.
Smart Images

Figure CN120780735A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a main-chain DAG blockchain network model for food big data, and is relevant to the fields of food safety and blockchain. Specifically, the model provides a food blockchain architecture design and method based on the main-chain DAG. Background Art
[0002] Food is the most essential substance for human survival and development. With the development of the global economy, people's quality of life is gradually improving, and with it, the demand for food quality and safety is also increasing. With the widespread application of information technology and intelligent technology in the food sector, food big data is becoming a key driving force for the transformation and upgrading of the food industry. Food big data refers to the massive, multi-source, heterogeneous, and rapidly growing data collection generated throughout the entire food life cycle, including production, processing, transportation, sales, consumption, and regulation. Its typical characteristics include large volume, diverse types, fast processing speed, low value density, but high potential value. The food supply chain is complex, with numerous stakeholders involved in each link. The multi-dimensional, multi-link, and multi-level real-time dynamic data across the entire supply chain, from farm to table, such as seed quality, quality inspection methods, and transportation conditions, has led to an explosive growth in the volume of food supply chain data. This not only provides more comprehensive and analyzable food data, but also poses unprecedented challenges to existing food data storage and processing technologies. With the in-depth integration and application of technologies such as the Internet of Things, blockchain, and artificial intelligence, data collection in the food sector is becoming increasingly granular, with increasing frequency, real-time updates, and a growing variety of data. This trend not only drives exponential growth in food data volumes but also creates throughput pressure during its transmission, processing, and storage, resulting in the typical high-throughput data characteristic. In particular, in key scenarios such as food safety monitoring, intelligent traceability systems, and cold chain logistics tracking, high-frequency, multi-node data interaction has become the norm, further increasing the system's requirements for data processing efficiency and throughput. High throughput has become a core requirement for modern food data storage. However, due to the storage pressure caused by high throughput, food data is prone to loss and duplication, significantly impacting the security of food supply chain information, leading to food safety issues and posing a threat to human health. Data storage and traceability in the food supply chain are directly related to food safety, and researchers both domestically and internationally have conducted in-depth research on how to strengthen data storage. This research has led to the design of data encryption models, the selection and optimization of deep learning algorithms, and the implementation of data storage encryption systems. Deep learning can be used to verify data integrity, detecting data tampering during transmission or storage, and helping to ensure data integrity and authenticity. While these in-depth studies on data storage technologies have addressed some of these storage pressures, a storage model framework tailored to the high-throughput characteristics of food data is currently lacking. Therefore, there is an urgent need for a safe, reliable and efficient method to solve the data storage problem of the high throughput characteristics of existing food.
[0003] Blockchain, as a distributed infrastructure and computing paradigm, utilizes a block chain structure to verify and store data, a distributed node consensus algorithm to generate and update data, cryptography to protect data transmission and access, and smart contracts to program and manipulate data. With its decentralization, immutability, data transparency, distributed storage, and traceability, blockchain enables real-time, full-process, and transparent data management in the food supply chain. As a new decentralized chain structure, blockchain also enables nodes to jointly maintain on-chain data security. Furthermore, the full chain data features strong traceability, extensive traceability coverage, and highly secure information storage, providing technical support for information storage and traceability in the food supply chain.
[0004] As blockchain networks continue to expand, the chain-based blockchain architecture has gradually exposed some significant limitations. Its linear storage structure dictates that blocks can only be added sequentially within a single chain. This not only results in inefficient data storage but also limits parallel processing capabilities, limiting the system's throughput when handling large-scale transactions. Furthermore, as the chain lengthens, the consensus process becomes more complex and slower, increasing network confirmation times and ultimately impacting overall system performance and scalability. To address the bottlenecks of chain-based blockchains in high-throughput data processing, the innovative architecture of graph-based blockchains (DAG blockchains) has emerged. Unlike linear chain structures, DAG blockchains organize data using a directed acyclic graph (DAG), enabling parallel expansion of blocks rather than relying solely on a single main chain. This structure not only improves transaction processing capabilities but also optimizes storage efficiency, reduces the time required for network-wide consensus, and enhances system scalability and performance. The introduction of DAG blockchains provides a more efficient and flexible solution for high-throughput blockchain applications such as food supply chains, the Internet of Things, and big data. Scholars have conducted multi-faceted research on the topology of DAG blockchains, and three mainstream DAG blockchain topologies exist. The first is the naive DAG topology, also known as the divergent DAG topology, where the overall topology exhibits a divergent, diffuse pattern. Representative examples include IOTA, Spectre, and Haootia. The second is the parachain DAG topology, which essentially runs multiple blockchains in parallel to increase the speed of block generation. Representative examples include Prism, OHIE, and DAG-Rider. The third is the mainchain DAG topology, which essentially selects a subset of blocks from the naive DAG topology to form a mainchain. Other blocks are then confirmed and ordered based on the reference relationships between the mainchain blocks and other blocks. Representative examples include Conflux and Byteball. Summary of the Invention
[0005] The present invention analyzes the food supply chain data information for the entire process. According to their participation mode, they are abstracted into internal participants and external participants. The internal participants are mainly production enterprises, processing enterprises, transportation enterprises and sales enterprises, and the external participants mainly include consumers, government and other regulatory departments, and quality inspection departments, etc.; combined with the analysis of food supply chain data information, and based on the characteristics of the main chain DAG blockchain, a main chain DAG blockchain architecture suitable for high-throughput food data is designed; based on the characteristics of food data, a special block header is designed to reduce computing overhead and improve management query efficiency; based on the main chain DAG blockchain topology structure characteristics, a special block header is designed to construct an adaptive block header content; the storage bytes of the block header are refined and calculated to reduce block storage requirements. It mainly includes the following steps:
[0006] (1) Food supply chain data analysis
[0007] Analyzing the food supply chain reveals a complex data hierarchy. The food supply chain is divided into three major parts: upstream, midstream, and downstream. Each part contains relevant links and corresponds to different business entities. Different business entities use different IoT devices to collect food data, which includes both publicly shared data and privately encrypted data.
[0008] (2) Food blockchain architecture based on main chain DAG
[0009] The food blockchain architecture based on the mainchain DAG includes a node model and block topology design. First, the node model is designed, consisting of a set of enterprise entity nodes and a set of food regulatory nodes. These nodes together form a peer-to-peer (P2P) network. Data is collected by enterprise IoT devices, which upload the data from the enterprise entity nodes to the blockchain. Regulatory agencies, such as the Market Supervision Bureau or the Food Safety Department, act as food regulatory nodes to verify and reach consensus on the data, which is then stored in the mainchain DAG-based food blockchain architecture. This architecture includes: (a) improvements to the block Merkle tree. Based on the introduction of the Merkle Patricia Tree (MPT), a hierarchical MPT structure optimization scheme based on food data sensitivity levels is proposed to reduce the large computational overhead of the large Merkle tree and improve management and query efficiency. (b) Relevant fields are introduced in the block header to adapt to the mainchain DAG blockchain topology. These fields include version, timestamp, public key, block signature, parent hash, block hash, reference hash, and Merkle Patricia tree root. (c) Calculation of relevant fields in the block header.
[0010] The advantages of the present invention are:
[0011] (1) The main chain DAG blockchain network model for food big data established in this invention is an attempt to improve the main chain DAG blockchain. It is innovative and has certain guiding value for the subsequent expansion of this method to other products and even other industries.
[0012] (2) Compared with the existing technology, the present invention can cope with the high throughput characteristics of food data today, achieve this goal by building a main chain DAG blockchain model, and has the traceability function of food data.
[0013] (3) The present invention has strong applicability and can realize data storage and traceability for different types of food data, and has universal applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 Food blockchain architecture diagram based on main chain DAG
[0015] Figure 2 Merkle Patricia Tree Example Diagram
[0016] Figure 3 Block structure design diagram
[0017] Figure 4 Block topology DETAILED DESCRIPTION
[0018] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail and in depth below with reference to examples.
[0019] This paper constructs a main chain DAG blockchain network model for food big data. The specific implementation steps are as follows:
[0020] Step 1: Food supply chain data analysis
[0021] The food supply chain has a complex data and information hierarchy, categorized as upstream, midstream, and downstream. Each segment comprises related links and corresponds to different business entities. The upstream segment, at the beginning of the supply chain, encompasses production and procurement, specifically the raw material manufacturers and processing companies that acquire them. The midstream segment primarily processes and modifies raw materials, transforming them into practical products, encompassing transportation, raw material warehousing, processing, and finished product storage. Downstream enterprises encompass transportation and sales, specifically transport companies, retailers, and end consumers. As shown in Table 1, relevant companies collect data and information through equipment and categorize it according to its privacy level into publicly shareable data and private data accessible only to companies along the supply chain and regulatory authorities.
[0022] The upstream segment encompasses both production and procurement, with the corresponding entities being manufacturers and processors. Manufacturers' IoT devices include cameras, temperature and humidity sensors, light intensity sensors, and radio frequency identification devices. Publicly shared data includes soil information, climate, light intensity, temperature difference, manufacturer, production date, product code, seed source, production site, harvest time, fertilizer / pesticide usage, product batch, and certificates of conformity. Privacy-encrypted data includes production and primary processing costs, seed type, production quantity, shipment quantity, production personnel information, quality inspection results, and quality indicators.
[0023] The midstream segment includes transportation, raw material storage, processing, and finished product storage. The transportation segment corresponds to transportation companies, while the remaining segments correspond to processing companies. Transportation companies' IoT devices include cameras, temperature and humidity sensors, radio frequency identification (RFID) devices, and GPS. Publicly shared data includes transportation methods and routes, temperature and humidity, transportation companies, departure and destination points, time, cargo type, and real-time transportation status. Privacy-encrypted data includes transportation costs, transportation batches and quantities, transportation vehicle and personnel information, basic driver information, and travel records. Processing companies' IoT devices include cameras, temperature and humidity sensors, and radio frequency identification (RFID) devices. Publicly shared data includes processing companies, processing dates, food additive ingredients, quarantine certificates, raw material storage / finished product storage time and location, warehouse temperature and humidity, and warehouse entry and exit times. Privacy-encrypted data includes raw material costs, purchase quantities, finishing costs, shipment quantities, processing personnel information, warehouse entry and exit quantities, raw material storage / finished product storage quantities and costs, and warehouse manager information.
[0024] The downstream segment includes transportation and sales. The corresponding companies are transport companies and sales companies. The sales companies' IoT devices are cameras, the publicly shared data includes product batches and sales companies, and the privately encrypted data includes purchase price, sales price, purchase quantity, and salesperson information.
[0025] Table 1 Food supply chain information analysis table
[0026]
[0027] Step 2: Food blockchain architecture based on the main chain DAG
[0028] Current research on naive DAG and parachain DAG blockchains has led to global consistency issues as data grows, making it difficult to easily determine the total order of transactions. Mainchain DAG blockchains, by introducing mainchain constraints, can effectively address this issue. However, improving the blockchain architecture and block storage model is a pressing issue for applying mainchain DAG blockchains to high-throughput food data.
[0029] This invention is based on the characteristics of the main chain DAG blockchain and is designed to be applicable to the food blockchain architecture based on the main chain DAG. The specific architecture is as follows: Figure 1 As shown in the following figure. In the food blockchain architecture based on the main chain DAG, enterprise entity nodes upload data to the blockchain based on the main chain DAG. The enterprise entity node set broadcasts messages to the food regulatory node set through the P2P network and Gossip protocol. The overall system can be divided into four parts:
[0030] 1. Physical Enterprises
[0031] From Step 1: Food Supply Chain Data Analysis, we can see that the food supply chain can be divided into three parts: upstream, midstream, and downstream. The upstream includes production and procurement, and the corresponding enterprises are manufacturers and processors. The midstream includes transportation, raw material storage, processing, and finished product storage. The transportation part is associated with transportation companies, while the remaining parts are associated with processing companies. The downstream includes transportation and sales, and the corresponding enterprises are transportation companies and sales companies. Physical enterprises can be divided into four types: manufacturers, processors, transportation companies, and sales companies.
[0032] 2. IoT devices
[0033] The four physical enterprises contain various IoT devices for collecting and uploading food data, including cameras, temperature sensors, humidity sensors, light intensity sensors, GPS, etc.
[0034] 3. Node
[0035] Assume that the node set in the model is N, which includes food supervision node N f and enterprise entity node N l . Food Supervision Node N f For regulatory agencies such as market supervision bureaus, food safety departments, etc., responsible for processing transactions, maintaining DAG blockchains and participating in consensus; enterprise entity nodes N l Responsible for generating transactions for each entity and submitting them to the food supervision node N f Verify and store.
[0036] 4. Food blockchain architecture based on main chain DAG
[0037] This architecture, designed using a mainchain DAG blockchain architecture, combines the security of blockchain with the data parallel processing capabilities of DAG to enable high-throughput food data applications. Blocks in this architecture include regular blocks and mainchain blocks, while edges include primary and secondary edges. Together, blocks and edges form the topology of the architecture's blocks, expressing the relationships between them.
[0038] 1. Block topology: G = (B, E), where B is the set of all blocks B = {b1, b2, b3, ..., b n}; E is the set of all edges, each edge represents the reference relationship between one block and another block. Each block bi needs to reference multiple previous blocks to form a DAG structure: P(b i )={b j |b j ∈B,b j ←b i}≥2, where P(b i ) represents block b i The set of preceding blocks, b j ←b i Indicates b i Direct quote b j , and each new block references at least two previous blocks. In the DAG structure, the weight and topological order of edges can be used to determine the primary and secondary edges.
[0039] 2. Main side and parent block definition: Each new block b i The parent block b p It is the block with the largest weight among the previous blocks it references, specifically expressed as: Where w(b j ) is b j The weight of the block represents the transaction volume of the block, etc. The block with the largest weight is selected as the parent block b p . Then the main side can be defined as: That is, connect to the parent block b p and the current block b i The main side.
[0040] 3. Definition of secondary edge and reference block: Secondary edge is used to assist in determining the total order relationship of blocks. It expresses that a block is generated after the previous block is generated, and is used to enhance the topological structure. Among the non-main chain blocks, the block with the latest generation time is selected as the reference block, which is expressed as R(b i )=argmaxt(b j ), where M(b) is combined with the main chain block, t(b j ) is b j The generation timestamp, R(b i ) is a reference block set, and b j ∈P(b i ), b j ≠b p The secondary edge set is: E r ={(b j ,b i )|b j ∈R(b i)}.
[0041] The topology of a block can be summarized as follows: a block references a previous block with a higher transaction volume as a primary edge, determines the timestamp of a block on a non-main chain, and connects to the block with the latest generation time using a secondary edge. This strategy ensures that new blocks reference high-transaction volume blocks on the main chain to enhance its stability, while also utilizing non-main chain blocks to improve data verifiability and system concurrency.
[0042] The above is a description of the various parts of the food blockchain architecture based on the main chain DAG. The specific data on-chain process is as follows:
[0043] Transaction generation: In food supply chain analysis, IoT devices are registered to the enterprise blockchain system and obtain a unique identity D id , corresponding to the generation of public and private key pairs (Pubkey D ,Prikey D ), and the public key Pubkey D Register to the blockchain system, with a total of N food supervision nodes f Verification. Enterprise entity node N l Corresponding to the relevant enterprises in the food supply chain. After the relevant enterprises collect food data through IoT devices, the enterprise entity node N l Upload to the blockchain architecture. Enterprise entity node N l Generate transaction T, where T=(T id ,T data ,T sig ), including the transaction unique identifier T id , transaction data T data and signature T sig Among them, the identity of the IoT device is used as part of the transaction unique identifier. To ensure that each transaction is unique, additional fields are required: Timestamp to ensure time uniqueness and Serailnumber to prevent duplication and conflict of transactions with the same timestamp. In summary, the transaction unique identifier can be specifically expressed as: T id =Hash(D id ||Timestamp||Serailnumber), the transaction is uniquely identified by the unique identity of the IoT device D id , transaction generation timestamp and transaction sequence number; transaction data T data This refers to the data collected by IoT devices from businesses, such as temperature and humidity data, light intensity data, video and image data, and GPS data. To standardize the storage methods of different types of food data, this article designs a unified data standard, dividing transaction data into four categories: text data, image data, video data, and GPS data. These are distinguished using the standardized label Data_Type, as shown in Table 2:
[0044] Table 2 defines unified data type labels
[0045]
[0046]
[0047] Where T id It is the unique identifier of the transaction and is designed to be 64 characters long. id It is the unique identity of the IoT device and the hash value of the device identifier, designed to be 32 characters long. Timestamp is the timestamp generated by the transaction, designed to be 20 characters long, and the standard format is YYYY-MM-DDThh:mm:ss, where YYYY is the year, MM is the month, DD is the day, hh is the hour, mm is the minute, and ss is the second. Accurate to the second can meet the traceability requirements. Data_Type is the data type, which is divided into four categories: "TEXT" text data, "IMAGE" image data, "VIDEO" video data, and "GPS" GPS data, designed to be 8 characters long. Data_Hash is the data hash value, stored on the chain to ensure data integrity. The SHA-256 algorithm is applicable, and the character length is 64. Data_Reference is the storage location pointer of the off-chain data, such as IPFS hash address, database index, etc. It is applicable to image and video data and is designed to be 64 characters long. T sig To sign transactions, the ECDSA (secp256k1) digital signature algorithm is used to generate a 512-bit (64-byte) signature consisting of two 256-bit values. The signature data is approximately 86-130 characters long after Hex / Base58 encoding. To ensure system compatibility and security redundancy, the signature field length is standardized to 128-130 characters.
[0048] Regarding data volume and on-chain requirements, text and GPS data are small, suitable for direct storage and facilitate direct traceability and query, and are therefore stored directly on-chain. Image and video data are larger, and frequent uploads can lead to block bloat and bandwidth consumption. Therefore, a strategy is adopted where specific data is stored in an off-chain database and a hash of the on-chain storage location pointer. This classification approach achieves a balance between data verifiability and system efficiency, as shown in Table 3.
[0049] Table 3 Data type classification table
[0050]
[0051] Transaction broadcast: Enterprise entity node N l Send T to food supervision node N through P2 network fone of the sets, denoted as where P2P protocol is adopted to ensure the efficiency and scalability of message transmission. The food regulatory node receiving the transaction After receiving the transaction T, the food regulatory node N f broadcasts it to other food regulatory nodes N f to improve fault tolerance and data consistency. To achieve efficient and reliable transaction propagation, an improved Gossip protocol is used as the message diffusion mechanism. Specifically, when a food regulatory node N f receives a new transaction, it randomly selects a certain number of nodes (the number is called Fanout) from its connected neighbor nodes to continue transmitting the transaction. To avoid infinite propagation and redundant diffusion in the network, the Gossip protocol sets an upper limit on the number of propagation rounds, i.e., each transaction is allowed to propagate in the network for a certain number of rounds, and propagation stops after the number of rounds is exceeded. In addition, considering the security of network communication, the communication between enterprise entity nodes and food regulatory nodes is established on the DTLS secure encryption channel to ensure that transaction data cannot be intercepted, tampered with, or forged by third parties during transmission.
[0052] Transaction verification: After receiving the transaction, the food regulatory node N f checks the data format of T and T sig whether it is valid. The verification process is to find the registered device public key on the chain, use the public key to verify the validity of the transaction signature, to ensure that the transaction indeed comes from a legal Internet of Things device and the content has not been tampered with. To prevent network congestion and data redundancy caused by repeated broadcast of transactions, the food regulatory node maintains a transaction hash table to record the unique identifier of each transaction that has been received. When a transaction is received, the system will first check whether the transaction identifier already exists, if it exists, it will be discarded directly to avoid repeated propagation. At the same time, in order to prevent the food regulatory node from receiving too many invalid transactions or malicious transactions and causing the system resources to be exhausted, the food regulatory node sets a buffer for the received transactions, limiting the maximum capacity of the buffer, when the buffer is full, it will preferentially remove transactions with expired timestamps or invalid signatures to ensure the stability of the system. When a transaction is propagated by the Gossip protocol and is successfully received and confirmed by more than 2 / 3 of the food regulatory nodes in the network, the transaction is formally included in the DAG block structure, and then the food regulatory node N f performs consensus, and the transaction T that passes the verification is added to the legal transaction set of the main chain DAG blockchain, forming a new directed acyclic graph topology. The transaction T is referenced by selecting appropriate parent transactions T faher to ensure the scalability and parallel processing capability of the DAG structure. Finally, after completing transaction verification and storage, the food regulatory node N f feeds the transaction confirmation information T feedback back to the enterprise entity node Nl , ensure the closed loop of data upload process.
[0053] Step three: improvement of Merkle tree
[0054] The traditional Merkle tree is mainly used for transaction data integrity verification in the blockchain system. It recursively hashes each transaction data through tree structure and records the root hash in the block header. However, the Merkle tree itself has the problem of rapid increase of tree height with the growth of data volume, which leads to limited query efficiency and dynamic update ability, large computational overhead, and serious restriction of system performance in high-throughput, multi-concurrent transaction main chain DAG blockchain architecture. Therefore, in the design of block body, this paper introduces the Merkle Patricia Tree (MPT) structure to replace the traditional Merkle tree and improve the overall query efficiency and system scalability. The Merkle Patricia Tree has the encryption authentication characteristics of the Merkle tree and the efficient storage characteristics of the prefix tree, and can store key-value pairs of any length and support efficient insertion, deletion and query operations. Compared with the traditional binary Merkle tree, the query complexity of MPT is reduced from O(log2 n) to O(log 16 n), especially in the main chain DAG architecture with large transaction data size and numerous block branches, its advantage is more obvious. Specifically, MPT can adapt to the DAG multi-branch and high-concurrency scenario, support dynamic and efficient insertion of transactions on each branch chain, and avoid the computational burden caused by frequent reconstruction of the traditional Merkle tree due to the addition of new transactions.
[0055] In the block body structure designed in this paper, all transaction hashes are organized through MPT, and the block header only stores the root hash value. After receiving the block header, the enterprise entity node does not need to store all the transaction data completely, but only needs to obtain the MPT path node information corresponding to the target transaction to complete the transaction existence verification, which greatly reduces the storage and computational burden of the enterprise entity node and meets the actual needs of resource-limited devices in the food traceability system. In addition, MPT uses recursive calculation of node hash combined with path compression, which not only ensures the tamper resistance of transaction data, but also avoids the abnormal expansion of tree structure, has good tamper resistance and anti-malicious deep chain attack ability, and improves the system security. At the same time, compared with the binary structure of the traditional Merkle tree, MPT significantly reduces the storage overhead caused by the increase of block volume, further optimizing the overall system performance.
[0056] Currently, MPT has been widely used in mainstream blockchain platforms such as Ethereum. Its practical experience in account status tree and transaction record storage has fully verified the efficiency and feasibility of this data structure in high-throughput blockchain systems. Therefore, the introduction of MPT into the food blockchain based on the main chain DAG not only realizes the efficient, dynamic and secure storage and verification of transaction data, but also takes into account the lightweight and scalability of the system, meeting the needs of high-performance traceability systems. The Merkle Patricia tree can store any length of<key,value> Key-value pairs enable fast node insertion and deletion, as well as efficient querying of node data. The Merkle Patricia tree contains three types of nodes: leaf nodes, extension nodes, and branch nodes. It uses path compression technology to effectively reduce the tree height, eliminate redundant nodes, and improve query performance.
[0057] 1. Leaf nodes
[0058] Leaf nodes are used to store complete<key,value> Key-value pairs, where the key is hexadecimal-encoded and stores the remaining path portion after path compression, and the value corresponds to the actual data content. Leaf nodes are the end points of the path and are responsible for the final storage of the data.
[0059] 2. Extension Node
[0060] The extension node records the common prefix in the path, and its structure is the same as<key,value> The value of a node stores the hash value of the subsequent child node, pointing to the next node location. Expanding nodes reduces redundant links and improves storage efficiency by compressing multiple nodes with the same prefix path.
[0061] 3. Branch Node
[0062] A branch node is an array structure with a length of 17. The first 16 items correspond to hexadecimal characters 0 through F, each storing the hash value of the corresponding child node or a null value. The 17th item is the value item. If the current path ends at this node, this item stores the corresponding value; otherwise, it is null. Branch nodes implement path forking management and are the core of multipath access in the MPT tree structure.
[0063] Figure 2Because of 4<key,value> An example of an MPT consisting of key-value pairs. Among them, the prefix of all keys is a6, so in the first step of the tree structure, the common prefix a6 is path-compressed, extracted as an extended node, and used as the root node of the MPT. The key of the extended node stores a6, and its value stores the hash value pointing to the subsequent node. After removing a6, a branch node is constructed, where the second, sixth, and fth items are used to store the hash values of subsequently generated nodes. After removing the first, seventh, and fth items, only key1 and key3 of the four keys have a common prefix. The common prefix 6d is extracted to construct an extended node, and the remaining parts of key0 and key2 are used to construct leaf nodes respectively. Finally, a branch node is constructed, where the third and ninth items are used to store the hash values of subsequently generated nodes, and the remaining parts of key1 and key3 are used to construct leaf nodes respectively.
[0064] In order to further improve the data query efficiency, access control capability and system scalability in the food blockchain system based on the main chain DAG, this paper proposes a hierarchical MPT structure optimization scheme based on the sensitivity level of food data on the basis of the MPT adopted by the block structure. Specifically, food data is divided into two levels according to sensitivity: the first level is public shared data, and the second level is sensitive privacy data, corresponding to the food supply chain information analysis table. Each type of data is constructed<key,value> When constructing the Patricia tree, data sensitivity labels are embedded as path prefixes within the MPT, logically dividing the data into multiple sub-path areas for data insertion and organization. For example, first-level publicly shared data, such as product batch, production time, and geographic location, uses the path prefix / pub / ; second-level privacy-sensitive data, such as cost structure and quality inspection personnel information, uses the path prefix / pri / . This strategy implements a hierarchical sensitivity tree for food data within the MPT tree without changing the three node types (leaf, extension, and branch) of the MPT structure. Furthermore, this structure facilitates high-performance traceability operations such as time window queries and fuzzy matching. For example, using / pub / 202503 / as the path prefix supports monthly queries. Combined with path compression and node hashing, this significantly reduces query complexity and improves node response efficiency. In summary, this Patricia tree structure optimization scheme not only balances data immutability and dynamic scalability, but also enhances the hierarchical management capabilities of food data and the traceability adaptability of the system. It is particularly suitable for food blockchain traceability scenarios where private and public data coexist.
[0065] 1.2.3 Block Header Design
[0066] According to the characteristics of the main chain DAG blockchain, build the adapted block header content. Figure 3As shown, it includes parent hash, reference hash, block hash, timestamp, version, public key, block signature and MPT tree root. Parent hash is used to identify the parent block to which the current block is directly connected, and its value is the hash value of the parent block header. This field is used to form the main edge in the DAG structure, ensuring the traceability and connectivity of the block in the DAG topology, and at the same time providing a pre-order dependency for the subsequent consensus process to ensure the orderliness of the block topology. The reference hash is used to record the current block's reference to other existing blocks. Its value is a set of hash values of multiple referenced blocks, forming a secondary edge in the DAG structure. By referencing historical blocks, the connectivity of the topology graph can be enhanced, overly long chains can be avoided, the system fault tolerance and topological robustness can be improved, and orphan blocks can be prevented. The block hash is the overall hash value of the current block header, and is the core identifier of the block connected to subsequent blocks. The parent hash or reference hash field of other blocks must point to the block hash to realize the chain association between blocks in the DAG. The specific connection method is as follows Figure 4 As shown in the figure, the timestamp records the generation time of the current block, ensuring the order of blocks. It also serves as an auxiliary basis for sorting in the main chain DAG topology, preventing time conflicts caused by excessive block generation. The version number indicates the protocol version used by the current block, ensuring version compatibility during subsequent system iterations and preventing parsing ambiguities between blocks of different versions. The public key field records the public key of the block producer and, combined with the block signature, verifies the legitimacy of the block. This public key information can be traced back to the identity of the block producer. The block signature is signed by the block producer using its private key to key fields in the block header, ensuring that the block has not been tampered with and preventing malicious nodes from forging blocks. Food regulatory nodes can verify the signature using the public key to confirm the legitimacy of the block. The MPT tree root records the Merkle Patricia root hash of all transaction data within the current block body. Combined with the MPT structure, it enables efficient and dynamic storage and verification of transaction data within the block body, ensuring data integrity and immutability. Enterprise entity nodes can implement lightweight verification using the root hash and a small number of path nodes, reducing storage burden. In summary, this block header structure fully combines the high concurrency and multi-branch characteristics of the main chain DAG blockchain to ensure orderly block connections and stable topology, while taking into account block security, verification efficiency and data integrity, meeting the performance and security requirements of the food traceability data storage system.
[0067] When constructing the block header of the mainchain DAG blockchain, the design of each field must not only ensure the implementation of its logical functionality but also balance storage efficiency and network transmission performance. Therefore, this study further calculated the precise byte allocation for each field in the block header to ensure the compactness and practicality of the block header structure. On this basis, the parent hash, reference hash, block hash, timestamp, version, public key, block signature, and MPT tree root fields are shown in Table 1.
[0068] 1) Version: The version field is represented by a 32-bit integer, typically encoded in hexadecimal (e.g., 0x20000000), occupying 4 bytes. This length is designed based on the version of mainstream blockchain protocols such as Bitcoin, meeting the requirements of system protocol upgrades and compatibility identification.
[0069] 2) Timestamp: The timestamp field uses the UNIX timestamp format to record the block generation time and is stored using 4 bytes (32-bit). It meets the data timeliness requirements of long-term application scenarios such as food traceability.
[0070] 3) Public Key: The ECDSA (Secp256k1) signature algorithm is used. To reduce storage overhead, the public key is compressed, occupying 33 bytes. By omitting part of the y-coordinate, the compressed public key maintains uniqueness and security while reducing the field length.
[0071] 4) Block signature: The ECDSA (Secp256k1) algorithm is used to generate a signature, which consists of two 256-bit values, r and s, and occupies 64 bytes. This ensures that the identity of the block producer can be verified and the block content has not been tampered with.
[0072] 5) Parent hash, reference hash, block hash, MPT root: These hash fields are calculated using the SHA-256 hash algorithm, with a fixed output length of 32 bytes (256 bits). They are used to connect the previous block, reference block, current block identifier, and block body data summary, respectively, to ensure data integrity and topological order on the chain.
[0073] Table 4 Bytes and descriptions of relevant fields
[0074]
Claims
1. A main chain DAG blockchain network model for food big data, involving the fields of food safety and blockchain. Specifically, the model provides a set of food blockchain architecture design and methods based on the main chain DAG. It is characterized by: The management methods include: (1) Food supply chain data analysis The food supply chain has a complex data and information hierarchy, categorized as upstream, midstream, and downstream. Each segment comprises related links corresponding to different business entities. The upstream segment, at the beginning of the supply chain, encompasses production and procurement, specifically the manufacturers that provide raw materials and the processing companies that acquire them. The midstream segment primarily processes and modifies raw materials, transforming them into practical products, encompassing transportation, raw material warehousing, processing, and finished product storage. Downstream enterprises encompass transportation and sales, specifically transport companies, retailers, and end consumers. Relevant companies collect data and information through equipment and categorize it according to its level of privacy, either publicly shareable or private data accessible only to companies along the supply chain and regulatory authorities. (2) Food blockchain architecture based on main chain DAG The blockchain architecture based on the main chain DAG includes a node model and block topology design. First, the node model is designed, consisting of a set of enterprise entity nodes and a set of food regulatory nodes. These two sets of nodes together form a peer-to-peer network. Data-collecting enterprises upload data from the enterprise entity nodes to the blockchain. Regulatory agencies, such as the Market Supervision Bureau or the Food Safety Department, act as food regulatory nodes to verify and reach consensus on the data, which is then stored in the data storage model of the main chain DAG blockchain. This data storage model includes: (a) improvements to the block Merkle tree. Based on the introduction of the Merkle Patricia Tree (MPT), a hierarchical MPT structure optimization scheme based on the sensitivity level of food data is proposed to reduce the large computational overhead of the large Merkle tree and improve management and query efficiency. (b) Relevant fields are introduced in the block header to adapt to the main chain DAG blockchain topology. These fields generally include version, timestamp, public key, block signature, parent hash, block hash, reference hash, and Merkle Patricia tree root. (c) Calculation of relevant fields in the block header.
2. The method according to claim 1, characterized in that The main chain DAG-based food blockchain architecture first conducts data analysis on the food supply chain and investigates the high throughput characteristics of food based on actual conditions.
3. The method according to claim 1 or 2, characterized in that The food blockchain architecture based on the main chain DAG consists of a supply chain model, a node model and a main chain DAG blockchain model.
4. The method according to claim 1 or 2, characterized in that The definition and design of the block topology, primary edge and parent block, secondary edge and reference block in the blockchain architecture based on the main chain DAG in the present invention.
5. The method according to claim 1 or 2, characterized in that The Merkle Patricia tree is combined with the main chain DAG blockchain to adapt to high-throughput food data, improving overall query efficiency and system scalability. Based on the Merkle Patricia tree, a Merkle Patricia tree logical structure model with layered food data sensitivity is designed. Under the MPTRoot in the block header as the root node, the / pub / and / pri / paths are used as logical sensitivity branches to construct corresponding data path structures. Under each path, the extension node and branch node are used to locate the key, and finally the leaf node is landed to complete the specific<key,value> Storage and indexing of data pairs.
6. The method according to claim 1 or 2, characterized in that In the food blockchain architecture based on the main chain DAG, special parent hashes, reference hashes and block hashes are introduced to ensure the traceability and connectivity of blocks in the DAG topology, while providing pre-order dependencies for subsequent consensus processes to ensure the orderliness of the block topology.
7. The method according to claim 1 or 2, characterized in that The food blockchain architecture based on the main chain DAG is designed and calculated for specific fields, which supports complex applications while maintaining smaller storage requirements, meeting the storage requirements of high-throughput blockchains.
Citation Information
Cited By
Verifiable medical data query method based on DAG block chain architecture
CN121478784A
A verifiable medical data query method based on a DAG blockchain architecture
CN121478784B