CN115544047B - Distributed supply chain tracing and information storage method and system based on block chain - Google Patents

Distributed supply chain tracing and information storage method and system based on block chain Download PDF

Info

Publication number
CN115544047B
CN115544047B CN202211490729.2A CN202211490729A CN115544047B CN 115544047 B CN115544047 B CN 115544047B CN 202211490729 A CN202211490729 A CN 202211490729A CN 115544047 B CN115544047 B CN 115544047B
Authority
CN
China
Prior art keywords
transaction
file
information
chain
pointer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211490729.2A
Other languages
Chinese (zh)
Other versions
CN115544047A (en
Inventor
徐欢
鲍福光
沈仲华
钱江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Non Line Digital Technology Co ltd
Original Assignee
Zhejiang Non Line Digital Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Non Line Digital Technology Co ltd filed Critical Zhejiang Non Line Digital Technology Co ltd
Priority to CN202211490729.2A priority Critical patent/CN115544047B/en
Publication of CN115544047A publication Critical patent/CN115544047A/en
Application granted granted Critical
Publication of CN115544047B publication Critical patent/CN115544047B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention discloses a distributed supply chain tracing and information storage method and system based on a block chain, relating to the technical field of the block chain, wherein the method comprises the following steps: sending a source tracing request to the whole node; receiving link data of target transaction sent by all nodes; acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction; acquiring a target original certificate storing file from an IPFS (Internet protocol platform System) by using CID (File identifier) information of original certificate storing files of various transactions, and sending a data acquisition request to a whole node so that the whole node acquires data on a block chain of various transactions; and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result. In the invention, the source tracing process is completed by data interaction between the source tracing node and the IPFS system, thereby greatly reducing the workload of all nodes and lightening the source tracing pressure of all nodes.

Description

Distributed supply chain tracing and information storage method and system based on block chain
Technical Field
The invention relates to the technical field of block chains, in particular to a distributed supply chain tracing and information storage method and system based on a block chain.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
The blockchain may serve as a data record database, which is shared by the network nodes. Different from the existing database, when the nodes update data, the nodes submit data records, and the consistency of the data among the nodes is ensured through a mechanism of negotiation consistency; after the consistency is determined, the records such as the blockchain and the like will not be changed or deleted. The block chain technology is very suitable for the data tracing field due to the unique non-tamper property and traceability. The block chain technique is built on the internet, and combines the data blocks arranged in time sequence into a specific data structure in the chain by using P2P, distributed storage and distributed key ideas. Meanwhile, the front and back transactions are also connected with the unlocking algorithm through the user signature, and a specific transaction chain structure is formed. Due to different deployment environment models, the blockchain also has different architectures, such as a public chain, a federation chain, a private chain, and the like. In consideration of the consensus problem in a complex application scenario, in the block chain mode of the alliance chain, the number of all nodes is far less than that of all nodes in the public chain mode, so that the authoritative all nodes in the alliance chain can meet the tracing request of mass and concentrated data and bear great data index pressure. No effective solution has been proposed to the above-mentioned problems.
Disclosure of Invention
The embodiment of the invention provides a distributed supply chain tracing and information storage method and system based on a block chain, which are used for at least solving the technical problems of reducing the tracing pressure of all nodes and reducing network congestion caused by mass data transmission.
According to an aspect of the embodiments of the present invention, a distributed supply chain tracing method based on a blockchain is provided, which is applied to a tracing node of the blockchain, and includes: sending a source tracing request to the whole node; receiving link data of target transaction sent by all nodes; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data comprises at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction; acquiring a target original certificate-storing file from an IPFS (Internet protocol multimedia System) by utilizing the CID (certificate-storing File) information of the original certificate-storing files of each transaction, and sending a data acquisition request to a whole node so that the whole node acquires data on the block chain of each transaction according to the hash information of the previous transaction and the height information of the previous transaction block; and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result.
Optionally, obtaining, from the IPFS system, pointer files of transactions in a transaction chain where the target transaction is located by using CID information of the pointer file of the target transaction, where the obtaining includes: acquiring the pointer file of the target transaction from an IPFS system by utilizing the CID information of the pointer file of the target transaction; acquiring CID information of a previous transaction pointer file of the target transaction from the pointer file of the target transaction; and utilizing the CID information of the prior transaction pointer file of the target transaction to continuously acquire the pointer file of the prior transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained.
Optionally, obtaining a pointer file of a previous transaction from the IPFS system by using the CID information of the previous transaction pointer file of the target transaction includes: judging whether the pointer file continuously obtained is a key pointer file; the key pointer file comprises CID information of the last key file; if not, utilizing the CID information of the previous transaction pointer file in the pointer file obtained continuously, and continuously obtaining the pointer file of the previous transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained; if yes, acquiring a previous key pointer file from the IPFS system by using the CID information of the previous key pointer file, and continuously acquiring the pointer file of the previous transaction from the IPFS system by using the key pointer file and the previous key pointer file synchronously until acquiring the pointer file of the first transaction in the transaction chain or the acquired key pointer file.
According to another aspect of the embodiments of the present invention, there is also provided a block chain-based distributed supply chain information storage method, applied to a supply chain information recording node of a block chain, the method including: acquiring an original evidence storage file of a newly added transaction and previous transaction information of the newly added transaction; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; uploading the original certificate storing file to an IPFS (Internet protocol file system) so as to acquire CID (CID) information of the original certificate storing file from the IPFS; generating a pointer file of the newly added transaction by using the previous transaction information and the CID information of the original evidence storing file; uploading the pointer file of the newly added transaction to the IPFS system so as to acquire CID information of the pointer file of the newly added transaction from the IPFS system; and sending the CID information of the pointer file of the newly added transaction to a full node, so that the full node writes the CID information of the pointer file of the newly added transaction into a block chain.
Optionally, generating a pointer file of the newly added transaction by using the previous transaction information and the CID information of the original deposit certificate file, including: adding the former transaction information and the CID information of the original certificate-storing file to a target file; and taking the target file as a pointer file.
Optionally, the new transaction includes attribute information; generating the pointer file of the newly added transaction by using the previous transaction information and the CID information of the original certificate-storing file, and further comprising: judging whether the newly added transaction is a key transaction according to the attribute information; if so, adding the CID information of the key pointer file of the previous stage to the target file, and taking the added target file as the key pointer file of the current stage.
According to another aspect of the embodiments of the present invention, there is also provided a distributed supply chain information storage method based on a blockchain, applied to all nodes of the blockchain, the method including: receiving CID information of a pointer file of a newly added transaction, and writing the CID information of the pointer file of the newly added transaction into the link data of the newly added transaction; when a tracing request is received, acquiring on-chain data of a target transaction from a blockchain according to the tracing request; the on-chain data of the target transaction at least comprises CID information of a pointer file of the target transaction; sending the linked data of the target transaction to a tracing node so that the tracing node acquires a pointer file from an IPFS system by using CID information of the pointer file of the target transaction and acquires a target original evidence storage file based on the acquired pointer file; when a data acquisition request is received, acquiring the on-chain data of each transaction in the transaction chain where the target transaction is located in the block chain according to the data acquisition request; the data acquisition request comprises previous transaction hash information and previous transaction block height information of each transaction of the transaction chain, which are recorded by the tracing node; and sending the linked data of each transaction to the source tracing node.
Optionally, the method further comprises: receiving a supply chain tracing result sent by a tracing node; and verifying the supply chain tracing result.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform any of the method steps described above.
According to another aspect of the embodiment of the present invention, there is also provided a distributed supply chain tracing system based on a block chain, including a full node, a tracing node and a supply chain information recording node; the full node comprises the electronic device for executing the distributed supply chain tracing method based on the block chain, the tracing node comprises the electronic device for executing the distributed supply chain tracing method based on the block chain, and the supply chain information recording node comprises the electronic device for executing the distributed supply chain information storage method based on the block chain.
In the embodiment of the invention, a source tracing request is sent to the whole node; receiving link data of target transaction sent by the whole node; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data comprises at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction; acquiring a target original certificate-storing file from an IPFS (Internet protocol multimedia System) by utilizing the CID (certificate-storing File) information of the original certificate-storing files of each transaction, and sending a data acquisition request to a whole node so that the whole node acquires data on the block chain of each transaction according to the hash information of the previous transaction and the height information of the previous transaction block; and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result. In the embodiment of the invention, the link data of the target transaction is acquired from the blockchain based on the whole node, then the target original evidence storage file is acquired from the IPFS system by utilizing the tracing node and the pointer files corresponding to all transactions in the transaction chain based on the CID information of the pointer files of the target transaction in the link data, and then the data acquisition request is sent to the whole node, so that the whole node acquires the link data of all transactions in the transaction chain in the blockchain, and the tracing process is completed by the tracing node and the IPFS system through data interaction, thereby greatly reducing the workload of the whole node and lightening the tracing pressure of the whole node.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a flowchart of a block chain-based distributed supply chain tracing method for a tracing node according to an embodiment of the present invention;
fig. 2 is a flowchart of a block chain-based distributed supply chain information storage method according to an embodiment of the present invention;
fig. 3 is a flowchart of a full-node block chain-based distributed supply chain tracing method according to an embodiment of the present invention;
fig. 4 is a block output flow of the three-level distributed tracing structure according to the embodiment of the present invention;
fig. 5 is a three-tier distributed tracing structure according to an embodiment of the present invention;
fig. 6 is a distributed tracing flow supporting cross-phase synchronous tracing according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first", "second", and the like in the description and claims of the present invention and the accompanying drawings are used for distinguishing different objects, and are not used for limiting a specific order.
IPFS (Inter satellite File System) is an integrated and utilized existing technologies such as DHT (Distributed Hash Table), git (open source Distributed version control System), P2P (peer-to-peer), bitTorrent (bit stream, a content distribution protocol), and cryptography. In the IPFS system, a file is split into 256K-sized unit blocks, each block calculates a block hash value, the hash values of all the blocks are combined and then hashed, a file unique identification CID (Content ID) is obtained, the CID and the node ID of the corresponding stored file are recorded on a DHT, and a downloader can download the corresponding file in the IPFS network only by using the CID. IPFS is a content addressing based distributed file system, because it is content addressing based and hash algorithm based, so the file data in IPFS is not changeable.
Based on this, the application provides a block chain-based distributed supply chain tracing and information storage method and system, and the scheme is mainly implemented in a federation chain. The method combines the advantages of IPFS based on content addressing, and enables a user to complete a process of tracing a transaction chain in a pointer structure layer through interaction with the IPFS by constructing the pointer structure layer. The scheme can deal with higher-order data traceability requests, can improve the traceability efficiency of a certain transaction chain, greatly reduces the traceability pressure of all nodes, and reduces network congestion caused by a large amount of data transmission.
According to an aspect of the embodiment of the present invention, a method for tracing a distributed supply chain based on a blockchain is provided, and fig. 1 is a flowchart of the method for tracing a distributed supply chain based on a blockchain of a tracing node according to the embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, sending a source tracing request to all nodes;
in this step, the traceback node performs data processing with the full node and the supply chain information recording node using the same blockchain. The user can initiate tracing to any transaction in the transaction chain through the tracing request.
It should be noted that the transaction chain includes a plurality of related transactions arranged in time sequence, for example, there are a first transaction, a second transaction and a third transaction in a certain transaction chain. The second transaction is associated with a first transaction that occurs before the second transaction and a third transaction that occurs after the second transaction, respectively. It is also noted that the transaction may be a logged event.
Step S104, receiving linked data of target transaction sent by all nodes; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data comprises at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
in this step, the on-chain data is all the data for a certain transaction stored in the blockchain. The on-chain data includes at least CID information of a pointer file of the target transaction; the pointer file comprises original certificate storing file CID information and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information. A plurality of transaction data can be stored in one block of the block chain. And receiving the on-chain data of the target transaction acquired from the blockchain by the whole node based on the source tracing request. Wherein the target transaction may be the last transaction in the transaction chain.
It should be noted that each transaction in the transaction chain corresponds to a unique pointer file, and the CID information of each pointer file is recorded in the blockchain in advance, so that the link data of the target transaction is acquired from the blockchain by using the full nodes, so that the obtained CID information of the pointer file of the target transaction has high reliability, subsequent tracing is performed based on the CID information, and the reliability of the tracing result is improved.
Step S106, acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer file of the target transaction;
in this step, after CID information of a certain file is obtained, the file may be acquired from the IPFS system. Therefore, the pointer file of the target transaction can be obtained from the IPFS system by utilizing the CID information of the pointer file of the target transaction, the pointer file comprises the CID information of the original certificate file and the previous transaction information, and the previous transaction information comprises the CID information of the previous transaction pointer file, so that the source tracing can be carried out on the basis of the pointer file of the target transaction and the CID information of the previous transaction pointer file included in the pointer file of the target transaction, the pointer files of various transactions on the transaction chain where the target transaction is located can be obtained, and a pointer file chain can be obtained.
It should be noted that if the first transaction is adjacent to the second transaction in the transaction chain, the first transaction may be referred to as a previous transaction of the second transaction.
In addition, after the pointer file chain is obtained, because the previous transaction information of the pointer file further includes the previous transaction hash information and the previous transaction block height information, the CID information of the original certificate file in the pointer file of each transaction in the transaction chain, the previous transaction hash information of each transaction and the previous transaction block height information of each transaction can be recorded.
Step S108, the CID information of the original certificate storage files of each transaction is utilized to obtain target original certificate storage files from the IPFS system, and a data obtaining request is sent to the whole node, so that the whole node obtains the data on the block chain of each transaction according to the hash information of the previous transaction and the block height information of the previous transaction.
In this step, the recorded CID information of the original certificate file may be used to obtain the corresponding original certificate file from the IPFS system, and in order to reduce the data volume, only the original certificate file required in the tracing request, that is, the target original certificate file, may be obtained. The data acquisition request can include previous transaction hash information of each transaction in the transaction chain and previous transaction block height information of each transaction. The whole node can search the information stored in the block of the block chain according to the transaction hash information and the block height information to obtain the corresponding transaction on-chain data.
Step S110, receiving the link data of each transaction sent by the whole node, and using the link data of each transaction and the target original evidence storage file as a supply chain tracing result.
In this step, the on-chain data includes all transaction record information and also includes verification information, which can be used to verify the supply chain traceability result and confirm the validity of the traceability result. For example, it may be used to verify the pointer file, original certificate file, or original transaction record information in the blockchain.
In the embodiment of the invention, a source tracing request is sent to the whole node; receiving link data of target transaction sent by all nodes; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data comprises at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction; acquiring a target original certificate-storing file from an IPFS (Internet protocol multimedia System) by utilizing the CID (certificate-storing File) information of the original certificate-storing files of each transaction, and sending a data acquisition request to a whole node so that the whole node acquires data on the block chain of each transaction according to the hash information of the previous transaction and the height information of the previous transaction block; and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result. In the embodiment of the invention, the link data of the target transaction is acquired from the blockchain based on the whole node, then the target original evidence storage file is acquired from the IPFS system by utilizing the tracing node and the pointer files corresponding to all transactions in the transaction chain based on the CID information of the pointer files of the target transaction in the link data, and then the data acquisition request is sent to the whole node, so that the whole node acquires the link data of all transactions in the transaction chain in the blockchain, and the tracing process is completed by the tracing node and the IPFS system through data interaction, thereby greatly reducing the workload of the whole node and lightening the tracing pressure of the whole node.
In an alternative embodiment, the obtaining, from the IPFS system, the pointer file of each transaction in the transaction chain where the target transaction is located by using the CID information of the pointer file of the target transaction may be performed according to the following steps:
acquiring the pointer file of the target transaction from an IPFS system by utilizing the CID information of the pointer file of the target transaction; acquiring CID information of a previous transaction pointer file of the target transaction from the pointer file of the target transaction; and utilizing the CID information of the prior transaction pointer file of the target transaction to continuously acquire the pointer file of the prior transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained.
In an optional embodiment of the present invention, the tracing node interacts with the IPFS system, and obtains the pointer file in the transaction chain by using the CID information, and the newly obtained pointer file includes the CID information of the pointer file of the previous transaction of the current transaction, so that the pointer file of the previous transaction of the current transaction can be obtained based on the CID information, and the above steps are repeated until the pointer file of the first transaction is obtained. It should be noted that there is no previous transaction in the first transaction in the transaction chain.
In an alternative embodiment, using the CID information of the previous transaction pointer file of the target transaction, the method for continuously obtaining the pointer file of the previous transaction from the IPFS system may be performed according to the following steps:
judging whether the pointer file continuously obtained is a key pointer file or not; the key pointer file comprises CID information of the last key pointer file; if not, utilizing CID information of the previous transaction pointer file in the pointer file obtained continuously to obtain the pointer file of the previous transaction from the IPFS system continuously until the pointer file of the first transaction in the transaction chain is obtained; if so, acquiring the previous key pointer file from the IPFS system by using the CID information of the previous key pointer file, and continuously acquiring the pointer file of the previous transaction from the IPFS system by using the key pointer file and the previous key pointer file synchronously until the pointer file of the first transaction on the transaction chain or the acquired key pointer file is obtained.
In an alternative embodiment of the present invention, if the CID information of the last key pointer file is included in the pointer file, the pointer file is determined to be the key pointer file. If the pointer file is a key pointer file, acquiring the previous key pointer file from the IPFS system by using the CID information of the previous key pointer file, and synchronously acquiring the pointer file of the previous transaction from the IPFS system by using the key pointer file and the previous key pointer file until the pointer file of the first transaction in the transaction chain or the acquired key pointer file is obtained; if the pointer file is not the key pointer file, tracing based on the pointer file is continued until the pointer file of the first transaction in the transaction chain is obtained. By using the key pointer file, synchronous tracing can be realized, and the efficiency of tracing the source of the supply chain is improved.
A block chain based distributed supply chain tracing method for a tracing node is described below with a specific embodiment. The distributed tracing steps are accomplished by interacting with the IPFS as follows:
for example, the user node B is a tracing node, and when the whole node of the block chain receives a tracing request initiated by the user node B, the whole node firstly traces back the last transaction record locally, and returns a corresponding pointer file CID to the user node B. Then, the user node B sends a request to the IPFS according to the CID, retrieves the pointer file of the last transaction, retrieves the previous pointer file through the recorded previous pointer information and records the CID of the verification file and the transaction position information on the chain. The process is continuously circulated, when a key cross-phase pointer file is encountered, other key cross-phase pointer files can be quickly positioned by the cross-phase pointer, and single-chain tracing is converted into multi-stage synchronous tracing. After traversing the complete chain pointer file structure, the user can send a request to the complete node through the recorded on-chain transaction position, retrieve the complete transaction chain information recorded on the block chain at one time, and retrieve the original evidence storage file required by the user according to the requirement. A distributed tracing flow supporting cross-phase synchronous tracing is shown in fig. 6.
Referring to fig. 6, further describing the cross-stage tracing, the user node initiates a tracing request to the whole node, the whole node traces back the last transaction on the chain, and then the tracing is completed in the pointer file structure. When a key pointer file is encountered, cross-stage synchronous tracing is started, a tracing node can at least record a destination file CID and record information and block height on a chain based on the pointer file obtained by tracing, a full node can retrieve data of a full transaction chain on the chain based on the block height and the information on the chain provided by the tracing node and return the data to the tracing node, the tracing node can retrieve a destination certification file from an IPFS system based on the destination file CID, and finally the destination certification file and the data of the full transaction chain on the chain are used as a tracing result. The data of the whole transaction chain on the chain retrieved by the whole node can also comprise verification information used for verifying the tracing result.
According to another aspect of the embodiments of the present invention, there is further provided a block chain-based distributed supply chain information storage method, which is applied to a supply chain information recording node of a block chain, and fig. 2 is a flowchart of the block chain-based distributed supply chain information storage method provided in the embodiments of the present invention, as shown in fig. 2, the method includes the following steps:
step S202, acquiring original evidence storage files of newly added transactions and previous transaction information of the newly added transactions; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
in this step, the original certification documentation may include documentation in the form of photographs, documents, invoices, and videos. The new transaction is the most recently occurring transaction that needs to be added to the transaction chain.
Step S204, uploading the original certificate storing file to an IPFS system so as to acquire CID information of the original certificate storing file from the IPFS system;
in this step, CID information of the original authentication file is generated using the IPFS system. And storing the original certificate storing file in an IPFS in a distributed manner according to a certain structure.
Step S206, generating a pointer file of the newly added transaction by using the previous transaction information and the CID information of the original deposit certificate file;
in this step, the pointer file includes the CID information of the original deposit certificate file of the current new transaction and the previous transaction information of the current transaction.
Step S208, uploading the pointer file of the newly added transaction to the IPFS system so as to obtain CID information of the pointer file of the newly added transaction from the IPFS system;
in this step, the CID information of the pointer file for the new transaction is generated using the IPFS system.
Step S210, sending the CID information of the pointer file of the newly added transaction to a full node, so that the full node writes the CID information of the pointer file of the newly added transaction into a block chain.
In the step, the CID information of the pointer file of the newly added transaction is sent to the whole node, so that the whole node is only responsible for writing the CID information of the pointer file of the newly added transaction into the block chain, the tracing node traces the source based on the CID information of the pointer file, the workload of the whole node is greatly reduced, and the tracing pressure of the whole node is reduced.
The CID information of the pointer file of each newly added transaction is written into the block chain, a pointer structure layer can be constructed, a three-layer distributed architecture is finally formed with the block chain and the IPFS system, the pointer structure layer can be connected with the block chain and the IPFS system in a two-way mode, and therefore the tracing node can realize tracing through interaction with the IPFS system.
In an alternative embodiment, generating the pointer file of the new transaction by using the previous transaction information and the CID information of the original certificate file may be performed according to the following steps:
adding the previous transaction information and the CID information of the original certificate-storing file to a target file; and taking the target file as a pointer file.
In an alternative embodiment, the new transaction includes attribute information; generating the pointer file of the newly added transaction by using the previous transaction information and the CID information of the original certificate-storing file, and further executing the following steps:
judging whether the newly added transaction is a key transaction or not according to the attribute information; if so, adding the CID information of the key pointer file of the previous stage to the target file, and taking the added target file as the key pointer file of the current stage.
In an alternative embodiment of the invention, the attribute information may be used to mark the supply chain stage to which the new transaction belongs. And if the current transaction is the last transaction of a certain stage and the information of the next stage is recorded in the subsequent transaction, considering that the current transaction is a milestone transaction event, namely the key transaction. And adding the CID information of the previous key pointer file into the pointer file of the newly added transaction to obtain the key pointer file if the newly added transaction is the current transaction. Based on the key pointer file, cross-phase synchronous distributed tracing can be realized. The method greatly improves the tracing efficiency, and particularly obviously improves the tracing efficiency of the long-span transaction chain.
A block chain-based distributed supply chain information storage method for a supply chain information recording node is described below with a specific embodiment.
For example, the user node a is a supply chain information recording node, see the block-out flow of the three-tier distributed tracing structure shown in fig. 4, and the user node a initiating the transaction needs to provide an original certificate of deposit file and upload the original certificate of deposit file to the IPFS to obtain all CIDs of the original certificate of deposit file. And combining the previous transaction information including the hash of the previous transaction, the height of the block where the previous transaction is located and the CID of the previous pointer file to generate a pointer file and uploading the pointer file to the IPFS system. If the current initiated transaction is a milestone event, a stage-one key pointer file CID needs to be added additionally, and a key cross-stage pointer file is generated and uploaded to the IPFS system. After the CID of the pointer file is obtained, it is written into the transaction information by consensus in the block chain. The resulting three-tier distributed traceback architecture is shown in fig. 5.
In FIG. 5, the phase one, phase two, and phase three represent three different phases within the same transaction chain. Wherein, the first phase includes transaction tx.1 and transaction tx.2, transaction tx.1 is the previous transaction of transaction tx.2, transaction tx.2 is the milestone transaction of the first phase, the block where transaction tx.2 is located stores some basic transaction information such as the initiator receiver of transaction tx.2, and the related transaction information of transaction tx.2, for example: the former transaction of the transaction tx.2 is transaction tx.1, and the latter transaction is tx.3, etc. The block where the transaction tx.2 is located also stores CID information of the pointer file of the transaction tx.2, the pointer file of the transaction tx.2 can be obtained in the IPFS system based on the CID information of the pointer file, since the transaction tx.2 is a milestone transaction, the pointer file of the transaction tx.2 is a key pointer file, and after the pointer file of the transaction tx.2 is obtained, the original evidence file ("file" shown in the last row in the figure) can be obtained from the IPFS system based on the CID information of the evidence file because the pointer file includes CID information of the original evidence file. The CID information storage and use conditions corresponding to the transaction tx.2 in the stage one are explained above, and the transaction tx.2 is referred to for the transaction CID information storage and use conditions in the stage one transaction tx.1 and the stage two and the stage three, which are not described again.
Referring to fig. 5, when tracing, a transaction tx.n is the last transaction of the transaction chain where the transaction tx.n is located, and the transaction tx.n is used as a target transaction, after receiving a tracing request of a tracing node, a whole node sends the data on the chain of the last transaction tx.n to the tracing node, where the data on the chain at least includes CID information of a pointer file of the last transaction tx.n, so that the tracing node obtains the pointer file of the transaction tx.n from the IPFS system based on CID information of the pointer file, and traces to the pointer file of the transaction tx.n-1 based on the previous transaction information stored in the pointer file of the transaction tx.n, and since the pointer file of the transaction tx.n-1 is a key pointer file (where CID of the key pointer file of the previous stage is stored, and the key pointer file of the previous stage in the figure is transaction tx.2), the pointer files of the transaction tx.2 and the pointer file of the transaction tx.n-1 can be used for synchronous tracing. The above process is based on a block chain, a pointer file chain (each transaction in the transaction chain corresponds to only one pointer file, and therefore, the pointer file also constitutes the pointer file chain), and an IPFS system, and constitutes a three-level distributed traceability structure.
According to another aspect of the embodiment of the present invention, there is also provided a block chain-based distributed supply chain tracing method, and fig. 3 is a flowchart of a full-node block chain-based distributed supply chain tracing method according to the embodiment of the present invention, as shown in fig. 3, the method includes the following steps:
step S302, receiving CID information of a pointer file of a newly added transaction, and writing the CID information of the pointer file of the newly added transaction into the data on the link of the newly added transaction;
step S304, when a tracing request is received, obtaining the on-chain data of the target transaction from the block chain according to the tracing request; the on-chain data of the target transaction at least comprises CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
step S306, sending the linked data of the target transaction to a tracing node, so that the tracing node acquires a pointer file from an IPFS system by using CID information of the pointer file of the target transaction, and acquires a target original deposit certificate file based on the acquired pointer file;
step S308, when a data acquisition request is received, acquiring the on-chain data of each transaction in the transaction chain where the target transaction is located in the block chain according to the data acquisition request; the data acquisition request comprises previous transaction hash information and previous transaction block height information of each transaction of the transaction chain, which are recorded by the tracing node;
step S310, sending the linked data of each transaction to the tracing node.
In the embodiment of the present invention, the whole node interacts with the supply chain information recording node, and may receive CID information of a pointer file of a newly added transaction, write CID information of the pointer file of the newly added transaction into data on a chain of the newly added transaction, and then obtain data on the chain of a target transaction from a blockchain when receiving a tracing request sent by a tracing node, because data on the chain of the target transaction at least includes CID information of the pointer file of the target transaction, after sending the data on the chain of the target transaction to the tracing node, the tracing node may obtain the pointer file from the IPFS system by using CID information of the pointer file of the target transaction, and obtain a target original deposit file based on the obtained pointer file, and then when the whole node receives a data obtaining request sent by the tracing node, the data obtaining request includes hash information of previous transaction and height information of previous transaction blocks of transactions of each transaction in the transaction chain where the target transaction is located, and thus the whole node may obtain data on the blockchain of the transactions according to the data obtaining request. The block chain full node is mainly responsible for executing a consensus algorithm for generating new blocks, participating in continuous generation of the blocks, tracing the source of the last transaction and providing final full chain information when receiving a tracing request.
In order to prove that a certain transaction is the source transaction of the last transaction, the process of knowing the information of the latter transaction and searching the previous transaction information needs to be repeated continuously, so that the traceability of the block chain technology is necessarily the whole chain traceability, namely, the relevance and the legality of the source transaction record and the latest transaction record can be proved through verification. Thus, in an alternative embodiment, the method may further perform the steps of: receiving a supply chain tracing result sent by a tracing node; and verifying the supply chain tracing result.
In this step, whether the transaction record information obtained by tracing is uplink or not can be verified by merkel root provided by the whole node of the block chain. Because IPFS has strong tamper resistance, the validity of the retrieved pointer file can be verified by the CID in the transaction record, and the validity of the original certificate can be further verified by the CID of the original certificate recorded in the pointer file. And finally, verifying the front-back relation of the transaction according to the user signature and the unlocking algorithm in the transaction so as to determine the legal relation between the source transaction and the final transaction in a transaction chain.
The nodes in the scheme are divided into a user node A for initiating transaction, a user node B for initiating a tracing request and a block chain full node for consensus and recording. The implementation of the scheme is described below in a specific embodiment in connection with the interaction between the three types of nodes. The scheme can comprise the following specific steps:
1) User node a initiates a create transaction (which may also be referred to as a trade) tx.n, and node a provides the corresponding original credential file Raw Files and uploads to the IPFS. And generating a Pointer file Pointer according to the CID of the certificate storage Files Raw Files, the transaction hash of the previous transaction Tx.n-1 and the hash of the block where the Pointer file Pointer is located, and uploading the Pointer file Pointer to the IPFS. Writing CID of Pointer into transaction information, after all nodes are identified, writing into block uplink.
2) And constructing a Key cross-stage Pointer file Key Pointer (Key Pointer file) according to each milestone event in the full life cycle of the product in reality. When the current transaction is the last transaction of a certain stage and the information of the next stage is recorded in the subsequent transaction, the current transaction is regarded as a milestone transaction event, and a key cross-stage pointer file is established for the current transaction, and points to the milestone transaction event of the previous stage and the corresponding key cross-stage pointer file.
3) After receiving the tracing request of the user node B, the whole node locally traces the source of the last transaction record and returns the verification information of the last transaction and the pointer file CID.
4) After the user node B obtains the CID of the pointer file of the last transaction, it sends a request to IPFS to retrieve the pointer file. According to the previous transaction information recorded in the pointer file, the pointer file of the previous transaction is retrieved, and the information of the original certificate-storing file CID of the current transaction, the position of the previous transaction on the blockchain and the like is recorded. This step is continuously cycled until the pointer file of the first transaction or the critical cross-phase pointer file is traced.
5) When the user node B traces back the key cross-stage pointer file, the key cross-stage pointer file of each stage can be quickly retrieved according to the recorded cross-stage pointer, and the corresponding pointer file of each stage is synchronously traced back, and step 4 is continuously repeated until the pointer file of the first transaction or the acquired key cross-stage pointer file is traced back.
6) And (5) after the user node B finishes the steps 4 and 5 and obtains the pointer file of the first transaction by tracing, retrieving the original certificate storage file according to the CID of the recorded original certificate storage file of the whole transaction chain as required, sending a request to the whole node according to the position information of the recorded transaction on the blockchain, retrieving the transaction information on the chain and carrying out corresponding verification.
The application provides a distributed supply chain tracing and information storage method and system based on a block chain, and the method can be suitable for a tracing scheme under the pressure of a large number of tracing requests. By constructing the pointer structure layer, a user can obtain the full transaction chain pointer file through continuous interaction with the IPFS, and then retrieve the transaction information and the original evidence storage file on the chain through the pointer file recording information. Compared with the traditional block chain traceability mode, in the distributed traceability architecture constructed based on the block chain and the IPFS technology, the traceability process can be finished by interaction of a user and the IPFS, all nodes only need to finish verification work, and the traceability pressure of all nodes is greatly reduced, so that the computing power of all nodes is liberated, and more work gravity centers are transferred to the fields of verification, supervision and the like. The method has the advantages that the tracing efficiency of a specific transaction chain is improved, network congestion caused by mass data transmission is reduced, and the method has more remarkable advantages when processing ultrahigh-level requests. The scheme only improves the file structure of distributed storage, improves corresponding tracing processes and algorithms, does not involve the change of the original chain structure of a block chain and a consensus algorithm, and has strong compatibility.
According to another aspect of the embodiments of the present invention, there is also provided a distributed supply chain tracing apparatus based on a blockchain, where the apparatus is applied to a tracing node of the blockchain, and the distributed supply chain tracing apparatus based on the blockchain includes: the device comprises a source tracing request module, a data receiving module, a pointer file acquiring module, a source tracing data module and a source tracing result module;
the source tracing request module is used for sending a source tracing request to the whole node; the data receiving module is used for receiving the linked data of the target transaction sent by the whole node; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data includes at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; the pointer file acquisition module is used for acquiring the pointer files of all transactions on a transaction chain where the target transaction is located from the IPFS system by utilizing the CID information of the pointer files of the target transaction; a source tracing data module, configured to obtain a target original certificate-storing file from an IPFS system by using CID information of the original certificate-storing file of each transaction, and send a data obtaining request to a full node, so that the full node obtains link data of each transaction in the blockchain according to hash information of a previous transaction of each transaction and height information of a previous transaction block; and the source tracing result module is used for receiving the on-chain data of each transaction sent by the whole node and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain source tracing result.
In the embodiment of the invention, a source tracing request is sent to the whole node; receiving link data of target transaction sent by the whole node; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data includes at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction; acquiring a target original certificate-storing file from an IPFS (Internet protocol multimedia System) by utilizing the CID (certificate-storing File) information of the original certificate-storing files of each transaction, and sending a data acquisition request to a whole node so that the whole node acquires data on the block chain of each transaction according to the hash information of the previous transaction and the height information of the previous transaction block; and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result. In the embodiment of the invention, the whole node acquires the on-chain data of the target transaction from the blockchain, then the original target deposit certificate file is acquired from the IPFS system by utilizing the tracing node and the pointer file corresponding to each transaction in the transaction chain based on the CID information of the pointer file of the target transaction in the on-chain data, and then the data acquisition request is sent to the whole node, so that the whole node acquires the on-chain data of each transaction in the transaction chain in the blockchain, and the tracing process is completed by the tracing node and the IPFS system through data interaction, thereby greatly reducing the workload of the whole node and lightening the tracing pressure of the whole node.
It should be noted here that the foregoing tracing request module, the data receiving module, the pointer file obtaining module, the tracing data module, and the tracing result module correspond to steps S102 to S110 in the method embodiment, and the foregoing modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in the method embodiment.
In an optional implementation manner, the pointer file acquiring module is specifically configured to: acquiring the pointer file of the target transaction from an IPFS system by utilizing the CID information of the pointer file of the target transaction; acquiring CID information of a previous transaction pointer file of the target transaction from the pointer file of the target transaction; and continuously acquiring the pointer file of the previous transaction from the IPFS system by utilizing the CID information of the pointer file of the previous transaction of the target transaction until the pointer file of the first transaction in the transaction chain is obtained.
In an optional implementation manner, the pointer file obtaining module is specifically configured to: judging whether the pointer file continuously obtained is a key pointer file; the key pointer file comprises CID information of the last key pointer file; if not, utilizing the CID information of the previous transaction pointer file in the pointer file obtained continuously, and continuously obtaining the pointer file of the previous transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained; if so, acquiring the previous key pointer file from the IPFS system by using the CID information of the previous key pointer file, and continuously acquiring the pointer file of the previous transaction from the IPFS system by using the key pointer file and the previous key pointer file synchronously until the pointer file of the first transaction on the transaction chain or the acquired key pointer file is obtained.
According to another aspect of the embodiments of the present invention, there is also provided a blockchain-based distributed supply chain information storage apparatus applied to a supply chain information recording node of a blockchain, the blockchain-based distributed supply chain information storage apparatus including: the device comprises an acquisition module, a first uploading module, a generation module, a second uploading module and a sending module;
the acquisition module is used for acquiring the original evidence storage file of the newly added transaction and the previous transaction information of the newly added transaction; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; the first uploading module is used for uploading the original certificate storing file to an IPFS system so as to acquire CID information of the original certificate storing file from the IPFS system; the generating module is used for generating a pointer file of the newly added transaction by utilizing the previous transaction information and the CID information of the original evidence storing file; the second uploading module is used for uploading the pointer file of the newly added transaction to the IPFS system so as to obtain CID information of the pointer file of the newly added transaction from the IPFS system; and the sending module is used for sending the CID information of the pointer file of the newly added transaction to the whole node so that the whole node writes the CID information of the pointer file of the newly added transaction into the block chain.
It should be noted here that the acquiring module, the first uploading module, the generating module, the second uploading module and the sending module correspond to steps S202 to S210 in the method embodiment, and the modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in the method embodiment.
In an optional implementation manner, the generating module is specifically configured to: adding the previous transaction information and the CID information of the original certificate-storing file to a target file; and taking the target file as a pointer file.
In an alternative embodiment, the new transaction includes attribute information; the generation module is further configured to: judging whether the newly added transaction is a key transaction or not according to the attribute information; if so, adding the CID information of the key pointer file of the previous stage to the target file, and taking the added target file as the key pointer file of the current stage.
According to another aspect of the embodiments of the present invention, there is also provided a distributed supply chain tracing apparatus based on a blockchain, where the apparatus is applied to all nodes of the blockchain, and the distributed supply chain tracing apparatus based on the blockchain includes: the system comprises a transaction data receiving module, a target data acquisition module, a target data sending module, an on-chain data acquisition module and an on-chain data sending module;
the transaction data receiving module is used for receiving CID information of the pointer file of the newly added transaction and writing the CID information of the pointer file of the newly added transaction into the link data of the newly added transaction; the target data acquisition module is used for acquiring the on-chain data of the target transaction from the blockchain according to the source tracing request when the source tracing request is received; the on-chain data of the target transaction at least comprises CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information; a target data sending module, configured to send the data on the link of the target transaction to a tracing node, so that the tracing node obtains a pointer file from an IPFS system by using CID information of the pointer file of the target transaction, and obtains a target original evidence storage file based on the obtained pointer file; the on-chain data acquisition module is used for acquiring on-chain data of each transaction in a transaction chain where the target transaction is located in the block chain according to the data acquisition request when the data acquisition request is received; the data acquisition request comprises previous transaction hash information and previous transaction block height information of each transaction of the transaction chain, which are recorded by the tracing node; and the on-chain data sending module is used for sending the on-chain data of each transaction to the source tracing node.
It should be noted here that the above-mentioned transaction data receiving module, target data acquiring module, target data transmitting module, on-chain data acquiring module and on-chain data transmitting module correspond to steps S302 to S310 in the method embodiment, and the above-mentioned modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure in the above-mentioned method embodiment.
In an optional implementation, the apparatus further comprises a verification module configured to: receiving a supply chain tracing result sent by a tracing node; and verifying the supply chain tracing result.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the method steps of any of the above.
According to another aspect of the embodiment of the present invention, a distributed supply chain tracing system based on a block chain is further provided, where the system includes a full node, a tracing node, and a supply chain information recording node; the full node comprises the electronic equipment, the source tracing node comprises the electronic equipment, and the supply chain information recording node comprises the electronic equipment.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.

