CN115840787A - Supply chain data sharing method, device, equipment and medium based on block chain - Google Patents

Supply chain data sharing method, device, equipment and medium based on block chain Download PDF

Info

Publication number
CN115840787A
CN115840787A CN202310138076.XA CN202310138076A CN115840787A CN 115840787 A CN115840787 A CN 115840787A CN 202310138076 A CN202310138076 A CN 202310138076A CN 115840787 A CN115840787 A CN 115840787A
Authority
CN
China
Prior art keywords
data
block
node
uplink
signature
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.)
Granted
Application number
CN202310138076.XA
Other languages
Chinese (zh)
Other versions
CN115840787B (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.)
Tabixing Information Technology Shenzhen Co ltd
Original Assignee
Tabixing Information Technology Shenzhen 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 Tabixing Information Technology Shenzhen Co ltd filed Critical Tabixing Information Technology Shenzhen Co ltd
Priority to CN202310138076.XA priority Critical patent/CN115840787B/en
Publication of CN115840787A publication Critical patent/CN115840787A/en
Application granted granted Critical
Publication of CN115840787B publication Critical patent/CN115840787B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to a block chain technology, and discloses a supply chain data sharing method, a device, equipment and a medium based on a block chain, wherein the method comprises the following steps: writing the transaction data on the supply chain into an uplink message queue, and acquiring data to be uplink; generating a public and private key pair according to the certificate authentication node and the data to be chain-linked, carrying out asymmetric signature on the data to be chain-linked by using a private key in the public and private key pair, sending the data to be chain-linked containing the signature to a sequencing node and sequencing to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic main node corresponding to a sharing mechanism connected with a supply chain; and extracting a public key corresponding to the sequencing data, carrying out signature verification on the block by using the public key by the basic main node, synchronizing the block to the basic sub-node after the verification is passed, and storing the block into a distributed account book corresponding to the basic sub-node. The invention can solve the problems of low safety, incapability of tracing and strong coupling among multiple systems on a supply chain in the data sharing process.

Description

