Supply chain data sharing method and device based on block chain
By adopting a combination method of blockchain evidence storage and asymmetric encryption algorithms in supply chain data sharing, the problems of low security and low efficiency of supply chain data sharing are solved, and efficient and secure data sharing is achieved.
Patent Information
- Application Number
- CN202311528741.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-16
- Publication Date
- 2025-05-16
AI Technical Summary
In the prior art, supply chain data sharing is relatively low in security and data sharing efficiency is not high.
The blockchain-based method is adopted to calculate the hash value of the supply chain data through a preset hash algorithm and upload the blockchain to store evidence. The data is encrypted in combination with the preset asymmetric encryption algorithm, and the encrypted data packets are transmitted through the point-to-point communication channel. After receiving the data, the data receiver performs decryption and hash value comparison to ensure the integrity and security of the data.
It improves the security and efficiency of supply chain data sharing, ensures the integrity and privacy of data during transmission, and realizes the trusted sharing of supply chain data.
Smart Images

Figure CN120012143A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of supply chain technology, and in particular to a supply chain data sharing method and device based on blockchain. Background Art
[0002] Supply chain refers to the network structure formed by upstream and downstream enterprises involved in the production and distribution process that provide products or services to end users, that is, the entire chain from merchants to consumers.
[0003] At present, in the process of sharing supply chain business data, in order to ensure the security of data transmission, various business nodes usually design more complex data sharing verification methods. This leads to a more complicated business information docking process and it is difficult to truly ensure the security of business information sharing. The efficiency of data sharing needs to be further improved. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a supply chain data sharing method and device based on blockchain, so as to solve the problems of low supply chain data sharing security and low data sharing efficiency in the prior art.
[0005] The technical solution adopted by the present invention is: In a first aspect, the present invention provides a supply chain data sharing method based on blockchain, which is applied to a data sender, comprising: Calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; Using a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; A point-to-point communication channel is established, and the encrypted data packet is transmitted to a data recipient through the communication channel.
[0006] Furthermore, the method of calculating the first hash value of the original supply chain data by using a preset hash algorithm and uploading the first hash value to the blockchain for evidence storage includes: The data sender locally divides the original supply chain data according to a fixed block size to obtain multiple data blocks; A preset hash algorithm is used to initialize a hash value for each data block, and the hash values of multiple data blocks are combined in pairs to obtain the first hash value of the original supply chain data, and the first hash value is uploaded to the blockchain for evidence storage.
[0007] Furthermore, the using of a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet includes: The data sender generates a UUID corresponding to the original supply chain data locally, uploads the UUID to the blockchain for evidence storage, and builds a mapping relationship between the UUID and the first hash value; The data sender obtains the public key for asymmetric encryption generated by the data receiver, and uses the public key to encrypt the original supply chain data and UUID to obtain a corresponding encrypted data packet.
[0008] Furthermore, it also includes: when a message is received from the data recipient that the original supply chain data is inconsistent, a new encrypted data packet is regenerated locally based on the original supply chain data and UUID, and the new encrypted data packet is sent to the data recipient through a point-to-point communication channel.
[0009] In a second aspect, the present invention provides a supply chain data sharing method based on blockchain, which is applied to a data recipient, comprising: Receive the encrypted data packet, and decrypt the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; Calculate a second hash value of the original supply chain data using a preset hash algorithm; The first hash value of the original supply chain data is read from the blockchain, and a consistency comparison is performed on the first hash value and the second hash value, and the integrity of the original supply chain data is determined according to the consistency comparison result.
[0010] Furthermore, the receiving the encrypted data packet and decrypting the encrypted data packet using a preset asymmetric encryption algorithm to obtain the original supply chain data includes: The data recipient receives the encrypted data packet from the point-to-point communication channel, and decrypts the encrypted data packet using its own asymmetric encryption private key to obtain the original supply chain data and UUID.
[0011] Further, the reading of the first hash value of the original supply chain data from the blockchain, performing a consistency comparison between the first hash value and the second hash value, and determining the integrity of the original supply chain data according to the consistency comparison result includes: The data receiver reads the first hash value of the original supply chain data from the blockchain according to the UUID of the original supply chain data; Compare the first hash value and the second hash value to see if they are consistent. If the first hash value and the second hash value are consistent, determine that the original supply chain data is complete, and store the original supply chain data locally. If the first hash value and the second hash value are inconsistent, determine that the original supply chain data is incomplete, and delete the original supply chain data and the encrypted data packet.
[0012] Furthermore, it also includes: if the first hash value is inconsistent with the second hash value, the data receiver feeds back a message indicating the inconsistency of the original supply chain data to the data sender through a point-to-point communication channel.
[0013] In a third aspect, the present invention provides a supply chain data sharing device based on blockchain, which is applied to a data sender, and includes: A data evidence storage module, used to calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; A data encryption module, used to use a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; The data transmission module is used to establish a point-to-point communication channel and transmit the encrypted data packet to the data recipient through the communication channel.
[0014] In a fourth aspect, the present invention provides a supply chain data sharing device based on blockchain, which is applied to a data recipient, and includes: A data decryption module, used to receive the encrypted data packet and decrypt the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; A hash calculation module, used to calculate a second hash value of the original supply chain data using a preset hash algorithm; A data comparison module is used to read the first hash value of the original supply chain data from the blockchain, and perform a consistency comparison between the first hash value and the second hash value, and determine the integrity of the original supply chain data according to the consistency comparison result.
[0015] In summary, the beneficial effects of the present invention are as follows: The blockchain-based supply chain data sharing method provided by the present invention first calculates the first hash value of the original supply chain data and uploads it to the blockchain for evidence storage, so that the data recipient can subsequently perform data consistency comparison. Then, by constructing a point-to-point communication channel to transmit the encrypted original supply chain data, the privacy and security of data sharing are increased, and the speed and efficiency of data sharing transmission are improved. Finally, after the encrypted original data transmission is completed, by calculating and comparing whether the hash values before and after the original supply chain data sharing are consistent, it is determined whether the data in the point-to-point data sharing process has been tampered with, thereby realizing the trusted sharing of supply chain data, reducing the data sharing operation process, and improving the security of supply chain data sharing. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the drawings required for use in the embodiment of the present invention will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work, and these are all within the protection scope of the present invention.
[0017] Figure 1 This is a flowchart of a supply chain data sharing method based on blockchain in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a supply chain data sharing method based on blockchain in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of a supply chain data sharing device based on blockchain in Example 3 of the present invention; Figure 4 This is a schematic diagram of the structure of a supply chain data sharing device based on blockchain in Example 4 of the present invention. Implementation
[0018] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described in conjunction with the drawings in the embodiment of the present invention. It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. In the description of the present invention, it should be understood that the orientation or position relationship indicated by the terms "center", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, article or device. In the absence of further restrictions, the elements defined by the phrase "comprising..." do not exclude the existence of other identical elements in the process, method, article or device comprising the elements. If there is no conflict, the various features of the present invention and the embodiments can be combined with each other, all within the protection scope of the present invention. Example 1
[0019] See also Figure 1 , Figure 1The supply chain data sharing method based on blockchain provided in Embodiment 1 of the present invention is applied to the data sender, and includes: S11: Calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; S12: Using a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; S13: Establish a point-to-point communication channel, and transmit the encrypted data packet to the data recipient through the communication channel.
[0020] Furthermore, in one embodiment, in step S11, a first hash value of the original supply chain data is calculated using a preset hash algorithm, and the first hash value is uploaded to the blockchain for evidence storage, including but not limited to the following sub-steps: S1101: The data sender locally divides the original supply chain data according to a fixed block size to obtain multiple data blocks. Since the hash algorithm calculates the hash value of the data based on the data block, the size of the data block division is fixed and can be preset.
[0021] In addition, when the size of the last divided data block does not meet the preset fixed size of the data block, the data block needs to be padded so that its size meets the preset fixed size of the data block.
[0022] S1102: Use a preset hash algorithm to initialize a hash value for each data block, and perform pairwise combination operations on the hash values of multiple data blocks to obtain a first hash value of the original supply chain data, and upload the first hash value to the blockchain for evidence storage.
[0023] Specifically, the embodiment of the present invention performs pairwise combination operations on the hash values of multiple data blocks, so that there is only one hash value finally stored on the blockchain, which is convenient for subsequent data integrity verification.
[0024] In addition, it is also possible to only calculate the hash value of each data block, and combine the hash values of multiple data blocks to form a first hash value group to reduce the amount of calculation of the local computer. If an abnormality occurs in the subsequent data integrity check, the data block with the data abnormality can also be located according to the hash value in the first hash value group.
[0025] Specifically, the preset hash algorithms used in the embodiment of the present invention include SHA-256 algorithm, SHA-3 algorithm and bcrypt algorithm. In addition, other hash algorithms can also be used to calculate the hash value of data, which can be selected according to actual conditions, and this embodiment will not be repeated.
[0026] Further, in one embodiment, the step S12 uses a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet, including but not limited to the following sub-steps: S1201: The data sender generates a UUID corresponding to the original supply chain data locally, uploads the UUID to the blockchain for evidence storage, and establishes a mapping relationship between the UUID and the first hash value; S1202: The data sender obtains the public key for asymmetric encryption generated by the data receiver, and uses the public key to encrypt the original supply chain data and UUID to obtain a corresponding encrypted data packet.
[0027] Among them, the embodiment of the present invention generates a UUID corresponding to the original supply chain data and uploads it to the blockchain for evidence storage. At the same time, the first hash value of the original supply chain data constructs a mapping relationship to facilitate subsequent inquiries to obtain the first hash value for data integrity verification.
[0028] Furthermore, in one embodiment, the embodiment of the present invention also includes: when receiving a message from the data recipient that the original supply chain data is inconsistent, the data sender regenerates a new encrypted data packet locally based on the original supply chain data and UUID, and sends the new encrypted data packet to the data recipient through a point-to-point communication channel.
[0029] When the data sender resends the encrypted data packet, the number of retransmissions and the retransmission interval can be set. In addition, when receiving inconsistent messages of the same original supply chain data multiple times, the data sender can notify the data receiver to check the security of the communication channel.
[0030] The embodiment of the present invention calculates the first hash value of the original supply chain data and uploads it to the blockchain for evidence storage, so that the data recipient can subsequently perform data consistency comparison. Then, a point-to-point communication channel is constructed to transmit the encrypted original supply chain data, thereby increasing the privacy and security of data sharing and improving the speed and efficiency of data sharing transmission. Example 2
[0031] Reference Figure 2 As shown, an embodiment of the present invention provides a supply chain data sharing method based on blockchain, which is applied to a data receiver, including: S21: receiving the encrypted data packet, and decrypting the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; S22: Calculate a second hash value of the original supply chain data using a preset hash algorithm; S23: Read the first hash value of the original supply chain data from the blockchain, perform a consistency comparison between the first hash value and the second hash value, and determine the integrity of the original supply chain data based on the consistency comparison result.
[0032] Further, in one embodiment, receiving the encrypted data packet in step S21, and decrypting the encrypted data packet using a preset asymmetric encryption algorithm to obtain the original supply chain data, includes the following process: The data recipient receives the encrypted data packet from the point-to-point communication channel, and decrypts the encrypted data packet using its own asymmetric encryption private key to obtain the original supply chain data and UUID.
[0033] Among them, the public key and private key of asymmetric encryption are generated locally by the data receiver, and the public key is notified to the data sender through the communication channel. The algorithm used for asymmetric encryption in the embodiment of the present invention includes but is not limited to the RSA algorithm, the DSA algorithm, the ECC algorithm and the DH algorithm. The asymmetric encryption algorithm can be jointly agreed upon by the data sender and the data receiver.
[0034] Specifically, when the second hash value of the original supply chain data is calculated using a preset hash algorithm in step S22 of the embodiment of the present invention, the hash algorithm used for the calculation is the same as the hash algorithm in Example 1. Therefore, the specific calculation process of the second hash value can refer to the calculation process in the above-mentioned Example 1, and this embodiment will not be repeated here.
[0035] Further, in one embodiment, in step S23, the first hash value of the original supply chain data is read from the blockchain, and the first hash value is compared with the second hash value for consistency, and the integrity of the original supply chain data is determined according to the consistency comparison result, including but not limited to the following sub-steps: S2301: The data recipient reads the first hash value of the original supply chain data from the blockchain according to the UUID of the original supply chain data and the mapping relationship between the UUID and the first hash value.
[0036] S2302: Compare the first hash value and the second hash value to see if they are consistent. If the first hash value and the second hash value are consistent, it is determined that the original supply chain data is complete, and the original supply chain data is stored locally. If the first hash value and the second hash value are inconsistent, it is determined that the original supply chain data is incomplete, and the original supply chain data and the encrypted data packet are deleted.
[0037] Among them, the present invention can determine whether the original supply chain data has been tampered with during the data sharing transmission process by comparing whether the first hash value is consistent with the second hash value, thereby improving the security of data sharing.
[0038] Furthermore, in one embodiment, the embodiment of the present invention further includes: if the first hash value is inconsistent with the second hash value, the data receiver feeds back a message of inconsistency of the original supply chain data to the data sender through a point-to-point communication channel. By feeding back a message of data inconsistency to the data sender, the data sender can be informed of security issues in data sharing transmission while reacquiring the data.
[0039] After the encrypted original data transmission is completed, the embodiment of the present invention calculates and compares whether the hash values before and after the original supply chain data is shared are consistent, thereby determining whether the data has been tampered with during the point-to-point data sharing process, thereby achieving trusted sharing of supply chain data, reducing the data sharing operation process, and improving the security of supply chain data sharing. Example 3
[0040] Reference Figure 3 As shown, the embodiment of the present invention provides a supply chain data sharing device based on blockchain on the basis of the above embodiment 1, which is applied to the data sender and includes: A data evidence storage module, used to calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; A data encryption module, used to use a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; The data transmission module is used to establish a point-to-point communication channel and transmit the encrypted data packet to the data recipient through the communication channel.
[0041] Specifically, the supply chain data sharing device of the embodiment of the present invention calculates the first hash value of the original supply chain data through the data storage module and uploads it to the blockchain for storage, so as to facilitate the data recipient to perform data consistency comparison later. Then the data transmission module transmits the original supply chain data encrypted by the data encryption module by constructing a point-to-point communication channel, thereby increasing the privacy and security of data sharing and improving the speed and efficiency of data sharing transmission. Example 4
[0042] Reference Figure 4 As shown, the embodiment of the present invention provides a supply chain data sharing device based on blockchain on the basis of the above embodiment 2, which is applied to the data receiving party and includes: A data decryption module, used to receive the encrypted data packet and decrypt the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; A hash calculation module, used to calculate a second hash value of the original supply chain data using a preset hash algorithm; A data comparison module is used to read the first hash value of the original supply chain data from the blockchain, and perform a consistency comparison between the first hash value and the second hash value, and determine the integrity of the original supply chain data according to the consistency comparison result.
[0043] Specifically, after the encrypted original data transmission is completed, the data decryption module of the supply chain data sharing device of the embodiment of the present invention decrypts the encrypted data packet to obtain the original supply chain data. The second hash value is calculated by the hash calculation module, and the second hash value is handed over to the data comparison module to compare with the first hash value in the blockchain to determine the integrity of the shared data. The supply chain data sharing device mainly determines whether the data has been tampered with during the point-to-point data sharing process by calculating and comparing whether the hash values before and after the original supply chain data are shared are consistent, thereby realizing the trusted sharing of supply chain data, reducing the data sharing operation process, and improving the security of supply chain data sharing.
[0044] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0045] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0046] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A supply chain data sharing method based on blockchain, applied to the data sender, characterized in that: include: Calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; Using a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; A point-to-point communication channel is established, and the encrypted data packet is transmitted to a data recipient through the communication channel.
2. The supply chain data sharing method based on blockchain according to claim 1 is characterized in that: The method of calculating the first hash value of the original supply chain data by using a preset hash algorithm and uploading the first hash value to the blockchain for evidence storage includes: The data sender locally divides the original supply chain data according to a fixed block size to obtain multiple data blocks; A preset hash algorithm is used to initialize a hash value for each data block, and the hash values of multiple data blocks are combined in pairs to obtain the first hash value of the original supply chain data, and the first hash value is uploaded to the blockchain for evidence storage.
3. The blockchain-based supply chain data sharing method according to claim 1 is characterized in that: The method of using a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet includes: The data sender generates a UUID corresponding to the original supply chain data locally, uploads the UUID to the blockchain for evidence storage, and builds a mapping relationship between the UUID and the first hash value; The data sender obtains the public key for asymmetric encryption generated by the data receiver, and uses the public key to encrypt the original supply chain data and UUID to obtain a corresponding encrypted data packet.
4. The supply chain data sharing method based on blockchain according to claim 1 is characterized in that: Also includes: When a message is received from the data recipient that the original supply chain data is inconsistent, a new encrypted data packet is regenerated locally based on the original supply chain data and UUID, and the new encrypted data packet is sent to the data recipient through a point-to-point communication channel.
5. A supply chain data sharing method based on blockchain, applied to data receivers, characterized in that: include: Receive the encrypted data packet, and decrypt the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; Calculate a second hash value of the original supply chain data using a preset hash algorithm; The first hash value of the original supply chain data is read from the blockchain, and a consistency comparison is performed on the first hash value and the second hash value, and the integrity of the original supply chain data is determined according to the consistency comparison result.
6. The blockchain-based supply chain data sharing method according to claim 5 is characterized in that: The receiving the encrypted data packet and decrypting the encrypted data packet using a preset asymmetric encryption algorithm to obtain the original supply chain data includes: The data recipient receives the encrypted data packet from the point-to-point communication channel, and decrypts the encrypted data packet using its own asymmetric encryption private key to obtain the original supply chain data and UUID.
7. The supply chain data sharing method based on blockchain according to claim 5 is characterized in that: The step of reading the first hash value of the original supply chain data from the blockchain, performing a consistency comparison between the first hash value and the second hash value, and determining the integrity of the original supply chain data according to the consistency comparison result includes: The data receiver reads the first hash value of the original supply chain data from the blockchain according to the UUID of the original supply chain data; Compare the first hash value and the second hash value to see if they are consistent. If the first hash value and the second hash value are consistent, determine that the original supply chain data is complete, and store the original supply chain data locally. If the first hash value and the second hash value are inconsistent, determine that the original supply chain data is incomplete, and delete the original supply chain data and the encrypted data packet.
8. The supply chain data sharing method based on blockchain according to claim 7 is characterized in that: Also includes: If the first hash value is inconsistent with the second hash value, the data receiver feeds back a message indicating the inconsistency of the original supply chain data to the data sender through a point-to-point communication channel.
9. A supply chain data sharing device based on blockchain, applied to the data sender, characterized in that: include: A data evidence storage module, used to calculate the first hash value of the original supply chain data using a preset hash algorithm, and upload the first hash value to the blockchain for evidence storage; A data encryption module, used to use a preset asymmetric encryption algorithm to encrypt the original supply chain data to obtain an encrypted data packet; The data transmission module is used to establish a point-to-point communication channel and transmit the encrypted data packet to the data recipient through the communication channel.
10. A supply chain data sharing device based on blockchain, applied to a data receiver, characterized in that: include: A data decryption module, used to receive the encrypted data packet and decrypt the encrypted data packet using a preset asymmetric encryption algorithm to obtain original supply chain data; A hash calculation module, used to calculate a second hash value of the original supply chain data using a preset hash algorithm; A data comparison module is used to read the first hash value of the original supply chain data from the blockchain, and perform a consistency comparison between the first hash value and the second hash value, and determine the integrity of the original supply chain data according to the consistency comparison result.
Citation Information
Cited By
Data element circulation full-link credible evidence storage method
CN120281486A