Claims (10)

1. A distributed supply chain tracing method based on a blockchain is characterized in that the method is applied to a tracing node of the blockchain, and comprises the following steps:
sending a source tracing request to the whole node;
receiving link data of target transaction sent by the whole node; the on-chain data is acquired by the full node from a blockchain based on the tracing request; the on-chain data includes at least CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
acquiring pointer files of various transactions on a transaction chain where the target transaction is located from an IPFS system by using CID information of the pointer files of the target transaction;
acquiring a target original certificate-storing file from an IPFS (Internet protocol multimedia System) by utilizing the CID (certificate-storing File) information of the original certificate-storing files of each transaction, and sending a data acquisition request to a whole node so that the whole node acquires data on the block chain of each transaction according to the hash information of the previous transaction and the height information of the previous transaction block;
and receiving the on-chain data of each transaction sent by the whole node, and taking the on-chain data of each transaction and the target original evidence storage file as a supply chain tracing result.
2. The method of claim 1, wherein obtaining pointer files for transactions in a transaction chain of the target transaction from an IPFS system using the CID information of the pointer file for the target transaction comprises:
acquiring the pointer file of the target transaction from an IPFS system by utilizing the CID information of the pointer file of the target transaction;
acquiring CID information of a previous transaction pointer file of the target transaction from the pointer file of the target transaction;
and utilizing the CID information of the prior transaction pointer file of the target transaction to continuously acquire the pointer file of the prior transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained.
3. The method of claim 2, wherein using the CID information of the pointer file of the previous transaction for the target transaction to obtain the pointer file of the previous transaction from the IPFS system, comprises:
judging whether the pointer file continuously obtained is a key pointer file or not; the key pointer file comprises CID information of the last key pointer file;
if not, utilizing the CID information of the previous transaction pointer file in the pointer file obtained continuously, and continuously obtaining the pointer file of the previous transaction from the IPFS system until the pointer file of the first transaction on the transaction chain is obtained;
if so, acquiring the previous key pointer file from the IPFS system by using the CID information of the previous key pointer file, and continuously acquiring the pointer file of the previous transaction from the IPFS system by using the key pointer file and the previous key pointer file synchronously until the pointer file of the first transaction on the transaction chain or the acquired key pointer file is obtained.
4. A distributed supply chain information storage method based on a block chain is characterized in that the method is applied to a supply chain information recording node of the block chain, and comprises the following steps:
acquiring an original evidence storage file of a newly added transaction and previous transaction information of the newly added transaction; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
uploading the original certificate storing file to an IPFS (Internet protocol file system) so as to acquire CID (CID) information of the original certificate storing file from the IPFS;
generating a pointer file of the newly added transaction by using the previous transaction information and the CID information of the original evidence storing file;
uploading the pointer file of the newly added transaction to the IPFS system so as to acquire CID information of the pointer file of the newly added transaction from the IPFS system;
sending the CID information of the pointer file of the newly added transaction to a full node, so that the full node writes the CID information of the pointer file of the newly added transaction into a block chain, and the tracing node realizes tracing through interaction with an IPFS system; and the full node is used for acquiring the on-chain data of the target transaction from the block chain during tracing to obtain the CID information of the pointer file of the target transaction.
5. The method of claim 4, wherein generating the pointer file for the new transaction using the previous transaction information and the original credit file CID information comprises:
adding the former transaction information and the CID information of the original certificate-storing file to a target file;
and taking the target file as a pointer file.
6. The method of claim 5, wherein the new addition transaction includes attribute information; generating the pointer file of the newly added transaction by using the previous transaction information and the CID information of the original deposit certificate file, and further comprising:
judging whether the newly added transaction is a key transaction according to the attribute information;
if so, adding the CID information of the key pointer file of the previous stage to the target file, and taking the added target file as the key pointer file of the current stage.
7. A distributed supply chain tracing method based on a blockchain is applied to all nodes of the blockchain, and the method comprises the following steps:
receiving CID information of a pointer file of a newly added transaction, and writing the CID information of the pointer file of the newly added transaction into the link data of the newly added transaction;
when a tracing request is received, acquiring the on-chain data of the target transaction from the block chain according to the tracing request; the on-chain data of the target transaction at least comprises CID information of a pointer file of the target transaction; the pointer file comprises CID information of an original certificate storing file and previous transaction information; the previous transaction information comprises previous transaction pointer file CID information, previous transaction hash information and previous transaction block height information;
sending the linked data of the target transaction to a tracing node so that the tracing node acquires a pointer file from an IPFS system by using CID information of the pointer file of the target transaction and acquires a target original evidence storage file based on the acquired pointer file;
when a data acquisition request is received, acquiring the on-chain data of each transaction in the transaction chain where the target transaction is located in the block chain according to the data acquisition request; the data acquisition request comprises previous transaction hash information and previous transaction block height information of each transaction of the transaction chain, which are recorded by the tracing node;
and sending the linked data of each transaction to the source tracing node.
8. The method of claim 7, further comprising:
receiving a supply chain tracing result sent by a tracing node;
and verifying the supply chain tracing result.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method steps of any one of claims 1 to 8.
10. A distributed supply chain traceability system based on a block chain is characterized by comprising a full node, a traceability node and a supply chain information recording node;
the full node comprises an electronic device for executing the block chain based distributed supply chain tracing method of claim 7 or 8;
the tracing node comprises an electronic device for executing the block chain based distributed supply chain tracing method of any one of claims 1-3;
the supply chain information recording node comprises an electronic device for executing the block chain based distributed supply chain information storage method of any one of claims 4 to 6.
CN202211490729.2A 2022-11-25 2022-11-25 Distributed supply chain tracing and information storage method and system based on block chain Active CN115544047B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211490729.2A CN115544047B (en) 2022-11-25 2022-11-25 Distributed supply chain tracing and information storage method and system based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211490729.2A CN115544047B (en) 2022-11-25 2022-11-25 Distributed supply chain tracing and information storage method and system based on block chain