Supply chain data sharing method, device, equipment and medium based on block chain
Technical Field
The present invention relates to the field of block chain technologies, and in particular, to a method and an apparatus for sharing supply chain data based on a block chain, an electronic device, and a computer-readable storage medium.
Background
With the continuous deepening of social production, market competition has shifted from competition between single customers to competition between supply chains. The core enterprise is taken as the axis, the supply chain of a plurality of medium-sized and small enterprises is radiated rapidly, and the market scale is huge. In the development of the supply chain, the data sharing of the system based on the supply chain is very important. Currently, the industry has two following approaches to cross-company system data sharing in the supply chain: 1. performing cross-company system sharing data based on an https protocol interface; 2. sharing data across company systems is performed in a manner that text files are transferred based on the sftp protocol.
However, the two methods have the following disadvantages: 1. during the transmission process or the storage process of the data, the data can be tampered by means of human or attack and the like; 2. after the data is transmitted by a plurality of companies, the generation source of the data cannot be confirmed; 3. due to the fact that the coupling between systems on a supply chain is strong, due to the fact that a server of one company is in failure and the like, other companies lose response in acquiring or uploading data, and therefore the work of business systems of other companies is affected.
In summary, the problems of low security, incapability of tracing and strong coupling between multiple systems in a supply chain exist in the prior art in the transaction data sharing process.
Disclosure of Invention
The invention provides a supply chain data sharing method and device based on a block chain, electronic equipment and a computer readable storage medium, and mainly aims to solve the problems that the security is low, the traceability cannot be realized and the coupling between multiple systems on a supply chain is strong in the transaction data sharing process.
In order to achieve the above object, the present invention provides a supply chain data sharing method based on a block chain, including:
acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink one by one from the uplink message queue;
generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
sequencing the data to be uplink-transmitted containing the signature by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic node corresponding to a sharing mechanism connected with the supply chain, wherein the basic node comprises a basic main node and a basic sub-node;
Extracting a public key corresponding to the sequencing data, and performing signature verification on the block by using the public key through the basic main node;
and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
Optionally, the writing the transaction data into a preset uplink message queue one by one includes:
selecting a target message queue from the uplink message queue according to the system attribute of the transaction data and a preset message queue not-full condition;
calculating the offset of the target thread corresponding to the transaction data for enqueuing, calculating the target position of the target thread in the target message queue according to the offset, and executing enqueuing operation at the target position through the target thread.
Optionally, the generating a public-private key pair according to a preset certificate authentication node and the data to be uplink includes:
acquiring an original mechanism of the data to be chained, and performing identity verification on the original mechanism;
after the identity verification of the original organization passes, setting data are defined according to the original organization, and initialization operation is carried out on a preset secret key pair generator through the setting data and a preset space object;
And generating a key pair according to the initialized key pair generator, generating a target public key according to the key pair, generating a target private key according to the key pair, and taking the target public key and the target private key as a public and private key pair.
Optionally, the generating a target public key according to the key pair includes:
creating a public key character stream object, and generating a public key object of an encoding stream according to the public key character stream object;
acquiring public key byte data information from the key pair, and writing the public key byte data information into a public key object of the encoded stream to obtain public key character string information;
and outputting the public key character string information to a preset public and private key pair array to obtain a target public key.
Optionally, the asymmetrically signing the to-be-uplink data with a private key in the public and private key pair to obtain the to-be-uplink data containing a signature includes:
performing hash calculation on the data to be linked to obtain a data abstract;
and encrypting the data abstract by using the private key to obtain a digital signature, and obtaining the data to be uplink containing the signature according to the data signature and the data to be uplink.
Optionally, the sorting the data to be uplink, which includes the signature, by using the sorting node to obtain sorted data, includes:
Checking the data to be uplink data containing the signature, and deleting the data which do not meet the preset requirement to obtain the data to be sorted;
sequencing the data to be sequenced according to the time sequence to obtain corresponding sequencing numbers;
and setting the sequencing attribute of the data to be linked containing the signature as the sequencing number to obtain sequencing data.
Optionally, the constructing the block corresponding to the sorting data includes:
obtaining historical block information of a previous block, and generating a time stamp and a version number of a current block;
encapsulating the block head of the current block according to the historical block information, the timestamp and the version number;
and packaging the sorting data into the block body of the current block, and taking the packaged block head and the current block of the block body as the block corresponding to the sorting data.
In order to solve the above problem, the present invention further provides a block chain-based supply chain data sharing apparatus, where the apparatus includes:
the uplink message queue processing module is used for acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink from the uplink message queue one by one;
The to-be-uplink data signature module is used for generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
the sequencing node processing module is used for sequencing the data to be uplink, which contains the signature, by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a base node corresponding to a sharing mechanism connected with the supply chain, wherein the base node comprises a base main node and a base sub-node;
the basic node processing module is used for extracting a public key corresponding to the sequencing data and utilizing the public key to carry out signature verification on the block through the basic main node; and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
In order to solve the above problem, the present invention also provides an electronic device, including:
At least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the above-described block chain based supply chain data sharing method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the above supply chain data sharing method based on a block chain.
According to the method and the device, the private key is generated according to the preset certificate authentication node and the data to be uplink signed, the private key is used for signing the data to be uplink signed, the signed data to be uplink has the identity attribute issued by the certificate authentication node, and the purpose that the data source can still be identified according to the signature in the subsequent data circulation process is achieved; by using the private key to carry out asymmetric signature on the data to be uplinked, the security of the data in the transfer process is improved, the risks of counterfeiting and tampering in the midway are reduced, and the trust problem among all sharing mechanisms in the supply chain is effectively solved; the data are broadcasted to the basic main nodes corresponding to the sharing mechanisms connected with the supply chain, the data are transmitted to the child nodes through the main nodes after the main nodes pass verification, and the child nodes store the data on the distributed accounts, so that the sharing mechanisms connected with the supply chain all have full sharing data, the system coupling degree among different organizations is reduced, the servers of the sharing mechanisms do not need to rely on the services of the other parties, and the system availability of the sharing mechanisms is well guaranteed; and any party sharing mechanism can not modify the data of the other party illegally or non-procedurally, thereby avoiding the occurrence of any party counterfeiting behavior and having very high reliability on the uplink data. Therefore, the supply chain data sharing method and device based on the block chain, the electronic device and the computer readable storage medium provided by the invention can solve the problems that the security is low, the traceability cannot be realized and the coupling between multiple systems on the supply chain is strong in the transaction data sharing process.
Drawings
Fig. 1 is a schematic flowchart of a block chain-based supply chain data sharing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating a process of generating a public-private key pair according to a certificate authentication node and data to be linked;
fig. 3 is a schematic flow chart illustrating a process of constructing blocks corresponding to sorted data according to an embodiment of the present invention;
fig. 4 is a functional block diagram of a block chain-based supply chain data sharing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for implementing the block chain-based supply chain data sharing method according to an embodiment of the present invention.
The objects, features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a supply chain data sharing method based on a block chain. The execution subject of the block chain-based supply chain data sharing method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the supply chain data sharing method based on the block chain can be executed by software or hardware installed in a terminal device or a server device, and the software can be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flow chart of a block chain-based supply chain data sharing method according to an embodiment of the present invention. In this embodiment, the method for sharing supply chain data based on a block chain includes:
s1, transaction data on a preset supply chain are obtained, the transaction data are written into a preset uplink message queue one by one, and data to be uplink are obtained from the uplink message queue one by one.
In the embodiment of the present invention, the supply chain may be a block chain of a federation based on a hyper book Fabric, where there are multiple interconnected sharing organizations (i.e., enterprises, organizations) in the supply chain, and the transaction data is business data generated by the multiple sharing organizations in the supply chain.
The embodiment of the invention can capture the transaction data from the business system of the sharing mechanism on the supply chain through a preset acquisition interface or through a computer script with a data capture function, such as a java script or python.
In an actual application scenario of the present invention, there may be more than one uplink message queue, and the specific data may be determined according to the data of the shared infrastructure service system, or according to the carrying capacity of the uplink message queue.
In an embodiment of the present invention, writing the transaction data into a preset uplink message queue one by one includes:
selecting a target message queue from the uplink message queue according to the system attribute of the transaction data and a preset message queue not-full condition;
calculating the offset of the target thread corresponding to the transaction data for enqueuing, calculating the target position of the target thread in the target message queue according to the offset, and executing enqueuing operation at the target position through the target thread.
In this embodiment of the present invention, the message queue not-full condition may be represented as: when the message queue is full, data is prohibited from being written into the message queue; when the message queue is not full, data will be written in the message queue. According to the embodiment of the invention, when the message queue is full, the execution of the queue operation is forbidden, so that the safety and the accuracy of the message writing are ensured, and the problem of blocking during communication between thread tasks of transaction data writing is prevented.
In the embodiment of the invention, a transaction data writing task allocates a thread, and the offset refers to the distance between the actual address of a transaction data storage unit and the segment address of the segment where the transaction data storage unit is located; when the threads are enqueued, each thread can adopt an atomic operation incremental mode to calculate the enqueued offset of the thread, and the calculated enqueued offsets of different threads are different.
Further, the embodiment of the present invention may read the value of the writable count parameter CanWriteCount through the target thread, decrease the value of CanWriteCount by atomic operation, if the value of the decreased CanWriteCount is obtained as 0, determine that the message queue is full, otherwise, determine that the message queue is not full; and if the message queue is full, stopping executing the queue.
The embodiment of the invention can read the parameter value of the size of the target message queue, and then adopts the parameter value to perform modulo on the value of the offset, thereby obtaining the actual position of the target thread for enqueuing.
Specifically, the actual position may be expressed as: p = Q% S, where P is the actual position of the target thread to enqueue, Q is the modulus of the offset, and S is the parameter value of the target message queue size. Since the offset of the enqueue of different threads is different, the actual positions of the threads in the message queue are different.
The embodiment of the invention can orderly read the messages in the uplink message queue and acquire the data to be uplink one by creating the task thread for dequeuing the messages and then utilizing the task thread to sequentially execute dequeue operation in the uplink message queue.
In an actual application scenario, dequeue operation and enqueue operation of the uplink message queue can be performed simultaneously, and data in the message queue is read orderly by a single thread, so that resource consumption is reduced, system resources are fully utilized, processing speed is increased, and server throughput is increased.
And S2, generating a public and private key pair according to a preset certificate authentication node and the data to be chain-linked, carrying out asymmetric signature on the data to be chain-linked by using a private key in the public and private key pair to obtain the data to be chain-linked containing the signature, and sending the data to be chain-linked containing the signature to a preset sequencing node.
In the embodiment of the invention, the certificate authentication node is responsible for carrying out identity authentication on data and executing generation of a public and private key pair. The Certificate Authority node may be a Certificate Authority (CA) that is comprised of a server and a client component.
Referring to fig. 2, in an embodiment of the present invention, the generating a public-private key pair according to a preset certificate authentication node and the to-be-uplink data includes:
s21, acquiring an original mechanism of the data to be chained, and verifying the identity of the original mechanism;
S22, after the identity authentication of the original organization is passed, setting data are defined according to the original organization, and initialization operation is carried out on a preset secret key pair generator through the setting data and a preset space object;
s23, generating a key pair according to the initialized key pair generator, generating a target public key according to the key pair, generating a target private key according to the key pair, and taking the target public key and the target private key as a public and private key pair.
In the embodiment of the invention, the identity of the original organization is verified, including but not limited to short message password authentication, dynamic password authentication, biometric authentication, static password authentication and mobile phone verification codes. The setting data can be predefined by an original mechanism, or random numbers are generated according to the rule setting of the original mechanism; the setting data may be any type of character not less than a certain length (the length may be defined at the system initialization stage).
In an embodiment of the present invention, the key pair generator may generate the key pair generator based on an ECDSA algorithm, and the space object may be an elliptic curve space object generated according to a secp256k1 algorithm.
Further, in this embodiment of the present invention, the generating a target public key according to the key pair includes:
Creating a public key character stream object, and generating a public key object of an encoding stream according to the public key character stream object;
acquiring public key byte data information from the key pair, and writing the public key byte data information into a public key object of the encoded stream to obtain public key character string information;
and outputting the public key character string information to a preset public and private key pair array to obtain a target public key.
In this embodiment of the present invention, the encoded stream may be a PEM encoded stream (private Enhanced Mail).
In the embodiment of the present invention, the process of generating the target private key according to the key pair is similar to the process of generating the target public key according to the key pair, and is not described in detail herein.
In the embodiment of the present invention, the asymmetrically signing the to-be-uplink data by using the private key in the public and private key pair to obtain the to-be-uplink data containing the signature includes:
performing hash calculation on the data to be linked to obtain a data abstract;
and encrypting the data abstract by using the private key to obtain a digital signature, and obtaining the data to be uplink containing the signature according to the data signature and the data to be uplink.
The embodiment of the invention can adopt RSA algorithm to encrypt the data summary.
In the embodiment of the invention, the asymmetric encryption depends on complex mathematical operations including large number multiplication, large digital-to-analog and the like, and the time consumption is long. If the data volume is large, the calculation of the digital signature is time-consuming, and the Hash value obtained by carrying out Hash operation on the data to be linked is the data abstract. The data summary, just like a person's fingerprint, may represent a person, and as long as the content changes, the computed summary should also change.
In the embodiment of the invention, the sequencing node executes the function of sequencing the unpacked data to generate the block and broadcasting the block to the basic node (Peer node), so as to ensure that the nodes on the same chain receive the same message and have the same logic sequence.
In the embodiment of the present invention, after the to-be-uplink data containing the signature is generated, uplink is performed on the to-be-uplink data containing the signature, and the to-be-uplink data containing the signature is sent to the sorting node packet generation block.
And S3, sequencing the data to be uplink containing the signature by using the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic node corresponding to a sharing mechanism connected with the supply chain, wherein the basic node comprises a basic main node and a basic sub-node.
In the embodiment of the present invention, the base nodes are all accounting nodes (Committer), and the base master node (Leader Peer) represents a node communicating with the sorting node, and is responsible for verifying data in the blocks of the slave sorting node, maintaining state data and copies of the ledger, and synchronizing the latest block obtained from the sorting node within an organization, that is, synchronizing to the base child node; the basic host node can be preset or obtained by dynamic election; the base child node may also verify the synchronized block.
In another optional embodiment of the invention, part of the basic nodes are endorsement nodes, accounting nodes and basic child nodes; or the endorsement node, the basic host node and the accounting node are simultaneously used; it may also be just an accounting node or a basic sub-node/basic master node.
In an embodiment of the present invention, the sorting the data to be uplink, which includes a signature, by using the sorting node to obtain sorting data includes:
checking the data to be linked containing the signature, and deleting the data which do not meet the preset requirement to obtain the data to be sorted;
sequencing the data to be sequenced according to the time sequence to obtain corresponding sequencing numbers;
And setting the sequencing attribute of the data to be uplink-linked containing the signature as the sequencing number to obtain sequencing data.
In the embodiment of the invention, whether the signature of the data to be uplink accords with the uplink requirement can be determined by performing signature verification, data format verification and the like on the data to be uplink containing the signature.
In an embodiment of the present invention, the sorting data is a key-value pair including the sorting number and the signature-containing data to be uplink.
Referring to fig. 3, in the embodiment of the present invention, the constructing the block corresponding to the sorting data includes:
s31, obtaining historical block information of a previous block, and generating a time stamp and a version number of a current block;
s32, packaging the block head of the current block according to the historical block information, the timestamp and the version number;
and S33, packaging the sorting data into the block body of the current block, and taking the packaged block head and the current block of the block body as the block corresponding to the sorting data.
In an embodiment of the present invention, the historical block information of the previous block includes a hash value of the previous block, a Merkel tree root, and the like.
The embodiment of the invention can carry out whole-network broadcasting on the supply chain through a peer-to-peer (P2P) network, and all nodes (basic nodes corresponding to a sharing mechanism) in the P2P network have equal identity positions, so that information can be transmitted and tasks can be distributed among the nodes equally.
And S4, extracting a public key corresponding to the sequencing data, and performing signature verification on the block by using the public key through the basic main node.
In the embodiment of the invention, the sequencing data is provided with a corresponding original mechanism, the original mechanism can be in the form of an organization code number in the sequencing data, and a corresponding public key is selected from a preset public key database according to the organization code number.
In the embodiment of the invention, before the block is broadcasted in the base node corresponding to the sharing mechanism, the block validity needs to be verified so as to ensure the safety and validity of data of each node in the supply chain.
In this embodiment of the present invention, the verifying the signature of the block by using the public key through the basic host node includes:
extracting block data in the block, and performing hash calculation on the block data to obtain a first verification abstract;
decrypting the digital signature corresponding to the block data by using the public key to obtain a second verification abstract;
when the first verification digest is the same as the second verification digest, determining that the signature of the block verifies.
In the embodiment of the present invention, the manner used for performing hash calculation on the block data and decrypting the digital signature corresponding to the block data is similar to the method used in the process of asymmetrically signing the to-be-uplink data by using the private key in the public and private key pair in S2, which is not described herein in detail.
And S5, after the signature verification is passed, synchronizing the block to the basic sub-node through the basic main node, and storing the block into a distributed account book corresponding to the basic sub-node.
In the embodiment of the invention, after the block validity verification is passed, the block is safe and can be broadcasted by the child node, and then the block needs to be broadcasted to the basic child node by the basic main node.
In the embodiment of the invention, the distributed account book is an account book database which is possessed by each basic node as an accounting node and is used for storing uplink data, and further, each node of a sharing mechanism can possess the whole uplink data; the sharing mechanism can use the whole quantity of uplink data on the respective server, does not need to rely on the services of other mechanisms, and has good guarantee for the system availability. By utilizing the distributed architecture, illegal modification of data by other organizations can be protected, the occurrence of counterfeiting behavior is avoided, and the data on the respective basic nodes of the shared organization has high reliability.
According to the method and the device, the private key is generated according to the preset certificate authentication node and the data to be uplink, the data to be uplink is signed by the private key, the signed data to be uplink has the identity attribute issued by the certificate authentication node, and the purpose that the data source can still be identified according to the signature in the subsequent data transfer process is achieved; by using the private key to carry out asymmetric signature on the data to be linked, the security of the data in the transfer process is improved, the risks of counterfeiting and tampering in the midway are reduced, and the trust problem among all sharing mechanisms on the supply chain is effectively solved; the data are broadcasted to the basic main nodes corresponding to the sharing mechanisms connected with the supply chain, the data are transmitted to the child nodes through the main nodes after the main nodes pass verification, and the child nodes store the data on the distributed accounts, so that the sharing mechanisms connected with the supply chain all have full sharing data, the system coupling degree among different organizations is reduced, the servers of the sharing mechanisms do not need to rely on the services of the other parties, and the system availability of the sharing mechanisms is well guaranteed; and any party sharing mechanism can not modify the data of the other party illegally or non-procedurally, thereby avoiding the occurrence of any party counterfeiting behavior and having very high credibility for the uplink data. Therefore, the supply chain data sharing method based on the block chain can solve the problems that the safety is low, the traceability cannot be realized and the coupling between multiple systems on the supply chain is strong in the transaction data sharing process.
Fig. 4 is a functional block diagram of a block chain-based supply chain data sharing apparatus according to an embodiment of the present invention.
The block chain based supply chain data sharing apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the block chain-based supply chain data sharing apparatus 100 may include a uplink message queue processing module 101, a to-be-uplink data signature module 102, a sorting node processing module 103, and a base node processing module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and can perform a fixed function, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the uplink message queue processing module 101 is configured to acquire transaction data on a preset supply chain, write the transaction data into a preset uplink message queue one by one, and acquire data to be uplink from the uplink message queue one by one;
the to-be-uplink data signature module 102 is configured to generate a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, perform asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair, obtain to-be-uplink data with a signature, and send the to-be-uplink data with the signature to a preset sequencing node;
The sorting node processing module 103 is configured to sort the data to be linked with a signature by using the sorting node to obtain sorting data, construct a block corresponding to the sorting data, and broadcast the block to a base node corresponding to a sharing mechanism connected to the supply chain, where the base node includes a base main node and a base sub-node;
the basic node processing module 104 is configured to extract a public key corresponding to the sorted data, and perform signature verification on the block by using the public key through the basic master node; and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
In detail, when the modules in the supply chain data sharing device 100 based on the block chain according to the embodiment of the present invention are used, the same technical means as the supply chain data sharing method based on the block chain described in fig. 1 to fig. 3 are adopted, and the same technical effects can be produced, which is not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device for implementing a block chain-based supply chain data sharing method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a supply chain data sharing program based on a block chain, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules stored in the memory 11 (for example, executing a supply chain data sharing program based on a block chain, etc.), and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in the electronic device and various types of data, such as codes of a supply chain data sharing program based on a block chain, etc., but also for temporarily storing data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The block chain based supply chain data sharing program stored by the memory 11 in the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, may implement:
Acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink one by one from the uplink message queue;
generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
sequencing the data to be uplink containing the signature by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic node corresponding to a sharing mechanism connected with the supply chain, wherein the basic node comprises a basic main node and a basic sub-node;
extracting a public key corresponding to the sequencing data, and performing signature verification on the block by using the public key through the basic main node;
and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium storing a computer program which, when executed by a processor of an electronic device, implements:
acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink one by one from the uplink message queue;
generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
Sequencing the data to be uplink containing the signature by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic node corresponding to a sharing mechanism connected with the supply chain, wherein the basic node comprises a basic main node and a basic sub-node;
extracting a public key corresponding to the sequencing data, and performing signature verification on the block by using the public key through the basic main node;
and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A block chain based supply chain data sharing method, the method comprising:
acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink one by one from the uplink message queue;
generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
Sequencing the data to be uplink containing the signature by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a basic node corresponding to a sharing mechanism connected with the supply chain, wherein the basic node comprises a basic main node and a basic sub-node;
extracting a public key corresponding to the sequencing data, and performing signature verification on the block by using the public key through the basic main node;
and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
2. The method of claim 1, wherein writing the transaction data one by one into a predetermined uplink message queue comprises:
selecting a target message queue from the uplink message queue according to the system attribute of the transaction data and a preset message queue not-full condition;
calculating the offset of the target thread corresponding to the transaction data for enqueuing, calculating the target position of the target thread in the target message queue according to the offset, and executing enqueuing operation at the target position through the target thread.
3. The method for block chain-based supply chain data sharing according to claim 1, wherein the generating a public-private key pair with the to-be-uplink data according to a preset certificate authentication node comprises:
acquiring an original mechanism of the data to be chained, and performing identity verification on the original mechanism;
after the identity verification of the original organization passes, setting data are defined according to the original organization, and initialization operation is carried out on a preset secret key pair generator through the setting data and a preset space object;
and generating a key pair according to the initialized key pair generator, generating a target public key according to the key pair, generating a target private key according to the key pair, and taking the target public key and the target private key as a public and private key pair.
4. The block chain based supply chain data sharing method of claim 3, wherein the generating a target public key from the key pair comprises:
creating a public key character stream object, and generating a public key object of an encoding stream according to the public key character stream object;
acquiring public key byte data information from the key pair, and writing the public key byte data information into a public key object of the encoded stream to obtain public key character string information;
And outputting the public key character string information to a preset public and private key pair array to obtain a target public key.
5. The method for block chain-based supply chain data sharing according to claim 1, wherein the asymmetrically signing the to-be-uplink data by using a private key in the public and private key pair to obtain the signed to-be-uplink data comprises:
performing hash calculation on the data to be linked to obtain a data abstract;
and encrypting the data abstract by using the private key to obtain a digital signature, and obtaining the data to be uplink containing the signature according to the data signature and the data to be uplink.
6. The method of claim 1, wherein the sorting the signature-containing uplink data by the sorting node to obtain sorted data comprises:
checking the data to be linked containing the signature, and deleting the data which do not meet the preset requirement to obtain the data to be sorted;
sequencing the data to be sequenced according to the time sequence to obtain corresponding sequencing numbers;
and setting the sequencing attribute of the data to be linked containing the signature as the sequencing number to obtain sequencing data.
7. The method as claimed in any one of claims 1 to 6, wherein said constructing the block corresponding to the sorting data comprises:
obtaining historical block information of a previous block, and generating a time stamp and a version number of a current block;
packaging the block head of the current block according to the historical block information, the timestamp and the version number;
and packaging the sorting data into the block body of the current block, and taking the packaged block head and the current block of the block body as the block corresponding to the sorting data.
8. A block chain based supply chain data sharing apparatus, the apparatus comprising:
the uplink message queue processing module is used for acquiring transaction data on a preset supply chain, writing the transaction data into a preset uplink message queue one by one, and acquiring data to be uplink from the uplink message queue one by one;
the to-be-uplink data signature module is used for generating a public and private key pair according to a preset certificate authentication node and the to-be-uplink data, carrying out asymmetric signature on the to-be-uplink data by using a private key in the public and private key pair to obtain to-be-uplink data containing a signature, and sending the to-be-uplink data containing the signature to a preset sequencing node;
The sequencing node processing module is used for sequencing the data to be uplink, which contains the signature, by utilizing the sequencing node to obtain sequencing data, constructing a block corresponding to the sequencing data, and broadcasting the block to a base node corresponding to a sharing mechanism connected with the supply chain, wherein the base node comprises a base main node and a base sub-node;
the basic node processing module is used for extracting a public key corresponding to the sequencing data and utilizing the public key to carry out signature verification on the block through the basic main node; and after the signature verification is passed, synchronizing the block to the basic child node through the basic main node, and storing the block into a distributed account book corresponding to the basic child node.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the block chain based supply chain data sharing method of any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for block chain based supply chain data sharing according to any one of claims 1 to 7.
CN202310138076.XA 2023-02-20 2023-02-20 Block chain-based supply chain data sharing method, device, equipment and medium Active CN115840787B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310138076.XA CN115840787B (en) 2023-02-20 2023-02-20 Block chain-based supply chain data sharing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310138076.XA CN115840787B (en) 2023-02-20 2023-02-20 Block chain-based supply chain data sharing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115840787A true CN115840787A (en) 2023-03-24
CN115840787B CN115840787B (en) 2023-05-02

