CN109522362B - Incomplete data synchronization method, system and equipment based on block chain data - Google Patents

Incomplete data synchronization method, system and equipment based on block chain data Download PDF

Info

Publication number
CN109522362B
CN109522362B CN201811206580.4A CN201811206580A CN109522362B CN 109522362 B CN109522362 B CN 109522362B CN 201811206580 A CN201811206580 A CN 201811206580A CN 109522362 B CN109522362 B CN 109522362B
Authority
CN
China
Prior art keywords
node
target
block
data
target block
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
CN201811206580.4A
Other languages
Chinese (zh)
Other versions
CN109522362A (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.)
Beijing Rui Zhuo Xi Tou Technology Development Co ltd
Original Assignee
Beijing Rui Zhuo Xi Tou Technology Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Rui Zhuo Xi Tou Technology Development Co ltd filed Critical Beijing Rui Zhuo Xi Tou Technology Development Co ltd
Priority to CN201811206580.4A priority Critical patent/CN109522362B/en
Publication of CN109522362A publication Critical patent/CN109522362A/en
Application granted granted Critical
Publication of CN109522362B publication Critical patent/CN109522362B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of block chains, in particular to a method, a system and equipment for incomplete data synchronization based on block chain data, wherein the method comprises the following steps: requesting a synchronization target block from a target node; receiving the requested target block; if the received node is the incomplete node, forwarding the target block to the complete node; and the complete node verifies the received target block, and if the received target block passes the verification, the target block is fragmented and the obtained fragment data is stored in a service chain. The embodiment of the invention achieves the following technical effects: the method solves the problems that the time consumed by sharing data is continuously increased along with the continuous increase of the data volume of the block chain in the prior art, block chain network congestion and block storage burden are easily caused, and therefore the purposes of shortening the sharing period, improving the sharing efficiency, saving the storage quantity and ensuring the data safety are achieved.

Description