Publications (2)

Publication Number Publication Date
CN115544047A CN115544047A (en) 2022-12-30
CN115544047B true CN115544047B (en) 2023-03-10

Family

ID=84721922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211490729.2A Active CN115544047B (en) 2022-11-25 2022-11-25 Distributed supply chain tracing and information storage method and system based on block chain

Country Status (1)

Country Link
CN (1) CN115544047B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263035A (en) * 2019-05-31 2019-09-20 阿里巴巴集团控股有限公司 Data storage, querying method and device and electronic equipment based on block chain
CN112256662A (en) * 2020-10-22 2021-01-22 安徽农业大学 Storage and tracing method, device, equipment and storage medium for agricultural product information block chain
CN113157693A (en) * 2021-03-21 2021-07-23 贵州大学 Block chain storage optimization scheme for digital currency
CN113411373A (en) * 2021-04-26 2021-09-17 艾普工华科技(武汉)有限公司 Transaction data storage method, tracking and tracing method and block chain network
CN113553380A (en) * 2021-07-23 2021-10-26 东北大学 Reputation-behavior association-oriented data traceability system with double block chains
CN113807866A (en) * 2021-09-07 2021-12-17 浙江天演维真网络科技股份有限公司 Block chain information tracing method based on biological characteristic image recognition of agricultural products
CN114119011A (en) * 2021-11-12 2022-03-01 常州市勇阳信息技术有限公司 Block chain-based physical asset digitization method
CN114358775A (en) * 2022-01-10 2022-04-15 深圳星际鑫航科技有限公司 Internet of things source tracing method based on Fabric and IPFS and related equipment thereof
CN114490808A (en) * 2021-12-29 2022-05-13 深圳供电局有限公司 Data tracing method and device, computer equipment and storage medium
CN114943007A (en) * 2022-05-24 2022-08-26 江苏大学 Monitoring data association tracing method based on composite block chain
CN115185914A (en) * 2022-07-20 2022-10-14 广东省禁毒基金会 Data sharing method and computing device based on uplink and downlink data cooperation

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11146380B2 (en) * 2017-08-03 2021-10-12 Parity Technologies Ltd. Methods and systems for a heterogeneous multi-chain framework
CN111507709B (en) * 2020-03-25 2023-11-14 农业农村部农药检定所(国际食品法典农药残留委员会秘书处) Data tracing system
CN112184247B (en) * 2020-10-16 2023-04-07 浙江工业大学 Product full-link information tracing system based on block chain fragmentation technology

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263035A (en) * 2019-05-31 2019-09-20 阿里巴巴集团控股有限公司 Data storage, querying method and device and electronic equipment based on block chain
CN112256662A (en) * 2020-10-22 2021-01-22 安徽农业大学 Storage and tracing method, device, equipment and storage medium for agricultural product information block chain
CN113157693A (en) * 2021-03-21 2021-07-23 贵州大学 Block chain storage optimization scheme for digital currency
CN113411373A (en) * 2021-04-26 2021-09-17 艾普工华科技(武汉)有限公司 Transaction data storage method, tracking and tracing method and block chain network
CN113553380A (en) * 2021-07-23 2021-10-26 东北大学 Reputation-behavior association-oriented data traceability system with double block chains
CN113807866A (en) * 2021-09-07 2021-12-17 浙江天演维真网络科技股份有限公司 Block chain information tracing method based on biological characteristic image recognition of agricultural products
CN114119011A (en) * 2021-11-12 2022-03-01 常州市勇阳信息技术有限公司 Block chain-based physical asset digitization method
CN114490808A (en) * 2021-12-29 2022-05-13 深圳供电局有限公司 Data tracing method and device, computer equipment and storage medium
CN114358775A (en) * 2022-01-10 2022-04-15 深圳星际鑫航科技有限公司 Internet of things source tracing method based on Fabric and IPFS and related equipment thereof
CN114943007A (en) * 2022-05-24 2022-08-26 江苏大学 Monitoring data association tracing method based on composite block chain
CN115185914A (en) * 2022-07-20 2022-10-14 广东省禁毒基金会 Data sharing method and computing device based on uplink and downlink data cooperation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于联盟区块链的农产品质量安全高效追溯体系分析;罗静;《电脑知识与技术》;20200225(第06期);全文 *