Family

ID=85579894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310138076.XA Active CN115840787B (en) 2023-02-20 2023-02-20 Block chain-based supply chain data sharing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115840787B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116346503A (en) * 2023-05-25 2023-06-27 红杉天枰科技集团有限公司 Encryption method and device for water carbon emission data based on full life cycle
CN117113419A (en) * 2023-10-18 2023-11-24 深圳市中农易讯信息技术有限公司 Information sharing method and device based on multi-stage supply chain

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110012015A (en) * 2019-04-09 2019-07-12 中国科学院沈阳计算技术研究所有限公司 A kind of internet of things data sharing method and system based on block chain
CN110278256A (en) * 2019-06-13 2019-09-24 思力科(深圳)电子科技有限公司 Block chain node accesses cochain method, relevant device and system
CN110309634A (en) * 2019-04-04 2019-10-08 深圳大通实业股份有限公司 A kind of credible advertisement data management system based on block chain
WO2020033627A1 (en) * 2018-08-10 2020-02-13 Walmart Apollo, Llc System and method for product recall using blockchain
CN111125787A (en) * 2019-12-27 2020-05-08 上海共链信息科技有限公司 Gas inspection data cochain system based on block chain and use method thereof
CN111339116A (en) * 2020-02-29 2020-06-26 中央财经大学 Block chain-based method for sharing open bank data
CN113536388A (en) * 2020-04-16 2021-10-22 中移物联网有限公司 Data sharing method and system based on block chain
CN113779607A (en) * 2021-09-16 2021-12-10 北京易华录信息技术股份有限公司 Industrial data asset management method, system and equipment
WO2022041902A1 (en) * 2020-08-28 2022-03-03 平安科技(深圳)有限公司 Data processing method and apparatus
CN114219647A (en) * 2021-12-31 2022-03-22 绿城科技产业服务集团有限公司 Method and device for managing cross-regional enterprise credit based on alliance chain
US20220303121A1 (en) * 2021-03-17 2022-09-22 International Business Machines Corporation Blockchain data segregation
CN115357915A (en) * 2022-08-01 2022-11-18 华南师范大学 Block chain method based on deep learning and information hiding and medical health transaction system

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020033627A1 (en) * 2018-08-10 2020-02-13 Walmart Apollo, Llc System and method for product recall using blockchain
CN110309634A (en) * 2019-04-04 2019-10-08 深圳大通实业股份有限公司 A kind of credible advertisement data management system based on block chain
CN110012015A (en) * 2019-04-09 2019-07-12 中国科学院沈阳计算技术研究所有限公司 A kind of internet of things data sharing method and system based on block chain
CN110278256A (en) * 2019-06-13 2019-09-24 思力科(深圳)电子科技有限公司 Block chain node accesses cochain method, relevant device and system
CN111125787A (en) * 2019-12-27 2020-05-08 上海共链信息科技有限公司 Gas inspection data cochain system based on block chain and use method thereof
CN111339116A (en) * 2020-02-29 2020-06-26 中央财经大学 Block chain-based method for sharing open bank data
CN113536388A (en) * 2020-04-16 2021-10-22 中移物联网有限公司 Data sharing method and system based on block chain
WO2022041902A1 (en) * 2020-08-28 2022-03-03 平安科技(深圳)有限公司 Data processing method and apparatus
US20220303121A1 (en) * 2021-03-17 2022-09-22 International Business Machines Corporation Blockchain data segregation
CN113779607A (en) * 2021-09-16 2021-12-10 北京易华录信息技术股份有限公司 Industrial data asset management method, system and equipment
CN114219647A (en) * 2021-12-31 2022-03-22 绿城科技产业服务集团有限公司 Method and device for managing cross-regional enterprise credit based on alliance chain
CN115357915A (en) * 2022-08-01 2022-11-18 华南师范大学 Block chain method based on deep learning and information hiding and medical health transaction system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
方轶;丛林虎;邓建球;杨珍波;: "基于区块链的航空导弹业务数据安全研究", 舰船电子工程 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116346503A (en) * 2023-05-25 2023-06-27 红杉天枰科技集团有限公司 Encryption method and device for water carbon emission data based on full life cycle
CN116346503B (en) * 2023-05-25 2023-07-28 红杉天枰科技集团有限公司 Encryption method and device for water carbon emission data based on full life cycle
CN117113419A (en) * 2023-10-18 2023-11-24 深圳市中农易讯信息技术有限公司 Information sharing method and device based on multi-stage supply chain
CN117113419B (en) * 2023-10-18 2024-02-09 深圳市中农易讯信息技术有限公司 Information sharing method and device based on multi-stage supply chain

