CN110059089A - Data synchronization method and device, storage medium and electronic equipment - Google Patents

Data synchronization method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN110059089A
CN110059089A CN201910239276.8A CN201910239276A CN110059089A CN 110059089 A CN110059089 A CN 110059089A CN 201910239276 A CN201910239276 A CN 201910239276A CN 110059089 A CN110059089 A CN 110059089A
Authority
CN
China
Prior art keywords
node
block
block head
head
heads
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
CN201910239276.8A
Other languages
Chinese (zh)
Other versions
CN110059089B (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.)
Cloudminds Shanghai Robotics Co Ltd
Original Assignee
Cloudminds Shenzhen Robotics Systems 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 Cloudminds Shenzhen Robotics Systems Co Ltd filed Critical Cloudminds Shenzhen Robotics Systems Co Ltd
Priority to CN201910239276.8A priority Critical patent/CN110059089B/en
Publication of CN110059089A publication Critical patent/CN110059089A/en
Application granted granted Critical
Publication of CN110059089B publication Critical patent/CN110059089B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Bioethics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure relates to a data synchronization method, apparatus, storage medium, and electronic device, so that a new node joining a licensed blockchain system can synchronize data from any node in the licensed blockchain. The data synchronization method is applied to a new node of block chain data to be synchronized in a block chain system, and comprises the following steps: the new node acquires a plurality of continuous block heads of a block chain locally stored by a first node from the first node in the block chain system; according to the identification of the block head, acquiring a plurality of continuous block heads with the same identification in a block chain locally stored by a second node from the second node; comparing the block header obtained from the first node with the block header obtained from the second node; and if the block head obtained from the first node is consistent with the block head obtained from the second node in comparison, synchronizing the block data corresponding to the plurality of continuous block heads from the first node to the new node.

Description

Method of data synchronization, device, storage medium and electronic equipment
Technical field
This disclosure relates to block chain technical field, and in particular, to a kind of method of data synchronization, device, storage medium and Electronic equipment.
Background technique
Block chain is the novel of the computer technologies such as Distributed Storage, point-to-point transmission, common recognition mechanism, Encryption Algorithm Application model.Wherein, license block chain is more and more applied to each as a kind of block chain with permission control ability In a tissue and alliance, company.Each node has all been divided permission on some basic chains in license block chain, such as digs mine Permission, access authority etc..Wherein, license block chain account can control based on access authority or node is connected to block chain network And the process of block data is obtained, it ensure that the data safety of license block chain, but also bring the synchronous problem of data simultaneously.
For the new node of license block catenary system is added, since only original node has access authority, this is new Node can only initially synchronize block data from original node.Also, if the new node is light node, since light node is only remembered Block head is recorded, does not record the authority information of other nodes, therefore in entire data synchronization process, which all can only From original node synchrodata, and cannot be from other node synchrodatas, this is larger to the pressure of original node, and also influences The data synchronization efficiency of new node.
Summary of the invention
Purpose of this disclosure is to provide a kind of method of data synchronization, device, storage medium and electronic equipments, are permitted so as to be added Can the new node of block catenary system can be from any node synchrodata in the license block chain.
To achieve the goals above, in a first aspect, the disclosure provides a kind of method of data synchronization, the method is applied to area The new node of block chain data to be synchronized in block catenary system, which comprises
The new node obtains the block chain that the first node is locally stored from the first node in the block catenary system Multiple continuous block heads, wherein the first node is not accessing in the block catenary system to the new node The node of permission;
According to the mark of the block head, obtaining from second node has phase in the block chain that the second node is locally stored With multiple continuous block heads of mark, the second node is that have access to the new node in the block catenary system The node of permission;
The block head obtained from the first node is compared with the block head obtained from the second node;
If the block head obtained from the first node compares unanimously with the block head obtained from the second node, The corresponding block data of the multiple continuous block head is synchronized to the new node from the first node.
Second aspect, the disclosure also provide a kind of data synchronization unit, and described device is applied in block catenary system to same The new node of block chain data is walked, described device includes:
First obtains module, obtains the first node from the first node in the block catenary system for the new node The multiple continuous block heads for the block chain being locally stored, wherein the first node is in the block catenary system to institute Stating new node does not have the node of access authority;
Second acquisition module obtains the second node from second node and locally deposits for the mark according to the block head With multiple continuous block heads of like-identified in the block chain of storage, the second node is pair in the block catenary system The new node has the node of access authority;
Comparison module, the block head for will be obtained from the first node and the block head from second node acquisition It is compared;
Synchronization module, for when the block head obtained from the first node and the block head from second node acquisition When comparing consistent, the corresponding block data of the multiple continuous block head is synchronized to the new node from the first node.
The third aspect, the disclosure also provide a kind of computer readable storage medium, are stored thereon with computer program, the journey The step of method described in first aspect is realized when sequence is executed by processor.
Fourth aspect, the disclosure also provide a kind of electronic equipment, comprising:
Memory is stored thereon with computer program;
Processor, for executing the computer program in the memory, to realize method described in first aspect The step of.
Through the above technical solutions, the new node being added in license block catenary system can be from the license block catenary system There is no the synchronous block data of first node of access authority to new node, scheme compared to the prior art, the data of the disclosure Synchronous method can mitigate the pressure of original node, accelerate data synchronization efficiency.It, can be with also, during data are synchronous By having the data validity of the second node verifying first node of access authority in the license block catenary system to new node, To ensure that the Information Security in data synchronization process.
Other feature and advantage of the disclosure will the following detailed description will be given in the detailed implementation section.
Detailed description of the invention
Attached drawing is and to constitute part of specification for providing further understanding of the disclosure, with following tool Body embodiment is used to explain the disclosure together, but does not constitute the limitation to the disclosure.In the accompanying drawings:
Fig. 1 is the flow chart according to a kind of method of data synchronization shown in one exemplary embodiment of the disclosure;
Fig. 2 is the topology signal according to each node in the license block catenary system shown in one exemplary embodiment of the disclosure Figure;
Fig. 3 is the block diagram according to a kind of data synchronization unit shown in one exemplary embodiment of the disclosure;
Fig. 4 is the block diagram according to a kind of electronic equipment shown in one exemplary embodiment of the disclosure.
Specific embodiment
It is described in detail below in conjunction with specific embodiment of the attached drawing to the disclosure.It should be understood that this place is retouched The specific embodiment stated is only used for describing and explaining the disclosure, is not limited to the disclosure.
Illustrate the technical term that the embodiment of the present disclosure is related to first.
License block chain: in block catenary system account or node can to block catenary system progress operation weigh Limit a kind of block catenary system of control.
Access authority: whether block chain account or node have the permission for accessing block catenary system and synchrodata.
Full node: the node with all data in block catenary system.
Light node: the node with partial data in block chain, it will usually possess block head all in block catenary system Information can do limited data verification.
Original node: the node of original account operation, usually full node.
Destination node: the full node of a certain license block catenary system has been accessed.
New node: prepare the node of a certain license block catenary system of access, including light node and Quan Jiedian.
Legitimate node: there is the node of access authority to new node.
Illegal node: do not have the node of access authority to new node.
In the related art, the new node for permitting block catenary system for being added, since only original node has access Permission, therefore the new node can only initially synchronize block data from original node, only when new node is synchronized to certain data Afterwards, other destination nodes equally with access authority can just be found, thus could be concomitantly from the same step number of other destination nodes According to.But if the new node is light node, due to light node recording areas build, the permission of other nodes is not recorded Information, therefore in entire data synchronization process, which can only cannot all save from original node synchrodata from other Point synchrodata, this is larger to the pressure of original node, and also affects the data synchronization efficiency of new node.
In order to solve the above-mentioned technical problem, the embodiment of the present disclosure provides a kind of method of data synchronization, can be applied to block The new node of block chain data to be synchronized in catenary system.Referring to Fig.1, which may include:
Step S101, new node obtain the block chain that the first node is locally stored from the first node in block catenary system Multiple continuous block heads.
Wherein, first node be there is no the node of access authority to new node in block catenary system, but it is to be understood that, New node has access authority to first node in the embodiments of the present disclosure.Therefore, new node can be obtained from first node and is somebody's turn to do The multiple continuous block heads for the block chain that first node is locally stored.
Illustratively, first node may include legal destination node, i.e., first node is to have access authority to new node Destination node, but new node block data is also comprising corresponding relevant authority information when data are synchronous, in such cases, The first node is the node of not access authority currently for new node.In another case, first node can also wrap Illegal destination node is included, i.e. first node is not have the destination node of access authority to new node.Step S102, according to block The mark of head obtains multiple continuous areas in the block chain that the second node is locally stored with like-identified from second node Build.
Wherein, second node is the node to new node with access authority in block catenary system, and be should understand that , new node equally has access authority to second node in the embodiment of the present disclosure, in other words, second node and new node Between have bilateral construction permission.Illustratively, second node can be the original node in block catenary system, be also possible to block chain There is the either objective node, etc. of access authority to new node, the embodiment of the present disclosure is not construed as limiting this in system.
In block chain, each block connects in sequence, and each block head has corresponding sequence identification (for example, area The number of build), therefore can be obtained in step s 102 from second node corresponding multiple continuous according to the mark of block head Block head.For example, 100 block heads that number is 1-100 are obtained from first node in step s101, correspondingly, in step Can be according to the number (mark) of the 100 block heads got in rapid S102, obtaining number in second node is 1-100's 100 block heads.
The block head obtained from first node is compared step S103 with the block head obtained from second node.
Step S104, if the block head obtained from the first node and the block head ratio obtained from the second node To consistent, then the corresponding block data of multiple continuous block heads is synchronized to new node from first node.
If the block head obtained from first node compares unanimously with the block head obtained from second node, illustrate from the Consistent (the number of the corresponding block data of the block head block data corresponding with the block head obtained from second node that one node obtains Pass through according to validation verification), so as to synchronize the corresponding block data of multiple continuous block heads to new section from first node Point.In another case, if compared from the block head that first node obtains with the block head obtained from second node different It causes, then illustrates the corresponding block data of the block head area corresponding with the block head obtained from second node obtained from first node Block number is not according to inconsistent (Validation of Data passes through), then consider Information Security, then it is not synchronous from the first node The corresponding block data of multiple continuous block heads is to new node.
By above-mentioned mode, the new node being added in license block catenary system can be right from the license block catenary system New node does not have the synchronous block data of the first node of access authority, and the data of scheme compared to the prior art, the disclosure are same One step process can mitigate the pressure of original node, accelerate data synchronization efficiency.Also, during data are synchronous, Ke Yitong The data validity to new node with the second node verifying first node of access authority is crossed in the license block catenary system, from And it ensure that the Information Security in data synchronization process.
For the method for data synchronization for making those skilled in the art more understand that the embodiment of the present disclosure provides, below to above-mentioned Each step carries out illustrated in greater detail.
In the embodiments of the present disclosure, since first node is that new node does not have the node of access authority, in step In S101, new node and first node foundation are limited connections, i.e., only carry out establishing connection institute between new node and first node The data interaction needed, and without any other data interaction in addition to establishing needed for connection, it thereby may be ensured that data are pacified Quan Xing.
After establishing limited connection with first node, multiple continuous block heads can be obtained from first node.Example Ground, the quantity of the block head obtained from first node can be, the disclosure determining, etc. according to the actual conditions of block catenary system Embodiment is not construed as limiting this.It should be understood that the block head quantity of acquisition can be dynamic for assuring data security Change at random, for example obtain 100 continuous block heads from first node for the first time, obtains 120 from first node for the second time A continuous block head obtains 110 continuous block heads, etc. from first node for the third time.
In a kind of possible mode, after getting multiple continuous block heads from first node, can also verify from First node obtain multiple continuous block heads validity, correspondingly, if step S102 can be validation verification at Function, then according to the mark of block head, obtaining from second node has like-identified in the block chain that the second node is locally stored Multiple continuous block heads.
In other words, before executing step S102, the multiple continuous blocks obtained from first node can first be verified Whether head can form effective block chain.Illustratively, the mode of verifying can be cryptographic Hash inspection or hash chain is examined, etc. Deng the embodiment of the present disclosure is not construed as limiting this.If validity is verified, i.e., what is got from first node is multiple continuous Block head can form effective block chain, then can obtain the second node sheet from second node according to the mark of block head Multiple continuous block heads with like-identified in the block chain of ground storage.
In the case where alternatively possible, if validation verification does not pass through, the first segment got can be abandoned Multiple continuous block heads of point, and the connection with the first node is disconnected, it is obtained again from other first nodes corresponding more A continuum build carries out data synchronization process.Alternatively, disconnect with after the connection of the first node, can also by this first Node is added in blacklist, avoids obtaining block head from the first node again in subsequent data synchronization process.In this way Mode, not only ensure that the synchronous safety of data, but also improve the synchronous efficiency of data.
After corresponding multiple continuous block heads are got from second node, the area that can will be got from first node Build is compared with the block head got from second node.In a kind of possible mode, it can will be obtained from first node The cryptographic Hash of the multiple continuous block heads taken and the cryptographic Hash of the multiple continuous block heads obtained from second node are compared It is right, correspondingly, in step S104, if can be from first node obtain multiple continuous block heads cryptographic Hash with from The cryptographic Hash for multiple continuous block heads that second node obtains is identical, then synchronizes multiple continuous block heads pair from first node The block data answered is to the new node.
In other words, in the embodiments of the present disclosure, the multiple continuous areas obtained from first node can be first determined respectively The cryptographic Hash of the cryptographic Hash of build and the multiple continuous block heads obtained from second node, then by obtained above two A cryptographic Hash is compared, if compared unanimously, synchronizes the corresponding block data of multiple continuous block heads from first node To new node.
It, can be first to each block from multiple continuous block heads that first node obtains in a kind of possible mode The cryptographic Hash of head carries out Hash calculation, the first cryptographic Hash is obtained, and obtain the second cryptographic Hash, then by the first cryptographic Hash and second Cryptographic Hash is compared.Wherein, the second cryptographic Hash be according to new node from multiple continuous block heads that second node obtains The cryptographic Hash of each block head carries out what Hash calculation obtained.
The cryptographic Hash of multiple continuous block head is arranged by the mark sequence of block head for example, the first cryptographic Hash can be It is carried out obtained from Hash calculation after column.It is multiple in the acquisition for receiving new node transmission that second cryptographic Hash can be second node After the request of data of continuum build, the range of multiple continuum builds is first determined according to the request of data, then by the block Multiple continuous blocks in head range carry out Hash calculation after arranging according to the mark sequence of block head and obtain and be sent to new Node.In this case, new node directly can obtain the second cryptographic Hash from second node.Certainly, possible at other In mode, the second cryptographic Hash is also possible to new node to each block head from multiple continuous block heads that second node obtains Cryptographic Hash carry out Hash calculation and get, etc., the embodiment of the present disclosure is not construed as limiting this.
By the above-mentioned means, can determine an entirety according to the cryptographic Hash of each block head in multiple continuous block heads Then cryptographic Hash the corresponding whole cryptographic Hash of first node and second node is compared.It is whole in this way to compare Mode, quickly first node can be verified, to more efficiently realize the data between first node and new node Synchronizing process.
In alternatively possible mode, the Hash of each block head in multiple continuous block heads can also be determined respectively Value, then the cryptographic Hash of corresponding block head each in first node and second node is compared one by one respectively.Specifically, It can be and first determine the corresponding cryptographic Hash of N+2 block head from multiple continuous block heads that first node obtains, then Determine the N+2 area from multiple continuous block heads that second node obtains with above-mentioned N+2 block head with like-identified The corresponding cryptographic Hash of build, it is then that N+2 block head of N+2 block head of first node and second node is corresponding Cryptographic Hash is compared one by one.
Wherein, N+2 block head may include first area from multiple continuous block heads that first node obtains N number of block head between build, the last one block head and first block head and the last one block head, N is positive whole Number.
Illustratively, the value of N can determine that the embodiment of the present disclosure does not limit this according to the actual conditions of block catenary system It is fixed.For example, 100 continuous block heads are obtained from first node, then N should be less than the positive integer equal to 98.In addition, It should be understood that the value of N is bigger, then comparison result is more credible, i.e., more can guarantee that the data obtained from first node are effective Property, to more can guarantee the Information Security in data synchronization process.
In data synchronization process, second node can not temporarily be connected due to network environment, hardware fault etc., In such cases, multiple batches of in step s101 block head can be obtained from first node, and to the block that each batch obtains Head addition does not compare label, wherein each batch obtains multiple continuous block heads.Correspondingly, step S102 can be first really Determine second node be in can connection status, then judge from first node obtain multiple batches of block head in, if exist have not The batch of label is compared, there is the batch for not comparing label if it exists, then according to the mark of the block head of the batch, from the second section Point obtains multiple continuous block heads in the block chain that the second node is locally stored with like-identified.Correspondingly, step S103, which can be, to carry out in the block head that will have the batch for not comparing label with the corresponding block head obtained from second node After comparison, that deletes the block head of the batch does not compare label.
In other words, when second node can not temporarily connect, step S101 can be first performed a plurality of times in new node, multiple batches of Block head is obtained, and label is not compared to the addition of every batch of block head, it, can be according to this then when second node restores to connect Label is compared, successively executes step S102- step S104, and after comparison, that deletes respective batch block head does not compare mark Note, to guarantee being normally carried out for data synchronization process.
Illustratively, not comparing label can be a character, such as a number or letter, be also possible to multiple characters, For example string number or letter, etc., the embodiment of the present disclosure are not construed as limiting this.It should be understood that in the embodiment of the present disclosure, For the block head that same batch is got, can uniformly add it is identical do not compare label, and different batches are got Block head, the different labels that do not compare can be added respectively and distinguished.
In the case where alternatively possible, when second node can not permanently be connected due to account key loss, damage etc. When connecing, it is possible to specify new node has other destination nodes of access authority as second node.For other destination nodes Selection can be determined according to the actual conditions of block catenary system, for example the block catenary system of mechanism, alliance is characterized for one, Other destination nodes can be a destination node for characterizing ally in the mechanism, alliance.
It should be noted that can cancel after new node is synchronized to certain or newest block data as new node Other specified destination nodes, allow new node using the destination node with access authority any in block catenary system as Second node, to restore normal data synchronization process.
In addition, it is to be understood that first node, which is likely to become, has new node with the progress of data synchronization process The node of access authority, such as in the case where first node is legal destination node, the new node process synchronous in data In get the corresponding authority information of the first node after, which, which then becomes, has access authority for new node Node.In such cases, new node can synchronize block counts from the first node by method of data synchronization in the related technology According to for example, new node can verify the first node by Merkle tree (Merkel tree), cryptographic Hash or hash chain inspection Data validity after, from the first node synchrodata, which is not described herein again for detailed process.
Below with a complete example, the method for data synchronization of the embodiment of the present disclosure is illustrated.
It include two original node A and B in the license block catenary system referring to Fig. 2, three destination node C accessed, D and E, and prepare to access new node G, F and H of the license block catenary system.Also, new node G, F and H match in access authority It postpones, establishes connection with the interdependent node in the license block catenary system respectively.
The access authority for having new node G due to originating node A, new node G can establish two-way with original node A Connection (with the signal of double-head arrow connecting line in figure), and destination node D and E do not have the access authority of new node G, therefore press this public affairs The method of data synchronization of embodiment is opened, new node G can establish limited connection (with single arrow in figure with destination node D and E respectively Connecting line signal).
In data synchronization process, new node G first passes through original node A and verifies to the data of destination node D and E, Specific verification process is being described above, and which is not described herein again.After being verified, new node G from destination node D and E synchrodata.Same mode, new node F can verify the data of destination node C and E by original node B.When After being verified, new node F is from destination node C and E synchrodata.
The license block chain can first be specified since it does not connect with original node A and B directly for new node H Either objective node in network is that second node carries out data synchronization process.Such as, it is possible to specify destination node D is the second section Point, then using destination node C as first node, by the method for data synchronization of the embodiment of the present disclosure from the same step number of destination node C According to arrive new node.
It should be understood that the synchronous process of the data of the embodiment of the present disclosure can in order to further increase data synchronization efficiency Concurrently to execute, i.e., new node can carry out data synchronization process to the data of multiple destination nodes request different batches simultaneously. For example, referring to Fig. 2, new node G can carry out data synchronization process from the data of destination node D and E request different batches simultaneously, For example, new node G can request the block head that number is 1-100 to carry out above-mentioned data synchronization process from destination node D, simultaneously also The block head that number is 101-200 can be requested to carry out above-mentioned data synchronization process from destination node E.
Based on the same inventive concept, the disclosure also provides a kind of data synchronization unit, can be applied in block catenary system The new node of block chain data to be synchronized.Referring to Fig. 3, which includes:
First obtain module 301, for the new node from the first node in the block catenary system obtain this first The multiple continuous block heads for the block chain that node is locally stored, wherein the first node is in the block catenary system There is no the node of access authority to the new node;
Second obtains module 302, for the mark according to the block head, obtains second node local from second node With multiple continuous block heads of like-identified in the block chain of storage, the second node is in the block catenary system There is the node of access authority to the new node;
Comparison module 303, block head for will be obtained from the first node with from the area that the second node obtains Build is compared;
Synchronization module 304, for when the block head that be obtained from the first node with from the area of second node acquisition When build compares consistent, the corresponding block data of the multiple continuous block head is synchronized to the new section from the first node Point.
Optionally, the cryptographic Hash of multiple block heads of the comparison module 303 for that will be obtained from the first node and The cryptographic Hash of the multiple block heads obtained from the second node is compared;
The synchronization module 304 is used for when the cryptographic Hash of multiple block heads that obtains from the first node and from described the When the cryptographic Hash for multiple block heads that two nodes obtain is identical, the multiple continuous block head pair is synchronized from the first node The block data answered is to the new node.
Optionally, the comparison module 303 is used for:
According to the cryptographic Hash of each block head from multiple continuous block heads that the first node obtains, first is determined Cryptographic Hash;
The second cryptographic Hash is obtained, second cryptographic Hash is the multiple companies obtained according to the new node from the second node The cryptographic Hash of each block head carries out what Hash calculation obtained in continuous block head;
First cryptographic Hash is compared with second cryptographic Hash.
Optionally, the comparison module 303 is used for:
Determine the corresponding cryptographic Hash of N+2 block head from multiple block heads that the first node obtains, wherein The N+2 block head includes first block head, the last one block head and described first in the multiple block head N number of block head between a block head and the last one described block head, N is positive integer;
Determine the N+ from multiple block heads that the second node obtains with the N+2 block head with like-identified The corresponding cryptographic Hash of 2 block heads;
By the corresponding cryptographic Hash one of N+2 block head of the N+2 block head and the second node of the first node One is compared.
Optionally, described first module 301 is obtained for multiple batches of from first node acquisition block head, and to each The block head addition that batch obtains does not compare label, wherein each batch obtains multiple continuous block heads;
It is described according to second acquisition module 302 for determine the second node be in can connection status, judge from described In the multiple batches of block head that first node obtains, if exist with the batch for not comparing label, and there is institute when existing When stating the batch for not comparing label, according to the mark of the block head of the batch, the second node is obtained from second node and is locally deposited With multiple continuous block heads of like-identified in the block chain of storage;
The comparison module 303 be used for will have the block head of the batch for not comparing label with from second section After the corresponding block head that point obtains is compared, that deletes the block head of the batch does not compare label.
Optionally, described device 300 further include:
Authentication module, for verifying the validity of the multiple continuous block heads obtained from the first node;
Described second, which obtains module 302, is used for when validation verification success, according to the mark of the block head, from The second node obtains multiple continuous block heads in the block chain that the second node is locally stored with like-identified.
About the device in above-described embodiment, wherein modules execute the concrete mode of operation in related this method Embodiment in be described in detail, no detailed explanation will be given here.
By any of the above-described data synchronization unit, the new node being added in license block catenary system can be from the license block There is no the synchronous block data of first node of access authority to new node in catenary system, scheme compared to the prior art, this public affairs The method of data synchronization opened can mitigate the pressure of original node, accelerate data synchronization efficiency.Also, in the synchronous process of data In, it can be by having the data of the second node verifying first node of access authority in the license block catenary system to new node Validity, to ensure that the Information Security in data synchronization process.
Based on the same inventive concept, the embodiment of the present disclosure also provides a kind of electronic equipment, comprising:
Memory is stored thereon with computer program;
Processor, for executing the computer program in the memory, to realize that any of the above-described item data is synchronous The step of method.
In a kind of possible mode, the block diagram of the electronic equipment can be as shown in Figure 4.Referring to Fig. 4, the electronic equipment 400 may include: processor 401, memory 402.The electronic equipment 400 can also include multimedia component 403, input/defeated One or more of (I/O) interface 404 and communication component 405 out.
Wherein, processor 401 is used to control the integrated operation of the electronic equipment 400, to complete the above-mentioned data side of synchronization All or part of the steps in method.Memory 402 is for storing various types of data to support the behaviour in the electronic equipment 400 To make, these data for example may include the instruction of any application or method for operating on the electronic equipment 400, with And the relevant data of application program, such as the authority information of node, block data etc..The memory 402 can be by any class The volatibility or non-volatile memory device or their combination of type are realized, such as static random access memory (Static Random Access Memory, abbreviation SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, abbreviation EEPROM), Erasable Programmable Read Only Memory EPROM (Erasable Programmable Read-Only Memory, abbreviation EPROM), programmable read only memory (Programmable Read- Only Memory, abbreviation PROM), read-only memory (Read-Only Memory, abbreviation ROM), magnetic memory, flash Device, disk or CD.
Multimedia component 403 may include screen and audio component.Wherein screen for example can be touch screen, audio component For output and/or input audio signal.For example, audio component may include a microphone, microphone is for receiving outside Audio signal.The received audio signal can be further stored in memory 402 or be sent by communication component 405.Sound Frequency component further includes at least one loudspeaker, is used for output audio signal.
I/O interface 404 provides interface between processor 401 and other interface modules, other above-mentioned interface modules can be with It is keyboard, mouse, button etc..These buttons can be virtual push button or entity button.Communication component 405 is set for the electronics Wired or wireless communication is carried out between standby 400 and other equipment.Wireless communication, such as Wi-Fi, bluetooth, near-field communication (Near Field Communication, abbreviation NFC), 2G, 3G, 4G, NB-IOT, eMTC or other 5G etc. or they one of Or several combinations, it is not limited here.Therefore the corresponding communication component 407 may include: Wi-Fi module, bluetooth module, NFC module etc..
In one exemplary embodiment, electronic equipment 400 can be by one or more application specific integrated circuit (Application Specific Integrated Circuit, abbreviation ASIC), digital signal processor (Digital Signal Processor, abbreviation DSP), digital signal processing appts (Digital Signal Processing Device, Abbreviation DSPD), programmable logic device (Programmable Logic Device, abbreviation PLD), field programmable gate array (Field Programmable Gate Array, abbreviation FPGA), controller, microcontroller, microprocessor or other electronics member Part is realized, for executing above-mentioned method of data synchronization.
In a further exemplary embodiment, a kind of computer readable storage medium including program instruction is additionally provided, it should The step of above-mentioned method of data synchronization is realized when program instruction is executed by processor.For example, the computer readable storage medium It can be the above-mentioned memory 402 including program instruction, above procedure instruction can be executed by the processor 401 of electronic equipment 400 To complete above-mentioned method of data synchronization.
The preferred embodiment of the disclosure is described in detail in conjunction with attached drawing above, still, the disclosure is not limited to above-mentioned reality The detail in mode is applied, in the range of the technology design of the disclosure, a variety of letters can be carried out to the technical solution of the disclosure Monotropic type, these simple variants belong to the protection scope of the disclosure.
It is further to note that specific technical features described in the above specific embodiments, in not lance In the case where shield, can be combined in any appropriate way, in order to avoid unnecessary repetition, the disclosure to it is various can No further explanation will be given for the combination of energy.
In addition, any combination can also be carried out between a variety of different embodiments of the disclosure, as long as it is without prejudice to originally Disclosed thought equally should be considered as disclosure disclosure of that.

Claims (10)

1. a kind of method of data synchronization, which is characterized in that the method is applied to block chain data to be synchronized in block catenary system New node, which comprises
The new node obtains the more of block chain that the first node is locally stored from the first node in the block catenary system A continuous block head, wherein the first node is that do not have access authority to the new node in the block catenary system Node;
According to the mark of the block head, obtaining from second node has identical mark in the block chain that the second node is locally stored The multiple continuous block heads known, the second node are that have access authority to the new node in the block catenary system Node;
The block head obtained from the first node is compared with the block head obtained from the second node;
If the block head obtained from the first node compares unanimously with the block head obtained from the second node, from institute It states first node and synchronizes the corresponding block data of the multiple continuous block head to the new node.
2. the method according to claim 1, wherein it is described by the block head obtained from the first node with from The block head that the second node obtains is compared, comprising:
By the cryptographic Hash of the multiple continuous block heads obtained from the first node with obtained from the second node it is multiple The cryptographic Hash of continuous block head is compared;
If the block head obtained from the first node compares unanimously with the block head obtained from the second node, The corresponding block data of the multiple continuous block head is synchronized to the new node from the first node, comprising:
If obtained from the cryptographic Hash of multiple continuous block heads of first node acquisition and from the second node more The cryptographic Hash of a continuous block head is identical, then synchronizes the corresponding block of the multiple continuous block head from the first node Data are to the new node.
3. according to the method described in claim 2, it is characterized in that, described multiple continuous by what is obtained from the first node The cryptographic Hash of block head is compared with the cryptographic Hash of the multiple continuous block heads obtained from the second node, comprising:
Hash calculation is carried out to the cryptographic Hash of each block head from multiple continuous block heads that the first node obtains, is obtained To the first cryptographic Hash;
Obtain the second cryptographic Hash, second cryptographic Hash be obtained according to the new node from the second node it is multiple continuous Block head in the cryptographic Hash of each block head carry out Hash calculation and obtain;
First cryptographic Hash is compared with second cryptographic Hash.
4. according to the method described in claim 2, it is characterized in that, described multiple continuous by what is obtained from the first node The cryptographic Hash of block head is compared with the cryptographic Hash of the multiple continuous block heads obtained from the second node, comprising:
Determine the corresponding cryptographic Hash of N+2 block head from multiple continuous block heads that first node obtains, wherein N+ 2 block heads include from first node obtain multiple continuous block heads in first block head, the last one block head, And N number of block head between first block head and the last one block head, N is positive integer;
Determine the N+2 from multiple continuous block heads that second node obtains with the N+2 block head with like-identified The corresponding cryptographic Hash of a block head;
By the corresponding cryptographic Hash of N+2 block head of the N+2 block head and the second node of the first node one by one into Row compares.
5. method according to claim 1 to 4, which is characterized in that the new node is from the block catenary system First node obtains the multiple continuous block heads for the block chain that the first node is locally stored, comprising:
It is multiple batches of to obtain block head from the first node, and label is not compared to the block head addition that each batch obtains, In, each batch obtains multiple continuous block heads;
The mark according to the block head, obtaining from second node has phase in the block chain that the second node is locally stored With multiple continuous block heads of mark, comprising:
Determine the second node be in can connection status;
Judge from the multiple batches of block head that the first node obtains, if exist with the batch for not comparing label;
There is the batch for not comparing label if it exists, then according to the mark of the block head of the batch, obtained from second node With multiple continuous block heads of like-identified in the block chain that the second node is locally stored;
The described block head obtained from the first node is compared with the block head obtained from the second node include:
Will have the block head of the batch for not comparing label and the corresponding block head that is obtained from the second node into After row compares, that deletes the block head of the batch does not compare label.
6. method according to claim 1 to 4, which is characterized in that the method also includes:
Verify the validity of the multiple continuous block heads obtained from the first node;
The mark according to the block head, obtaining from second node has phase in the block chain that the second node is locally stored With multiple continuous block heads of mark, comprising:
If the validation verification success, according to the mark of the block head, obtains second section from the second node With multiple continuous block heads of like-identified in the block chain that point is locally stored.
7. a kind of data synchronization unit, which is characterized in that described device is applied to block chain data to be synchronized in block catenary system New node, described device includes:
First obtains module, obtains first node local from the first node in the block catenary system for the new node Multiple continuous block heads of the block chain of storage, wherein the first node is in the block catenary system to described new Node does not have the node of access authority;
Second acquisition module obtains what the second node was locally stored from second node for the mark according to the block head With multiple continuous block heads of like-identified in block chain, the second node is in the block catenary system to described New node has the node of access authority;
Comparison module, the block head for will obtain from the first node are carried out with the block head obtained from the second node It compares;
Synchronization module, for being compared when the block head obtained from the first node with the block head obtained from the second node When consistent, the corresponding block data of the multiple continuous block head is synchronized to the new node from the first node.
8. device according to claim 7, which is characterized in that the comparison module from the first node for that will obtain The cryptographic Hash of multiple block heads be compared with the cryptographic Hash of the multiple block heads obtained from the second node;
The synchronization module is used for when the cryptographic Hash of multiple block heads that obtains from the first node and from the second node When the cryptographic Hash of the multiple block heads obtained is identical, the corresponding area of the multiple continuous block head is synchronized from the first node Block number evidence arrives the new node.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor The step of any one of claim 1-6 the method is realized when row.
10. a kind of electronic equipment characterized by comprising
Memory is stored thereon with computer program;
Processor, for executing the computer program in the memory, to realize described in any one of claim 1-6 The step of method.
CN201910239276.8A 2019-03-27 2019-03-27 Data synchronization method and device, storage medium and electronic equipment Active CN110059089B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910239276.8A CN110059089B (en) 2019-03-27 2019-03-27 Data synchronization method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910239276.8A CN110059089B (en) 2019-03-27 2019-03-27 Data synchronization method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN110059089A true CN110059089A (en) 2019-07-26
CN110059089B CN110059089B (en) 2021-01-22

Family

ID=67317433

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910239276.8A Active CN110059089B (en) 2019-03-27 2019-03-27 Data synchronization method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN110059089B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572473A (en) * 2019-09-20 2019-12-13 腾讯科技(深圳)有限公司 Block header synchronization method, equipment and computer readable storage medium
CN111431867A (en) * 2020-03-06 2020-07-17 杭州云象网络技术有限公司 Node access method based on block chain BaaS platform
CN111444206A (en) * 2020-03-24 2020-07-24 腾讯科技(深圳)有限公司 Synchronous processing method, device, equipment and medium
CN111581289A (en) * 2020-05-08 2020-08-25 西安华域网络文化发展有限公司 Data management method, system, device and medium for double-end block chain
CN111756829A (en) * 2020-06-19 2020-10-09 深圳市蔚链科技有限公司 Account book data synchronization method, device, equipment and storage medium
CN113364847A (en) * 2021-05-31 2021-09-07 新疆大学 Data synchronization method and device of block chain nodes and storage medium
WO2024114342A1 (en) * 2022-11-29 2024-06-06 蚂蚁财富(上海)金融信息服务有限公司 Data synchronization method and apparatus, storage medium and electronic device

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815330A (en) * 2016-12-29 2017-06-09 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain expanded along Spatial Dimension
CN107079058A (en) * 2016-12-23 2017-08-18 深圳前海达闼云端智能科技有限公司 The business of block chain node performs method, device and node device
CN107077674A (en) * 2016-12-29 2017-08-18 深圳前海达闼云端智能科技有限公司 Transaction verification processing method and device and node equipment
US20170346639A1 (en) * 2016-05-24 2017-11-30 Business Information Exchange System Corp. Public Key Infrastructure based on the Public Certificates Ledger
CN108615156A (en) * 2018-05-09 2018-10-02 上海魅联信息技术有限公司 A kind of data structure based on block chain
CN108984744A (en) * 2018-07-16 2018-12-11 夸克链科技(深圳)有限公司 A kind of non-master chain block self-propagation method
CN109034807A (en) * 2018-08-15 2018-12-18 杭州复杂美科技有限公司 A kind of block chain method of data synchronization
CN109088914A (en) * 2018-07-03 2018-12-25 深圳智乾区块链科技有限公司 Generation method, the block chain ecosystem and the computer readable storage medium of block
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN109213901A (en) * 2018-09-18 2019-01-15 百度在线网络技术(北京)有限公司 A kind of method of data synchronization, device, equipment and the medium of block chain
KR20190010515A (en) * 2018-11-22 2019-01-30 김경준 Management system for blockchain
CN109460405A (en) * 2018-09-27 2019-03-12 上海点融信息科技有限责任公司 For the block generation method of block chain network, synchronous method, storage medium, calculate equipment
CN109491996A (en) * 2018-09-27 2019-03-19 上海点融信息科技有限责任公司 For the block generation method of block chain network, block data access method, calculate equipment, storage medium
CN109542888A (en) * 2018-12-03 2019-03-29 百度在线网络技术(北京)有限公司 The data modification and synchronous method of block chain, device, equipment and storage medium
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage
CN110737664A (en) * 2019-10-21 2020-01-31 深圳前海微众银行股份有限公司 block link point synchronization method and device

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170346639A1 (en) * 2016-05-24 2017-11-30 Business Information Exchange System Corp. Public Key Infrastructure based on the Public Certificates Ledger
CN107079058A (en) * 2016-12-23 2017-08-18 深圳前海达闼云端智能科技有限公司 The business of block chain node performs method, device and node device
CN106815330A (en) * 2016-12-29 2017-06-09 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain expanded along Spatial Dimension
CN107077674A (en) * 2016-12-29 2017-08-18 深圳前海达闼云端智能科技有限公司 Transaction verification processing method and device and node equipment
CN108615156A (en) * 2018-05-09 2018-10-02 上海魅联信息技术有限公司 A kind of data structure based on block chain
CN109088914A (en) * 2018-07-03 2018-12-25 深圳智乾区块链科技有限公司 Generation method, the block chain ecosystem and the computer readable storage medium of block
CN108984744A (en) * 2018-07-16 2018-12-11 夸克链科技(深圳)有限公司 A kind of non-master chain block self-propagation method
CN109034807A (en) * 2018-08-15 2018-12-18 杭州复杂美科技有限公司 A kind of block chain method of data synchronization
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN109213901A (en) * 2018-09-18 2019-01-15 百度在线网络技术(北京)有限公司 A kind of method of data synchronization, device, equipment and the medium of block chain
CN109460405A (en) * 2018-09-27 2019-03-12 上海点融信息科技有限责任公司 For the block generation method of block chain network, synchronous method, storage medium, calculate equipment
CN109491996A (en) * 2018-09-27 2019-03-19 上海点融信息科技有限责任公司 For the block generation method of block chain network, block data access method, calculate equipment, storage medium
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage
KR20190010515A (en) * 2018-11-22 2019-01-30 김경준 Management system for blockchain
CN109542888A (en) * 2018-12-03 2019-03-29 百度在线网络技术(北京)有限公司 The data modification and synchronous method of block chain, device, equipment and storage medium
CN110737664A (en) * 2019-10-21 2020-01-31 深圳前海微众银行股份有限公司 block link point synchronization method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张婷: ""基于区块链技术的数字资产确权交易模型研究"", 《福建工程学院学报》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572473A (en) * 2019-09-20 2019-12-13 腾讯科技(深圳)有限公司 Block header synchronization method, equipment and computer readable storage medium
CN111431867A (en) * 2020-03-06 2020-07-17 杭州云象网络技术有限公司 Node access method based on block chain BaaS platform
CN111431867B (en) * 2020-03-06 2022-04-08 杭州云象网络技术有限公司 Node access method based on block chain BaaS platform
CN111444206A (en) * 2020-03-24 2020-07-24 腾讯科技(深圳)有限公司 Synchronous processing method, device, equipment and medium
CN111444206B (en) * 2020-03-24 2021-10-15 腾讯科技(深圳)有限公司 Synchronous processing method, device, equipment and medium
CN111581289A (en) * 2020-05-08 2020-08-25 西安华域网络文化发展有限公司 Data management method, system, device and medium for double-end block chain
CN111581289B (en) * 2020-05-08 2024-03-22 西安华域网络文化发展有限公司 Data management method, system, device and medium for double-head block chain
CN111756829A (en) * 2020-06-19 2020-10-09 深圳市蔚链科技有限公司 Account book data synchronization method, device, equipment and storage medium
CN113364847A (en) * 2021-05-31 2021-09-07 新疆大学 Data synchronization method and device of block chain nodes and storage medium
CN113364847B (en) * 2021-05-31 2022-07-19 新疆大学 Data synchronization method and device of block chain nodes and storage medium
WO2024114342A1 (en) * 2022-11-29 2024-06-06 蚂蚁财富(上海)金融信息服务有限公司 Data synchronization method and apparatus, storage medium and electronic device

