Inter-blockchain activity state synchronization method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2026-08-11
AI Technical Summary
[0022] The blockchain activity state synchronization method of the present invention has the following beneficial effects: it achieves activity state synchronization between blockchains by adding routers and synchronizers to the blockchain for state and data synchronization; the routers ensure real-time data collection and generation of identifier codes; the synchronizers control the routers to achieve synchronization. During the synchronization process, the synchronizers use algorithms to determine whether synchronization is needed, and this determination process is based on the data collected by the routers, thus improving the efficiency of synchronization; compared with the existing technology that requires continuous acquisition of data from each node to achieve synchronization, it significantly reduces complexity and effectively avoids the situation where synchronization is performed when it is not needed, thus consuming system resources. The main process is as follows: 1. Router and synchronizer control: This invention uses routers to group the target blockchain, and the routers manage the nodes in the sub-blockchains after grouping. Data is collected from the nodes in real time without frequent data interaction between nodes, saving system resources. Furthermore, after acquiring the data, the synchronizer determines in advance whether synchronization is needed, avoiding unnecessary subsequent operations and improving synchronization efficiency. 2. Data comparison algorithm: When comparing data, this invention constructs a comparison matrix based on real-time running data or data requiring synchronization. Then, using the constructed comparison matrix, a comparison model is used to determine whether data needs synchronization. Compared to traditional one-to-one data comparison, this significantly reduces the amount of data required for comparison and improves efficiency. 3. Flag code establishment: This invention compares the flag codes of each node in both routers level by level, starting from the flag code of the router root node. This further reduces redundant operations required for data synchronization and improves efficiency.
Smart Images