Also Published As

Publication number Publication date
CN115840787B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
KR101974060B1 (en) Method and system for validating ownership of digital assets using distributed hash tables and peer-to-peer distributed decoys
CN108833081B (en) Block chain-based equipment networking authentication method
JP6995762B2 (en) Cryptographic methods and systems for the secure extraction of data from the blockchain
CN109074579B (en) Method and system for protecting computer software using distributed hash table and blockchain
CN110771095B (en) System and method for implementing blockchain-based digital certificates
CN110800254B (en) System and method for generating digital signature
CN115840787B (en) Block chain-based supply chain data sharing method, device, equipment and medium
WO2020025198A1 (en) Documenting timestamps within a blockchain
CN112104627B (en) Block chain-based data transmission method and device, electronic equipment and storage medium
CN113055380B (en) Message processing method and device, electronic equipment and medium
CN113112252B (en) Resource transfer method and device based on block chain, electronic equipment and storage medium
CN114124502B (en) Message transmission method, device, equipment and medium
CN113822675A (en) Block chain based message processing method, device, equipment and storage medium
CN111950032A (en) Block chain-based data storage method, terminal device and storage medium
CN114884697A (en) Data encryption and decryption method based on state cryptographic algorithm and related equipment
CN113706313A (en) Financing method, system and computer readable storage medium based on block chain
JP2023530594A (en) Permitted Event Processing in Distributed Databases
CN112217639B (en) Data encryption sharing method and device, electronic equipment and computer storage medium
CN114417374A (en) Intelligent contract business card method, device, equipment and storage medium based on block chain
CN117043772A (en) Block chain data separation
CN109698750A (en) Block generation method, device, equipment and the readable storage medium storing program for executing of block chain
CN113918517A (en) Multi-type file centralized management method, device, equipment and storage medium
CN114629663A (en) Block chain-based digital commodity transaction method and device
CN115311061B (en) Electronic transaction management method, device, equipment and storage medium based on digital authentication
CN114826613B (en) Identity information query method, device, equipment and storage medium based on blockchain

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