Incomplete data synchronization method, system and equipment based on block chain data
Technical Field
The invention relates to the technical field of block chains, in particular to a method, a system and equipment for incomplete data synchronization based on block chain data.
Background
The blockchain technique, also known as distributed ledger technique, is essentially a decentralized distributed internet database. A network constructed using blockchain technology can be considered as a blockchain network, where the blockchain network includes a plurality of blockchain nodes, and any blockchain node can correspond to at least one blockchain, and any blockchain can include at least one block.
In the prior art, blockchain applications can be divided into two categories:
public chains: all nodes can participate in consensus and competitive accounting rights. The public chain is directed to the public, and any individual or group can read and send the transaction, and the transaction can obtain the effective confirmation of the blockchain and participate in the consensus blockchain. And (6) disclosing data. The method is characterized in that: neutral, open, slow transaction speed, need of 'mining' or similar consensus methods, commonly used P2P network, high censorship resistance.
And (3) a permission chain: only the allowed nodes can agree on, compete for billing rights and create blocks, including all non-public chains, such as private, federation, enterprise, etc. The data may or may not be disclosed. The private chain is a block chain with writing authority in an organization hand; a federation chain refers to a chain of blocks controlled by several people or organizations, corporations, governments. The characteristics of the permission chain are: the transaction speed is high, the whole network consensus of the mining class is not needed, and the transaction cost is low (the transaction only needs to be verified by a plurality of allowed nodes); can be examined and can occupy the mainstream of the commercial application field.
Specifically, the process of service data uplink (i.e. stored in the blockchain network) comprises three stages:
1. in the accepting stage, it can be understood that the service data to be uplink is received by a certain block link point in the block link network, and the service data is accepted by the block link point;
2. in the consensus stage, after the block link point accepts the service data, other block link points in the block link network need to participate in consensus processing on the service data, and the service data can enter the storage stage after passing the consensus;
3. in the storage stage, it can be understood that the block nodes perform uplink processing on the service data passing through the common identity.
The consensus method in the block chain technology, namely the consensus algorithm, is an important method for establishing trust and obtaining rights and interests among different block chain nodes in a block chain network. The so-called consensus method is to complete the verification and confirmation of the transaction in a short time through the voting of special nodes; if multiple nodes with irrelevant benefits can achieve consensus on a transaction, the whole network can be considered to achieve consensus on the nodes. A blockchain, which is a data structure that stores data in time sequence, may support different consensus methods.
Under different consensus methods, the generation process of the blocks will be slightly different. However, generally speaking, after each node processes the received tile information, the transaction process is roughly as follows: the node receives a plurality of transaction information and puts the transaction information into a transaction pool; the node acquires currently received transaction information from the transaction pool, sorts the transactions and executes the transactions in sequence; after execution, the node generates a complete block, which is finally broadcast.
As an emerging technology, a block chain has many problems to be improved, and a block chain protocol faces an obstacle to scalability. The scalability problem of blockchains is roughly divided into two aspects:
1. scalability hurdles to transaction throughput and transaction validation delays;
2. and the expansibility obstacle is caused by the bottleneck of data storage of the global account book of the block chain.
Taking the service request of block uplink in the service data as an example, in the consensus stage, after receiving the block uplink request, any block chain node needs to broadcast its signature on the current uplink request to the whole network by all other block chain nodes in the block chain network, and the uplink can be performed after passing the consensus. In the existing block chain used, whether a public chain, a private chain or a alliance chain is used for processing transactions on one chain, and considering that the number of block chain nodes is large, when there is a consensus demand, the block chain network is easy to be congested. Such as: if a company has different mechanisms, if the services of the mechanisms are all put on a chain, the pressure for processing the services on the chain is increased, the time for processing the services is prolonged, and the business expansion is not facilitated. Moreover, signatures of all blockchain nodes in the whole network need to be stored in the blocks, and as the number of nodes on the blockchain increases, the time consumed by sharing data and consensus also increases, which causes storage burden to the blocks.
The blockchain network is a network system based on a distributed principle, theoretically, the content on each network node is consistent, and it is only necessary to obtain data in a blockchain from any one of the nodes or a local node.
In practical applications, however, the local node is free to configure the type of the current local node. For example, the local node may be selectively configured as a fully-logged node (full-node) containing full blockchain data, or a non-fully-logged node (n-full-node) containing partial blockchain data.
Which data is stored locally may be determined by the current local node type and specific configuration, and therefore not all data of the complete blockchain in the current network may be stored in the blockchain of the local node. When the local node is configured as a non-full record node, the required data needs to be acquired from other nodes of the local block chain network during data synchronization, and it is difficult for the current data synchronization method to implement safe and efficient data synchronization in the above scenario.
Therefore, it is desirable to find a new blockchain synchronization scheme to overcome the above problems.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method, a system and equipment for incomplete data synchronization based on block chain data, which solve the problems that the block chain network congestion and the block storage burden are easily caused by the continuous increase of the data quantity of the block chain and the continuous increase of the time consumed by data sharing in the prior art, thereby achieving the purposes of shortening the sharing period, improving the sharing efficiency, saving the storage quantity and ensuring the data safety, and the specific scheme is as follows:
in a first aspect, the present invention provides a method for incomplete data synchronization based on blockchain data, where a blockchain includes a main chain and a plurality of service chains, and the service chains include a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, the method including:
requesting a synchronization target block from a target node;
receiving the requested target block;
if the received node is the incomplete node, forwarding the target block to the complete node;
and the complete node verifies the received target block, and if the received target block passes the verification, the target block is fragmented and the obtained fragmented data is broadcasted to a service chain for storage.
Preferably, the verifying the received target block by the full node comprises:
and the complete node compares whether the received pre-hash of the target block is consistent with the hash of the latest block of the complete node, if so, the complete node performs consensus verification on the target block, and if the target block passes the verification, the verification is passed.
Preferably, requesting the synchronization target block from the target node comprises:
dividing the main chain into a plurality of blockchain subchains;
and requesting the target node of each block subchain to synchronize the target block so as to acquire the latest target block in each block subchain.
Preferably, before the target block is sliced, the method includes:
and if at least two target blocks are received, the at least two target blocks are respectively sent by different block sub-chain nodes, and the corresponding previous target blocks are the same, adding the at least two target blocks into a block chain where the complete node is located according to the change time sequence in the at least two target blocks.
Preferably, the slicing the target block includes:
and segmenting the target block into one or more pieces of fragment data, and randomly encoding the one or more pieces of fragment data into corresponding one or more pieces of target fragment data.
Preferably, the broadcasting the obtained fragmented data to a service chain for storage includes
And acquiring the hash of the target block and the hash of each target fragment data, and broadcasting the hash of the target block and the hash of each target fragment data to a service chain for storage.
Preferably, the method further comprises:
obtaining the hash of the target fragment data;
searching a corresponding target block according to the hash of the target fragment data and acquiring corresponding target fragment data content;
and storing the hash of the target fragment data and the content of the target fragment data to a service chain where the incomplete node is located.
In a second aspect, the present invention provides a regional consensus system, where a blockchain includes a main chain and a plurality of service chains, where each service chain includes a complete node participating in main chain consensus and a plurality of incomplete nodes participating in service chain consensus, and the system includes: a plurality of
A request module for requesting a synchronization target block from a target node;
a receiving module, configured to receive the requested target block;
a scheduling module, configured to forward the target block to the complete node if the received node is the incomplete node;
and the processing module is used for verifying the received target block by the complete node, and if the received target block passes the verification, the target block is fragmented and the obtained fragmented data is broadcasted to a service chain for storage.
In a third aspect, the present invention provides a regional consensus apparatus, where a blockchain includes a main chain and a plurality of service chains, where a service chain includes a complete node participating in main chain consensus and a plurality of incomplete nodes participating in service chain consensus, and the apparatus includes:
the communication bus is used for realizing the connection communication between the processor and the memory;
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of:
requesting a synchronization target block from a target node;
receiving the requested target block;
if the received node is the incomplete node, forwarding the target block to the complete node;
and the complete node verifies the received target block, and if the received target block passes the verification, the target block is fragmented and the obtained fragmented data is broadcasted to a service chain for storage.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of the first aspect described above.
Has the advantages that: according to the incomplete data synchronization method and system based on the block chain data, blocks are stored in a blocking mode by using the plurality of nodes on the service chain, so that the overall storage mode adopted by distributed storage based on the block chain in the prior art is changed, and the block storage with large data volume can be met; the risk that the block is integrally damaged under the potential conditions such as downtime, operation faults and the like in the integral storage mode is avoided, and even if the risk exists, synchronous data can be acquired from other normally-operated block chain nodes, so that the safety of data storage is improved; due to the anti-tampering characteristic of the blockchain, any party cannot tamper the stored data in the blockchain privately, so that the safety of the stored data is effectively guaranteed.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present invention, the embodiments in the drawings do not constitute any limitation to the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating an embodiment of a method for non-complete data synchronization based on blockchain data according to the present invention.
Fig. 2 is a schematic structural diagram of an embodiment of a system for non-complete data synchronization based on blockchain data according to the present invention.
Fig. 3 is a schematic structural diagram of an embodiment of a device for incomplete data synchronization based on blockchain data according to the present invention.
Detailed Description
The technical solution of the present invention will be further described in detail with reference to the accompanying drawings and embodiments, which are preferred embodiments of the present invention. It is to be understood that the described embodiments are merely a subset of the embodiments of the invention, and not all embodiments; it should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. 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.
The main idea of the technical scheme of the embodiment of the invention is as follows: requesting a synchronization target block from a target node; receiving the requested target block; if the received node is the incomplete node, forwarding the target block to the complete node; and the complete node verifies the received target block, and if the received target block passes the verification, the target block is fragmented and the obtained fragment data is stored in a service chain.
In order to better understand the technical solutions, the technical solutions will be described in detail below with reference to the drawings and specific embodiments.
Example one
An embodiment of the present invention provides an incomplete data synchronization method based on blockchain data, where a blockchain includes a main chain and a plurality of service chains, and a service chain includes a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, as shown in fig. 1, the data synchronization method may specifically include the following steps:
step S101, a synchronous target block is requested from a target node;
in the embodiment of the present application, this step is used for initiating data synchronization to a target node of a synchronization object at a service chain timing. Specifically, a target node in a short distance can be selected, and the synchronization request is sent to the target node; and the service link receives the synchronous data returned by the target node.
Step S102, receiving the requested target block;
in this embodiment of the application, the service chain may forward the requested target block through the receiving interactive platform, where the interactive platform may be configured to receive a project creation request sent by a project initiator and create a corresponding service project, and when the service project is in a running state, the interactive platform may further receive a service processing request of a user for the service project, and perform service processing according to the service project and the service processing request.
The interaction platform can be a crowd funding platform, the crowd funding platform can receive a crowd funding project creation request sent by a funding party and create a corresponding crowd funding project, and can also receive a crowd funding confirmation request sent by a investor, and the crowd funding confirmation request can be a crowd funding confirmation request for the crowd funding project in a funding state.
In the embodiment of the application, the interaction platform provides an external docking standard protocol, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and dock with the interaction platform to form a consensus node.
In the embodiment of the present application, a node accepts a service of a block, and the node may be referred to as a service accepting node and initiates a consensus on the service. Besides the node, a plurality of nodes can be included, and if the nodes participate in the consensus process of the service, the nodes can be called consensus nodes. In addition, these nodes may also serve as service accepting nodes. For example: the main chain of the block chain comprises 5 nodes (for example, a node 1, a node 2, a node 3, a node 4 and a node 5), and each node can be a service receiving node and a consensus node. Assuming that the node 1 accepts a certain service data, the node 1 is a service accepting node, and the nodes 2, 3, 4, and 5 participate in the consensus process for the service data as consensus nodes for the service data.
In the embodiment of the present application, a node of a main chain of a block chain may be a service data reception node, or may not be a service data reception node, but be a node for initiating a consensus process, or a complete node of the current consensus process, which is not specifically limited herein.
If the node of the main chain of the block chain is used as the receiving node of the service data, the block chain link point may retrieve a part of the service data from the locally stored received service data as the service data to be identified, so as to initiate the identification process for the retrieved part of the service data subsequently.
If the node of the service chain is not taken as a service data acceptance node but is taken as a complete node of the common identification processing, the block chain node can drag out a part of service data from the service data resource pool to be common identified as the service data to be common identified, so as to subsequently initiate the common identification processing for the dragged part of service data.
Specifically, the node of the service chain receives a target block sent by the interactive platform, and after receiving the target block to be identified, acquires corresponding service data generating the service request to be identified. Since the user information of the target block is transmitted to the common node, when the node receives the service data, the node can determine which user side the service processing data corresponding to the target block is received by as long as the service data includes the user information.
Step S103, if the received node is the incomplete node, forwarding the target block to the complete node.
In the embodiment of the present application, as described above, the interaction platform provides an external standard protocol for interfacing, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and interface with the interaction platform to form an external common node, which is called a complete node. In addition, any subject can also be docked to the interactive platform to become an internal common knowledge node, called a non-complete node.
The type of the pair of common knowledge nodes can be individuals, enterprises, regulatory agencies and the like, and can also be different credit levels of high credit, medium credit, low credit and the like. In short, the types of the internal common knowledge nodes can be divided according to actual situations, and the application does not limit the types.
Specifically, for individuals or individuals, a client with a built-in docking standard protocol can be installed on a terminal, and a service request can be submitted at any time through the client; for an enterprise, especially an enterprise providing services for users, the application of the enterprise can be connected with the configuration center, and when the enterprise provides services for the users, a service request corresponding to the service can be submitted for the corresponding consensus subsystem to perform consensus verification.
For example, a client of a certain e-commerce platform may have a built-in docking standard protocol, dock with the interactive platform, and when a user purchases a product on the e-commerce platform, the e-commerce platform requests the consensus sub-network to perform consensus verification on the product purchased by the user, whether the user has paid successfully, and the like, and feeds back the consensus verification to the user.
For example, a common individual may become an internal consensus node, when two internal consensus nodes transfer money, one of the internal consensus nodes may initiate a service request, request the regional block chain network corresponding to the payment field to perform consensus check for the transfer, and record a block corresponding to the transfer on the regional block chain.
In a word, under the architecture of the system, application scenes are very rich, individuals can become internal common knowledge nodes to request to check various events generated by the internal common knowledge nodes, and enterprises can become the internal common knowledge nodes to enhance the trust of users on the internal common knowledge nodes.
In this embodiment of the present application, the incomplete node is an internal node subject, and in this system, an identity of the node may be given to the internal node subject, but these incomplete nodes cannot participate in external consensus verification in the application scenario of the present application, and the external consensus verification in the application scenario of the present application is performed by the complete node.
However, the incomplete node in the application scenario of the present application may perform the mutual recognition check, and as described above, the entire society may be brought into a unified credit system based on the service chain, and when the service chain corresponds to a public blockchain network, the public blockchain network only needs to be docked with the service chain, and the original operation of the public blockchain network, i.e., the main chain, is not affected.
Specifically, if the receiving node of the service chain is the incomplete node which is commonly seen from the inside, the received target block of step S102 is forwarded to the complete node which is commonly seen from the outside.
In an alternative embodiment, the full node may be a leader node that is elected by the Raft algorithm. In the Raft protocol, each node in the distributed network can be divided into a leader node and a subordinate node, the leader node has the authority to send heartbeat information to the subordinate nodes in the distributed network, and the subordinate nodes in the distributed network can update the heartbeat information to the local information log of the subordinate nodes after receiving the heartbeat information sent by the leader node. In addition, when a service is initiated by the subordinate node, the subordinate node may transmit the service to the leader node, and be processed by the leader node, or be distributed to other subordinate nodes for processing.
The leader node may be generated by election of each internal consensus node when the block chain network starts to operate, and specifically, how the leader node elects and how the leader node changes, may be consistent with a Raft protocol in the prior art, which is not limited in this application.
Further, in this embodiment of the application, when the distributed protocol is a Raft protocol, since a leader node in the Raft protocol needs to send heartbeat information to each node in the network, when determining the leader node in the blockchain network, the consensus node may determine the leader node through the received heartbeat information. If the consensus node does not receive the heartbeat information sent by the leader node in the time period corresponding to the heartbeat information, the consensus node can wait for other consensus nodes to initiate elections, receive voting requests sent by candidate nodes, and select the leader node in the next deadline by responding to the voting requests. Of course, the consensus node may also become an voter node and send a voting request to other consensus nodes, and then the consensus node may also become a leader node in the blockchain network. Since the determination of the leader node belongs to the prior art, detailed description of the technology is omitted in this application.
It should be noted that the complete node or the incomplete node may be a terminal, such as a device like a mobile phone, a personal computer/a tablet computer, or the complete node or the incomplete node may also be a server, and the server may be a server corresponding to the incomplete node or the incomplete node, and the server may be a single device, or may be a system composed of multiple devices, as long as the device can be used as the incomplete node or the incomplete node of the blockchain network to receive service data sent by an interaction platform corresponding to the consensus node, and has a right to initiate consensus in the blockchain network, and the specific kind of the device of the incomplete node or the incomplete node is not limited in the present application.
And step S104, the complete node verifies the received target block, if the received target block passes the verification, the target block is fragmented, and the obtained fragmented data is broadcasted to a service chain for storage. The detailed description is as follows:
step S1041, the complete node compares whether the received hash of the target block and the hash of the latest block of the complete node are consistent, if so, the complete node performs consensus check on the target block, and if so, it indicates that the target block passes the verification.
As described above, since the user information of the target block is transmitted to the common node, when the node receives the service data, it is possible to determine which user has received the service data corresponding to the block as long as the service data includes the user information.
Specifically, first, the received hash of the target block is compared with the hash of the latest block of the complete node to determine whether the received hash of the target block is consistent with the hash of the latest block of the complete node, and if the comparison result is consistent, it indicates that the target block is the latest block, so that data synchronization between the data of the service link node and the data of the target node is achieved. Then, on the basis that the data of the service chain node and the data of the target node realize data synchronization, performing consensus verification on the target block, specifically, the complete node can verify the signature information contained in the target block by using a public key held by the complete node itself, and after determining that the signature information passes verification, verifying the head hash value of the target block according to the content contained in the target block. After determining that the head hash value of the target block passes the verification, it may be determined that the target block passes the verification, that is, the target block passes the service chain verification, and the target block may be stored as a block in its service chain. The check code type may be configured as various encryption algorithms or check codes generated by a check algorithm commonly used by those skilled in the art.
It should be noted that, in the field of blockchain technology, specifically, each node performs consensus verification on a target block according to a consensus algorithm, and a blockchain network has access to privacy such as an account and a transaction record of each node for verification. The consensus verification process in the embodiment of the present application is not different from the existing consensus verification process, and thus will not be described in detail in the following description.
Step S1042, the target block is divided into one or more pieces of sliced data, and the one or more pieces of sliced data are randomly encoded into one or more corresponding target pieces of sliced data.
Preferably, in order to ensure load balancing of each node in the entire pair of common node sets, the load capacity of each node in the node set may be determined, and further, the amount of current idle resources of each node may be determined, so as to determine the number of fragmented data segmented by the target block.
Further, in order to further improve the security of the target block, the one or more pieces of sliced data are randomly encoded. The random coding in the embodiment of the present invention is not different from the conventional random linear network coding, and thus will not be described in detail in the following description.
Step S1043, obtaining the hash of the target block and the hashes of the target fragment data, and broadcasting the hashes of the target block and the hashes of the target fragment data to a service chain for storage.
In the embodiment of the present invention, this step is mainly used to record the distribution of the target blocks stored in the service chain, and establish an index relationship among the hash of the target block, the hash set of the target fragment data, and the uniform resource location of the target block, so as to be used when the incomplete node of the service chain stores the target block.
Specifically, the complete node acquires the hash of the target block and the hashes of the target fragmented data, and forms a target fragmented data hash set according to the hashes of the target fragmented data; and establishing an index relationship among the Hash of the target block, the Hash set of the target fragment data and the uniform resource positioning table of the target block, and broadcasting the Hash of the target block, the Hash set of the target fragment data, the uniform resource positioning table of the target block and the index relationship to a service chain for storage.
And step S105, receiving the fragment data and storing the fragment data in a distributed manner. The detailed description is as follows:
step S1051, hash of the target fragment data is obtained;
each target fragment has a unique hash corresponding to it for identifying and distinguishing the target fragments, so that a non-complete node of a service chain needs to acquire the hash of the target fragment.
Step S1052, searching a corresponding target block according to the hash of the target fragment data and acquiring corresponding target fragment data content;
specifically, a corresponding target fragment data hash set is searched according to the hash of the target fragment data, a uniform resource positioning table of a target block corresponding to the target fragment data hash set is obtained according to an index relationship among the target fragment data hash set, the hash of the target block and the uniform resource positioning table of the target block, the target block is read according to the uniform resource positioning table of the target block, and corresponding target fragment data content is obtained from the target block according to a target block fragmentation threshold.
Step S1053, storing the hash of the target fragment data and the content of the target fragment data to the service chain where the incomplete node is located.
In practical application, a node on a service chain first completes storage of a target fragment corresponding to a first hash in a target fragment hash set, and then completes storage of target fragment data corresponding to a next hash in the target fragment data hash set through other nodes on the service chain, and the steps are repeated until all hashes in the target fragment data hash set are traversed until the whole target block is completely stored.
After receiving the fragment data, other non-complete nodes of the service chain may store the fragment data as a block in the service chain stored in the non-complete nodes of the service chain in the same manner.
The block partitioned storage method of the embodiment of the invention changes the integral storage mode adopted by distributed storage based on the block chain in the prior art, uses a plurality of nodes on the service chain to perform block partitioned storage on the block, and can meet the block storage with larger data volume; in addition, the block partitioned storage method provided by the invention also improves the safety of data storage and avoids the risk that the potential block is damaged integrally in the integral storage mode.
Example two
An embodiment of the present invention provides an incomplete data synchronization method based on blockchain data, where a blockchain includes a main chain and a plurality of service chains, and a service chain includes a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, as shown in fig. 1, the data synchronization method may specifically include the following steps:
step S201, request the synchronous target block to the target node;
in the embodiment of the present application, this step is used for initiating data synchronization to a target node of a synchronization object at a service chain timing. Specifically, a target node in a short distance can be selected, and the synchronization request is sent to the target node; and the service link receives the synchronous data returned by the target node.
In the embodiment of the present application, the main chain is first divided into a plurality of block subchains, and then a target node of each block subchain requests to synchronize the target block to obtain the latest target block in each block subchain.
Specifically, the main chain is divided into a plurality of block subchains with the length of 256, and the traversal of each block subchain is sequentially requested, wherein the queue numbers of the blocks of each block subchain are 1-256, 257-512, 513-768, … …, and the like.
In an alternative embodiment, the length of the blockchain may also be set to other fixed lengths or variable lengths of different sizes according to actual requirements.
Step S202, receiving the requested target block;
in this embodiment of the application, the service chain may forward the requested target block through the receiving interactive platform, where the interactive platform may be configured to receive a project creation request sent by a project initiator and create a corresponding service project, and when the service project is in a running state, the interactive platform may further receive a service processing request of a user for the service project, and perform service processing according to the service project and the service processing request.
The interaction platform can be a crowd funding platform, the crowd funding platform can receive a crowd funding project creation request sent by a funding party and create a corresponding crowd funding project, and can also receive a crowd funding confirmation request sent by a investor, and the crowd funding confirmation request can be a crowd funding confirmation request for the crowd funding project in a funding state.
In the embodiment of the application, the interaction platform provides an external docking standard protocol, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and dock with the interaction platform to form a consensus node.
In the embodiment of the present application, a node accepts a service of a block, and the node may be referred to as a service accepting node and initiates a consensus on the service. Besides the node, a plurality of nodes can be included, and if the nodes participate in the consensus process of the service, the nodes can be called consensus nodes. In addition, these nodes may also serve as service accepting nodes. For example: the main chain of the block chain comprises 5 nodes (for example, a node 1, a node 2, a node 3, a node 4 and a node 5), and each node can be a service receiving node and a consensus node. Assuming that the node 1 accepts a certain service data, the node 1 is a service accepting node, and the nodes 2, 3, 4, and 5 participate in the consensus process for the service data as consensus nodes for the service data.
In the embodiment of the present application, a node of a main chain of a block chain may be a service data reception node, or may not be a service data reception node, but be a node for initiating a consensus process, or a complete node of the current consensus process, which is not specifically limited herein.
If the node of the main chain of the block chain is used as the receiving node of the service data, the block chain link point may retrieve a part of the service data from the locally stored received service data as the service data to be identified, so as to initiate the identification process for the retrieved part of the service data subsequently.
If the node of the service chain is not taken as a service data acceptance node but is taken as a complete node of the common identification processing, the block chain node can drag out a part of service data from the service data resource pool to be common identified as the service data to be common identified, so as to subsequently initiate the common identification processing for the dragged part of service data.
Specifically, the node of the service chain receives a target block sent by the interactive platform, and after receiving the target block to be identified, acquires corresponding service data generating the service request to be identified. Since the user information of the target block is transmitted to the common node, when the node receives the service data, the node can determine which user side the service processing data corresponding to the target block is received by as long as the service data includes the user information.
Step S203, if the received node is the incomplete node, forwarding the target block to the complete node.
In the embodiment of the present application, as described above, the interaction platform provides an external standard protocol for interfacing, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and interface with the interaction platform to form an external common node, which is called a complete node. In addition, any subject can also be docked to the interactive platform to become an internal common knowledge node, called a non-complete node.
The type of the pair of common knowledge nodes can be individuals, enterprises, regulatory agencies and the like, and can also be different credit levels of high credit, medium credit, low credit and the like. In short, the types of the internal common knowledge nodes can be divided according to actual situations, and the application does not limit the types.
Specifically, for individuals or individuals, a client with a built-in docking standard protocol can be installed on a terminal, and a service request can be submitted at any time through the client; for an enterprise, especially an enterprise providing services for users, the application of the enterprise can be connected with the configuration center, and when the enterprise provides services for the users, a service request corresponding to the service can be submitted for the corresponding consensus subsystem to perform consensus verification.
For example, a client of a certain e-commerce platform may have a built-in docking standard protocol, dock with the interactive platform, and when a user purchases a product on the e-commerce platform, the e-commerce platform requests the consensus sub-network to perform consensus verification on the product purchased by the user, whether the user has paid successfully, and the like, and feeds back the consensus verification to the user.
For example, a common individual may become an internal consensus node, when two internal consensus nodes transfer money, one of the internal consensus nodes may initiate a service request, request the regional block chain network corresponding to the payment field to perform consensus check for the transfer, and record a block corresponding to the transfer on the regional block chain.
In a word, under the architecture of the system, application scenes are very rich, individuals can become internal common knowledge nodes to request to check various events generated by the internal common knowledge nodes, and enterprises can become the internal common knowledge nodes to enhance the trust of users on the internal common knowledge nodes.
In this embodiment of the present application, the incomplete node is an internal node subject, and in this system, an identity of the node may be given to the internal node subject, but these incomplete nodes cannot participate in external consensus verification in the application scenario of the present application, and the external consensus verification in the application scenario of the present application is performed by the complete node.
However, the incomplete node in the application scenario of the present application may perform the mutual recognition check, and as described above, the entire society may be brought into a unified credit system based on the service chain, and when the service chain corresponds to a public blockchain network, the public blockchain network only needs to be docked with the service chain, and the original operation of the public blockchain network, i.e., the main chain, is not affected.
Specifically, if the receiving node of the service chain is the incomplete node which is commonly seen from the inside, the received target block of step S102 is forwarded to the complete node which is commonly seen from the outside.
In an alternative embodiment, the full node may be a leader node that is elected by the Raft algorithm. In the Raft protocol, each node in the distributed network can be divided into a leader node and a subordinate node, the leader node has the authority to send heartbeat information to the subordinate nodes in the distributed network, and the subordinate nodes in the distributed network can update the heartbeat information to the local information log of the subordinate nodes after receiving the heartbeat information sent by the leader node. In addition, when a service is initiated by the subordinate node, the subordinate node may transmit the service to the leader node, and be processed by the leader node, or be distributed to other subordinate nodes for processing.
The leader node may be generated by election of each internal consensus node when the block chain network starts to operate, and specifically, how the leader node elects and how the leader node changes, may be consistent with a Raft protocol in the prior art, which is not limited in this application.
Further, in this embodiment of the application, when the distributed protocol is a Raft protocol, since a leader node in the Raft protocol needs to send heartbeat information to each node in the network, when determining the leader node in the blockchain network, the consensus node may determine the leader node through the received heartbeat information. If the consensus node does not receive the heartbeat information sent by the leader node in the time period corresponding to the heartbeat information, the consensus node can wait for other consensus nodes to initiate elections, receive voting requests sent by candidate nodes, and select the leader node in the next deadline by responding to the voting requests. Of course, the consensus node may also become an voter node and send a voting request to other consensus nodes, and then the consensus node may also become a leader node in the blockchain network. Since the determination of the leader node belongs to the prior art, detailed description of the technology is omitted in this application.
It should be noted that the complete node or the incomplete node may be a terminal, such as a device like a mobile phone, a personal computer/a tablet computer, or the complete node or the incomplete node may also be a server, and the server may be a server corresponding to the incomplete node or the incomplete node, and the server may be a single device, or may be a system composed of multiple devices, as long as the device can be used as the incomplete node or the incomplete node of the blockchain network to receive service data sent by an interaction platform corresponding to the consensus node, and has a right to initiate consensus in the blockchain network, and the specific kind of the device of the incomplete node or the incomplete node is not limited in the present application.
Step S204, the complete node verifies the received target block, if the received target block passes the verification, the target block is fragmented, and the obtained fragmented data is broadcasted to a service chain for storage. The detailed description is as follows:
step S2041, comparing whether the received hash of the target block and the hash of the latest block of the complete node are consistent, if so, verifying the target block, and if so, indicating that the verification is passed.
As described above, since the user information of the target block is transmitted to the common node, when the node receives the service data, it is possible to determine which user has received the service data corresponding to the block as long as the service data includes the user information.
Specifically, first, the received hash of the target block is compared with the hash of the latest block of the complete node to determine whether the received hash of the target block is consistent with the hash of the latest block of the complete node, and if the comparison result is consistent, it indicates that the target block is the latest block, so that data synchronization between the data of the service link node and the data of the target node is achieved. Then, on the basis that the data of the service chain node and the data of the target node realize data synchronization, performing consensus verification on the target block, specifically, the complete node can verify the signature information contained in the target block by using a public key held by the complete node itself, and after determining that the signature information passes verification, verifying the head hash value of the target block according to the content contained in the target block. After determining that the head hash value of the target block passes the verification, it may be determined that the target block passes the verification, that is, the target block passes the service chain verification, and the target block may be stored as a block in its service chain. The check code type may be configured as various encryption algorithms or check codes generated by a check algorithm commonly used by those skilled in the art.
It should be noted that, in the field of blockchain technology, specifically, each node performs consensus verification on a target block according to a consensus algorithm, and a blockchain network has access to privacy such as an account and a transaction record of each node for verification.
Step S2042, if at least two target blocks are received, where the at least two target blocks are respectively sent by different sub-chain nodes, and corresponding previous target blocks are the same, adding the at least two target blocks into a block chain where the complete node is located according to the change time ordering of the at least two target blocks.
As can be seen from the above, when a synchronization target block is requested from a target node, the main chain is firstly divided into a plurality of block sub-chains, and then the synchronization target block is requested from the target node of each block sub-chain to obtain the latest target block in each block sub-chain.
In practical applications, a plurality of different blockchain sub-link nodes send respective target blocks to a complete node at the same time, in this case, the head hash values of the previous blocks included in the target blocks of the different blockchain sub-link nodes may be the same, and if the complete node determines that the target blocks all pass verification, the target blocks are stored in a blockchain process, and a branched chain situation occurs, thereby increasing the complexity of the blockchain.
Therefore, in the embodiment of the present invention, when the complete node receives at least two special target blocks, the special target blocks may be sorted according to the block generation time and/or the head hash value of each special target block included in each special target block, and based on the obtained sorting result, the head hash value of the previous target block included in each special target block and the head hash value corresponding to each special target block are updated and stored.
Step S2043, the target block is divided into one or more pieces of sliced data, and the one or more pieces of sliced data are randomly encoded into one or more corresponding target pieces of sliced data.
Preferably, in order to ensure load balancing of each node in the entire pair of common node sets, the load capacity of each node in the node set may be determined, and further, the amount of current idle resources of each node may be determined, so as to determine the number of fragmented data segmented by the target block.
Further, in order to further improve the security of the target block, the one or more pieces of sliced data are randomly encoded. The random coding in the embodiment of the present invention is not different from the conventional random linear network coding, and thus will not be described in detail in the following description.
Step S2044, the hash of the target block and the hashes of the target fragment data are obtained, and the hashes of the target block and the hashes of the target fragment data are broadcast to a service chain for storage.
In the embodiment of the present invention, this step is mainly used to record the distribution of the target blocks stored in the service chain, and establish an index relationship among the hash of the target block, the hash set of the target fragment data, and the uniform resource location of the target block, so as to be used when the incomplete node of the service chain stores the target block.
Specifically, the complete node acquires the hash of the target block and the hashes of the target fragmented data, and forms a target fragmented data hash set according to the hashes of the target fragmented data; and establishing an index relationship among the Hash of the target block, the Hash set of the target fragment data and the uniform resource positioning table of the target block, and broadcasting the Hash of the target block, the Hash set of the target fragment data, the uniform resource positioning table of the target block and the index relationship to a service chain for storage.
Step S205, receiving the fragment data and storing the fragment data in a distributed manner. The detailed description is as follows:
step S2051, obtaining a hash of the target fragment data;
each target fragment has a unique hash corresponding to it for identifying and distinguishing the target fragments, so that a non-complete node of a service chain needs to acquire the hash of the target fragment.
Step S2052, searching a corresponding target block according to the hash of the target fragment data and acquiring the corresponding target fragment data content;
specifically, a corresponding target fragment data hash set is searched according to the hash of the target fragment data, a uniform resource positioning table of a target block corresponding to the target fragment data hash set is obtained according to an index relationship among the target fragment data hash set, the hash of the target block and the uniform resource positioning table of the target block, the target block is read according to the uniform resource positioning table of the target block, and corresponding target fragment data content is obtained from the target block according to a target block fragmentation threshold.
Step S2053, store the hash of the target fragment data and the content of the target fragment data to the service chain where the incomplete node is located.
In practical application, a node on a service chain first completes storage of a target fragment corresponding to a first hash in a target fragment hash set, and then completes storage of target fragment data corresponding to a next hash in the target fragment data hash set through other nodes on the service chain, and the steps are repeated until all hashes in the target fragment data hash set are traversed until the whole target block is completely stored.
After receiving the fragment data, other non-complete nodes of the service chain may store the fragment data as a block in the service chain stored in the non-complete nodes of the service chain in the same manner.
The block partitioned storage method of the embodiment of the invention changes the integral storage mode adopted by distributed storage based on the block chain in the prior art, uses a plurality of nodes on the service chain to perform block partitioned storage on the block, and can meet the block storage with larger data volume; in addition, the block partitioned storage method provided by the invention also improves the safety of data storage and avoids the risk that the potential block is damaged integrally in the integral storage mode.
EXAMPLE III
An embodiment of the present invention provides an incomplete data synchronization system based on blockchain data, where a blockchain includes a main chain and a plurality of service chains, and each service chain includes a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, as shown in fig. 2, the synchronization system may specifically include the following modules:
a request module for requesting a synchronization target block from a target node;
a receiving module, configured to receive the requested target block;
a scheduling module, configured to forward the target block to the complete node if the received node is the incomplete node;
and the processing module is used for verifying the received target block by the complete node, and if the received target block passes the verification, the target block is fragmented and the obtained fragmented data is broadcasted to a service chain for storage.
Example four
An embodiment of the present invention provides an incomplete data synchronization device based on blockchain data, where a blockchain includes a main chain and a plurality of service chains, and each service chain includes a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, as shown in fig. 3, the synchronization system may specifically include the following modules:
the communication bus is used for realizing the connection communication between the processor and the memory;
a memory for storing a computer program; the memory may comprise high-speed RAM memory and may also comprise non-volatile memory, such as at least one disk memory. The memory may optionally comprise at least one memory device.
A processor for executing the computer program to implement the steps of:
step S301, request the synchronous target block to the target node;
in the embodiment of the present application, this step is used for initiating data synchronization to a target node of a synchronization object at a service chain timing. Specifically, a target node in a short distance can be selected, and the synchronization request is sent to the target node; and the service link receives the synchronous data returned by the target node.
In the embodiment of the present application, the main chain is first divided into a plurality of block subchains, and then a target node of each block subchain requests to synchronize the target block to obtain the latest target block in each block subchain.
Specifically, the main chain is divided into a plurality of block subchains with the length of 256, and the traversal of each block subchain is sequentially requested, wherein the queue numbers of the blocks of each block subchain are 1-256, 257-512, 513-768, … …, and the like.
In an alternative embodiment, the length of the blockchain may also be set to other fixed lengths or variable lengths of different sizes according to actual requirements.
Step S302, receiving the requested target block;
in this embodiment of the application, the service chain may forward the requested target block through the receiving interactive platform, where the interactive platform may be configured to receive a project creation request sent by a project initiator and create a corresponding service project, and when the service project is in a running state, the interactive platform may further receive a service processing request of a user for the service project, and perform service processing according to the service project and the service processing request.
The interaction platform can be a crowd funding platform, the crowd funding platform can receive a crowd funding project creation request sent by a funding party and create a corresponding crowd funding project, and can also receive a crowd funding confirmation request sent by a investor, and the crowd funding confirmation request can be a crowd funding confirmation request for the crowd funding project in a funding state.
In the embodiment of the application, the interaction platform provides an external docking standard protocol, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and dock with the interaction platform to form a consensus node.
In the embodiment of the present application, a node accepts a service of a block, and the node may be referred to as a service accepting node and initiates a consensus on the service. Besides the node, a plurality of nodes can be included, and if the nodes participate in the consensus process of the service, the nodes can be called consensus nodes. In addition, these nodes may also serve as service accepting nodes. For example: the main chain of the block chain comprises 5 nodes (for example, a node 1, a node 2, a node 3, a node 4 and a node 5), and each node can be a service receiving node and a consensus node. Assuming that the node 1 accepts a certain service data, the node 1 is a service accepting node, and the nodes 2, 3, 4, and 5 participate in the consensus process for the service data as consensus nodes for the service data.
In the embodiment of the present application, a node of a main chain of a block chain may be a service data reception node, or may not be a service data reception node, but be a node for initiating a consensus process, or a complete node of the current consensus process, which is not specifically limited herein.
If the node of the main chain of the block chain is used as the receiving node of the service data, the block chain link point may retrieve a part of the service data from the locally stored received service data as the service data to be identified, so as to initiate the identification process for the retrieved part of the service data subsequently.
If the node of the service chain is not taken as a service data acceptance node but is taken as a complete node of the common identification processing, the block chain node can drag out a part of service data from the service data resource pool to be common identified as the service data to be common identified, so as to subsequently initiate the common identification processing for the dragged part of service data.
Specifically, the node of the service chain receives a target block sent by the interactive platform, and after receiving the target block to be identified, acquires corresponding service data generating the service request to be identified. Since the user information of the target block is transmitted to the common node, when the node receives the service data, the node can determine which user side the service processing data corresponding to the target block is received by as long as the service data includes the user information.
Step S303, if the received node is the incomplete node, forwarding the target block to the complete node.
In the embodiment of the present application, as described above, the interaction platform provides an external standard protocol for interfacing, and specifically, each service chain network may develop a client with a built-in standard protocol according to an Application Programming Interface (API) provided by the interaction platform, and interface with the interaction platform to form an external common node, which is called a complete node. In addition, any subject can also be docked to the interactive platform to become an internal common knowledge node, called a non-complete node.
The type of the pair of common knowledge nodes can be individuals, enterprises, regulatory agencies and the like, and can also be different credit levels of high credit, medium credit, low credit and the like. In short, the types of the internal common knowledge nodes can be divided according to actual situations, and the application does not limit the types.
Specifically, for individuals or individuals, a client with a built-in docking standard protocol can be installed on a terminal, and a service request can be submitted at any time through the client; for an enterprise, especially an enterprise providing services for users, the application of the enterprise can be connected with the configuration center, and when the enterprise provides services for the users, a service request corresponding to the service can be submitted for the corresponding consensus subsystem to perform consensus verification.
For example, a client of a certain e-commerce platform may have a built-in docking standard protocol, dock with the interactive platform, and when a user purchases a product on the e-commerce platform, the e-commerce platform requests the consensus sub-network to perform consensus verification on the product purchased by the user, whether the user has paid successfully, and the like, and feeds back the consensus verification to the user.
For example, a common individual may become an internal consensus node, when two internal consensus nodes transfer money, one of the internal consensus nodes may initiate a service request, request the regional block chain network corresponding to the payment field to perform consensus check for the transfer, and record a block corresponding to the transfer on the regional block chain.
In a word, under the architecture of the system, application scenes are very rich, individuals can become internal common knowledge nodes to request to check various events generated by the internal common knowledge nodes, and enterprises can become the internal common knowledge nodes to enhance the trust of users on the internal common knowledge nodes.
In this embodiment of the present application, the incomplete node is an internal node subject, and in this system, an identity of the node may be given to the internal node subject, but these incomplete nodes cannot participate in external consensus verification in the application scenario of the present application, and the external consensus verification in the application scenario of the present application is performed by the complete node.
However, the incomplete node in the application scenario of the present application may perform the mutual recognition check, and as described above, the entire society may be brought into a unified credit system based on the service chain, and when the service chain corresponds to a public blockchain network, the public blockchain network only needs to be docked with the service chain, and the original operation of the public blockchain network, i.e., the main chain, is not affected.
Specifically, if the receiving node of the service chain is the incomplete node which is commonly seen from the inside, the received target block of step S102 is forwarded to the complete node which is commonly seen from the outside.
In an alternative embodiment, the full node may be a leader node that is elected by the Raft algorithm. In the Raft protocol, each node in the distributed network can be divided into a leader node and a subordinate node, the leader node has the authority to send heartbeat information to the subordinate nodes in the distributed network, and the subordinate nodes in the distributed network can update the heartbeat information to the local information log of the subordinate nodes after receiving the heartbeat information sent by the leader node. In addition, when a service is initiated by the subordinate node, the subordinate node may transmit the service to the leader node, and be processed by the leader node, or be distributed to other subordinate nodes for processing.
The leader node may be generated by election of each internal consensus node when the block chain network starts to operate, and specifically, how the leader node elects and how the leader node changes, may be consistent with a Raft protocol in the prior art, which is not limited in this application.
Further, in this embodiment of the application, when the distributed protocol is a Raft protocol, since a leader node in the Raft protocol needs to send heartbeat information to each node in the network, when determining the leader node in the blockchain network, the consensus node may determine the leader node through the received heartbeat information. If the consensus node does not receive the heartbeat information sent by the leader node in the time period corresponding to the heartbeat information, the consensus node can wait for other consensus nodes to initiate elections, receive voting requests sent by candidate nodes, and select the leader node in the next deadline by responding to the voting requests. Of course, the consensus node may also become an voter node and send a voting request to other consensus nodes, and then the consensus node may also become a leader node in the blockchain network. Since the determination of the leader node belongs to the prior art, detailed description of the technology is omitted in this application.
It should be noted that the complete node or the incomplete node may be a terminal, such as a device like a mobile phone, a personal computer/a tablet computer, or the complete node or the incomplete node may also be a server, and the server may be a server corresponding to the incomplete node or the incomplete node, and the server may be a single device, or may be a system composed of multiple devices, as long as the device can be used as the incomplete node or the incomplete node of the blockchain network to receive service data sent by an interaction platform corresponding to the consensus node, and has a right to initiate consensus in the blockchain network, and the specific kind of the device of the incomplete node or the incomplete node is not limited in the present application.
Step S304, the complete node verifies the received target block, and if the received target block passes the verification, the complete node fragments the target block and broadcasts the obtained fragment data to a service chain for storage. The detailed description is as follows:
step S3041, comparing whether the received hash of the target block is consistent with the hash of the latest block of the complete node, if so, verifying the target block, and if so, indicating that the target block passes verification.
As described above, since the user information of the target block is transmitted to the common node, when the node receives the service data, it is possible to determine which user has received the service data corresponding to the block as long as the service data includes the user information.
Specifically, first, the received hash of the target block is compared with the hash of the latest block of the complete node to determine whether the received hash of the target block is consistent with the hash of the latest block of the complete node, and if the comparison result is consistent, it indicates that the target block is the latest block, so that data synchronization between the data of the service link node and the data of the target node is achieved. Then, on the basis that the data of the service chain node and the data of the target node realize data synchronization, performing consensus verification on the target block, specifically, the complete node can verify the signature information contained in the target block by using a public key held by the complete node itself, and after determining that the signature information passes verification, verifying the head hash value of the target block according to the content contained in the target block. After determining that the head hash value of the target block passes the verification, it may be determined that the target block passes the verification, that is, the target block passes the service chain verification, and the target block may be stored as a block in its service chain. The check code type may be configured as various encryption algorithms or check codes generated by a check algorithm commonly used by those skilled in the art.
It should be noted that, in the field of blockchain technology, specifically, each node performs consensus verification on a target block according to a consensus algorithm, and a blockchain network has access to privacy such as an account and a transaction record of each node for verification.
Step S3042, if at least two target blocks are received, where the at least two target blocks are respectively sent by different sub-chain nodes, and corresponding previous target blocks are the same, adding the at least two target blocks into the block chain where the complete node is located according to the change time sequence of the at least two target blocks.
As can be seen from the above, when a synchronization target block is requested from a target node, the main chain is firstly divided into a plurality of block sub-chains, and then the synchronization target block is requested from the target node of each block sub-chain to obtain the latest target block in each block sub-chain.
In practical applications, a plurality of different blockchain sub-link nodes send respective target blocks to a complete node at the same time, in this case, the head hash values of the previous blocks included in the target blocks of the different blockchain sub-link nodes may be the same, and if the complete node determines that the target blocks all pass verification, the target blocks are stored in a blockchain process, and a branched chain situation occurs, thereby increasing the complexity of the blockchain.
Therefore, in the embodiment of the present invention, when the complete node receives at least two special target blocks, the special target blocks may be sorted according to the block generation time and/or the head hash value of each special target block included in each special target block, and based on the obtained sorting result, the head hash value of the previous target block included in each special target block and the head hash value corresponding to each special target block are updated and stored.
Step S3043, segment the target block into one or more pieces of sliced data, and randomly encode the one or more pieces of sliced data into corresponding one or more pieces of target sliced data.
Preferably, in order to ensure load balancing of each node in the entire pair of common node sets, the load capacity of each node in the node set may be determined, and further, the amount of current idle resources of each node may be determined, so as to determine the number of fragmented data segmented by the target block.
Further, in order to further improve the security of the target block, the one or more pieces of sliced data are randomly encoded. The random coding in the embodiment of the present invention is not different from the conventional random linear network coding, and thus will not be described in detail in the following description.
Step S3044, acquiring the hash of the target block and the hashes of the target fragment data, and broadcasting the hashes of the target block and the hashes of the target fragment data to a service chain for storage.
In the embodiment of the present invention, this step is mainly used to record the distribution of the target blocks stored in the service chain, and establish an index relationship among the hash of the target block, the hash set of the target fragment data, and the uniform resource location of the target block, so as to be used when the incomplete node of the service chain stores the target block.
Specifically, the complete node acquires the hash of the target block and the hashes of the target fragmented data, and forms a target fragmented data hash set according to the hashes of the target fragmented data; and establishing an index relationship among the Hash of the target block, the Hash set of the target fragment data and the uniform resource positioning table of the target block, and broadcasting the Hash of the target block, the Hash set of the target fragment data, the uniform resource positioning table of the target block and the index relationship to a service chain for storage.
Step S305, receiving the fragment data and storing the fragment data in a distributed manner. The detailed description is as follows:
step S3051, obtaining the hash of the target fragment data;
each target fragment has a unique hash corresponding to it for identifying and distinguishing the target fragments, so that a non-complete node of a service chain needs to acquire the hash of the target fragment.
Step S3052, searching a corresponding target block according to the hash of the target fragment data and acquiring corresponding target fragment data content;
specifically, a corresponding target fragment data hash set is searched according to the hash of the target fragment data, a uniform resource positioning table of a target block corresponding to the target fragment data hash set is obtained according to an index relationship among the target fragment data hash set, the hash of the target block and the uniform resource positioning table of the target block, the target block is read according to the uniform resource positioning table of the target block, and corresponding target fragment data content is obtained from the target block according to a target block fragmentation threshold.
Step S3053, storing the hash of the target fragment data and the content of the target fragment data to a service chain where the incomplete node is located.
In practical application, a node on a service chain first completes storage of a target fragment corresponding to a first hash in a target fragment hash set, and then completes storage of target fragment data corresponding to a next hash in the target fragment data hash set through other nodes on the service chain, and the steps are repeated until all hashes in the target fragment data hash set are traversed until the whole target block is completely stored.
After receiving the fragment data, other non-complete nodes of the service chain may store the fragment data as a block in the service chain stored in the non-complete nodes of the service chain in the same manner.
EXAMPLE five
An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the above-mentioned incomplete data synchronization method based on block chain data.
In summary, according to the incomplete data synchronization method and system based on block chain data provided in the embodiments of the present invention, blocks are stored in blocks by using multiple nodes on a service chain, so that an overall storage manner adopted in distributed storage based on a block chain in the prior art is changed, and block storage with a large data size can be satisfied; the risk that the block is integrally damaged under the potential conditions such as downtime, operation faults and the like in the integral storage mode is avoided, and even if the risk exists, synchronous data can be acquired from other normally-operated block chain nodes, so that the safety of data storage is improved; due to the anti-tampering characteristic of the blockchain, any party cannot tamper the stored data in the blockchain privately, so that the safety of the stored data is effectively guaranteed. Therefore, the embodiment of the invention achieves the following technical effects: the method solves the problems that the time consumed by sharing data is continuously increased along with the continuous increase of the data volume of the block chain in the prior art, block chain network congestion and block storage burden are easily caused, and therefore the purposes of shortening the sharing period, improving the sharing efficiency, saving the storage quantity and ensuring the data safety are achieved.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that the acts and modules illustrated are not necessarily required to practice the invention.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions described in accordance with the embodiments of the present application are generated in whole or in part when the computer program instructions are loaded or executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more collections of available media. The available media may be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., DVDs), or semiconductor media. The semiconductor medium may be a solid state disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. 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 application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
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 can be realized in a form of hardware, and can also be realized in a form of a software functional 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 computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for incomplete data synchronization based on blockchain data, the blockchain including a main chain and a plurality of service chains, wherein the service chains include a complete node participating in the consensus of the main chain and a plurality of incomplete nodes participating in the consensus of the service chains, the method comprising:
requesting a synchronization target block from a target node;
receiving the requested target block;
if the received node is the incomplete node, forwarding the target block to the complete node;
and the complete node verifies the received target block, and if the received target block passes the verification, the target block is fragmented and the obtained fragmented data is broadcasted to a service chain for storage.
2. The method of claim 1, wherein the verifying the received target block by the full node comprises:
and the complete node compares whether the received pre-hash of the target block is consistent with the hash of the latest block of the complete node, if so, the complete node performs consensus verification on the target block, and if the target block passes the verification, the verification is passed.
3. The method of claim 2, wherein requesting a synchronization target block from a target node comprises:
dividing the main chain into a plurality of blockchain subchains;
and requesting the target node of each block subchain to synchronize the target block so as to acquire the latest target block in each block subchain.
4. The method of claim 3, wherein before the target block is sliced, the method further comprises:
and if at least two target blocks are received, the at least two target blocks are respectively sent by different block sub-chain nodes, and the corresponding previous target blocks are the same, adding the at least two target blocks into a block chain where the complete node is located according to the change time sequence in the at least two target blocks.
5. The method of claim 1, wherein the slicing the target block comprises:
and segmenting the target block into one or more pieces of fragment data, and randomly encoding the one or more pieces of fragment data into corresponding one or more pieces of target fragment data.
6. The method according to any of claims 1-5, wherein the broadcasting the obtained fragmented data to a service chain for storage comprises:
and acquiring the hash of the target block and the hash of each target fragment data, and broadcasting the hash of the target block and the hash of each target fragment data to a service chain for storage.
7. The method of claim 6, further comprising:
obtaining the hash of the target fragment data;
searching a corresponding target block according to the hash of the target fragment data and acquiring corresponding target fragment data content;
and storing the hash of the target fragment data and the content of the target fragment data to a service chain where the incomplete node is located.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201811206580.4A 2018-10-17 2018-10-17 Incomplete data synchronization method, system and equipment based on block chain data Active CN109522362B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811206580.4A CN109522362B (en) 2018-10-17 2018-10-17 Incomplete data synchronization method, system and equipment based on block chain data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811206580.4A CN109522362B (en) 2018-10-17 2018-10-17 Incomplete data synchronization method, system and equipment based on block chain data

Publications (2)

Publication Number Publication Date
CN109522362A CN109522362A (en) 2019-03-26
CN109522362B true CN109522362B (en) 2020-09-15

Family

ID=65771758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811206580.4A Active CN109522362B (en) 2018-10-17 2018-10-17 Incomplete data synchronization method, system and equipment based on block chain data

Country Status (1)

Country Link
CN (1) CN109522362B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309173A (en) * 2019-06-14 2019-10-08 深圳前海达闼云端智能科技有限公司 Contract data recording method and device, block chain node and storage medium

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110086856B (en) * 2019-04-01 2022-02-01 达闼机器人有限公司 Control method and device of block chain node, storage medium and electronic equipment
CN110099106B (en) * 2019-04-24 2022-04-19 福建方维信息科技有限公司 Method and terminal for data synchronization between nodes in block chain
CN110347497B (en) * 2019-06-03 2020-07-21 阿里巴巴集团控股有限公司 Method and device for dividing multiple storage devices into device groups
US11099759B2 (en) 2019-06-03 2021-08-24 Advanced New Technologies Co., Ltd. Method and device for dividing storage devices into device groups
CN110210845B (en) * 2019-06-11 2021-06-18 网易(杭州)网络有限公司 Method, apparatus, medium, and computing device for blockchain data migration
CN110442644A (en) * 2019-07-08 2019-11-12 深圳壹账通智能科技有限公司 Block chain data filing storage method, device, computer equipment and storage medium
CN110430282B (en) * 2019-08-16 2022-03-01 微位(深圳)网络科技有限公司 Data transmission method and device between nodes of distributed system
CN110505305B (en) * 2019-08-27 2022-04-01 深圳市迅雷网络技术有限公司 Block chain fragmentation method and device and block chain system
CN110597466B (en) * 2019-09-16 2021-10-26 腾讯科技(深圳)有限公司 Control method and device of block chain node, storage medium and computer equipment
CN110609872B (en) * 2019-09-20 2021-03-05 北京海益同展信息科技有限公司 Method and apparatus for synchronizing node data
CN110737664B (en) * 2019-10-21 2022-11-25 深圳前海微众银行股份有限公司 Method and device for synchronizing block chain link points
CN111130801A (en) * 2019-12-26 2020-05-08 腾讯科技(深圳)有限公司 Data processing method and device, node equipment and computer storage medium
CN111221910A (en) * 2019-12-31 2020-06-02 杭州趣链科技有限公司 Fragment storage method for improving block chain read-write performance
CN111339086B (en) * 2020-02-18 2021-04-20 腾讯科技(深圳)有限公司 Block processing method, and data query method and device based on block chain
CN111339089B (en) * 2020-02-21 2023-09-22 联动优势科技有限公司 Data storage and acquisition method and device applied to blockchain
CN111478795B (en) * 2020-03-06 2022-08-12 重庆邮电大学 Alliance block chain network consensus method based on mixed Byzantine fault tolerance
CN111444203B (en) * 2020-03-24 2021-09-28 腾讯科技(深圳)有限公司 Synchronous processing method, device, equipment and medium
CN111432009B (en) * 2020-03-30 2023-04-07 深圳壹账通智能科技有限公司 Method and device for synchronizing block chain data, electronic equipment and storage medium
CN111597268B (en) * 2020-05-21 2023-09-12 昆明大棒客科技有限公司 Block chain extension method, block chain node and block chain system
CN111711526B (en) * 2020-06-16 2024-03-26 深圳前海微众银行股份有限公司 Method and system for consensus of block chain nodes
CN113098970A (en) * 2021-04-12 2021-07-09 浙江永旗区块链科技有限公司 Distributed network node data synchronization method
CN113722545B (en) * 2021-06-30 2023-04-28 电子科技大学 Data compiling and correcting method under license chain environment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649632B (en) * 2016-12-07 2018-03-16 北京众享比特科技有限公司 Method of data synchronization and system
CN107079059B (en) * 2016-12-21 2019-12-10 深圳前海达闼云端智能科技有限公司 Block chain storage method and device and node equipment
CN107197036A (en) * 2017-06-22 2017-09-22 广东网金控股股份有限公司 A kind of consistent processing method of information based on block chain and terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309173A (en) * 2019-06-14 2019-10-08 深圳前海达闼云端智能科技有限公司 Contract data recording method and device, block chain node and storage medium
CN110309173B (en) * 2019-06-14 2021-08-13 达闼机器人有限公司 Contract data recording method and device, block chain node and storage medium

Also Published As

Publication number Publication date
CN109522362A (en) 2019-03-26

Similar Documents

Publication Publication Date Title
CN109522362B (en) Incomplete data synchronization method, system and equipment based on block chain data
CN109547530B (en) Region consensus method, system and equipment
CN112153085B (en) Data processing method, node and block chain system
CN107809484B (en) Block chain transaction information processing method and block chain link point
KR101950912B1 (en) Verification system and method for transaction based block chain
CN109150971B (en) Super node voting and election method and device and network node
CN115210741B (en) Partially ordered blockchain
US20190268139A1 (en) Data authentication using a blockchain approach
CN110771127B (en) Method and system for consistent distributed memory pools in a blockchain network
KR20210005679A (en) Method and apparatus for selecting representative node devices, computer devices, and storage media
WO2017109140A1 (en) Decentralized, tamper-resistant, asset-oriented database system and method of recording a transaction
WO2021082863A1 (en) Method and device for evaluating consensus node
CN109302495A (en) A kind of date storage method and device
CN110505228B (en) Edge cloud architecture-based big data processing method, system, medium and device
CN113256297B (en) Data processing method, device and equipment based on block chain and readable storage medium
CN112988667B (en) Data storage method and device based on block chain network
CN113256424B (en) Transaction data processing method, device, equipment and storage medium
CN111367965B (en) Target object determining method, device, electronic equipment and storage medium
KR102542631B1 (en) Method and system for verifying blockchain data stored in a storage format different from blockchain
CN113518005B (en) Block consensus method, device, equipment and storage medium
CN113628049A (en) Block chain intelligent contract conflict resolution method based on group intelligence
CN112134883A (en) Method and device for quickly authenticating trust relationship between nodes based on trusted computing and related products
JP2020204898A (en) Method, system, and program for managing operation of distributed ledger system
CN115829731A (en) Transaction information processing method and device
CN115310137A (en) Secrecy method and related device of intelligent settlement system

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