Method for synchronizing activity states among block chains
By introducing routers and synchronizers into the blockchain, collecting data in real time and judging synchronization needs through algorithms, the problems of high synchronization complexity and waste of resources among blockchains in the existing technology are solved, and efficient and low-complexity state synchronization is achieved.
Patent Information
- Application Number
- CN202411839068.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-13
AI Technical Summary
When the prior art realizes the synchronization of active states between blockchains, it has high complexity and high resource consumption, especially when synchronization is not required, resulting in wasting system resources.
By adding routers and synchronizers to the blockchain, collecting node data in real time and generating flag codes, the synchronizer uses algorithms to determine whether synchronization is needed, reducing synchronization complexity and avoiding unnecessary resource consumption.
It improves the efficiency of active state synchronization among blockchains, significantly reduces complexity, and avoids waste of resources caused by synchronization without synchronization.
Smart Images

Figure CN119676252A_ABST
Abstract
Description
Background Art
[0002] What is blockchain? From a technological perspective, blockchain involves many scientific and technological issues such as mathematics, cryptography, the Internet, and computer programming. From an application perspective, in simple terms, blockchain is a distributed shared ledger and database with the characteristics of decentralization, immutability, full traceability, traceability, collective maintenance, and openness and transparency. These characteristics ensure the "honesty" and "transparency" of blockchain and lay the foundation for blockchain to create trust. The rich application scenarios of blockchain are basically based on the ability of blockchain to solve the problem of information asymmetry and achieve collaborative trust and concerted action among multiple entities.
[0003] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is an important concept of Bitcoin. It is essentially a decentralized database. At the same time, as the underlying technology of Bitcoin, it is a string of data blocks generated by cryptographic methods. Each data block contains a batch of Bitcoin network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block.
[0004] Blockchain has the following characteristics: Decentralization. Blockchain technology does not rely on additional third-party management agencies or hardware facilities, and has no central control. In addition to the self-contained blockchain itself, each node realizes self-verification, transmission and management of information through distributed accounting and storage. Decentralization is the most prominent and essential feature of blockchain. Openness. The foundation of blockchain technology is open source. In addition to the encryption of private information of the transaction parties, the data of the blockchain is open to everyone. Anyone can query blockchain data and develop related applications through public interfaces, so the information of the entire system is highly transparent. Independence. Based on consensus specifications and protocols (similar to various mathematical algorithms such as hash algorithms used by Bitcoin), the entire blockchain system does not rely on other third parties. All nodes can automatically and securely verify and exchange data within the system without any human intervention. Security. As long as 51% of all data nodes cannot be controlled, network data cannot be manipulated and modified at will, which makes the blockchain itself relatively safe and avoids subjective and artificial data changes. Anonymity. Unless there are legal regulations, from a technical point of view, the identity information of each block node does not need to be disclosed or verified, and information transmission can be anonymous. Summary of the invention
[0005] The main purpose of the present invention is to provide an activity status synchronization method between blockchains, which performs status synchronization and data synchronization by adding routers and synchronizers in the blockchain to achieve activity status synchronization between blockchains; the real-time data collection and flag code generation are ensured by the router; the router is controlled by the synchronizer to achieve synchronization. During the synchronization process, the synchronizer determines whether synchronization is required through an algorithm. The judgment process is implemented based on the data collected by the router, thereby improving the synchronization efficiency; compared with the prior art that requires continuous acquisition of data from each node to achieve synchronization, the complexity is significantly reduced, and the situation of consuming system resources by performing synchronization when synchronization is not required is effectively avoided.
[0006] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0007] A method for synchronizing activity status between blockchains, the method performing the following steps:
[0008] Step 1: Group the target blockchain to obtain several sub-blockchains; each blockchain contains at least two nodes;
[0009] Step 2: A router is set in each sub-blockchain; the router is respectively connected to each node signal in the sub-blockchain, collects the operation data of each node in real time, and generates a unique identification code according to the collected operation data; the router writes the generated unique identification code into a preset identification code tree; the router then generates the data identification code of the router according to all the unique identification codes in the identification code tree;
[0010] Step 3: A synchronizer is randomly set in the target blockchain, and the synchronizer is regarded as a node in the target blockchain. When the synchronizer performs state synchronization, it first obtains the data identifier of the router in the sub-blockchain where the target node in the target blockchain to be synchronized is located, determines the data to be synchronized, and synchronizes the data to be synchronized. After completing the data synchronization, it performs state synchronization based on the running data of the node collected by the router.
[0011] Step 4: When performing data synchronization, the router sends the data to be synchronized to the synchronizer; the synchronizer first uses a preset comparison model to compare the data to be synchronized to find the difference parts in the data to be synchronized, and sends the difference parts back to the router respectively; the router completes data synchronization based on the received difference parts;
[0012] Step 5: When performing state synchronization, the router sends the real-time operation data of each node in the sub-blockchain to the synchronizer; the synchronizer first uses the preset comparison model to compare the real-time operation data to find the differences between the real-time operation data, and sends the differences found to the router. The router completes the state synchronization based on the received differences.
[0013] Furthermore, the method further comprises, before determining the data to be synchronized: comparing the data identification codes of the routers of the two parties that need to synchronize data, and when the data identification codes of the routers of the two parties are inconsistent, executing the step of determining the data to be synchronized.
[0014] Furthermore, before comparing the data flag codes of the routers of both parties, the method further includes: calculating the data flag codes of the routers of both parties; the calculation of the data flag codes of the routers includes: for each leaf node in the router, obtaining the flag code of the leaf node by performing a flag code operation on the content of the leaf node; for each intermediate node in the router, obtaining the flag code of the intermediate node by arranging the flag codes of all child nodes of the intermediate node in sequence and then performing a flag code operation; obtaining the flag code of the router by arranging the flag codes of all child nodes of the root node of the router in sequence and then performing a flag code operation.
[0015] Furthermore, the method for the synchronizer to compare the real-time operation data and the data to be synchronized includes: constructing a comparison matrix based on the real-time operation data or the data to be synchronized, and the comparison matrix is expressed by the following formula: Among them, p 11 …p nk Each represents a data pair, including two real-time running data to be compared or two data to be synchronized; the comparison matrix is brought into the comparison model, and the comparison model compares the real-time running data based on the comparison matrix, or the comparison matrix compares the data to be synchronized based on the comparison matrix; the comparison model is expressed using the following formula: The three discriminant values H obtained by comparison s , H y and H t If H s , H y and H t If the real-time running data or the data to be synchronized are the same, then synchronization is not required. s , H y and H t If the three values are completely different from each other, it is determined that the real-time running data or the data to be synchronized is inconsistent, and all data needs to be synchronized; if H yand H t Same as H s If they are the same, it is determined that the real-time running data or the data to be synchronized corresponds to the self-p in the comparison matrix. 11 to p kk All parts need to be synchronized.
[0016] Furthermore, the router encrypts any data before sending it to the synchronizer.
[0017] Furthermore, the method for encrypting data by the router includes: obtaining an encryption key and data; selecting an encryption rule from a preset encryption rule library; using the encryption key to encrypt the data according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; packaging the intermediate data and the identification information to generate encrypted data; obtaining the identification information corresponding to the encryption rule includes: extracting a characteristic value of the data; using the encryption key to encrypt the characteristic value according to the encryption rule to obtain the identification information corresponding to the encryption rule.
[0018] Furthermore, the step of arranging the identification codes of the sub-nodes in order includes: arranging the sub-nodes in order according to the identifications of the sub-nodes.
[0019] Furthermore, the method of determining the data to be synchronized by comparing the data flag codes in the routers of both parties that need to synchronize data includes: starting from the flag code of the router root node, comparing the flag codes of each node in the routers of both parties step by step; when the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the subordinate nodes of the intermediate node are no longer compared.
[0020] Furthermore, the method of comparing the flag codes of the nodes in the routers of both parties step by step starting from the flag code of the root node of the router, when the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the lower-level nodes of the intermediate node are no longer compared. Specifically, it includes: step A, judging whether the flag codes of the root nodes in the routers of both parties are consistent, and executing step B when they are inconsistent; step B, entering any lower-level node for which flag code comparison has not been performed, and comparing whether the flag codes of the lower-level node are consistent, if yes, executing step E, otherwise executing step C; step C, judging whether the lower-level node is an intermediate node, if yes, executing step B; otherwise executing step D; step D, determining whether the data of the lower-level node is data that needs to be synchronized, and executing step E; step E, returning to the upper-level node, judging whether the upper-level node has other lower-level nodes for which flag code comparison has not been performed, if yes, executing step B, otherwise executing step F; step F, judging whether the upper-level node is a root node, if yes, ending, otherwise executing step E.
[0021] Furthermore, the encryption rules included in the encryption rule library are all data shuffling rules; the use of the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: performing data shuffling processing on the encryption key and the data according to the encryption rules to obtain intermediate data.
[0022] The method for synchronizing the activity status between blockchains of the present invention has the following beneficial effects: it performs status synchronization and data synchronization by adding a router and a synchronizer in the blockchain to achieve synchronization of the activity status between blockchains; ensures real-time data collection and generates a flag code by a router; controls the router by a synchronizer to achieve synchronization, and during the synchronization process, the synchronizer determines whether synchronization is required by an algorithm, and the determination process is implemented based on the data collected by the router, thereby improving the efficiency of synchronization; compared with the prior art, which requires continuous acquisition of data from each node to achieve synchronization, the complexity is significantly reduced, and the occurrence of a situation in which synchronization is performed when synchronization is not required and system resources are consumed is effectively avoided. It is mainly realized through the following processes: 1. Control of routers and synchronizers: The present invention groups the target blockchain through routers, and the routers manage the nodes in the grouped sub-blockchains, collect node data in real time, and do not need frequent data interaction between nodes, saving system resources; in addition, after obtaining the data, the synchronizer is used to determine in advance whether synchronization is required based on the obtained data, avoiding unnecessary subsequent operations and improving the efficiency of synchronization; 2. Data comparison algorithm: When comparing data, the present invention constructs a comparison matrix based on real-time running data or data that needs to be synchronized; then, through the constructed comparison matrix, a comparison model is used to determine whether the data needs to be synchronized. Compared with the traditional one-by-one comparison of data, it significantly reduces the amount of data required for comparison and improves efficiency; 3. Establishment of flag codes: The present invention compares the flag codes of each node in the routers of both parties step by step starting from the flag code of the router root node; in this way, the judgment before data comparison is made, which further reduces the redundant operations required for data synchronization and improves efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of a method flow of a method for synchronizing activity states between blockchains provided by an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of the distributed structure of a synchronizer and a router in the method for synchronizing activity states between blockchains provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of a structure for data transmission between a synchronizer and a router in a method for synchronizing activity states between blockchains provided by an embodiment of the present invention;
[0026] Figure 4 A schematic diagram of an experimental curve showing how the recognition efficiency of the method for synchronizing activity states between blockchains provided in an embodiment of the present invention changes with the number of nodes, and a schematic diagram of comparative experimental results of the prior art. DETAILED DESCRIPTION
[0027] The technical solution of the present invention is further described in detail below in conjunction with specific implementations and drawings:
[0028] Example 1
[0029] like Figure 1 As shown, a method for synchronizing activity states between blockchains is performed by:
[0030] Step 1: Group the target blockchain to obtain several sub-blockchains; each blockchain contains at least two nodes;
[0031] Step 2: A router is set in each sub-blockchain; the router is respectively connected to each node signal in the sub-blockchain, collects the operation data of each node in real time, and generates a unique identification code according to the collected operation data; the router writes the generated unique identification code into a preset identification code tree; the router then generates the data identification code of the router according to all the unique identification codes in the identification code tree;
[0032] Step 3: A synchronizer is randomly set in the target blockchain, and the synchronizer is regarded as a node in the target blockchain. When the synchronizer performs state synchronization, it first obtains the data identifier of the router in the sub-blockchain where the target node in the target blockchain to be synchronized is located, determines the data to be synchronized, and synchronizes the data to be synchronized. After completing the data synchronization, it performs state synchronization based on the running data of the node collected by the router.
[0033] Step 4: When performing data synchronization, the router sends the data to be synchronized to the synchronizer; the synchronizer first uses a preset comparison model to compare the data to be synchronized to find the difference parts in the data to be synchronized, and sends the difference parts back to the router respectively; the router completes data synchronization based on the received difference parts;
[0034] Step 5: When performing state synchronization, the router sends the real-time operation data of each node in the sub-blockchain to the synchronizer; the synchronizer first uses the preset comparison model to compare the real-time operation data to find the differences between the real-time operation data, and sends the differences found to the router. The router completes the state synchronization based on the received differences.
[0035] By adopting the above technical scheme, the present invention adds a router and a synchronizer in the blockchain to perform state synchronization and data synchronization, so as to realize the synchronization of activity states between blockchains; the real-time data collection and the generation of flag codes are ensured by the router; the router is controlled by the synchronizer to realize synchronization, and during the synchronization process, the synchronizer determines whether synchronization is required through an algorithm, and the judgment process is realized based on the data collected by the router, thereby improving the efficiency of synchronization; compared with the prior art that needs to continuously obtain the data of each node to realize synchronization, the complexity is significantly reduced, and the situation that synchronization is performed when synchronization is not required and system resources are consumed is effectively avoided. It is mainly realized through the following processes: 1. Control of routers and synchronizers: The present invention groups the target blockchain through routers, and the routers manage the nodes in the grouped sub-blockchains, collect node data in real time, and do not need frequent data interaction between nodes, saving system resources; in addition, after obtaining the data, the synchronizer is used to determine in advance whether synchronization is required based on the obtained data, avoiding unnecessary subsequent operations and improving the efficiency of synchronization; 2. Data comparison algorithm: When comparing data, the present invention constructs a comparison matrix based on real-time running data or data that needs to be synchronized; then, through the constructed comparison matrix, a comparison model is used to determine whether the data needs to be synchronized. Compared with the traditional one-by-one comparison of data, it significantly reduces the amount of data required for comparison and improves efficiency; 3. Establishment of flag codes: The present invention compares the flag codes of each node in the routers of both parties step by step starting from the flag code of the router root node; in this way, the judgment before data comparison is made, which further reduces the redundant operations required for data synchronization and improves efficiency.
[0036] Example 2
[0037] Based on the previous embodiment, the method further includes, before determining the data that needs to be synchronized: comparing the data identification codes of the routers of the two parties that need to synchronize data, and when the data identification codes of the routers of the two parties are inconsistent, executing the step of determining the data that needs to be synchronized.
[0038] Specifically, routers are usually located at the network layer, so routing technology is also a technology related to the network layer. Routers have many changes and differences compared to early bridges. Generally speaking, bridges have great limitations. They can only connect networks with the same or similar data link layers, and cannot connect networks with large differences between data link layers. But routers are different. They break this limitation and can connect any two different networks. However, these two different networks must abide by a principle, that is, use the same network layer protocol, so that they can be connected by routers. Routing technology is simply a technology for forwarding and exchanging a lot of information on the network. Specifically, it is to transmit information from the source address to the destination address through the Internet. Routing technology has also made good development and progress in recent years. In particular, the emergence of the fifth-generation router has met people's comprehensive application of data, voice and images, and has gradually been selected and widely used by most home networks. In addition, in recent years, my country's routing technology has become more and more mature, and it has also been combined with contemporary intelligent technology, so that people can experience fast and rapid effects in the process of using routing technology, thereby promoting and promoting the development of the Internet and network technology.
[0039] Example 3
[0040] On the basis of the previous embodiment, the method further includes, before comparing the data flag codes of the routers of the two parties: calculating the data flag codes of the routers of the two parties; the calculation of the data flag codes of the routers includes: for each leaf node in the router, obtaining the flag code of the leaf node by performing a flag code operation on the content in the leaf node; for each intermediate node in the router, obtaining the flag code of the intermediate node by arranging the flag codes of all child nodes of the intermediate node in sequence and then performing a flag code operation; obtaining the flag code of the router by arranging the flag codes of all child nodes of the root node of the router in sequence and then performing a flag code operation.
[0041] Specifically, a router is a hardware device that connects two or more networks and acts as a gateway between networks. It is a dedicated intelligent network device that reads the address in each data packet and then decides how to transmit it. It can understand different protocols, such as the Ethernet protocol used by a local area network and the TCP / IP protocol used by the Internet. In this way, the router can analyze the destination address of data packets from various types of networks, convert the address of non-TCP / IP networks into TCP / IP addresses, or vice versa; and then transmit each data packet to the designated location along the best route based on the selected routing algorithm. Therefore, a router can connect non-TCP / IP networks to the Internet.
[0042] Example 4
[0043] Based on the previous embodiment, the synchronizer compares the real-time operation data and the method for comparing the data to be synchronized includes: constructing a comparison matrix based on the real-time operation data or the data to be synchronized, and the comparison matrix is expressed by the following formula: Among them, p 11 …p nk Each represents a data pair, including two real-time running data to be compared or two data to be synchronized; the comparison matrix is brought into the comparison model, and the comparison model compares the real-time running data based on the comparison matrix, or the comparison matrix compares the data to be synchronized based on the comparison matrix; the comparison model is expressed using the following formula: The three discriminant values H obtained by comparison s , H y and H t If H s , H y and H t If the real-time running data or the data to be synchronized are the same, then synchronization is not required. s , H y and H t If the three values are completely different from each other, it is determined that the real-time running data or the data to be synchronized is inconsistent, and all data needs to be synchronized; if H y and H t Same as H s If the data is the same, it is determined that the real-time running data or the data to be synchronized corresponds to the data in the comparison matrix. 11 to p kk All parts need to be synchronized.
[0044] Example 5
[0045] Based on the previous embodiment, the router encrypts any data before sending it to the synchronizer.
[0046] Specifically, an encryption algorithm that uses the same key for encryption and decryption is required. Due to its speed, symmetric encryption is often used when the sender of a message needs to encrypt a large amount of data. Symmetric encryption is also called secret key encryption.
[0047] Symmetric means that both parties using this encryption method use the same key for encryption and decryption. The key is the instruction that controls the encryption and decryption process. The algorithm is a set of rules that specifies how to encrypt and decrypt.
[0048] Therefore, the security of encryption depends not only on the encryption algorithm itself, but also on the security of key management. Because both encryption and decryption use the same key, how to securely transfer the key to the decryptor becomes a problem that must be solved.
[0049] Example 6
[0050] On the basis of the previous embodiment, the method for encrypting data by the router includes: obtaining an encryption key and data; selecting an encryption rule from a preset encryption rule library; using the encryption key to encrypt the data according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; packaging the intermediate data and the identification information to generate encrypted data; obtaining the identification information corresponding to the encryption rule includes: extracting a feature value of the data; using the encryption key to encrypt the feature value according to the encryption rule to obtain the identification information corresponding to the encryption rule.
[0051] Specifically, encryption is based on mathematical encoding and decoding of information. There are two types of encryption, symmetric encryption and asymmetric encryption. Symmetric encryption uses a common key between both parties (of course, this key needs to be kept secret). Here we will talk about asymmetric encryption, which has two keys: a public key (as the name suggests, this is a key value that can be made public) and a private key (secret to the outside world). When you send a message to us, you use the public key to encrypt the message. Once we receive your encrypted message, we use the private key to decrypt the message (the message encrypted by our public key can only be decrypted by our private key, so it is technically guaranteed that only we can read the letter - because others do not have our private key). The message encrypted with the private key can only be decrypted with the public key (this function is applied to the field of digital signatures. The data encrypted by my private key can only be read by my public key. For specific content, please refer to the digital signature information) and vice versa to ensure the security of your information.
[0052] Example 7
[0053] Based on the previous embodiment, the step of arranging the identification codes of the sub-nodes in sequence includes: arranging the sub-nodes in sequence according to the identifications of the sub-nodes.
[0054] Example 8
[0055] On the basis of the previous embodiment, the method of determining the data to be synchronized by comparing the data flag codes in the routers of both parties that need to synchronize data includes: starting from the flag code of the router root node, comparing the flag codes of each node in the routers of both parties step by step; when the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the subordinate nodes of the intermediate node are no longer compared.
[0056] Example 9
[0057] On the basis of the previous embodiment, the flag codes of the nodes in the routers of both parties are compared step by step starting from the flag code of the root node of the router. When the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the lower-level nodes of the intermediate node are no longer compared. Specifically, it includes: step A, judging whether the flag codes of the root nodes in the routers of both parties are consistent, and executing step B when they are inconsistent; step B, entering any lower-level node where the flag code comparison has not been performed, and comparing whether the flag codes of the lower-level node are consistent, if yes, executing step E, otherwise executing step C; step C, judging whether the lower-level node is an intermediate node, if yes, executing step B; otherwise executing step D; step D, determining that the data of the lower-level node is the data that needs to be synchronized, and executing step E; step E, returning to the upper-level node, judging whether the upper-level node has other lower-level nodes whose flag codes have not been compared, if yes, executing step B, otherwise executing step F; step F, judging whether the upper-level node is a root node, if yes, ending, otherwise executing step E.
[0058] Example 10
[0059] Based on the previous embodiment, the encryption rules included in the encryption rule library are all data shuffling rules; the use of the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: according to the encryption rules, the encryption key and the data are shuffled to obtain intermediate data.
[0060] Specifically, software testing was born along with the emergence of software. In the early software development process, the software scale was very small and the complexity was low. The software development process was chaotic and quite random. The meaning of testing was relatively narrow. Developers equated testing with "debugging" to correct known faults in the software, and developers often completed this part of the work themselves. There was very little investment in testing, and testing intervention was also late. Testing was often not carried out until the code was formed and the product was basically completed. In the early 1980s, the software and IT industries entered a period of rapid development. Software tended to be large-scale and highly complex, and the quality of software became increasingly important. At this time, some basic theories and practical technologies of software testing began to take shape, and people began to design various processes and management methods for software development. The way of software development also gradually transitioned from a chaotic and disorderly development process to a structured development process, characterized by structured analysis and design, structured review, structured programming, and structured testing. People also incorporated the concept of "quality" into it, and the definition of software testing changed. Testing is not just a process of finding errors, but also a major function of software quality assurance (SQA), including the content of software quality evaluation. Bill Hetzel pointed out in the book "Complete Guide of Software Testing": "Testing is any activity aimed at evaluating the properties of a program or system. Testing is a measure of software quality." This definition is still quoted today. Software developers and testers began to sit together to discuss software engineering and testing issues.
[0061] The above is only an example of implementation of the present invention, but it cannot be used to limit the scope of the present invention. Any structural changes made according to the present invention should be regarded as falling within the protection scope of the present invention and subject to restrictions as long as they do not lose the essence of the present invention.
[0062] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0063] It should be noted that the system provided in the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of the present invention can be decomposed or combined. For example, the modules in the above embodiments can be combined into one module, or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present invention are only for distinguishing the modules or steps, and are not regarded as improper limitations of the present invention.
[0064] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the storage device and processing device described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0065] Those skilled in the art should be able to appreciate that the modules and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two, and the programs corresponding to the software modules and method steps can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field. In order to clearly illustrate the interchangeability of electronic hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0066] The terms "first", "second", etc. are used to distinguish similar objects rather than to describe or indicate a particular order or sequence.
[0067] The term "comprise" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus / device.
[0068] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0069] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A method for synchronizing activity status between blockchains, characterized in that: The method performs the following steps: Step 1: Group the target blockchain to obtain several sub-blockchains; each blockchain contains at least two nodes; Step 2: A router is set in each sub-blockchain; the router is respectively connected to each node signal in the sub-blockchain, collects the operation data of each node in real time, and generates a unique identification code based on the collected operation data; The router writes the generated unique identification code into the preset identification code tree; The router then generates the router data identifier based on all the unique identifiers in the identifier tree; Step 3: A synchronizer is randomly set in the target blockchain, and the synchronizer is regarded as a node in the target blockchain. When the synchronizer performs state synchronization, it first obtains the data identifier of the router in the sub-blockchain where the target node in the target blockchain to be synchronized is located, determines the data to be synchronized, and synchronizes the data to be synchronized. After data synchronization is completed, the status is synchronized based on the node operation data collected by the router; Step 4: When performing data synchronization, the router sends the data to be synchronized to the synchronizer; the synchronizer first uses a preset comparison model to compare the data to be synchronized to find the difference parts in the data to be synchronized, and sends the difference parts back to the router respectively; the router completes data synchronization based on the received difference parts; Step 5: When performing state synchronization, the router sends the real-time operation data of each node in the sub-blockchain to the synchronizer; the synchronizer first uses the preset comparison model to compare the real-time operation data to find the differences between the real-time operation data, and sends the differences found to the router. The router completes the state synchronization based on the received differences.
2. The method according to claim 1, characterized in that The method further comprises, before determining the data to be synchronized: comparing the data identification codes of the routers of the two parties that need to synchronize data, and when the data identification codes of the routers of the two parties are inconsistent, executing the step of determining the data to be synchronized.
3. The method according to claim 2, characterized in that Before comparing the data identification codes of the routers of the two parties, the method further comprises: calculating the data identification codes of the routers of the two parties; the calculating of the data identification codes of the routers comprises: for each leaf node in the router, performing identification code calculation on the content of the leaf node to obtain the identification code of the leaf node; for each intermediate node in the router, performing identification code calculation on the identification codes of all the child nodes of the intermediate node after sequentially arranging the identification codes of the intermediate node to obtain the identification code of the intermediate node; The identification code of the router is obtained by sequentially arranging the identification codes of all child nodes of the root node of the router and performing identification code calculation.
4. The method according to claim 3, characterized in that The method for the synchronizer to compare the real-time operation data and the data to be synchronized includes: constructing a comparison matrix based on the real-time operation data or the data to be synchronized, and the comparison matrix is expressed by the following formula: Among them, p 11 …p nk Each represents a data pair, including two real-time running data to be compared or two data to be synchronized; the comparison matrix is brought into the comparison model, and the comparison model compares the real-time running data based on the comparison matrix, or the comparison matrix compares the data to be synchronized based on the comparison matrix; the comparison model is expressed using the following formula: The three discriminant values H obtained by comparison s , H y and H t If H s , H t and H t If the real-time running data or the data to be synchronized are the same, then synchronization is not required. s , H y and H t If the three values are completely different from each other, it is determined that the real-time running data or the data to be synchronized is inconsistent, and all data needs to be synchronized; if H y and H t Same as H s If the data is the same, it is determined that the real-time running data or the data to be synchronized corresponds to the data in the comparison matrix. 11 to p kk All parts need to be synchronized.
5. The method according to claim 4, characterized in that The router encrypts any data before sending it to the synchronizer.
6. The method according to claim 5, characterized in that The method for encrypting data by the router includes: obtaining an encryption key and data; selecting an encryption rule from a preset encryption rule library; using the encryption key to encrypt the data according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; packaging the intermediate data and the identification information to generate encrypted data; the obtaining of the identification information corresponding to the encryption rule includes: extracting a characteristic value of the data; using the encryption key to encrypt the characteristic value according to the encryption rule to obtain the identification information corresponding to the encryption rule.
7. The method according to claim 6, characterized in that The arranging the identification codes of the sub-nodes in sequence includes: arranging the sub-nodes in sequence according to the identifications of the sub-nodes.
8. The method according to claim 7, characterized in that The method of determining the data to be synchronized by comparing the data flag codes in the routers of both parties that need to synchronize data includes: starting from the flag code of the router root node, comparing the flag codes of each node in the routers of both parties step by step; when the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the subordinate nodes of the intermediate node are no longer compared.
9. The method according to claim 8, characterized in that The method of comparing the flag codes of the nodes in the routers of both parties step by step starting from the flag code of the router root node, and when the flag codes of both parties of a node are consistent and the node is an intermediate node, the flag codes of the lower-level nodes of the intermediate node are no longer compared. Specifically includes: step A, judging whether the flag codes of the root nodes in the routers of both parties are consistent, and executing step B when they are inconsistent; step B, entering any lower-level node for which flag code comparison has not been performed, and comparing whether the flag codes of the lower-level node are consistent, if yes, executing step E, otherwise executing step C; step C, judging whether the lower-level node is an intermediate node, if yes, executing step B; otherwise executing step D; step D, determining whether the data of the lower-level node is data that needs to be synchronized, and executing step E; step E, returning to the upper-level node, judging whether the upper-level node has other lower-level nodes for which flag code comparison has not been performed, if yes, executing step B, otherwise executing step F; step F, judging whether the upper-level node is a root node, and ending if yes, otherwise executing step E.
10. The method according to claim 9, characterized in that The encryption rules included in the encryption rule library are all data shuffling rules; the using the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: shuffling the encryption key and the data according to the encryption rules to obtain intermediate data.
Citation Information
Patent Citations
Alliance chain based top level domain management method and system
CN108124502A
Confidentiality in a consortium blockchain network
US20180309567A1