CN109446273B - Data synchronization method and device of block chain, computer equipment and storage medium - Google Patents

Data synchronization method and device of block chain, computer equipment and storage medium Download PDF

Info

Publication number
CN109446273B
CN109446273B CN201811472522.6A CN201811472522A CN109446273B CN 109446273 B CN109446273 B CN 109446273B CN 201811472522 A CN201811472522 A CN 201811472522A CN 109446273 B CN109446273 B CN 109446273B
Authority
CN
China
Prior art keywords
data
message
node
local
service 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.)
Active
Application number
CN201811472522.6A
Other languages
Chinese (zh)
Other versions
CN109446273A (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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN201811472522.6A priority Critical patent/CN109446273B/en
Publication of CN109446273A publication Critical patent/CN109446273A/en
Application granted granted Critical
Publication of CN109446273B publication Critical patent/CN109446273B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/602Providing cryptographic facilities or services

Abstract

The invention relates to a data synchronization method, a device, computer equipment and a storage medium of a block chain, wherein the method comprises the steps of synchronizing service data needing to be linked to the local of each node by adopting a consensus algorithm; acquiring the block height; judging whether the block height changes; if yes, a message is issued to the central node; regularly pulling a node subscription message from a message center; decrypting the node subscription message to obtain the downlink service data; and synchronizing the downlink service data to the local. The invention synchronizes the data blocks needing to be chained to the local account book of the node through the consensus algorithm, and synchronizes the business data under the chain to the local database of the node through the unified message interaction API, and adopts different synchronization modes aiming at different data, so that the data synchronization can be carried out in multiple message types, synchronously or asynchronously, the data synchronization requirements suitable for the massive data among the nodes in the block chain and the high-concurrency business scene are realized, and the effects of rapidness, high efficiency, high throughput and high fault tolerance are achieved.

Description

Data synchronization method and device of block chain, computer equipment and storage medium
Technical Field
The present invention relates to a data processing method, and more particularly, to a data synchronization method and apparatus for a block chain, a computer device, and a storage medium.
Background
Due to the decentralized characteristic in the application scene of the block chain, multiple copies of data on the chain need to be circulated among nodes to achieve consensus, so that the consensus algorithm needs bidirectional data synchronization among the nodes.
In the working process of the block chain, data synchronization among a plurality of nodes is massive data synchronization, the synchronization speed is required to be high, the synchronization data volume is required to be large, and the existing consensus data volume and real-time performance can not meet the requirements of massive data and high-concurrency service scenes of the internet.
Therefore, it is necessary to design a new method to meet the requirements of massive data among nodes in a block chain and data synchronization under a high-concurrency service scenario, so as to achieve the effects of high speed, high efficiency, high throughput, and high fault tolerance.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a data synchronization method and device of a block chain, computer equipment and a storage medium.
In order to realize the purpose, the invention adopts the following technical scheme: the data synchronization method of the block chain comprises the following steps:
synchronizing the service data needing to be linked up to the local of each node by adopting a consensus algorithm;
acquiring the block height;
judging whether the block height changes;
if yes, a message is issued to the central node;
regularly pulling a node subscription message from a message center;
decrypting the node subscription message to obtain the downlink service data;
and synchronizing the downlink service data to the local.
The further technical scheme is as follows: the method for synchronizing the service data needing to be linked to the local of each node by adopting the consensus algorithm comprises the following steps:
acquiring service data needing to uplink;
encrypting and chaining service data needing to be chained;
and synchronizing the uplink service data to each local node through the block chain common identification network.
The further technical scheme is as follows: before the message is issued to the central node, the method further comprises:
and caching the uplink service data to a relational database and a file system according to the node synchronization rule.
The further technical scheme is as follows: the timing node subscription message is pulled from the message center, and the method comprises the following steps:
and regularly pulling the subscription message from the message center to the local node through the message service http interface, and calling back the stored data of the message monitoring interface of the node.
The further technical scheme is as follows: after the downlink service data are synchronized to the local, the method further comprises the following steps:
acquiring message monitoring conditions;
judging whether the message monitoring is successful;
if yes, updating the monitored message consumption progress;
if not, consuming in a timing retry mode to form a message consumption execution result;
and encrypting and uplink-linking the message consumption execution result.
The further technical scheme is as follows: the method further comprises the following steps:
acquiring heartbeat messages sent by member nodes at fixed time;
and acquiring the survival and running conditions of the member nodes according to the heartbeat message.
The further technical scheme is as follows: the method further comprises the following steps:
and acquiring and analyzing service data needing to be uplinked and downlink service data, and performing early warning and monitoring according to a service configuration threshold.
The invention also provides a data synchronization device of the block chain, which comprises:
the uplink synchronization unit is used for synchronizing the service data needing uplink to the local of each node by adopting a consensus algorithm;
a height acquisition unit for acquiring a block height;
the height judging unit is used for judging whether the height of the block is changed or not;
the issuing unit is used for issuing the message to the central node if the central node is the master node;
the pull-back unit is used for pulling the node subscription message from the message center at regular time;
the decryption unit is used for decrypting the node subscription message to obtain the downlink service data;
and the downlink synchronization unit is used for synchronizing the downlink service data to the local.
The invention also provides a computer device, which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor executes the computer program to realize the method.
The invention also provides a storage medium storing a computer program which, when executed by a processor, is operable to carry out the method as described above.
Compared with the prior art, the invention has the beneficial effects that: the invention synchronizes the data blocks needing to be chained to the local account book of the node through the consensus algorithm, drives the business data under the chain to be synchronized to the local database of the node through the unified message interaction API, adopts different synchronization modes aiming at different data, can carry out data synchronization in multiple message types, synchronization or asynchronization, realizes the data synchronization requirements suitable for massive data among nodes in the block chain and under a high-concurrency business scene, and achieves the effects of rapidness, high efficiency, high throughput and high fault tolerance.
The invention is further described below with reference to the accompanying drawings and specific embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a data synchronization method for a block chain according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data synchronization method for a block chain according to an embodiment of the present invention;
fig. 3 is a sub-flowchart of a data synchronization method for a block chain according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a data synchronization method for a block chain according to another embodiment of the present invention;
fig. 5 is a schematic block diagram of a data synchronization apparatus for a block chain according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of an on-chain synchronization unit of a data synchronization apparatus of a block chain according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a data synchronization apparatus for a block chain according to another embodiment of the present invention;
fig. 8 is a schematic block diagram of a computer device provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view illustrating an application scenario of a data synchronization method for a block chain according to an embodiment of the present invention. Fig. 2 is a schematic flowchart of a data synchronization method for a block chain according to an embodiment of the present invention. The data synchronization method of the block chain is applied to a server and used for synchronizing data of each node in the server.
Fig. 2 is a schematic flowchart of a data synchronization method for a block chain according to an embodiment of the present invention. As shown in fig. 2, the method includes the following steps S110 to S180.
S110, adopting a consensus algorithm to synchronize the service data needing to be uplink to the local of each node.
In this embodiment, the service data requiring uplink refers to data requiring synchronization to the block chain. And synchronizing the service data needing to be linked to a local account book of the node by a consensus algorithm.
In an embodiment, as shown in fig. 3, the step S110 may include steps S111 to S113.
S111, acquiring service data needing to be linked;
s112, encrypting and chaining the business data needing to be chained;
s113, the uplink service data is synchronized to the local nodes through the block chain common-identification network.
According to the scene design, a user carries out digital signature on related business data needing to be uplink, and then encryption is carried out and an interface is called for uplink. After the uplink is carried out, the block chain between the nodes synchronizes corresponding data to the local nodes through the block chain consensus network to complete the consensus.
S120, acquiring the block height.
In this embodiment, the block height is determined by the data stored in the block, and when new data is stored in the block, the block height changes, so that the block height is obtained, and whether the block height changes is further determined, thereby determining whether data synchronization is required.
S130, judging whether the block height changes;
s140, if yes, caching the business data after uplink to a relational database and a file system according to the node synchronization rule.
The node synchronization rule refers to a principle that the data on the link is correspondingly filtered and synchronized according to the service rule, and after synchronization, a multi-dimensional query function can be provided for the outside.
And S150, issuing the message to the central node.
In this embodiment, besides the existence of data that needs to be uplinked, there are some data that does not need to be uplinked, such as json or files or images, etc., the data needs to be separated into two parts, namely, uplink and downlink, according to the application scenario, for the downlink service data, the data is driven to be synchronized to the local database of the node through the unified message interaction API, and multiple data formats (such as files, videos, etc.) are supported, so that the high throughput and high fault tolerance characteristics of the system are ensured through message persistence and final consistency.
And issuing the message to the central node to pull back the message from the central node at regular time so as to synchronize data.
The issued message refers to a communication message for acquiring the central node.
And S160, regularly pulling the node subscription message from the message center.
In this embodiment, the node subscription message refers to a communication packet with downlink service data; specifically, the subscription message is regularly pulled from the message center to the local node through the message service http interface, and the data stored in the message monitoring interface of the node is called back. And then the data can be synchronized in time and the height change condition of the block can be monitored continuously, thereby ensuring the timeliness of data synchronization.
S170, decrypting the node subscription message to obtain the downlink service data.
And S180, synchronizing the downlink service data to the local.
After the node subscription message is decrypted, corresponding down-link service data (json/file/image and the like) are pulled to the local node from the central node, and synchronization of the down-link service data is completed.
If not, the process returns to the step S120.
The data communication under the complex service scene based on the block chain is well encapsulated in a unified API message communication mode supporting the same, asynchronous, multiple message types and multiple data formats. And supports various storage modes such as databases, file systems and the like. In addition, the distributed environment final consistency realized by the message persistence characteristic supports the interface idempotent repeat operation. The unified API (Application Programming Interface) Interface supports the node communication requirement under a complex service scene, the node Application access cost is effectively reduced, the development complexity is greatly reduced, meanwhile, the block chain fault-tolerant mechanism is greatly improved due to the persistence characteristic and the transaction characteristic based on the message height, in addition, the high throughput of the system is ensured due to the extremely low communication consumption, and the data interaction problem under a massive high-concurrency scene based on the block chain is effectively solved.
According to the data synchronization method of the block chain, the data blocks needing to be chained are synchronized to the local account book of the node through the consensus algorithm, the business data under the chain are driven to be synchronized to the local database of the node through the unified message interaction API, different synchronization modes are adopted for different data, data synchronization can be carried out in multiple message types, synchronously or asynchronously, the data synchronization requirements suitable for massive data among the nodes in the block chain and under a high-concurrency business scene are met, and the effects of rapidness, high efficiency, high throughput and high fault tolerance are achieved.
Fig. 4 is a flowchart illustrating a data synchronization method for a block chain according to another embodiment of the present invention. As shown in fig. 4, the data synchronization method of the block chain of the present embodiment includes steps S210 to S270. Steps S210 to S280 are similar to steps S110 to S180 in the above embodiment, and are not described herein again. The added steps S290-S294 in the present embodiment are explained in detail below.
S290, acquiring message monitoring conditions;
s291, judging whether the message monitoring is successful;
s292, if yes, updating the monitored message consumption progress;
s293, if not, consuming in a timing retry mode to form a message consumption execution result;
s294, encrypting the message consumption execution result and uplink.
Calling a service interface for message monitoring, updating the message consumption progress if the monitoring is successful or not according to the success of the monitoring, otherwise, consuming in a timing retry mode to achieve final consistency so as to obtain a final consistent message consumption execution result, namely a formula of each node, and encrypting and chaining the corresponding message consumption execution result to complete service closed loop.
In addition, the method further comprises:
acquiring a heartbeat message sent by a member node at fixed time;
and acquiring the survival and running conditions of the member nodes according to the heartbeat message.
The member nodes send heartbeat messages to the central node monitoring center at regular time, and the monitoring service judges node survival and operation conditions through the collected heartbeat messages so as to ensure the operation stability of the whole system.
In addition, the method further comprises:
and acquiring and analyzing service data needing to be uplinked and downlink service data, and performing early warning and monitoring according to a service configuration threshold.
The amount of the service data is controlled, and the stable operation of the system can be effectively ensured.
Of course, the above-mentioned three other embodiments can be combined with the first embodiment to form a new embodiment.
Fig. 5 is a schematic block diagram of a data synchronization apparatus 300 for a blockchain according to an embodiment of the present invention. As shown in fig. 5, the present invention further provides a data synchronization apparatus 300 for a blockchain corresponding to the above data synchronization method for a blockchain. The data synchronization apparatus 300 of the blockchain includes a unit for performing the above data synchronization method of the blockchain, and the apparatus may be configured in a server.
Specifically, referring to fig. 5, the data synchronization apparatus 300 of the blockchain includes:
a link synchronization unit 301, configured to synchronize service data to be linked to the local of each node by using a consensus algorithm;
a height acquisition unit 302 for acquiring a block height;
a height determining unit 303, configured to determine whether the block height changes;
an issuing unit 305, configured to issue a message to the central node if yes;
a pull-back unit 306, configured to pull the node subscription message from the message center at regular time;
a decryption unit 307, configured to decrypt the node subscription message to obtain downlink service data;
and the downlink synchronization unit 308 is configured to synchronize the downlink service data to the local.
In an embodiment, the apparatus further includes:
a node synchronization unit 304, configured to cache the uplink service data to a relational database and a file system according to the node synchronization rule.
In one embodiment, as shown in fig. 6, the on-chain synchronization unit 301 includes:
a data obtaining subunit 3011, configured to obtain service data that needs to be uplink;
an uplink subunit 3012, configured to encrypt and uplink service data that needs to be uplink;
the consensus synchronization subunit 3013 is configured to synchronize the uplink service data to the local nodes via the block chain consensus network.
Fig. 7 is a schematic block diagram of a data synchronization apparatus 300 for a block chain according to another embodiment of the present invention. As shown in fig. 7, the data synchronization apparatus 300 of the block chain according to the present embodiment is added with a snoop situation acquiring unit 309, a snoop determining unit 310, an updating unit 311, a timing retry unit 312, and a result uplink unit 313 in addition to the above embodiments.
A monitoring condition obtaining unit 309, configured to obtain a message monitoring condition;
a monitoring judging unit 310, configured to judge whether message monitoring is successful;
an updating unit 311, configured to update the monitored message consumption progress if the monitored message consumption progress is positive;
a timing retry unit 312, configured to consume in a timing retry manner if the message consumption is not the same as the message consumption execution result;
a result uplink unit 313 for encrypting and uplink the message consumption execution result.
In addition, the apparatus further comprises:
the message acquisition unit is used for acquiring heartbeat messages sent by member nodes at regular time;
and the status acquisition unit is used for acquiring the survival and running status of the member node according to the heartbeat message.
In addition, the apparatus further comprises:
and a monitoring unit 316, configured to collect and analyze service data that needs to be uplinked and downlink service data, and perform early warning and monitoring according to a service configuration threshold.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation process of the data synchronization apparatus 300 and each unit of the block chain may refer to the corresponding description in the foregoing method embodiment, and for convenience and simplicity of description, details are not repeated here.
The data synchronization apparatus 300 of the above block chain may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 8.
Referring to fig. 8, fig. 8 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a server, wherein the server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 8, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer programs 5032 include program instructions that, when executed, cause the processor 502 to perform a method of data synchronization for a blockchain.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to perform a block-chain data synchronization method.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 8 is a block diagram of only a portion of the configuration relevant to the present teachings and does not constitute a limitation on the computer device 500 to which the present teachings may be applied, and that a particular computer device 500 may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps:
synchronizing the service data needing to be linked to the local of each node by adopting a consensus algorithm;
acquiring the block height;
judging whether the block height changes or not;
if yes, issuing a message to the central node;
regularly pulling a node subscription message from a message center;
decrypting the node subscription message to obtain the downlink service data;
and synchronizing the downlink service data to the local.
In an embodiment, when the step of synchronizing the service data to be uplink to each node local by using the consensus algorithm is implemented, the processor 502 specifically implements the following steps:
acquiring service data needing to uplink;
encrypting and chaining service data needing to be chained;
and synchronizing the uplink service data to the local of each node through the block chain common identification network.
In an embodiment, before the step of issuing the message to the central node, the processor 502 further implements the following steps:
and caching the uplink service data to a relational database and a file system according to the node synchronization rule.
In an embodiment, when the processor 502 implements the step of pulling back the message from the central node at a certain timing, the following steps are specifically implemented:
and regularly pulling the subscription message from the message center to the local node through the message service http interface, and calling back the stored data of the message monitoring interface of the node.
In an embodiment, after the step of synchronizing the pair of downlink traffic data to the local location is implemented, the processor 502 further implements the following steps:
acquiring a message monitoring condition;
judging whether the message monitoring is successful;
if yes, updating the monitored message consumption progress;
if not, consuming in a timing retry mode to form a message consumption execution result;
and encrypting and uplink-linking the message consumption execution result.
In one embodiment, when the processor 502 implements the above steps, it further implements the following steps:
acquiring a heartbeat message sent by a member node at fixed time;
and acquiring the survival and running conditions of the member nodes according to the heartbeat message.
In an embodiment, when the processor 502 implements the above steps, it further implements the following steps:
and acquiring and analyzing the service data needing to be uplinked and the downlink service data, and performing early warning and monitoring according to the service configuration threshold.
It should be understood that, in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing relevant hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program, when executed by a processor, causes the processor to perform the steps of:
synchronizing the service data needing to be linked to the local of each node by adopting a consensus algorithm;
acquiring the block height;
judging whether the block height changes;
if yes, a message is issued to the central node;
regularly pulling a node subscription message from a message center;
decrypting the node subscription message to obtain the downlink service data;
and synchronizing the downlink service data to the local.
In an embodiment, when the processor executes the computer program to implement the step of synchronizing the service data to be uplinked to the local node by using the consensus algorithm, the following steps are specifically implemented:
acquiring service data needing to uplink;
encrypting and chaining service data needing to be chained;
and synchronizing the uplink service data to the local of each node through the block chain common identification network.
In one embodiment, before the step of issuing the message to the central node is performed by the processor executing the computer program, the following step is further performed:
and caching the uplink service data to a relational database and a file system according to the node synchronization rule.
In an embodiment, when the processor executes the computer program to implement the step of regularly pulling a node from a message center to subscribe to a message, the following steps are specifically implemented:
and regularly pulling the subscription message from the message center to the local node through the message service http interface, and calling back the stored data of the message monitoring interface of the node.
In an embodiment, after the processor executes the computer program to implement the synchronizing of the pair of downlink traffic data to the local step, the processor further implements the following steps:
acquiring message monitoring conditions;
judging whether the message monitoring is successful;
if yes, updating the monitored message consumption progress;
if not, consuming in a timing retry mode to form a message consumption execution result;
and encrypting and uploading the message consumption execution result.
In an embodiment, when the processor executes the computer program to realize the steps, the processor further realizes the following steps:
acquiring a heartbeat message sent by a member node at fixed time;
and acquiring the survival and running conditions of the member nodes according to the heartbeat message.
In one embodiment, when the processor executes the computer program to implement the steps, the processor further implements the steps of:
and acquiring and analyzing the service data needing to be uplinked and the downlink service data, and performing early warning and monitoring according to the service configuration threshold.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media of program codes.
Those of ordinary skill in the art will appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (7)

1. The data synchronization method of the block chain is characterized by comprising the following steps:
synchronizing the service data needing to be linked up to the local of each node by adopting a consensus algorithm;
acquiring the block height;
judging whether the block height changes or not;
if yes, a message is issued to the central node; except for data needing to be uplinked and some data needing no uplinking, the data needs to be separated into an uplink part and a downlink part according to an application scene, the data is driven to be synchronized to a node local database by the aid of a unified message interaction API (application program interface) for the downlink service data, and various data formats are supported;
regularly pulling a node subscription message from a message center; regularly pulling a subscription message from a message center to a node local through a message service http interface, and calling back the stored data of a node message monitoring interface;
decrypting the node subscription message to obtain the downlink service data;
synchronizing the downlink service data to the local;
the synchronizing the service data needing to be linked up to the local of each node by adopting the consensus algorithm comprises the following steps:
acquiring service data needing to uplink;
encrypting and chaining service data needing to be chained;
synchronously chaining the business data to each local node through a block chain consensus network;
before the issuing of the message to the central node, the method further includes:
and caching the business data after the chain linking to a relational database and a file system according to the node synchronization rule.
2. The method for data synchronization of blockchains according to claim 1, wherein after the synchronizing the downlink traffic data to local, further comprising:
acquiring a message monitoring condition;
judging whether the message monitoring is successful;
if yes, updating the monitored message consumption progress;
if not, consuming in a timing retry mode to form a message consumption execution result;
and encrypting and uplink-linking the message consumption execution result.
3. The method for data synchronization of blockchains according to claim 1, further comprising:
acquiring heartbeat messages sent by member nodes at fixed time;
and acquiring the survival and running conditions of the member nodes according to the heartbeat message.
4. The method for data synchronization of blockchains according to claim 1, further comprising:
and acquiring and analyzing service data needing to be uplinked and downlink service data, and performing early warning and monitoring according to a service configuration threshold.
5. A data synchronization apparatus for a block chain, comprising:
the uplink synchronization unit is used for synchronizing the service data needing uplink to the local of each node by adopting a consensus algorithm;
a height acquisition unit for acquiring a block height;
the height judging unit is used for judging whether the height of the block is changed or not;
the issuing unit is used for issuing the message to the central node if the central node is the master node; except for data needing to be uplinked and some data needing no uplinking, the data needs to be separated into an uplink part and a downlink part according to an application scene, the data is driven to be synchronized to a node local database by the aid of a unified message interaction API (application program interface) for the downlink service data, and various data formats are supported;
the pull-back unit is used for pulling the node subscription message from the message center at regular time; regularly pulling a subscription message from a message center to a node local through a message service http interface, and calling back data stored by a node message monitoring interface;
the decryption unit is used for decrypting the node subscription message to obtain the downlink service data;
the downlink synchronization unit is used for synchronizing downlink service data to the local;
the device further comprises:
the node synchronization unit is used for caching the business data after the chain linking to a relational database and a file system according to the node synchronization rule;
the on-chain synchronization unit includes:
a data acquisition subunit, configured to acquire service data that needs to be uplinked;
the uplink subunit is used for encrypting and uplink the service data needing uplink;
and the common identification synchronization subunit is used for synchronizing the uplink service data to the local of each node through the block chain common identification network.
6. A computer arrangement, characterized in that the computer arrangement comprises a memory, on which a computer program is stored, and a processor, which when executing the computer program, carries out the method according to any one of claims 1-4.
7. A storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 4.
CN201811472522.6A 2018-12-04 2018-12-04 Data synchronization method and device of block chain, computer equipment and storage medium Active CN109446273B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811472522.6A CN109446273B (en) 2018-12-04 2018-12-04 Data synchronization method and device of block chain, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811472522.6A CN109446273B (en) 2018-12-04 2018-12-04 Data synchronization method and device of block chain, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109446273A CN109446273A (en) 2019-03-08
CN109446273B true CN109446273B (en) 2022-07-22

Family

ID=65554704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811472522.6A Active CN109446273B (en) 2018-12-04 2018-12-04 Data synchronization method and device of block chain, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109446273B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162559B (en) * 2019-04-13 2020-07-10 山东公链信息科技有限公司 Block chain processing method based on universal JSON synchronous and asynchronous data API (application program interface) interface call
CN110198347B (en) * 2019-05-21 2023-01-10 深圳前海微众银行股份有限公司 Block chain based early warning method and sub-control server
CN110309160B (en) * 2019-05-22 2023-07-04 平安科技(深圳)有限公司 Data in-link transaction processing method, device, computer equipment and storage medium
CN110334540A (en) * 2019-06-17 2019-10-15 深圳壹账通智能科技有限公司 Insurance data exchange method, electronic device and computer equipment based on block chain
CN110381116A (en) * 2019-06-19 2019-10-25 深圳壹账通智能科技有限公司 Information synchronization system and information synchronization method
CN110609872B (en) * 2019-09-20 2021-03-05 北京海益同展信息科技有限公司 Method and apparatus for synchronizing node data
CN111159300A (en) * 2019-12-31 2020-05-15 中国银行股份有限公司 Data processing method and device based on block chain
CN111355608A (en) * 2020-02-18 2020-06-30 杭州复杂美科技有限公司 Block chain rollback exception identification method, system, equipment and storage medium
CN111400399B (en) * 2020-03-04 2023-11-14 链农(深圳)信息科技有限公司 Ledger synchronization method, device and hardware equipment of blockchain system
CN111475575B (en) 2020-04-09 2021-08-10 腾讯科技(深圳)有限公司 Data synchronization method and device based on block chain and computer readable storage medium
CN111552728B (en) * 2020-04-24 2021-11-30 深圳点链科技有限公司 Data processing method, system, terminal and storage medium of block chain
CN112015815B (en) * 2020-08-27 2024-02-02 中国平安财产保险股份有限公司 Data synchronization method, device and computer readable storage medium
CN113760556A (en) * 2020-11-17 2021-12-07 西安京迅递供应链科技有限公司 Message synchronization method and device
CN112200681B (en) * 2020-12-04 2021-05-28 腾讯科技(深圳)有限公司 Service processing method, information processing method and node equipment of block chain network
CN113612761B (en) * 2021-07-30 2022-03-22 立信(重庆)数据科技股份有限公司 Block chain-based investigation data chaining method and system
CN113691611B (en) * 2021-08-23 2022-11-22 湖南大学 Block chain distributed high-concurrency transaction processing method, system, equipment and storage medium
CN114938380B (en) * 2022-06-23 2023-08-22 成都质数斯达克科技有限公司 Data sharing system and method suitable for block chain

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902473A (en) * 2010-07-22 2010-12-01 武汉中地数码科技有限公司 Method for synchronously updating data based on grid GIS (Geographic Information System)
CN106327191A (en) * 2016-08-09 2017-01-11 联动优势科技有限公司 Transaction information recording method and transaction information recording device
CN107609010A (en) * 2017-07-27 2018-01-19 北京瑞卓喜投科技发展有限公司 Information processing method and device based on block chain technology
CN107657059A (en) * 2017-10-20 2018-02-02 中国银行股份有限公司 Method of data synchronization, middleware and system based on block chain application system
CN108694669A (en) * 2018-07-18 2018-10-23 矩阵元技术(深圳)有限公司 A kind of block chain intelligence contract implementation method and device
CN108848119A (en) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 The exchange method and device, system, electronic equipment of transregional piece of chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776894B (en) * 2016-11-29 2018-03-16 北京众享比特科技有限公司 Log database system and synchronous method
CN107341702B (en) * 2017-03-08 2020-06-23 创新先进技术有限公司 Service processing method and device
CN107918666B (en) * 2017-11-24 2020-05-12 中钞信用卡产业发展有限公司杭州区块链技术研究院 Data synchronization method and system on block chain
CN108429759B (en) * 2018-03-28 2020-06-30 电子科技大学成都研究院 Decentralized storage safety implementation method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902473A (en) * 2010-07-22 2010-12-01 武汉中地数码科技有限公司 Method for synchronously updating data based on grid GIS (Geographic Information System)
CN106327191A (en) * 2016-08-09 2017-01-11 联动优势科技有限公司 Transaction information recording method and transaction information recording device
CN107609010A (en) * 2017-07-27 2018-01-19 北京瑞卓喜投科技发展有限公司 Information processing method and device based on block chain technology
CN107657059A (en) * 2017-10-20 2018-02-02 中国银行股份有限公司 Method of data synchronization, middleware and system based on block chain application system
CN108848119A (en) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 The exchange method and device, system, electronic equipment of transregional piece of chain
CN108694669A (en) * 2018-07-18 2018-10-23 矩阵元技术(深圳)有限公司 A kind of block chain intelligence contract implementation method and device

Also Published As

Publication number Publication date
CN109446273A (en) 2019-03-08

Similar Documents

Publication Publication Date Title
CN109446273B (en) Data synchronization method and device of block chain, computer equipment and storage medium
US11860874B2 (en) Multi-partitioning data for combination operations
CN108388479B (en) Delayed message pushing method and device, computer equipment and storage medium
US8874700B2 (en) Optimizing storage of data files
CN110430087B (en) Block chain hot upgrade architecture design and implementation
CN108200219B (en) Data synchronization method, device, server and storage medium
US20230222141A1 (en) Systems and methods for adaptive data replication
Chun et al. Mobius: unified messaging and data serving for mobile apps
KR101871383B1 (en) Method and system for using a recursive event listener on a node in hierarchical data structure
EP2946527A2 (en) Variable duration windows on continuous data streams
CN109388677B (en) Method, device and equipment for synchronizing data among clusters and storage medium thereof
US20090083210A1 (en) Exchange of syncronization data and metadata
US9794360B1 (en) Estimating unique viewers of media content without cookies
CN111222089B (en) Data processing method, data processing device, computer equipment and storage medium
Ravindra et al. Latency aware elastic switching-based stream processing over compressed data streams
CN111475225A (en) Microservice configuration method, system, apparatus and computer readable storage medium
WO2016090938A1 (en) Data communication method and apparatus, and computer storage medium
WO2022134830A1 (en) Method and apparatus for processing block node data, computer device, and storage medium
CN113434297A (en) Hot spot peak clipping method and device, storage server, client and storage medium
CN113297008A (en) Data processing method and system
EP3961414A1 (en) Method and apparatus for processing time records
CN115604667B (en) Message sending method, device, computer equipment and storage medium
US20240080393A1 (en) Mme writer and identity service for ran parser
CN116347467B (en) Method and system for managing user data by UDR in 5G network
CN115168366B (en) Data processing method, data processing device, electronic equipment and storage medium

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