Also Published As

Publication number Publication date
CN115544047A (en) 2022-12-30

Similar Documents

Publication Publication Date Title
CN109471744B (en) Main chain and parallel multi-sub-chain system architecture based on block chain
CN106790431B (en) Cloud manufacturing service transaction information recording system and method based on block chain
CN113572618B (en) Fabric and IPFS combined decentralized storage system and data storage method thereof
CN108648084B (en) Data processing method, device and equipment of block chain network and storage medium
CN109522330B (en) Cloud platform data processing method, device, equipment and medium based on block chain
CN110912707B (en) Block chain-based digital certificate processing method, device, equipment and storage medium
CN112270550B (en) New energy power tracing method and system based on blockchain
CN110046894B (en) Erasure code-based block chain establishing method capable of reconstructing groups
CN104735164A (en) Method and device for saving file information
CN110569246B (en) Block chain node information synchronization method and device, computer equipment and storage medium
CN112235420A (en) Data synchronization method, system and related equipment based on block chain
CN114915404A (en) Block chain data storage extension model construction method for Internet of things
CN113886501A (en) Block chain service module extension method based on multi-chain architecture
CN111737352B (en) Supply chain information collaborative management method based on block chain
CN110597922A (en) Data processing method, device, terminal and storage medium
CN115185914A (en) Data sharing method and computing device based on uplink and downlink data cooperation
CN113378218B (en) Intellectual property data storage and authentication method based on block chain
JP2024515022A (en) Blockchain-based data processing method, device, equipment, and computer program
CN110910110A (en) Data processing method and device and computer storage medium
CN115544047B (en) Distributed supply chain tracing and information storage method and system based on block chain
CN110992182B (en) Transaction method and system of blockchain wallet
CN111414417B (en) Video copyright management method based on block chain
CN106713297B (en) Electronic data fixed platform based on cloud service
CN106210751A (en) The method and system of internet video live broadcasting data hierarchy transmission
CN117010889A (en) Data processing method, device, equipment, medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant