CN108599969A - The method and apparatus of data sharing in a kind of block chain - Google Patents

The method and apparatus of data sharing in a kind of block chain Download PDF

Info

Publication number
CN108599969A
CN108599969A CN201810412990.8A CN201810412990A CN108599969A CN 108599969 A CN108599969 A CN 108599969A CN 201810412990 A CN201810412990 A CN 201810412990A CN 108599969 A CN108599969 A CN 108599969A
Authority
CN
China
Prior art keywords
block chain
data
node
chain
target data
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.)
Pending
Application number
CN201810412990.8A
Other languages
Chinese (zh)
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.)
Beijing Chain Chain Information Technology Co Ltd
Original Assignee
Beijing Chain Chain Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Chain Chain Information Technology Co Ltd filed Critical Beijing Chain Chain Information Technology Co Ltd
Priority to CN201810412990.8A priority Critical patent/CN108599969A/en
Publication of CN108599969A publication Critical patent/CN108599969A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Abstract

The present invention provides a kind of method and apparatus of data sharing in block chain, first, obtain the target data changed in first node;Then, second node target data being broadcast in the block chain, wherein after second node receives target data, second node is based on common recognition algorithm and carries out common recognition operation to target data, and operation result is written in the chain of block chain in account book.In embodiments of the present invention, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and the data of each node in block chain are written to the mode in the chain of block chain in account book based on common recognition operation, it can realize that each internodal data in block chain can be shared and then achieve the purpose that each data among enterprises in the shared realization supply chain based on each internodal data in block chain are shared, solve the technical issues of cannot reaching an agreement in time due to the data in supply chain caused by the system lock between supply chain Zhong Ge enterprises in the prior art.

Description

The method and apparatus of data sharing in a kind of block chain
Technical field
The present invention relates to block chain technical fields, more particularly, to a kind of method and apparatus of data sharing in block chain.
Background technology
Block chain is the novel of the computer technologies such as Distributed Storage, point-to-point transmission, common recognition mechanism, Encryption Algorithm Application model.So-called common recognition mechanism is that the mathematics calculation for trusting, obtaining equity is established between realizing different nodes in block catenary system Method.Supply chain refers to the connection of each relative or the linking of business before commodity reach in consumer's hand, is to surround core enterprise, By the way that information flow, since logistics, the control of cash flow be made intermediate products and final products, finally purchasing raw material By sales network product be sent in consumer's hand by supplier, manufacturer, retail trader (retailer, whole seller etc.) is until most Whole user is linked to be the function network structure of an entirety.
At this stage, supply chain finance participates in each side's system lock, and the transaction data in supply chain cannot reach common understanding in time Unanimously, and in the data sharing between supply chain Zhong Ge enterprises there is part verification link and need manual examination and verification, inefficiency.
In view of the above problems, not proposing effective solution also.
Invention content
In view of this, the purpose of the present invention is to provide a kind of method and apparatus of data sharing in block chain, to solve System lock between supply chain Zhong Ge enterprises in the prior art, the technology that the data in supply chain cannot reach an agreement in time are asked Topic.
According to embodiments of the present invention, the method for providing data sharing in a kind of block chain is applied to block chain, the side Method includes:Obtain the target data that changes in first node, wherein the first node is in the block chain with first The corresponding node of enterprise, first enterprise are one in multiple Target Enterprises, and the multiple Target Enterprise is to pass through area Block chain gateway is linked into the enterprise in the supply chain of the block chain;Target data is broadcast in the block chain Two nodes, wherein the second node is all nodes in addition to the first node in the block chain;Wherein, in institute It states after second node receives the target data, the second node is based on common recognition algorithm and knows together to the target data Operation, and operation result is written in the chain of the block chain in account book.
Further, include by the second node that the target data is broadcast in the block chain:By the number of targets It is broadcast in the event sniffer of the second node according to by broadcast mechanism, so that the event sniffer passes through the block The target data is sent to the second node by chain gateway, wherein the event sniffer is in advance in second node The event sniffer being arranged in registered port.
Further, after in the chain that operation result is written to the block chain in account book, the method further includes:To The event sniffer transmission data fresh information of each node in the block chain, wherein the data update information is described The information that block chain is updated the target data in account book in the chain based on the operation result.
According to embodiments of the present invention, the method for additionally providing data sharing in a kind of block chain is applied in block chain Second node, including:The second node obtains the target data that block chain is broadcasted in chain, wherein the target data is The target data changed in first node in the block chain, wherein the first node be the block chain in The corresponding node of first enterprise, first enterprise are one in multiple Target Enterprises, and the multiple Target Enterprise is logical Cross the enterprise that block chain gateway is linked into the supply chain of the block chain;The second node receive the target data it Afterwards, common recognition operation is carried out to the target data based on common recognition algorithm, and account in the chain of the block chain is written into operation result In this.
Further, common recognition operation is carried out to the target data based on common recognition algorithm, and described in operation result is written Account book includes in the chain of block chain:Stored interaction data data with the target data respectively in the second node Content is compared, and obtains comparison result, wherein the data content includes numerical value and/or version number, and the interaction data is The number that the first node stores during being interacted with the second node when being changed to the target data According to;If the comparison result is that the interaction data is consistent with the target data, will be in the data of the target data Hold in the chain that the block chain is written in account book.
Further, the method further includes:If the comparison result is the interaction data and the target data It is inconsistent, then the interaction data of the second node is changed based on optimistic lock mechanism, is specifically included:Compare the interaction data with The version number of the target data;If the version number for comparing the interaction data is less than or equal to the version of the target data This number, then by the updating target data to the second node, and by the updating target data in the block chain Chain in account book.
Further, if the version number of the interaction data is higher than the version number of the target data, execution is returned The target data that block chain is broadcasted in chain is obtained, and common recognition operation is carried out to the target data based on common recognition algorithm, and will The step in account book in the chain of the block chain is written in operation result.
Further, after in the chain that operation result is written to the block chain in account book, the method further includes:Institute It states second node and the data update information that the block chain is sent is obtained by event sniffer, wherein the data update letter Breath is the information that the block chain is updated the target data in account book in the chain based on the operation result.
According to embodiments of the present invention, a kind of device of data sharing in block chain is additionally provided, block chain is applied to, it is described Device includes:First acquisition unit, for obtaining the target data changed in first node, wherein the first node For node corresponding with the first enterprise in the block chain, first enterprise is one in multiple Target Enterprises, described Multiple Target Enterprises are the enterprise being linked by block chain gateway in the supply chain of the block chain;Radio unit, being used for will The target data is broadcast to the second node in the block chain, wherein the second node in the block chain remove institute State all nodes other than first node;Wherein, after the second node receives the target data, the second node Common recognition operation is carried out to the target data based on common recognition algorithm, and account book in the chain of the block chain is written into operation result In.
According to embodiments of the present invention, a kind of device of data sharing in block chain is additionally provided, is applied in block chain Second node, including:Second acquisition unit obtains the target data that block chain is broadcasted in chain for the second node, In, the target data is the target data changed in the first node in the block chain, wherein the first node For node corresponding with the first enterprise in the block chain, first enterprise is one in multiple Target Enterprises, described Multiple Target Enterprises are the enterprise being linked by block chain gateway in the supply chain of the block chain;Arithmetic element is used for institute Second node is stated after receiving the target data, common recognition operation is carried out to the target data based on common recognition algorithm, and will Operation result is written in the chain of the block chain in account book.
In embodiments of the present invention, first, the target data changed in first node is obtained;Then, by number of targets According to the second node being broadcast in the block chain, wherein after second node receives target data, second node is based on altogether Know algorithm and common recognition operation is carried out to target data, and operation result is written in the chain of block chain in account book.Implement in the present invention In example, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and are based on common recognition operation by block chain In each node data write-in block chain chain in mode in account book, can realize that each internodal data can be total in block chain It enjoys, and then has reached the shared mesh of each data among enterprises in the shared realization supply chain based on each internodal data in block chain , it solves since the data in supply chain caused by the system lock between supply chain Zhong Ge enterprises in the prior art cannot be timely The technical issues of reaching an agreement, to realize the technique effect that the data between supply chain Zhong Ge enterprises can be shared.
Description of the drawings
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art Embodiment or attached drawing needed to be used in the description of the prior art are briefly described, it should be apparent that, in being described below Attached drawing is some embodiments of the present invention, for those of ordinary skill in the art, before not making the creative labor It puts, other drawings may also be obtained based on these drawings.
Fig. 1 is the flow chart of data sharing method in a kind of block chain provided according to embodiments of the present invention;
Fig. 2 is that the Target Enterprise provided according to embodiments of the present invention is linked into the signal in block chain by block chain gateway Figure;
Fig. 3 is that target data is broadcast to the second section based on broadcast mechanism in the block chain provided according to embodiments of the present invention Schematic diagram in point;
Fig. 4 is data in a kind of block chain applied to the second node in block chain provided according to embodiments of the present invention The flow chart of shared method;
It is the schematic diagram that data rewriting is entered to account book based on optimistic lock mechanism of embodiment offer that Fig. 5, which is according to the present invention,;
Fig. 6 is the schematic diagram of the device of data sharing in a kind of block chain provided according to embodiments of the present invention;
Fig. 7 is the structure chart of the block chain gateway provided according to embodiments of the present invention;
Fig. 8 is data in a kind of block chain applied to the second node in block chain provided according to embodiments of the present invention The schematic diagram of shared device;
Fig. 9 is the schematic diagram that the block chain provided according to embodiments of the present invention carries out the processing of data based on intelligent contract.
Specific implementation mode
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with attached drawing to the present invention Technical solution be clearly and completely described, it is clear that described embodiments are some of the embodiments of the present invention, rather than Whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative work premise Lower obtained every other embodiment, shall fall within the protection scope of the present invention.
Embodiment one:
Fig. 1 is the flow chart of data sharing method in a kind of block chain provided according to embodiments of the present invention, and the data are total The method enjoyed is applied to block chain, as shown in Figure 1, this method comprises the following steps:
Step S102 obtains the target data that changes in first node, wherein first node is in block chain with the The corresponding node of one enterprise, the first enterprise are one in multiple Target Enterprises, and multiple Target Enterprises are to pass through block link network Close the enterprise being linked into the supply chain of block chain;
Target data is broadcast to the second node in block chain by step S104, wherein second node is to be removed in block chain All nodes other than first node;
Wherein, after second node receives target data, second node is based on common recognition algorithm and is total to target data Know operation, and operation result is written in the chain of block chain in account book.
In embodiments of the present invention, first, the target data changed in first node is obtained;Then, by number of targets According to the second node being broadcast in the block chain, wherein after second node receives target data, second node is based on altogether Know algorithm and common recognition operation is carried out to target data, and operation result is written in the chain of block chain in account book.Implement in the present invention In example, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and are based on common recognition operation by block chain In each node data write-in block chain chain in mode in account book, can realize that each internodal data can be total in block chain It enjoys, and then has reached the shared mesh of each data among enterprises in the shared realization supply chain based on each internodal data in block chain , it solves since the data in supply chain caused by the system lock between supply chain Zhong Ge enterprises in the prior art cannot be timely The technical issues of reaching an agreement, to realize the technique effect that the data between supply chain Zhong Ge enterprises can be shared.
Fig. 2 is that the Target Enterprise provided according to embodiments of the present invention is linked into the signal in block chain by block chain gateway Figure.
In embodiments of the present invention, the enterprise in supply chain includes a series of participations of supplier, manufacturer, retail trader etc. Enterprise of the commodity from producing to being ultimately sent in consumer's hand, as shown in Fig. 2, financial institution's member's node in Fig. 2, transaction pair Hand member's node, warehouse receipt holder member node and storage ERP (that is, enterprise management system) member's node etc. belong to supply Enterprise's (that is, above-mentioned Target Enterprise) in chain.In embodiments of the present invention, each Target Enterprise passes through block chain gateway accessing It is uploaded in block chain into block chain, and by the data in respective Target Enterprise, it should be noted that in above-mentioned Target Enterprise Data can be one of data as shown in Figure 2:Data in account contract fund account, really power and the friendship of warehouse receipt contract Easy data, the data in account contract asset account, but it is not limited to the above-mentioned data enumerated.
In an alternative embodiment, target data is broadcast to the second node in block chain, specifically by step S104 Including following method:
Target data is broadcast to by broadcast mechanism in the event sniffer of second node, so that event sniffer passes through Target data is sent to second node by block chain gateway, wherein event sniffer is in advance in the registered port of second node The event sniffer of middle setting.
In embodiments of the present invention, first, each node in block chain needs the service in the gateway registration itself of block chain IP address and serve port (that is, above-mentioned registered port), and call Event hub (that is, above-mentioned action listener at registered port Device) it is monitored, it should be noted that event sniffer is the monitoring journey being arranged in the registered port of second node in advance Sequence, then, after block chain gets the target data changed in first node, block chain can pass through the target data Broadcast mechanism is broadcast in the event sniffer of second node, so that event sniffer is sent out target data by block chain gateway It is sent to second node, wherein event sniffer carries out the transmission of data with JSON formats.
Specific description is made to above-mentioned broadcast mechanism with specific example below.
Fig. 3 is that target data is broadcast to the second section based on broadcast mechanism in the block chain provided according to embodiments of the present invention Schematic diagram in point.
As shown in figure 3, when user (that is, above-mentioned first enterprise) initiates Accounting Request (that is, the first enterprise is to above-mentioned first segment Data in point change) when, the data in node 1 (that is, above-mentioned first node) shown in Fig. 3 can change. After data in node 1 change, block chain can be by changed data in node 1 (that is, above-mentioned in above-mentioned first node Data change after target data) be broadcast in the second node in block chain (that is, node 2 shown in Fig. 3), And then second node executes above-mentioned step target data being written based on common recognition algorithm in the chain of block chain in account book.Wherein, It is institute in Fig. 3 that second node, which executes the above-mentioned step that target data is written in the chain of block chain in account book based on common recognition algorithm, That shows is packaged data the process of book keeping operation.
It should be noted that account book page 1 as shown in Figure 3, account book page 2, account book equal blocks 1 in block chain of page 3, Block 2, block 3 etc..And so on, as shown in figure 3, when being written in the chain of block chain in account book target data, it will Increase a new block in chain to be written for the target data.
In embodiments of the present invention, block chain can not only be arrived the data broadcasting changed in node 1 based on broadcast mechanism (that is, account broadcast as shown in Figure 3) in node 2, can also be informed by broadcast mechanism after node 2 receives target data Node 1, and inform other node the following contents in block chain in addition to node 2:Node 2 has been received by target data (that is, as schemed Result shown in 3 is broadcasted).
In embodiments of the present invention, user can only add new data information in node 1, cannot be to having in node 1 Data rewritten.In addition, the broadcast of target data is carried out based on digital signature, carried out using the mode of digital signature The transmission of data can effectively be encrypted data so that the transmission process of data more has safety.In the present invention In embodiment, user be free to receive the data in node corresponding with itself in block chain, propagate, keep accounts With verification etc. operations.
In another optional embodiment, in the chain that operation result is written to block chain in account book after, the data Shared method further includes:
Step S106, the event sniffer transmission data fresh information of each node into block chain, wherein data update Information is the information that block chain is updated target data in account book in chain based on operation result.
In embodiments of the present invention, common recognition operation is carried out to target data when second node is based on common recognition algorithm, and will fortune After calculating in the chain of result write-in block chain in account book, block chain can be sent to the event sniffer of each node in block chain The information that data in the chain of block chain in account book are updated, so that the data that each node obtains in chain in account book are updated Message.
In embodiments of the present invention, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and The mode in the chain of block chain in account book is written into the data of each node in block chain based on common recognition operation, can realize block chain In each internodal data can share, and then reached in the shared realization supply chain based on each internodal data in block chain The shared purpose of each data among enterprises is solved due to being supplied caused by the system lock between supply chain Zhong Ge enterprises in the prior art The technical issues of answering the data on chain that cannot reach an agreement in time can be total to realize the data between supply chain Zhong Ge enterprises The technique effect enjoyed.
Embodiment two:
The method that the embodiment of the present invention additionally provides data sharing in a kind of block chain, this method are applied in block chain Second node, Fig. 4 are numbers in a kind of block chain applied to the second node in block chain provided according to embodiments of the present invention According to the flow chart of shared method, as shown in figure 4, this method comprises the following steps:
Step S401, second node obtain the target data that block chain is broadcasted in chain, wherein target data is block chain In first node in the target data that changes, wherein first node is section corresponding with the first enterprise in block chain Point, the first enterprise are one in multiple Target Enterprises, and multiple Target Enterprises are to be linked into block chain by block chain gateway Enterprise in supply chain;
Step S402, second node carry out common recognition fortune after receiving target data, based on common recognition algorithm to target data It calculates, and operation result is written in the chain of block chain in account book.
In embodiments of the present invention, first, second node obtains the target data that block chain is broadcasted in chain;Then, Two nodes carry out common recognition operation after receiving target data, based on common recognition algorithm to target data, and operation result is written In the chain of block chain in account book.
In embodiments of the present invention, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and The mode in the chain of block chain in account book is written into the data of each node in block chain based on common recognition operation, can realize block chain In each internodal data can share, and then reached in the shared realization supply chain based on each internodal data in block chain The shared purpose of each data among enterprises is solved due to being supplied caused by the system lock between supply chain Zhong Ge enterprises in the prior art The technical issues of answering the data on chain that cannot reach an agreement in time can be total to realize the data between supply chain Zhong Ge enterprises The technique effect enjoyed.
In an alternative embodiment, step S402 carries out common recognition operation based on common recognition algorithm to target data, and will Include the following steps in account book in the chain of operation result write-in block chain:
Step S4021, stored interaction data is carried out with the data content of the target data respectively in second node Compare, obtain comparison result, wherein data content includes numerical value and/or version number, and interaction data is first node to target The data stored during being interacted with second node when data change;
Step S4022, if comparison result is that interaction data is consistent with target data, by the data content of target data It is written in the chain of block chain in account book.
In embodiments of the present invention, after the target data that second node gets that block chain is broadcasted in chain, with It is stored in two nodes to be compared respectively with the target data content with the interaction data of first node.If comparing this Interaction data is consistent with target data, then the data content of target data is written in the chain of block chain in account book, that is, by target The numerical value of data and version number are written in the chain of block chain in account book.
In another optional embodiment, common recognition operation is carried out to target data based on common recognition algorithm, and by operation knot It further includes following steps that fruit, which is written in the chain of block chain in account book,:
Step S4023 is changed if comparison result is that interaction data and target data are inconsistent based on optimistic lock mechanism The interaction data of second node, specifically comprises the following steps:
Step S1 compares the version number of interaction data and target data;
Step S2, if the version number for comparing interaction data is less than or equal to the version number of target data, by target In data update to second node, and by updating target data in the chain of block chain in account book.
In embodiments of the present invention, optimistic lock mechanism is realized based on versions of data (Version) recording mechanism, in base In the version solution of database table, realized generally by " version " field is increased for database table.It reads When taking out data, this version number is read together, when updating later, this version number is added " 1 ".At this point, the version that data will be submitted Notebook data is compared with the current version information of database table corresponding record, if the versions of data number submitted is more than database Table current version number, then updated, otherwise it is assumed that being stale data.
In embodiments of the present invention, inconsistent with target data if comparing the interaction data, compare interaction data It will if the version number for comparing interaction data is less than or equal to the version number of target data with the version number of target data In updating target data to second node, and then by updating target data in the chain of block chain in account book.
Optionally, the interaction data that second node is changed based on optimistic lock mechanism, further includes following steps:
Step S3 returns to execution and obtains block chain if the version number of interaction data is higher than the version number of target data The target data broadcasted in chain, and common recognition operation is carried out to target data based on common recognition algorithm, and by operation result write area Step in the chain of block chain in account book.
In embodiments of the present invention, it if the version number for comparing interaction data is higher than the version number of target data, needs The step of re-executing synchronous read current data and version number, that is, return to execute and obtain what block chain was broadcasted in chain Target data, and common recognition operation is carried out to target data based on common recognition algorithm, and account in the chain of block chain is written into operation result Step in this.
Specific description to above-mentioned optimistic lock machine is manufactured with a specific example below.
It is the schematic diagram that data rewriting is entered to account book based on optimistic lock mechanism of embodiment offer that Fig. 5, which is according to the present invention,.
As shown in figure 5, during P1, when A (that is, above-mentioned first node, similarly hereinafter) accesses data s1, that is, A is by chain Data modification in interior account book is 80, can compare version number (that is, version shown in Fig. 5, similarly hereinafter) at this time.Such as Fig. 5 institutes Show, the version number of data is 1 in A, and the version number of the data in chain in account book is 2, at this point, the version number of data is less than in A Data rewriting in account book in chain cannot be then 80 by the version number of the data in chain in account book.Therefore, block chain needs again The data in current A are obtained, are re-executed based on common recognition algorithm by the process in target data write-in block chain, such as institute in Fig. 5 The P2 processes shown, the data in A are 100 at this time, and change has been carried out.
As shown in figure 5, during P1, when B (that is, a certain node in above-mentioned second node, similarly hereinafter) accesses data s1 When, that is, the data modification in account book in chain is 90 by B, can compare version number at this time, when version number is greater than or equal to current version This when, can just operate (that is, above-mentioned optimism lock mechanism), as shown in figure 5, the version number in B is 2, and the data in chain in account book Version number also be 2, at this point, by the data update in account book in chain be 90, that is, during P2 as shown in Figure 5, account book in chain Data be shown as 90.It should be noted that shown in during the P2 of such as Fig. 5, when the data in B are written in chain in account book Afterwards, the version number of data subtracts " 1 " automatically in B.
In embodiments of the present invention, a kind of Key-Values databases (key value database) are devised in block chain, and are carried For PUT, SET, GET operating methods, which belongs to the embedded database of lightweight, can easily dispose In node in block chain, when there is persistence service, that is, by account book in the chain of the write-in block chain of target data persistence When middle, API (Application Programming Interface, application programming interface) is called to can be operated.
In an optional embodiment, in the chain that operation result is written to block chain in account book after, the block Data sharing method further includes in chain:
Step S403, second node obtain the data update information that block chain is sent by event sniffer, wherein data Fresh information is the information that block chain is updated target data in account book in chain based on operation result.
In embodiments of the present invention, first, second node obtains the target data that block chain is broadcasted in chain;Then, Two nodes carry out common recognition operation after receiving target data, based on common recognition algorithm to target data, and operation result is written In the chain of block chain in account book.In embodiments of the present invention, supply chain Zhong Ge enterprises are linked by using block chain gateway In block chain, and the data of each node in block chain are written by the mode in the chain of block chain in account book, energy based on common recognition operation It enough realizes that each internodal data can be shared in block chain, and then has reached the shared reality based on each internodal data in block chain The shared purpose of each data among enterprises in existing supply chain is solved due to the system between supply chain Zhong Ge enterprises in the prior art The technical issues of data caused by closing in supply chain cannot reach an agreement in time, to realize between supply chain Zhong Ge enterprises The technique effect that can share of data.
Embodiment three:
A kind of device of data sharing in block chain is additionally provided according to embodiments of the present invention, and the device is for executing this hair The method of data sharing in the block chain applied to block chain that bright embodiment the above provides, below to the embodiment of the present invention The device of data sharing does specific introduction in the block chain of offer.
Fig. 6 is the schematic diagram of the device of data sharing in a kind of block chain provided according to embodiments of the present invention, such as Fig. 6 institutes Show, the device group of data sharing will include in the block chain:First acquisition unit 10, radio unit 20, wherein:
First acquisition unit 10, for obtaining the target data changed in first node, wherein first node is area Node corresponding with the first enterprise in block chain, the first enterprise are one in multiple Target Enterprises, and multiple Target Enterprises are logical Cross the enterprise that block chain gateway is linked into the supply chain of block chain;
Radio unit 20, the second node for being broadcast to target data in block chain, wherein second node is block All nodes in chain in addition to first node;
Wherein, after second node receives target data, second node is based on common recognition algorithm and is total to target data Know operation, and operation result is written in the chain of block chain in account book.
In embodiments of the present invention, block chain gateway is a kind of puppy parc, and platform (that is, block chain) is with enterprise (on that is, State the enterprise in supply chain) application between there are gateway layer, the gateway layer be responsible for processing application access (enterprise i.e. in supply chain connects Enter into block chain) protocol adaptation and packet parsing.Specifically, gateway layer using nodejs (a kind of event driven language (EDL) Running environment) researched and developed, as shown in fig. 7, parsing block link layer in GRPC (a kind of RPC frames) request post package at HTTPS api interfaces export JSON format general messages, wherein general api interface includes:User's registration is (that is, shown in Fig. 7 User), certificate management (that is, safety shown in fig. 7), intelligent contract call (that is, contract shown in fig. 7), intelligence to close About inquiry (that is, extension shown in fig. 7) etc..Enterprise's application can directly inherit Nodejs SDK, directly use SDK (softwares Development kit) internal user, certificate, intelligent contract function.Fig. 7 is the block chain gateway provided according to embodiments of the present invention Structure chart.
In embodiments of the present invention, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and The mode in the chain of block chain in account book is written into the data of each node in block chain based on common recognition operation, can realize block chain In each internodal data can share, and then reached in the shared realization supply chain based on each internodal data in block chain The shared purpose of each data among enterprises is solved due to being supplied caused by the system lock between supply chain Zhong Ge enterprises in the prior art The technical issues of answering the data on chain that cannot reach an agreement in time can be total to realize the data between supply chain Zhong Ge enterprises The technique effect enjoyed.
Example IV:
A kind of device of data sharing in block chain is additionally provided according to embodiments of the present invention, and the device is for executing this hair The method of data sharing, right below in the block chain for the second node being applied in block chain that bright embodiment the above provides The device of data sharing does specific introduction in block chain provided in an embodiment of the present invention.
Fig. 8 is data in a kind of block chain applied to the second node in block chain provided according to embodiments of the present invention The schematic diagram of shared device, as shown in figure 8, the device group of data sharing will include in the block chain:Second acquisition unit 30, Arithmetic element 40, wherein:
Second acquisition unit 30 obtains the target data that block chain is broadcasted in chain, wherein number of targets for second node According to the target data to be changed in the first node in block chain, wherein first node be block chain in the first enterprise Corresponding node, the first enterprise are one in multiple Target Enterprises, and multiple Target Enterprises are to pass through block chain gateway accessing To the enterprise in the supply chain of block chain;
Arithmetic element 40 carries out target data based on common recognition algorithm for second node after receiving target data Common recognition operation, and operation result is written in the chain of block chain in account book.
In embodiments of the present invention, in block chain it is the processing that data are carried out based on intelligent contract, Fig. 9 is according to this The block chain that inventive embodiments provide carries out the schematic diagram of the processing of data based on intelligent contract.
As shown in figure 9, the intelligent contract on block chain includes issued transaction and the mechanism of preservation, affairs include mainly to need The data (that is, being worth shown in Fig. 9, similarly hereinafter) of transmission;And event is then to the description information of these data (i.e. shown in Fig. 9 State, similarly hereinafter).After affairs and the incoming intelligent contract of event information, the resource status in contract resource collection can be updated, into And it triggers intelligent contract and carries out state machine judgement.If some in automatic state machine or the trigger condition of certain several action meet, Then select contract action is automatic to execute according to presupposed information by state machine.
Include trigger condition in time description information, that is, preset trigger event as shown in Figure 9 and preset response rule Then, wherein preset trigger event includes the preset specific time, and specific event etc., preset rule of response includes preset specific Transaction, specific action etc., intelligent contract system is according to the trigger condition, when meeting the trigger condition, certainly from intelligent contract It is dynamic to send out preset data resource, and the event including trigger condition, complete response.It should be noted that in this process, Intelligent contract be a transaction model and state machine at system, it does not generate intelligent contract, will not change intelligence Can contract, therefore block chain carries out the processing of data based on intelligent contract, and can be effectively ensured that data in block chain change can Traceability so that the operation in any block chain can retain evidence and be inquired.
In embodiments of the present invention, first, the target data changed in first node is obtained;Then, by number of targets According to the second node being broadcast in the block chain, wherein after second node receives target data, second node is based on altogether Know algorithm and common recognition operation is carried out to target data, and operation result is written in the chain of block chain in account book.Implement in the present invention In example, supply chain Zhong Ge enterprises are linked into block chain by using block chain gateway, and are based on common recognition operation by block chain In each node data write-in block chain chain in mode in account book, can realize that each internodal data can be total in block chain It enjoys, and then has reached the shared mesh of each data among enterprises in the shared realization supply chain based on each internodal data in block chain , it solves since the data in supply chain caused by the system lock between supply chain Zhong Ge enterprises in the prior art cannot be timely The technical issues of reaching an agreement, to realize the technique effect that the data between supply chain Zhong Ge enterprises can be shared.
The technique effect and preceding method embodiment phase of the device that the embodiment of the present invention is provided, realization principle and generation Together, to briefly describe, device embodiment part does not refer to place, can refer to corresponding contents in preceding method embodiment.
In addition, in the description of the embodiment of the present invention unless specifically defined or limited otherwise, term " installation ", " phase Even ", " connection " shall be understood in a broad sense, for example, it may be being fixedly connected, may be a detachable connection, or be integrally connected;It can Can also be electrical connection to be mechanical connection;It can be directly connected, can also indirectly connected through an intermediary, Ke Yishi Connection inside two elements.For the ordinary skill in the art, above-mentioned term can be understood at this with concrete condition Concrete meaning in invention.
In the description of the present invention, it should be noted that term "center", "upper", "lower", "left", "right", "vertical", The orientation or positional relationship of the instructions such as "horizontal", "inner", "outside" be based on the orientation or positional relationship shown in the drawings, merely to Convenient for the description present invention and simplify description, do not indicate or imply the indicated device or element must have a particular orientation, With specific azimuth configuration and operation, therefore it is not considered as limiting the invention.In addition, term " first ", " second ", " third " is used for description purposes only, and is not understood to indicate or imply relative importance.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, it can be with It realizes by another way.The apparatus embodiments described above are merely exemplary, for example, the division of the unit, Only a kind of division of logic function, formula that in actual implementation, there may be another division manner, in another example, multiple units or component can To combine or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or beg for The mutual coupling, direct-coupling or communication connection of opinion can be by some communication interfaces, device or unit it is indirect Coupling or communication connection can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme 's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product It is stored in the executable non-volatile computer read/write memory medium of a processor.Based on this understanding, of the invention Technical solution substantially the part of the part that contributes to existing technology or the technical solution can be with software in other words The form of product embodies, which is stored in a storage medium, including some instructions use so that One computer equipment (can be personal computer, server or the network equipment etc.) executes each embodiment institute of the present invention State all or part of step of method.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read- Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with Store the medium of program code.
Finally it should be noted that:Embodiment described above, only specific implementation mode of the invention, to illustrate the present invention Technical solution, rather than its limitations, scope of protection of the present invention is not limited thereto, although with reference to the foregoing embodiments to this hair It is bright to be described in detail, it will be understood by those of ordinary skill in the art that:Any one skilled in the art In the technical scope disclosed by the present invention, it can still modify to the technical solution recorded in previous embodiment or can be light It is readily conceivable that variation or equivalent replacement of some of the technical features;And these modifications, variation or replacement, do not make The essence of corresponding technical solution is detached from the spirit and scope of technical solution of the embodiment of the present invention, should all cover the protection in the present invention Within the scope of.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. a kind of method of data sharing in block chain, which is characterized in that it is applied to block chain, the method includes:
Obtain the target data changed in first node, wherein the first node is to be looked forward to first in the block chain The corresponding node of industry, first enterprise are one in multiple Target Enterprises, and the multiple Target Enterprise is to pass through block Chain gateway is linked into the enterprise in the supply chain of the block chain;
The target data is broadcast to the second node in the block chain, wherein the second node is the block chain In all nodes in addition to the first node;
Wherein, after the second node receives the target data, the second node is based on common recognition algorithm to the mesh Mark data carry out common recognition operation, and operation result is written in the chain of the block chain in account book.
2. according to the method described in claim 1, it is characterized in that, the target data to be broadcast to in the block chain Two nodes include:
The target data is broadcast to by broadcast mechanism in the event sniffer of the second node, so that the event is supervised Listen device that the target data is sent to the second node by the block chain gateway, wherein the event sniffer is The event sniffer being arranged in the registered port of second node in advance.
3. according to the method described in claim 1, it is characterized in that, in the chain that operation result is written to the block chain account book In after, the method further includes:
The event sniffer transmission data fresh information of each node into the block chain, wherein the data update information The information that the target data is updated in account book in the chain based on the operation result for the block chain.
4. a kind of method of data sharing in block chain, which is characterized in that the second node being applied in block chain, including:
The second node obtains the target data that block chain is broadcasted in chain, wherein the target data is the block chain In first node in the target data that changes, wherein the first node be in the block chain with first enterprise's phase Corresponding node, first enterprise are one in multiple Target Enterprises, and the multiple Target Enterprise is to pass through block link network Close the enterprise being linked into the supply chain of the block chain;
The second node carries out common recognition fortune after receiving the target data, based on common recognition algorithm to the target data It calculates, and operation result is written in the chain of the block chain in account book.
5. according to the method described in claim 4, it is characterized in that, carrying out common recognition fortune to the target data based on common recognition algorithm It calculates, and account book in the chain of the block chain is written into operation result and includes:
Stored interaction data is compared with the data content of the target data respectively in the second node, is compared Relatively result, wherein the data content includes numerical value and/or version number, and the interaction data is the first node to institute State the data stored during being interacted with the second node when target data changes;
If the comparison result is that the interaction data is consistent with the target data, will be in the data of the target data Hold in the chain that the block chain is written in account book.
6. according to the method described in claim 5, it is characterized in that, the method further includes:
If the comparison result is that the interaction data and the target data are inconsistent, institute is changed based on optimistic lock mechanism The interaction data for stating second node, specifically includes:
Compare the version number of the interaction data and the target data;
If the version number for comparing the interaction data is less than or equal to the version number of the target data, by the target In data update to the second node, and by the updating target data in the chain of the block chain in account book.
7. according to the method described in claim 6, it is characterized in that, if the version number of the interaction data is higher than the target The version number of data then returns and executes the target data that acquisition block chain is broadcasted in chain, and based on common recognition algorithm to the mesh Mark data carry out common recognition operation, and the step in the chain of the block chain in account book is written in operation result.
8. according to the method described in claim 4, it is characterized in that, in the chain that operation result is written to the block chain account book In after, the method further includes:
The second node obtains the data update information that the block chain is sent by event sniffer, wherein the data The fresh information block chain is updated the target data in account book in the chain based on the operation result Information.
9. the device of data sharing in a kind of block chain, which is characterized in that be applied to block chain, described device includes:
First acquisition unit, for obtaining the target data changed in first node, wherein the first node is described Node corresponding with the first enterprise in block chain, first enterprise are one in multiple Target Enterprises, the multiple mesh It is the enterprise being linked by block chain gateway in the supply chain of the block chain to mark enterprise;
Radio unit, the second node for being broadcast to the target data in the block chain, wherein the second node For all nodes in the block chain in addition to the first node;
Wherein, after the second node receives the target data, the second node is based on common recognition algorithm to the mesh Mark data carry out common recognition operation, and operation result is written in the chain of the block chain in account book.
10. the device of data sharing in a kind of block chain, which is characterized in that the second node being applied in block chain, including:
Second acquisition unit obtains the target data that block chain is broadcasted in chain, wherein the target for the second node Data are the target data changed in the first node in the block chain, wherein the first node is the block Node corresponding with the first enterprise in chain, first enterprise are one in multiple Target Enterprises, the multiple target enterprise Industry is the enterprise being linked by block chain gateway in the supply chain of the block chain;
Arithmetic element, for the second node after receiving the target data, based on common recognition algorithm to the number of targets According to carrying out common recognition operation, and operation result is written in the chain of the block chain in account book.
CN201810412990.8A 2018-05-02 2018-05-02 The method and apparatus of data sharing in a kind of block chain Pending CN108599969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810412990.8A CN108599969A (en) 2018-05-02 2018-05-02 The method and apparatus of data sharing in a kind of block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810412990.8A CN108599969A (en) 2018-05-02 2018-05-02 The method and apparatus of data sharing in a kind of block chain

Publications (1)

Publication Number Publication Date
CN108599969A true CN108599969A (en) 2018-09-28

Family

ID=63620776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810412990.8A Pending CN108599969A (en) 2018-05-02 2018-05-02 The method and apparatus of data sharing in a kind of block chain

Country Status (1)

Country Link
CN (1) CN108599969A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189742A (en) * 2018-11-02 2019-01-11 苏州友教习亦教育科技有限公司 topic extracting method and system
CN109302296A (en) * 2018-10-10 2019-02-01 上海保险交易所股份有限公司 Method, equipment and storage medium for broadcasting the message in block chain network
CN109361565A (en) * 2018-11-08 2019-02-19 国网黑龙江省电力有限公司信息通信公司 Data center's management system for monitoring based on block chain
CN109684287A (en) * 2018-12-29 2019-04-26 厦门链平方科技有限公司 Gateway information sharing query method and system based on block chain
CN109788060A (en) * 2019-01-22 2019-05-21 曲阜师范大学 Cloud data sharing and update method based on block chain
CN109977687A (en) * 2019-04-02 2019-07-05 深圳智乾区块链科技有限公司 Data sharing method, device, system and readable storage medium storing program for executing based on block chain
CN110175178A (en) * 2018-11-01 2019-08-27 华为终端有限公司 A kind of method of data processing, node device and system
CN111126978A (en) * 2019-12-28 2020-05-08 飞天诚信科技股份有限公司 Method and device for realizing rapid transaction processing on block chain
CN111355804A (en) * 2020-03-06 2020-06-30 微民保险代理有限公司 Alliance-chain-based vehicle management method, device, equipment and storage medium
CN112270601A (en) * 2020-10-29 2021-01-26 成都质数斯达克科技有限公司 Information transmission method and device, electronic equipment and readable storage medium
CN112543236A (en) * 2020-12-18 2021-03-23 中国联合网络通信集团有限公司 Data sharing method and block link point

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107103459A (en) * 2017-04-27 2017-08-29 电子科技大学 Accounting system and method based on block chain with sovereign right
CN107103480A (en) * 2017-05-18 2017-08-29 电子科技大学 Supply chain management method based on block chain with sovereign right
CN107180350A (en) * 2017-03-31 2017-09-19 唐晓领 A kind of method of the multi-party shared transaction metadata based on block chain, apparatus and system
CN107450981A (en) * 2017-05-31 2017-12-08 阿里巴巴集团控股有限公司 A kind of block chain common recognition method and apparatus
CN107767229A (en) * 2017-10-14 2018-03-06 董富坤 A kind of transparent business model
WO2018064645A1 (en) * 2016-10-01 2018-04-05 3Dpp, Llc Distributed manufactring & blockchain enabled packaging

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018064645A1 (en) * 2016-10-01 2018-04-05 3Dpp, Llc Distributed manufactring & blockchain enabled packaging
CN107180350A (en) * 2017-03-31 2017-09-19 唐晓领 A kind of method of the multi-party shared transaction metadata based on block chain, apparatus and system
CN107103459A (en) * 2017-04-27 2017-08-29 电子科技大学 Accounting system and method based on block chain with sovereign right
CN107103480A (en) * 2017-05-18 2017-08-29 电子科技大学 Supply chain management method based on block chain with sovereign right
CN107450981A (en) * 2017-05-31 2017-12-08 阿里巴巴集团控股有限公司 A kind of block chain common recognition method and apparatus
CN107767229A (en) * 2017-10-14 2018-03-06 董富坤 A kind of transparent business model

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109302296B (en) * 2018-10-10 2020-12-29 上海保险交易所股份有限公司 Method, apparatus, and storage medium for broadcasting messages in a blockchain network
CN109302296A (en) * 2018-10-10 2019-02-01 上海保险交易所股份有限公司 Method, equipment and storage medium for broadcasting the message in block chain network
CN110175178A (en) * 2018-11-01 2019-08-27 华为终端有限公司 A kind of method of data processing, node device and system
CN110175178B (en) * 2018-11-01 2022-06-07 花瓣云科技有限公司 Data processing method, node equipment and system
CN109189742A (en) * 2018-11-02 2019-01-11 苏州友教习亦教育科技有限公司 topic extracting method and system
CN109361565A (en) * 2018-11-08 2019-02-19 国网黑龙江省电力有限公司信息通信公司 Data center's management system for monitoring based on block chain
CN109684287A (en) * 2018-12-29 2019-04-26 厦门链平方科技有限公司 Gateway information sharing query method and system based on block chain
CN109788060A (en) * 2019-01-22 2019-05-21 曲阜师范大学 Cloud data sharing and update method based on block chain
CN109788060B (en) * 2019-01-22 2021-05-07 曲阜师范大学 Cloud data sharing and updating method based on block chain
CN109977687A (en) * 2019-04-02 2019-07-05 深圳智乾区块链科技有限公司 Data sharing method, device, system and readable storage medium storing program for executing based on block chain
CN111126978A (en) * 2019-12-28 2020-05-08 飞天诚信科技股份有限公司 Method and device for realizing rapid transaction processing on block chain
CN111355804A (en) * 2020-03-06 2020-06-30 微民保险代理有限公司 Alliance-chain-based vehicle management method, device, equipment and storage medium
CN112270601A (en) * 2020-10-29 2021-01-26 成都质数斯达克科技有限公司 Information transmission method and device, electronic equipment and readable storage medium
CN112270601B (en) * 2020-10-29 2023-08-01 成都质数斯达克科技有限公司 Information transfer method, information transfer device, electronic equipment and readable storage medium
CN112543236A (en) * 2020-12-18 2021-03-23 中国联合网络通信集团有限公司 Data sharing method and block link point

Similar Documents

Publication Publication Date Title
CN108599969A (en) The method and apparatus of data sharing in a kind of block chain
Li et al. Blockchain-enabled workflow operating system for logistics resources sharing in E-commerce logistics real estate service
US11887055B2 (en) System and method for forming, storing, managing, and executing contracts
Firouzi et al. Iot fundamentals: Definitions, architectures, challenges, and promises
CN105144159B (en) HIVE watch chain connects
Rugman et al. Fifty years of international business theory and beyond
US10831183B2 (en) Transfer of production control in proximity to production site for enabling decentralized manufacturing
Mishra et al. Cloud-based multi-agent architecture for effective planning and scheduling of distributed manufacturing
Fantana et al. IoT applications—value creation for industry
CN110442652A (en) A kind of across chain data processing method and device based on block chain
AU2017240796A1 (en) System and method for creating and executing data-driven legal contracts
Lin et al. An innovative machine learning model for supply chain management
US20180114121A1 (en) Opportunity driven system and method based on cognitive decision-making process
JP2005521111A (en) Business process policy object
Perotti et al. Logistics 4.0 in warehousing: a conceptual framework of influencing factors, benefits and barriers
Fernandez et al. Agricultural supply chain using blockchain
CN116433198A (en) Intelligent supply chain management platform system based on cloud computing
El Mohadab et al. Enterprise resource planning: Introductory overview
Worster et al. Big data: gaining a competitive edge
Shen et al. Implementing internet enabled virtual enterprises using collaborative agents
CN107943992A (en) The distributed storage method of electric business platform base merchandise news
CN113159956A (en) Account data processing method, device, equipment and storage medium
US20150006329A1 (en) Distributed erp
Santos et al. Systems development for the industrial IoT: challenges from Industry R&D projects
Stefanovic Blockchain for Supply Chain Management: Opportunities, Technologies, and Applications

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180928