Also Published As

Publication number Publication date
CN110059089B (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN110059089A (en) Data synchronization method and device, storage medium and electronic equipment
AU2019204735B2 (en) Field-programmable gate array based trusted execution environment for use in a blockchain network
CN111275857B (en) Control method of intelligent lock and intelligent lock
CN104537293B (en) Authenticating device and system
US8464347B2 (en) Software updating apparatus, software updating system, alteration verification method and alteration verification program
CN104991526B (en) Industrial control system safety supports framework and its Security Data Transmission and storage method
CN107395557A (en) A kind of processing method and processing device of service request
CN110019235A (en) Data storage, restoration methods, device, equipment and medium based on block chain
CN112822181A (en) Verification method of cross-chain transaction, terminal device and readable storage medium
JP6230322B2 (en) Communication apparatus, key sharing method, program, and communication system
CN101573936A (en) Digital rights management using trusted processing techniques
CN106060796A (en) Method and device for destroying backups of terminal
CN110598375B (en) Data processing method, device and storage medium
CN105099705B (en) A kind of safety communicating method and its system based on usb protocol
CN101640589A (en) Method and device for sharing license between safe and removable media
CN110647759B (en) Data recording method, node, device, storage medium and block chain system
CN114372296A (en) Block chain-based user behavior data auditing method and system
CN102272770A (en) Tampering monitoring system, control device, and tampering control method
CN111371588A (en) SDN edge computing network system based on block chain encryption, encryption method and medium
CN102246535B (en) Method, apparatus and system for employing a secure content protection system
CN112131041A (en) Method, apparatus and computer program product for managing data placement
CN110148441A (en) A kind of clinical test electronic data acquisition management method and device based on block chain
JP2009278397A (en) Communication device, roadside device, onboard unit, communication method, and communication program
CN115964730A (en) Block chain information storage method based on alliance chain multi-chain
JP2008004065A (en) Semiconductor device, electronic equipment, equipment authentication program

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
TR01 Transfer of patent right

Effective date of registration: 20210303

Address after: 201111 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Patentee after: Dalu Robot Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Patentee before: Shenzhen Qianhaida Yunyun Intelligent Technology Co.,Ltd.

TR01 Transfer of patent right
CP03 Change of name, title or address

Address after: 201111 Building 8, No. 207, Zhongqing Road, Minhang District, Shanghai

Patentee after: Dayu robot Co.,Ltd.

Address before: 201111 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Patentee before: Dalu Robot Co.,Ltd.

CP03 Change of name, title or address