Figure CN119676252B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of blockchain technology, specifically relating to a method for synchronizing the activity status between blockchains. Background Technology
[0002] What is blockchain? From a technological perspective, blockchain involves many scientific and technological issues, including mathematics, cryptography, the internet, and computer programming. From an application perspective, simply put, blockchain is a distributed, shared ledger and database with characteristics such as decentralization, immutability, full traceability, accountability, collective maintenance, and transparency. These characteristics ensure the "honesty" and "transparency" of blockchain, laying the foundation for trust. The rich applications of blockchain are primarily based on its ability to solve information asymmetry problems and achieve collaborative trust and consistent action among multiple entities.
[0003] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain, a key concept in Bitcoin, is essentially a decentralized database. As the underlying technology of Bitcoin, it consists of a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of Bitcoin network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block.
[0004] Blockchain possesses the following characteristics: Decentralization. Blockchain technology does not rely on additional third-party management institutions or hardware facilities, and has no central control. Besides the self-contained blockchain itself, through distributed computing and storage, each node achieves self-verification, transmission, and management of information. Decentralization is the most prominent and essential feature of blockchain. Openness. The foundation of blockchain technology is open source. Except for the encrypted private information of the transacting parties, blockchain data is open to everyone. Anyone can query blockchain data and develop related applications through public interfaces, thus ensuring high transparency of the entire system. Independence. Based on consensus-based norms and protocols (similar to the hash algorithms and other mathematical 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 arbitrarily manipulated or modified. This makes the blockchain itself relatively secure, avoiding subjective human data alteration. Anonymity. Unless required by law, from a purely technical perspective, the identity information of each block node does not need to be public or verified, and information transmission can be anonymous. Summary of the Invention
[0005] The main objective of this invention is to provide a method for synchronizing the activity states of blockchains. This method achieves state and data synchronization by adding routers and synchronizers to the blockchain. Routers ensure real-time data collection and generate identifier codes. Synchronizers control the routers to achieve synchronization. During synchronization, the synchronizer uses an algorithm to determine whether synchronization is necessary, based on data collected by the routers, thus improving synchronization efficiency. Compared to existing technologies that require continuous data acquisition from each node for synchronization, this method significantly reduces complexity and effectively avoids the waste of system resources caused by synchronization when it is not needed.
[0006] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0007] A method for synchronizing activity states between blockchains, comprising the following steps:
[0008] Step 1: Divide the target blockchain into several sub-blockchains; each sub-blockchain contains at least two nodes;
[0009] Step 2: Set up a router in each sub-blockchain; the router is connected to each node in the sub-blockchain, collects the operating data of each node in real time, and generates a unique identifier code based on the collected operating data; the router writes the generated unique identifier code into a preset identifier code tree; the router then generates the router's data identifier code based on all the unique identifier codes in the identifier code tree.
[0010] Step 3: Randomly set a synchronizer in the target blockchain. This synchronizer is regarded as a node in the target blockchain. When performing state synchronization, the synchronizer first obtains the data identifier code of the router in the sub-blockchain where the target node in the target blockchain is located, determines the data to be synchronized, and performs data synchronization on the data to be synchronized. After completing the data synchronization, it performs state synchronization based on the node's running data collected by the router.
[0011] Step 4: During 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 differences in the data, and sends the differences back to the router; the router completes the data synchronization based on the received differences.
[0012] Step 5: During state synchronization, the router sends the real-time running data of each node in its sub-blockchain to the synchronizer. The synchronizer first uses a preset comparison model to compare the real-time running data to find the differences between the real-time running data, and sends the found differences to the router. The router completes state synchronization based on the received differences.
[0013] Furthermore, before determining the data to be synchronized, the method further includes: comparing the data identifier codes of the routers of the two parties that need to synchronize data; if the data identifier codes of the two routers are inconsistent, the step of determining the data to be synchronized is performed.
[0014] Furthermore, before comparing the data identifiers of the routers of both parties, the method further includes: calculating the data identifiers of the routers of both parties; the calculation of the router data identifiers includes: for each leaf node in the router, obtaining the identifier of the leaf node by performing an identifier operation on the contents of the leaf node; for each intermediate node in the router, obtaining the identifier of the intermediate node by performing an identifier operation on the identifiers of all its child nodes in sequence; and obtaining the identifier of the router by performing an identifier operation on the identifiers of all its root nodes in sequence.
[0015] Furthermore, the method for the synchronizer to compare real-time running data and data that needs to be synchronized includes: constructing a comparison matrix based on the real-time running data or the data that needs to be synchronized, the comparison matrix being represented by the following formula: Where, p 11 …p nk Each represents a data pair, including two real-time running data sets for comparison or two data sets that need to be synchronized. The comparison matrix is input into the comparison model, which compares the real-time running data based on the comparison matrix, or 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 from the comparison s H y and H t The size of H s H y and H t If they are the same size, then the real-time running data or the data that needs to be synchronized is consistent, and synchronization is not required; if H 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 that needs 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, then determine whether the real-time running data or the data that needs to be synchronized corresponds to the data in the comparison matrix from p. 11 to p kk All parts need to be synchronized.
[0016] Furthermore, the router encrypts all data before sending any data 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; encrypting the data using the encryption key according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; and packaging the intermediate data and the identification information to generate encrypted data. Obtaining the identification information corresponding to the encryption rule includes: extracting feature values from the data; encrypting the feature values using the encryption key according to the encryption rule to obtain the identification information corresponding to the encryption rule.
[0018] Furthermore, the step of arranging the identifier codes of the child nodes in order includes: arranging the child nodes in order according to the identifiers of each child node.
[0019] Furthermore, the step of determining the data to be synchronized by comparing the data identifier codes in the routers of both parties that need to synchronize data includes: starting from the identifier code of the root node of the router, comparing the identifier codes of each node in both routers level by level; when the identifier codes of a node are consistent on both sides and the node is an intermediate node, then the identifier codes of the lower-level nodes of the intermediate node are no longer compared.
[0020] Furthermore, the step of comparing the flag codes of each node in both routers level by level, starting from the flag code of the router root node, and when the flag codes of a node are consistent across both sides and the node is an intermediate node, then the flag codes of the lower-level nodes of the intermediate node are no longer compared, specifically includes: Step A, determining whether the flag codes of the root nodes in the two routers are consistent; if they are inconsistent, proceed to Step B; Step B, entering any lower-level node whose flag codes have not been compared, and comparing whether the flag codes of the lower-level node are consistent; if they are, proceed to Step E; otherwise, proceed to Step C; Step C, determining whether the lower-level node is an intermediate node; if it is, proceed to Step B; otherwise, proceed to Step D; Step D, determining that the data of the lower-level node is the data that needs to be synchronized, and proceed to Step E; Step E, returning to the upper-level node, determining whether the upper-level node has other lower-level nodes whose flag codes have not been compared; if so, proceed to Step B; otherwise, proceed to Step F; Step F, determining whether the upper-level node is a root node; if so, end; otherwise, proceed to Step E.
[0021] Furthermore, the encryption rules included in the encryption rule base are all data mixing rules; the step of using the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: performing data mixing processing on the encryption key and the data according to the encryption rules to obtain intermediate data.
[0022] The blockchain activity state synchronization method of the present invention has the following beneficial effects: it achieves activity state synchronization between blockchains by adding routers and synchronizers to the blockchain for state and data synchronization; the routers ensure real-time data collection and generation of identifier codes; the synchronizers control the routers to achieve synchronization. During the synchronization process, the synchronizers use algorithms to determine whether synchronization is needed, and this determination process is based on the data collected by the routers, thus improving the efficiency of synchronization; compared with the existing technology that requires continuous acquisition of data from each node to achieve synchronization, it significantly reduces complexity and effectively avoids the situation where synchronization is performed when it is not needed, thus consuming system resources. The main process is as follows: 1. Router and synchronizer control: This invention uses routers to group the target blockchain, and the routers manage the nodes in the sub-blockchains after grouping. Data is collected from the nodes in real time without frequent data interaction between nodes, saving system resources. Furthermore, after acquiring the data, the synchronizer determines in advance whether synchronization is needed, avoiding unnecessary subsequent operations and improving synchronization efficiency. 2. Data comparison algorithm: When comparing data, this invention constructs a comparison matrix based on real-time running data or data requiring synchronization. Then, using the constructed comparison matrix, a comparison model is used to determine whether data needs synchronization. Compared to traditional one-to-one data comparison, this significantly reduces the amount of data required for comparison and improves efficiency. 3. Flag code establishment: This invention compares the flag codes of each node in both routers level by level, starting from the flag code of the router root node. This further reduces redundant operations required for data synchronization and improves efficiency. Attached Figure Description
[0023] Figure 1 A flowchart illustrating the method for synchronizing the activity state between blockchains provided in an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of the distributed structure of the synchronizer and router in the blockchain activity state synchronization method provided for embodiments of the present invention;
[0025] Figure 3 A schematic diagram illustrating the structure of data transmission between the synchronizer and the router in the blockchain activity state synchronization method provided in an embodiment of the present invention;
[0026] Figure 4 The diagram shows an experimental curve illustrating the efficiency of the blockchain activity state synchronization method provided in the embodiments of the present invention as a function of the number of nodes, and a comparison of experimental results with existing technologies. Detailed Implementation
[0027] The technical solution of the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings:
[0028] Example 1
[0029] like Figure 1 As shown, the method for synchronizing the activity state between blockchains includes the following steps:
[0030] Step 1: Divide the target blockchain into several sub-blockchains; each sub-blockchain contains at least two nodes;
[0031] Step 2: Set up a router in each sub-blockchain; the router is connected to each node in the sub-blockchain, collects the operating data of each node in real time, and generates a unique identifier code based on the collected operating data; the router writes the generated unique identifier code into a preset identifier code tree; the router then generates the router's data identifier code based on all the unique identifier codes in the identifier code tree.
[0032] Step 3: Randomly set a synchronizer in the target blockchain. This synchronizer is regarded as a node in the target blockchain. When performing state synchronization, the synchronizer first obtains the data identifier code of the router in the sub-blockchain where the target node in the target blockchain is located, determines the data to be synchronized, and performs data synchronization on the data to be synchronized. After completing the data synchronization, it performs state synchronization based on the node's running data collected by the router.
[0033] Step 4: During 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 differences in the data, and sends the differences back to the router; the router completes the data synchronization based on the received differences.
[0034] Step 5: During state synchronization, the router sends the real-time running data of each node in its sub-blockchain to the synchronizer. The synchronizer first uses a preset comparison model to compare the real-time running data to find the differences between the real-time running data, and sends the found differences to the router. The router completes state synchronization based on the received differences.
[0035] By adopting the above technical solution, this invention achieves state and data synchronization between blockchains by adding routers and synchronizers to the blockchain; the routers ensure real-time data collection and generation of identifier codes; and the synchronizers control the routers to achieve synchronization. During the synchronization process, the synchronizers use algorithms to determine whether synchronization is needed, and this determination process is based on the data collected by the routers, thus improving the efficiency of synchronization. Compared with existing technologies that require constantly acquiring data from each node to achieve synchronization, this invention significantly reduces complexity and effectively avoids the situation where synchronization is performed when it is not needed, thus consuming system resources. The main process is as follows: 1. Router and synchronizer control: This invention uses routers to group the target blockchain, and the routers manage the nodes in the sub-blockchains after grouping. Data is collected from the nodes in real time without frequent data interaction between nodes, saving system resources. Furthermore, after acquiring the data, the synchronizer determines in advance whether synchronization is needed, avoiding unnecessary subsequent operations and improving synchronization efficiency. 2. Data comparison algorithm: When comparing data, this invention constructs a comparison matrix based on real-time running data or data requiring synchronization. Then, using the constructed comparison matrix, a comparison model is used to determine whether data needs synchronization. Compared to traditional one-to-one data comparison, this significantly reduces the amount of data required for comparison and improves efficiency. 3. Flag code establishment: This invention compares the flag codes of each node in both routers level by level, starting from the flag code of the router root node. This further reduces 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 to be synchronized, comparing the data identifier codes of the routers of the two parties that need to synchronize data, and performing the step of determining the data to be synchronized when the data identifier codes of the two routers are inconsistent.
[0038] Specifically, routers typically reside at the network layer, making routing technology a network layer-related technology. Routers differ significantly from earlier bridges. Generally, bridges have limitations; they can only connect networks with similar or identical data link layer protocols, not networks with significantly different data link layer protocols. Routers, however, break this limitation, connecting any two different networks. However, these two different networks must adhere to the principle of using the same network layer protocol to be connected by the router. Simply put, routing technology is a technology for forwarding and exchanging numerous pieces of information on a network; specifically, it transmits information from a source address to a destination address through the internet. Routing technology has made significant progress in recent years, especially with the emergence of fifth-generation routers, which meet the comprehensive needs of data, voice, and image transmission, and have gradually been chosen and widely used in most home networks. Furthermore, in recent years, my country's routing technology has become increasingly mature, incorporating modern intelligent technologies, enabling users to experience fast and efficient routing, thereby promoting the development of the internet and network technology.
[0039] Example 3
[0040] Based on the previous embodiment, the method further includes, before comparing the data identifiers of the routers of both parties: calculating the data identifiers of the routers of both parties; the calculation of the router data identifiers includes: for each leaf node in the router, obtaining the identifier of the leaf node by performing an identifier operation on the contents of the leaf node; for each intermediate node in the router, obtaining the identifier of the intermediate node by performing an identifier operation on the identifiers of all its child nodes in sequence; and obtaining the identifier of the router by performing an identifier operation on the identifiers of all its root nodes in sequence.
[0041] Specifically, a router is a hardware device that connects two or more networks, acting as a gateway between them. It's a dedicated, intelligent network device that reads the address in each data packet and determines how to transmit it. It understands different protocols, such as Ethernet used by a local area network (LAN) and TCP / IP used by the Internet. Thus, a router can analyze the destination addresses of data packets from various types of networks, converting non-TCP / IP addresses to TCP / IP addresses, or vice versa; then, based on the selected routing algorithm, it transmits each data packet to its designated location along the optimal route. Therefore, a router can connect non-TCP / IP networks to the Internet.
[0042] Example 4
[0043] Based on the previous embodiment, the method for the synchronizer to compare real-time running data and data that needs to be synchronized includes: constructing a comparison matrix based on the real-time running data or the data that needs to be synchronized, wherein the comparison matrix is represented by the following formula: Where, p 11 …p nk Each represents a data pair, including two real-time running data sets for comparison or two data sets that need to be synchronized. The comparison matrix is input into the comparison model, which compares the real-time running data based on the comparison matrix, or 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 from the comparison s H y and H t The size of H s H y and H t If they are the same size, then the real-time running data or the data that needs to be synchronized is consistent, and synchronization is not required; if H 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 that needs to be synchronized is inconsistent, and all data needs to be synchronized; if H y and H t Same as H s If they are the same, then determine whether the real-time running data or the data that needs to be synchronized corresponds to the data in the comparison matrix from p. 11 to p kk All parts need to be synchronized.
[0044] Example 5
[0045] Building upon the previous embodiment, the router encrypts all data before sending any data to the synchronizer.
[0046] Specifically, symmetric encryption algorithms require the same key to be used for both encryption and decryption. Due to its speed, symmetric encryption is typically used when the message sender needs to encrypt large amounts of data. Symmetric encryption is also known as keyed encryption.
[0047] Symmetric encryption means that both parties using this encryption method use the same key for both encryption and decryption. The key is the instruction that controls the encryption and decryption process. An algorithm is a set of rules that specifies how to perform encryption and decryption.
[0048] Therefore, the security of encryption depends not only on the encryption algorithm itself, but also, and perhaps more importantly, on the security of key management. Since both encryption and decryption use the same key, how to securely transmit that key to the decryptor becomes a crucial problem to solve.
[0049] Example 6
[0050] Based on 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; encrypting the data using the encryption key according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; and packaging the intermediate data and the identification information to generate encrypted data. Obtaining the identification information corresponding to the encryption rule includes: extracting feature values from the data; and encrypting the feature values using the encryption key according to the encryption rule to obtain the identification information corresponding to the encryption rule.
[0051] Specifically, encryption is based on the mathematical encoding and decoding of information. There are two types of encryption: symmetric encryption and asymmetric encryption. Symmetric encryption uses a shared key (which must be kept secret). Asymmetric encryption uses two keys: a public key (as the name suggests, this is a publicly available key value) and a private key (kept secret). When you send us a message, you encrypt it using the public key. Once we receive your encrypted message, we use the private key to decrypt it (information encrypted with our public key can only be decrypted with our private key, thus technically ensuring that only we can decipher the message—because no one else has our private key). Information encrypted with the private key can only be decrypted with the public key (this functionality is used in the field of digital signatures; data encrypted with my private key can only be deciphered with my public key; see information on digital signatures for details). The reverse is also true to ensure your information security.
[0052] Example 7
[0053] Based on the previous embodiment, the step of arranging the identifier codes of the child nodes in order includes: arranging the child nodes in order according to the identifiers of each child node.
[0054] Example 8
[0055] Based on the previous embodiment, the step of determining the data to be synchronized by comparing the data flag codes in the routers of the two parties that need to synchronize data includes: starting from the flag code of the root node of the router, comparing the flag codes of each node in the routers of both parties level by level. When the flag codes of a node are consistent on both sides and the node is an intermediate node, the flag codes of the lower-level nodes of the intermediate node are no longer compared.
[0056] Example 9
[0057] Based on the previous embodiment, the step of comparing the flag codes of each node in both routers level by level, starting from the flag code of the router root node, and when the flag codes of a node are consistent across both sides and the node is an intermediate node, then the flag codes of the lower-level nodes of the intermediate node are no longer compared, specifically includes: Step A, determining whether the flag codes of the root nodes in the routers of both sides are consistent; if they are inconsistent, proceed to Step B; Step B, entering any lower-level node whose flag codes have not been compared, and comparing whether the flag codes of the lower-level node are consistent; if they are, proceed to Step E; otherwise, proceed to Step C; Step C, determining whether the lower-level node is an intermediate node; if it is, proceed to Step B; otherwise, proceed to Step D; Step D, determining that the data of the lower-level node is the data that needs to be synchronized, and proceed to Step E; Step E, returning to the upper-level node, determining whether the upper-level node has other lower-level nodes whose flag codes have not been compared; if so, proceed to Step B; otherwise, proceed to Step F; Step F, determining whether the upper-level node is a root node; if so, end; otherwise, proceed to Step E.
[0058] Example 10
[0059] Based on the previous embodiment, the encryption rules included in the encryption rule base are all data mixing rules; the step of using the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: performing data mixing processing on the encryption key and the data according to the encryption rules to obtain intermediate data.
[0060] Specifically, software testing arose alongside the development of software. In the early stages of software development, software was small in scale and low in complexity. The development process was chaotic, disorganized, and quite arbitrary. The meaning of testing was narrow; developers equated testing with "debugging," aiming to correct known faults in the software. This work was often done by the developers themselves. Minimal investment was made in testing, and testing intervention was late, often only occurring after the code was finalized and the product was essentially complete. In the early 1980s, the software and IT industry experienced rapid growth. Software became larger and more complex, and software quality became increasingly important. At this time, some fundamental theories and practical techniques of software testing began to emerge, and various processes and management methods were designed for software development. Software development gradually transitioned from a chaotic and disorganized process to a structured one, characterized by structured analysis and design, structured review, structured programming, and structured testing. The concept of "quality" was also incorporated, and the definition of software testing changed. Testing was no longer simply a process of finding errors, but rather a primary function of Software Quality Assurance (SQA), encompassing software quality evaluation. Bill Hetzel, in his book *The Complete Guide to Software Testing*, stated: "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 cited today. Software developers and testers began to sit down together to discuss software engineering and testing issues.
[0061] The above description is merely one embodiment of the present invention, but it cannot be used to limit the scope of the present invention. Any structural changes made based on the present invention, as long as they do not lose the essence of the present invention, should be considered to fall within the protection scope of the present invention and be subject to its restrictions.
[0062] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the system described above can be found in the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0063] It should be noted that the system provided in the above embodiments 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 further decomposed or combined. For example, the modules in the above embodiments can be merged 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 various modules or steps and are not considered as an improper limitation of the present invention.
[0064] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the storage device and processing device described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0065] Those skilled in the art will recognize that the modules and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. The programs corresponding to the software modules and method steps can be placed in random access memory (RAM), main 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 art. To clearly illustrate the interchangeability of electronic hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented 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 beyond the scope of the invention.
[0066] The terms “first”, “second”, etc., are used to distinguish similar objects, not to describe or indicate a specific order or sequence.
[0067] The term "comprising" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent in such process, method, article, or apparatus / device.
[0068] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles 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 such changes or substitutions will all fall within the scope of protection of the present invention.
[0069] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention.
Claims
1. A method for synchronizing the activity status between blockchains, characterized in that, The method performs the following steps: Step 1: Divide the target blockchain into several sub-blockchains; each sub-blockchain contains at least two nodes; Step 2: Set up a router in each sub-blockchain; the router is connected to each node in the sub-blockchain, collects the operating data of each node in real time, and generates a unique identifier code based on the collected operating data; The router writes the generated unique identifier into a preset identifier tree; The router then generates its data identifier based on all the unique identifiers in the identifier tree; Step 3: Randomly set a synchronizer in the target blockchain. This synchronizer is regarded as a node in the target blockchain. When the synchronizer performs state synchronization, it first obtains the data identifier code of the router in the sub-blockchain where the target node in the target blockchain is located, determines the data to be synchronized, and performs data synchronization on the data to be synchronized. After data synchronization is completed, state synchronization is then performed based on the node's operational data collected by the router. Step 4: During 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 differences in the data, and sends the differences back to the router; the router completes the data synchronization based on the received differences. Step 5: During state synchronization, the router sends the real-time running data of each node in its sub-blockchain to the synchronizer. The synchronizer first uses a preset comparison model to compare the real-time running data to find the differences between the real-time running data, and sends the found differences to the router. The router completes state synchronization based on the received differences.
2. The method as described in claim 1, characterized in that, The method further includes, before determining the data to be synchronized, comparing the data identifier codes of the routers of the two parties that need to synchronize data, and performing the step of determining the data to be synchronized when the data identifier codes of the two routers are inconsistent.
3. The method as described in claim 2, characterized in that, The method further includes, before comparing the data identifiers of the routers of both parties: calculating the data identifiers of the routers of both parties; the calculation of the data identifiers of the routers includes: for each leaf node in the router, obtaining the identifier of the leaf node by performing an identifier operation on the contents of the leaf node; for each intermediate node in the router, obtaining the identifier of the intermediate node by performing an identifier operation on the identifiers of all the child nodes of the intermediate node in sequence. The router's identifier is obtained by performing identifier operations on the identifiers of all child nodes of the router's root node in sequential order.
4. The method as described in claim 3, characterized in that, The method by which the synchronizer compares real-time running data and data that needs to be synchronized includes: constructing a comparison matrix based on the real-time running data or the data that needs to be synchronized, the comparison matrix being represented by the following formula: Where, p 11 …p nk Each represents a data pair, including two real-time running data sets for comparison or two data sets that need to be synchronized. The comparison matrix is input into the comparison model, which compares the real-time running data based on the comparison matrix, or 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 from the comparison s H y and H t The size of H s H t and H t If they are the same size, then the real-time running data or the data that needs to be synchronized is consistent, and synchronization is not required; if H 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 that needs to be synchronized is inconsistent, and all data needs to be synchronized; if H y and H t Same as H s If they are the same, then determine whether the real-time running data or the data that needs to be synchronized corresponds to the data in the comparison matrix from p. 11 to p kk All parts need to be synchronized.
5. The method as described in claim 4, characterized in that, The router encrypts all data before sending any data to the synchronizer.
6. The method as described in claim 5, characterized in that, The router's method for encrypting data includes: obtaining an encryption key and data; selecting an encryption rule from a preset encryption rule library; encrypting the data using the encryption key according to the encryption rule to obtain intermediate data; obtaining identification information corresponding to the encryption rule; and packaging the intermediate data and the identification information together to generate encrypted data. Obtaining the identification information corresponding to the encryption rule includes: extracting feature values from the data; encrypting the feature values using the encryption key according to the encryption rule to obtain the identification information corresponding to the encryption rule.
7. The method as described in claim 6, characterized in that, The step of arranging the identifier codes of the child nodes in order includes: arranging the child nodes in order according to the identifiers of each child node.
8. The method as described in claim 7, characterized in that, The process of determining the data to be synchronized by comparing the data identifier codes in the routers of both parties includes: starting from the identifier code of the root node of the router, comparing the identifier codes of each node in both routers level by level; when the identifier codes of a node are consistent on both sides and the node is an intermediate node, then the identifier codes of the lower-level nodes of the intermediate node are no longer compared.
9. The method as described in claim 8, characterized in that, The process of comparing the flag codes of each node in both routers, starting from the flag code of the root node, and proceeding level by level, until the flag codes of a node match and that node is an intermediate node, then the flag codes of its subordinate nodes are no longer compared, specifically includes: Step A, determining whether the flag codes of the root nodes in both routers match; if they do not match, proceed to Step B; Step B, entering any subordinate node whose flag codes have not yet been compared, and comparing whether the flag codes of that subordinate node match; if they match, proceed to Step E, otherwise proceed to Step C; Step C, determining whether the subordinate node is an intermediate node; if it is, proceed to Step B, otherwise proceed to Step D; Step D, determining that the data of the subordinate node is data that needs to be synchronized, and proceeding to Step E; Step E, returning to the parent node, determining whether there are any other subordinate nodes whose flag codes have not yet been compared; if so, proceed to Step B, otherwise proceed to Step F; Step F, determining whether the parent node is a root node; if so, end, otherwise proceed to Step E.
10. The method as described in claim 9, characterized in that, The encryption rules included in the encryption rule base are all data mixing rules; the step of using the encryption key to encrypt the data according to the encryption rules to obtain intermediate data includes: mixing 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