Blockchain cross-chain methods, devices, computer equipment, and storage media
By pre-deploying multiple consensus algorithms, selecting a target consensus algorithm, and obtaining data blocks with consistent consensus from the blockchain for on-chain processing, the problem of insufficient scalability of cross-chain technology is solved, and the scalability and efficient data exchange of the cross-chain system are realized.
Patent Information
- Application Number
- CN202210831739.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-07-15
AI Technical Summary
Existing cross-chain technologies lack scalability and cannot effectively achieve information exchange and data sharing between consortium blockchains and external blockchains.
By pre-deploying multiple consensus algorithms, selecting a target consensus algorithm, obtaining data blocks with consistent consensus from the first and second blockchains, and processing them on the blockchain to form the target blockchain, the system supports switching between multiple consensus algorithms and cross-chain expansion.
It achieves scalability of cross-chain systems, supports switching between multiple consensus algorithms, and improves the efficiency and reliability of data exchange between consortium blockchains and external blockchains.
Smart Images

Figure CN115221244B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a blockchain cross-chain method, apparatus, computer device, and storage medium. Background Technology
[0002] With the development of blockchain technology, it is no longer limited to a single application scenario; it is being applied in multiple fields such as logistics, intelligent transportation, and the Internet of Things. To avoid data silos and value isolation, cross-chain technology is needed to enable information exchange, data sharing, and value interconnection between consortium blockchains and external blockchains. To meet external regulatory requirements, security reviews, or blockchain expansion needs, blockchains should possess cross-chain capabilities.
[0003] Currently, the main cross-chain technologies include notary mechanisms, sidechain technology, hash locking, and distributed private keys. However, current cross-chain technologies lack scalability. Summary of the Invention
[0004] Therefore, it is necessary to provide a blockchain cross-chain method, apparatus, computer equipment, and storage medium that can improve the scalability of blockchain cross-chain technology in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a blockchain cross-chain method, which includes:
[0006] Obtain the first blockchain and the second blockchain to be processed, and obtain the first data block contained in the first blockchain and the second data block contained in the second blockchain;
[0007] Select the target consensus algorithm from a variety of pre-deployed consensus algorithms;
[0008] Using the target consensus algorithm, obtain the target data block that is consistent with the consensus from the first data block and the second data block;
[0009] The target data block is processed on the blockchain to obtain the target blockchain.
[0010] In one embodiment, before obtaining the target consensus algorithm from a pre-deployed plurality of consensus algorithms, the process includes:
[0011] Construct an encoding list; the encoding list stores the encoding identifiers corresponding to each consensus algorithm;
[0012] From a variety of pre-deployed consensus algorithms, obtain the target consensus algorithm, including:
[0013] Obtain the target code identifier from the code list, and based on the target code identifier, obtain the consensus algorithm corresponding to the target code identifier, which is then used as the target consensus algorithm.
[0014] In one embodiment, the number of target blockchains is multiple;
[0015] After processing the target data block on the blockchain to obtain the target blockchain, the following steps are taken:
[0016] From multiple target blockchains, one target blockchain is identified as the main chain, and the target blockchains other than the main chain are designated as secondary chains.
[0017] If the consensus result of the third data block in the main chain is inconsistent with that of the fourth data block corresponding to the third data block in the sub-chain, then the third data block and the fourth data block are interactively verified to make their consensus results consistent.
[0018] In one embodiment, interactive verification of the third and fourth data blocks includes:
[0019] Using the target consensus algorithm corresponding to the main chain, consensus is reached again on the third data block in the main chain;
[0020] If the consensus result of the second consensus is consistent with the consensus result of the first consensus, then the consensus result of the third data block is used as the consensus result of the fourth data block, so that the consensus results of the third data block and the fourth data block are consistent.
[0021] In one embodiment, the target data block is processed on-chain to obtain the target blockchain, including:
[0022] Obtain the initial data block; the initial data block is either the first data block contained in the first blockchain or the second data block contained in the second blockchain.
[0023] The initial data block and the target data block are processed on the blockchain to obtain the target blockchain.
[0024] In one embodiment, obtaining the first blockchain and the second blockchain to be processed includes:
[0025] Obtain the first consortium blockchain and the second consortium blockchain. The first consortium blockchain and the second consortium blockchain each deploy multiple sub-blockchains. Among them, the different sub-blockchains contained in the same consortium blockchain correspond to different consensus algorithms.
[0026] The first blockchain is obtained from multiple sub-blockchains of the first consortium blockchain, and the second blockchain is obtained from multiple sub-blockchains of the second consortium blockchain.
[0027] Secondly, this application also provides a blockchain cross-chain device, the device comprising:
[0028] The blockchain acquisition module is used to acquire the first blockchain and the second blockchain to be processed, and to acquire the first data block contained in the first blockchain and the second data block contained in the second blockchain;
[0029] The consensus algorithm acquisition module is used to acquire the target consensus algorithm from a variety of pre-deployed consensus algorithms;
[0030] The data block consensus module is used to obtain a target data block that is consistent with the consensus between the first data block and the second data block using the target consensus algorithm.
[0031] The data block on-chain module is used to process the target data block on the blockchain to obtain the target blockchain.
[0032] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described above.
[0033] Fourthly, this application also provides a computer-readable storage medium. This computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.
[0034] Fifthly, this application also provides a computer program product. This computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described method.
[0035] The aforementioned blockchain cross-chain method, apparatus, computer equipment, and storage medium acquire a first blockchain and a second blockchain to be processed, and acquire a first data block contained in the first blockchain and a second data block contained in the second blockchain; by selecting a target consensus algorithm from a pre-deployed set of consensus algorithms, a target data block with consensus can be obtained from the first and second data blocks using the target consensus algorithm; by uploading the target data block to the blockchain, the target blockchain can be obtained. Compared with traditional technologies, this application, through the pre-deployed set of consensus algorithms, allows for the selection of a target consensus algorithm to obtain a corresponding target blockchain, and enables the switching between multiple consensus algorithms. Based on the pre-deployed set of consensus algorithms, multiple cross-chain blockchains corresponding to multiple consensus algorithms can be obtained, thereby enabling the scalability of the cross-chain blockchain based on blockchains corresponding to multiple different consensus algorithms. Attached Figure Description
[0036] Figure 1 This is a diagram illustrating the application environment of a blockchain cross-chain method in one embodiment.
[0037] Figure 2 This is a flowchart illustrating a blockchain cross-chain method in one embodiment;
[0038] Figure 3 This is a flowchart illustrating the steps after processing the target data block onto the blockchain to obtain the target blockchain, as shown in one embodiment.
[0039] Figure 4 This is a flowchart illustrating the interactive verification steps for the third and fourth data blocks in one embodiment.
[0040] Figure 5 This is a flowchart illustrating the steps of obtaining the first and second blockchains to be processed in one embodiment;
[0041] Figure 6 This is a structural block diagram of a multi-consensus mechanism module in one embodiment;
[0042] Figure 7 Here is a block diagram of the cross-chain system and its structure in one embodiment;
[0043] Figure 8 This is a structural block diagram of a blockchain cross-chain device in one embodiment;
[0044] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0046] The blockchain cross-chain method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on other network servers. Multiple consensus algorithms can be stored in the data storage system. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0047] In one embodiment, such as Figure 2 As shown, a blockchain cross-chain method is provided. This embodiment applies this method to... Figure 1 Taking server 104 as an example, in this embodiment, the method includes the following steps:
[0048] Step S202: Obtain the first blockchain and the second blockchain to be processed, and obtain the first data block contained in the first blockchain and the second data block contained in the second blockchain.
[0049] In this blockchain, the first blockchain can be any blockchain that requires cross-chain functionality, and the second blockchain is the blockchain that needs to perform cross-chain communication with the first blockchain. A first data block is a data block obtained by packaging data; multiple first data blocks are uploaded to the blockchain using a consensus algorithm to form the first blockchain. Multiple second data blocks are uploaded to the blockchain using a consensus algorithm to form the second blockchain. Typically, there are multiple first and second data blocks. The consensus algorithms corresponding to the first and second blockchains can be different.
[0050] Specifically, the first blockchain and the second blockchain that need to be cross-chained can be obtained. Furthermore, the first data block containing cross-chain data in the first blockchain and the second data block containing cross-chain data in the second data block can be obtained.
[0051] Step S204: Obtain the target consensus algorithm from a variety of pre-deployed consensus algorithms.
[0052] The consensus algorithms can include Practical Byzantine Fault Tolerance (PBFT), Proof-of-Stake (POS), Delegated Proof-of-Stake (DPoS), and any other consensus algorithm suitable for cross-chain applications. Multiple consensus algorithms can be pre-deployed in the cross-chain system, and any one of the included consensus algorithms can be invoked. The target consensus algorithm is the consensus algorithm required for cross-chain applications. This target consensus algorithm can be any pre-deployed consensus algorithm in the system and can be pre-configured according to actual needs.
[0053] Specifically, multiple pre-deployed consensus algorithms can be obtained, and a target consensus algorithm can be selected from these. There can be multiple target consensus algorithms, and each can be obtained sequentially. Furthermore, cross-chain operations can be performed using multiple target consensus algorithms to obtain the blockchains corresponding to those algorithms.
[0054] Step S206: Using the target consensus algorithm, obtain the target data block that is consistent with the consensus from the first data block and the second data block.
[0055] The target data block refers to the data block formed by cross-chain data that has reached a consensus.
[0056] Specifically, the data that needs to be crossed between chains is obtained from the first data block and the second data block respectively. The target consensus algorithm is used to reach a consensus on the data that needs to be crossed between chains, and a data block with consistent consensus is obtained.
[0057] Step S208: The target data block is processed on the blockchain to obtain the target blockchain.
[0058] The number of target data blocks is multiple. The target blockchain refers to the blockchain obtained after cross-chain data consensus and on-chain processing; this target blockchain corresponds to the target consensus algorithm mentioned above.
[0059] Specifically, data blocks from the target blockchain that utilize the same target consensus algorithm and achieve consistent consensus are processed on-chain to obtain the target blockchain corresponding to that consensus algorithm. Furthermore, the first and second blockchains can perform cross-chain data transfer through the target blockchain.
[0060] In this embodiment, a first blockchain and a second blockchain to be processed are obtained, along with a first data block contained in the first blockchain and a second data block contained in the second blockchain. A target consensus algorithm is selected from a set of pre-deployed consensus algorithms. This allows the use of the target consensus algorithm to obtain a target data block with consistent consensus from the first and second data blocks. By uploading the target data block to the blockchain, the target blockchain is obtained. Compared to traditional technologies, this application, through the pre-deployed multiple consensus algorithms, allows for the selection of a target consensus algorithm to obtain the corresponding target blockchain, and enables the switching between multiple consensus algorithms. Based on the pre-deployed multiple consensus algorithms of this application, multiple cross-chain blockchains corresponding to various consensus algorithms can be obtained, thereby enabling the scalability of the cross-chain blockchain based on blockchains corresponding to multiple different consensus algorithms.
[0061] In one embodiment, before obtaining the target consensus algorithm from a pre-deployed plurality of consensus algorithms, the process includes:
[0062] Construct an encoding list; the encoding list stores the encoding identifiers corresponding to each consensus algorithm;
[0063] From a variety of pre-deployed consensus algorithms, obtain the target consensus algorithm, including:
[0064] Obtain the target code identifier from the code list, and based on the target code identifier, obtain the consensus algorithm corresponding to the target code identifier, which is then used as the target consensus algorithm.
[0065] The encoding list can contain encoding identifiers corresponding to each consensus algorithm, as well as the deployment status of each consensus algorithm. The encoding identifier serves as the identifier for each consensus algorithm, with one encoding identifier for each algorithm. The encoding identifier can be binary, decimal, octal, or hexadecimal.
[0066] Specifically, an encoding list is constructed, along with the correspondence between each encoding identifier in the list and each consensus algorithm. In response to a selection operation on an encoding identifier within the encoding list, the corresponding encoding identifier is retrieved from the list as the target encoding identifier. Based on the correspondence between the target encoding identifier and the consensus algorithm, the target consensus algorithm can be obtained.
[0067] In this embodiment, an encoding list containing encoding identifiers corresponding to each consensus algorithm is constructed. Based on the encoding identifiers in the encoding list, the corresponding consensus algorithm can be obtained and used as the target consensus algorithm. This allows for the accurate acquisition of the target consensus algorithm, providing a foundation for achieving scalable cross-chain functionality.
[0068] In one embodiment, the number of target blockchains is multiple;
[0069] like Figure 3 As shown, after processing the target data block onto the blockchain to obtain the target blockchain, the process includes:
[0070] Step S302: Identify one target blockchain as the main chain from multiple target blockchains, and designate the target blockchains other than the main chain as secondary chains.
[0071] Step S304: If the consensus result of the third data block in the main chain is inconsistent with that of the fourth data block in the sub-chain corresponding to the third data block, then the third data block and the fourth data block are interactively verified to make their consensus results consistent.
[0072] The main chain can be any blockchain obtained through consensus processing and on-chaining using any consensus algorithm. The secondary chain can be any blockchain other than the main chain, and its consensus algorithm can be the same as that of the main chain. The third data block can be any data block obtained through cross-chain processing, and the fourth data block is the data block corresponding to the third data block. For example, if the time of the third data block corresponds to the time of the fourth data block, then the third data block is considered to correspond to the fourth data block.
[0073] Specifically, multiple target blockchains can be obtained based on different target consensus algorithms. Alternatively, a blockchain obtained by consensusing and uploading data using a pre-determined consensus algorithm can be used as the main chain, while the other blockchains among the multiple target blockchains can be used as secondary chains. Furthermore, if multiple blockchains correspond to pre-determined consensus algorithms, then one of these blockchains can be used as the main chain, and the others as secondary chains.
[0074] If the formula result of any third data block in the main chain is inconsistent with that of its corresponding fourth data block in the sub-chain, then the third and fourth data blocks are cross-verified to ensure that they adopt the same consensus result. Further, the third data block in the main chain and the fourth data block in the sub-chain...
[0075] In this embodiment, by performing data interaction verification on data blocks in the main chain and data blocks in the sub-chain, the data in the main chain and the sub-chain is synchronized, thereby achieving consensus consistency between the main chain and the sub-chain, and thus enabling cross-chain scalability.
[0076] Furthermore, if the formula results of the main chain and the sub-chain are the same, then the main chain and the sub-chain do not need to perform interactive verification. For example, the main chain and the sub-chain correspond to the same consensus algorithm, which can reduce the degree of coupling and improve efficiency.
[0077] Furthermore, if other data blocks are blocked and waiting during the interactive verification process of any data block, the interactive verification of the next data block will proceed after the interactive verification result is completed.
[0078] In one embodiment, such as Figure 4 As shown, interactive verification is performed on the third and fourth data blocks, including:
[0079] Step S402: Use the target consensus algorithm corresponding to the main chain to reach consensus again on the third data block in the main chain;
[0080] Step S404: If the consensus result of the second consensus is consistent with the consensus result of the first consensus, then the consensus result of the third data block is used as the consensus result of the fourth data block, so that the consensus results of the third data block and the fourth data block are consistent.
[0081] Here, "re-consensus" refers to using the consensus algorithm corresponding to the main chain to reach consensus on data blocks in the main chain again. "Initial consensus" refers to the first consensus, which can be the consensus reached on data that needs to be crossed between chains during the formation of the main chain.
[0082] Specifically, using the target consensus algorithm corresponding to the main chain, the third data block in the main chain can be re-consensusd to obtain the result of the re-consensus. If the result of the re-consensus is the same as the result of the first consensus, it means that the consensus result of the third data block is correct. Then, the formula result of the third data block can be used as the consensus result of the fourth data block, so that the consensus result of the third data block and the consensus result of the fourth data block are the same.
[0083] In this embodiment, by using the consensus result of the third data block as the consensus result of the fourth data block, the consensus results of the main chain and the sub-chain can be kept consistent, thereby enabling the scalability of the cross-chain system.
[0084] In one embodiment, the target data block is processed on-chain to obtain the target blockchain, including:
[0085] Obtain the initial data block; the initial data block is either the first data block contained in the first blockchain or the second data block contained in the second blockchain.
[0086] The initial data block and the target data block are processed on the blockchain to obtain the target blockchain.
[0087] The initial data block can be a data block contained in the first blockchain, and it can contain data from the first data block that needs to be crossed between blockchains. Alternatively, the initial data block can be a data block contained in the second blockchain, and it can contain data from the second blockchain that needs to be crossed between blockchains.
[0088] Specifically, the data blocks contained in the first blockchain are used as the initial data blocks; or the data blocks contained in the second blockchain are used as the initial data blocks. The initial data blocks are obtained, and the initial data blocks and the target data blocks are processed on the blockchain to obtain the target blockchain.
[0089] In this embodiment, the application obtains an initial data block and uploads the initial data block and the target data block to the blockchain to obtain the target blockchain. This allows the initial data to be retained in the cross-chain system, and the data in the target blockchain and the data in the initial data block will not affect each other, thereby achieving the traceability of the initial data.
[0090] Furthermore, the data blocks contained in the first blockchain can be retained in the main chain, and the data blocks contained in the second blockchain can be retained in the sub-chain.
[0091] In one embodiment, such as Figure 5 As shown, obtaining the first and second blockchains to be processed includes:
[0092] Step S502: Obtain the first consortium blockchain and the second consortium blockchain. The first consortium blockchain and the second consortium blockchain each deploy multiple sub-blockchains. Among them, different sub-blockchains contained in the same consortium blockchain correspond to different consensus algorithms.
[0093] Step S504: Obtain the first blockchain from multiple sub-blockchains of the first consortium blockchain, and obtain the second blockchain from multiple sub-blockchains of the second consortium blockchain.
[0094] Among them, the first consortium blockchain and the second consortium blockchain are two blockchains that perform cross-chain operations; the first consortium blockchain and the second consortium blockchain each contain multiple sub-blockchains; the multiple sub-blockchains contained in the first consortium blockchain can correspond to different consensus algorithms, and the multiple sub-blockchains contained in the second consortium blockchain can correspond to different consensus algorithms.
[0095] Specifically, the process involves obtaining the first and second consortium blockchains that require cross-chain functionality. Any sub-blockchain from the first consortium blockchain is selected as the first blockchain, and any sub-blockchain from the second consortium blockchain is selected as the second blockchain. In this way, by selecting any sub-blockchain from the first consortium blockchain with multiple sub-blockchains and using it as the first blockchain, the multiple blockchains formed in the cross-chain system can originate from sub-blockchains corresponding to different consensus algorithms, thereby achieving cross-chain scalability.
[0096] Furthermore, by deploying multiple sub-blockchains within the first consortium blockchain, and by allowing these sub-blockchains to correspond to different consensus algorithms, the scalability of the first consortium blockchain can be achieved.
[0097] In a specific embodiment, a consortium blockchain system can deploy multiple consensus mechanism modules, compatible with various consensus mechanisms. This allows for the integration of multiple consensus algorithms within the same blockchain system, such as Practical Byzantine Fault Tolerance (PBFT), Proof-of-Stake (POS), Delegated Proof-of-Stake (DPOS), and other consensus mechanisms suitable for consortium blockchains. Multiple consensus mechanism modules include... Figure 6 As shown.
[0098] Furthermore, the multi-consensus mechanism module provides services to the outside world in the form of a standard interface. Each consensus mechanism is assigned a code number within the interface, so that each blockchain can select the corresponding consensus mechanism from the multi-consensus mechanism module according to the code parameters.
[0099] A pre-compiled encoding sequence table for the consensus mechanism is stored in each node of the consortium blockchain system. The encoding sequence representation of the consensus mechanism is shown in Table 1, and the encoding sequence is represented in binary form.
[0100] Table 1. Examples of Encoding Sequences for Consensus Mechanisms
[0101] coding consensus algorithm state 0000 PBFT Deployed and in normal condition. 0001 POS Deployed and in normal condition. 0010 DPOS Deployed and in normal condition. 0011 ...... .......
[0102] Furthermore, multiple consensus mechanisms can be deployed on each consensus node within the consortium blockchain system. These mechanisms are deployed separately using virtual containers, and each consensus mechanism can operate independently without affecting the others.
[0103] Furthermore, in a consortium blockchain system, each chain adopts a consensus mechanism based on a coding sequence table, and always uses the same consensus mechanism.
[0104] In each consortium blockchain system, one main chain and multiple sub-chains are deployed. The main chain and sub-chains can employ different consensus mechanisms, forming a one-main-multiple-sub-chain blockchain operating model. A schematic diagram of a blockchain including a main chain and multiple sub-chains is shown below. Figure 7 As shown.
[0105] Furthermore, the main chain and sub-chains operate in parallel within a virtual container, reducing coupling. For example, in consortium chain A, the main chain and sub-chains 1 and 2 run in parallel. Each blockchain selects the corresponding consensus mechanism from multiple consensus modules based on the consensus mechanism's encoding sequence number table for consensus and on-chain processing.
[0106] Furthermore, since each node in a consortium blockchain system needs to run multiple consensus mechanisms simultaneously, the computing performance and storage capacity of each node must meet certain requirements. Considering the limitations of computing performance and storage capacity of physical nodes, which make it difficult to expand as needed, resources should be reserved if deployment on physical nodes is required. Since cloud nodes can be elastically expanded and resources added on demand, deployment on cloud platforms within an organization or institution should be prioritized to fully utilize the distributed computing and storage capabilities of the cloud platform, leverage the ability of multiple chains to execute in parallel, and achieve BaaS (Blockchain as a Service) effects.
[0107] Furthermore, the consensus process between the main chain and the secondary chain is conducted in real-time or near real-time. The consensus result of the main chain is at least no later than the consensus result of the secondary chain. If the time it takes to obtain the consensus result of the main chain is later than the time it takes to obtain the consensus result of the secondary chain, then the secondary chain must block and wait for the main chain to obtain the result before starting the next round of the consensus process.
[0108] Furthermore, the main chain can utilize advantageous resources. The main chain prioritizes the use of node resources, while secondary chains can use node resources according to any priority order.
[0109] Cross-chain data is verified. Except for cross-chain data that fails verification, the data is packaged into a data block, forming a data block to be verified. The main chain and the secondary chain reach a consensus on the data block to be verified, and the data blocks that reach a consensus are packaged and uploaded to the chain. Transaction data that fails verification is added to the unverifiable dataset.
[0110] Furthermore, if the consensus results of the main chain and the secondary chain are consistent, then the main chain and the secondary chain do not need to interact to verify the results. This can reduce the coupling between the main chain and the secondary chain and improve the efficiency of cross-chain communication.
[0111] Furthermore, if the main chain and the secondary chain use different consensus mechanisms, their consensus results may be inconsistent. In this case, the consensus results of the main chain and the secondary chain are mutually verified. The mutual verification method includes: if the consensus results of the main chain and the secondary chain are inconsistent, the data of the main chain is re-entered into a consensus process; if the consensus result is consistent with the first one, the secondary chain adopts the consensus result of the main chain to achieve consensus consistency between the main chain and the secondary chain.
[0112] Furthermore, during interactive verification, the main chain and the sub-chain enter a blocking wait, and do not proceed to the consensus of the next data block. They wait for the interactive verification result to be completed before proceeding to the consensus process of the next data block.
[0113] In one embodiment, a trusted third party or election committee acts as a notary public to establish an indirect trust mechanism between two heterogeneous blockchains, forming a cross-chain system. Cross-chain interaction between the two consortium blockchains A and B requires the notary public to facilitate interaction, rather than direct interaction.
[0114] Optionally, a trusted third party, acting as a notary public, can serve as a consensus node in the cross-chain system, responsible for packaging, verification, and consensus processes, based on a third-party institution recognized by multiple consortium blockchains.
[0115] Optionally, the election committee, acting as a notary group, can obtain several reliable and stable nodes from within each consortium blockchain system to serve as consensus nodes for the cross-chain system, including packaging, verification, and consensus processes.
[0116] Furthermore, the tasks performed by the notary group include data collection and packaging, data verification, dissemination, reporting, punishment of malicious behavior, and consensus-building processes.
[0117] Furthermore, the notary group selects a cross-chain interaction consensus mechanism from multiple consensus modules to achieve consensus.
[0118] In one embodiment, a multi-chain parallel mode is adopted in the cross-chain system, and multiple consensus mechanism modules are deployed in the cross-chain system to achieve consensus mechanism mode switching.
[0119] Furthermore, in a multi-chain parallel mode, multiple blockchains operate in parallel. The cross-chain system includes both existing blockchain components and new blockchains. The existing blockchain serves as the initial block for the new blockchain, representing historical data and used solely for backtracking and reconciliation. Each blockchain can add new blocks to the existing blockchain, creating a new blockchain. The new blockchain not only retains data from the original consortium blockchain but also includes new cross-chain data, enabling traceability of the source data.
[0120] Furthermore, based on the consensus mechanism proposed by impartial individuals or the committee, a consensus mechanism is obtained from multiple consensus modules to reach a consensus, and the consensus-consensus blocks are added to the blockchain respectively.
[0121] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0122] Based on the same inventive concept, this application also provides a blockchain cross-chain device for implementing the blockchain cross-chain method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more blockchain cross-chain device embodiments provided below can be found in the limitations of the blockchain cross-chain method described above, and will not be repeated here.
[0123] In one embodiment, such as Figure 8 As shown, a blockchain cross-chain device is provided, including: a blockchain acquisition module 810, a consensus algorithm acquisition module 820, a data block consensus module 830, and a data block on-chain module 840, wherein:
[0124] The blockchain acquisition module 810 is used to acquire the first blockchain and the second blockchain to be processed, and to acquire the first data block contained in the first blockchain and the second data block contained in the second blockchain.
[0125] The consensus algorithm acquisition module 820 is used to acquire the target consensus algorithm from a variety of pre-deployed consensus algorithms.
[0126] The data block consensus module 830 is used to obtain a target data block that is consistent with the consensus between the first data block and the second data block using the target consensus algorithm.
[0127] The data block on-chain module 840 is used to process the target data block on the blockchain to obtain the target blockchain.
[0128] In one embodiment, the apparatus further includes an encoding list construction module; the consensus algorithm acquisition module includes a consensus algorithm acquisition unit.
[0129] The encoding list construction module is used to construct the encoding list; the encoding list stores the encoding identifiers corresponding to each consensus algorithm.
[0130] The consensus algorithm acquisition unit is used to obtain the target code identifier from the code list, and based on the target code identifier, obtain the consensus algorithm corresponding to the target code identifier as the target consensus algorithm.
[0131] In one embodiment, the number of target blockchains is multiple; the device also includes a blockchain confirmation module and an interactive verification module.
[0132] The blockchain confirmation module is used to confirm one target blockchain as the main chain from multiple target blockchains, and to designate the target blockchains other than the main chain as secondary chains.
[0133] The interactive verification module is used to perform interactive verification on the third data block and the fourth data block if the consensus result of the third data block in the main chain is inconsistent with that of the fourth data block corresponding to the third data block in the sub-chain, so as to make the consensus results of the third data block and the fourth data block consistent.
[0134] In one embodiment, the interactive verification module includes a re-consensus unit and a consensus result processing unit.
[0135] The second consensus unit is used to conduct a second consensus on the third data block in the main chain using the target consensus algorithm corresponding to the main chain.
[0136] If the consensus result processing unit finds that the consensus result of the second consensus is consistent with the consensus result of the first consensus, it will use the consensus result of the third data block as the consensus result of the fourth data block, so that the consensus results of the third data block and the fourth data block are consistent.
[0137] In one embodiment, the data block on-chain module includes an initial data acquisition unit and a target blockchain acquisition unit.
[0138] The initial data acquisition unit is used to acquire the initial data block; the initial data block is the first data block contained in the first blockchain, or the second data block contained in the second blockchain.
[0139] The target blockchain acquisition unit is used to process the initial data block and the target data block on the blockchain to obtain the target blockchain.
[0140] In one embodiment, the blockchain acquisition module includes a consortium blockchain acquisition unit and a blockchain acquisition unit.
[0141] The consortium blockchain acquisition unit is used to acquire the first consortium blockchain and the second consortium blockchain. The first consortium blockchain and the second consortium blockchain each deploy multiple sub-blockchains. Among them, the different sub-blockchains contained in the same consortium blockchain correspond to different consensus algorithms.
[0142] The blockchain acquisition unit is used to acquire the first blockchain from multiple sub-blockchains of the first consortium blockchain, and to acquire the second blockchain from multiple sub-blockchains of the second consortium blockchain.
[0143] The modules in the aforementioned blockchain cross-chain device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0144] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores various consensus algorithms and blockchains. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a cross-chain blockchain method.
[0145] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0147] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0148] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0149] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0150] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0151] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A blockchain cross-chain method, characterized in that, The method includes: Obtain the first blockchain and the second blockchain to be processed, and obtain the first data block contained in the first blockchain and the second data block contained in the second blockchain; Select the target consensus algorithm from a variety of pre-deployed consensus algorithms; Using the target consensus algorithm, a target data block with consistent consensus is obtained from the first data block and the second data block; The target data block is then processed on the blockchain to obtain the target blockchain; The number of target blockchains is multiple; the process of uploading the target data blocks to the blockchain to obtain the target blockchain includes: One target blockchain is identified as the main chain from multiple target blockchains, and the target blockchains other than the main chain are designated as secondary chains. If the consensus result of the third data block in the main chain is inconsistent with that of the fourth data block in the sub-chain corresponding to the third data block, then the third data block and the fourth data block are interactively verified to make their consensus results consistent. The interactive verification of the third data block and the fourth data block includes: Using the target consensus algorithm corresponding to the main chain, consensus is reached again on the third data block in the main chain; If the result of the second consensus is consistent with the result of the first consensus, then the consensus result of the third data block is used as the consensus result of the fourth data block, so that the consensus results of the third data block and the fourth data block are consistent. The step of uploading the target data block to the blockchain to obtain the target blockchain includes: Obtain an initial data block; the initial data block is the first data block contained in the first blockchain, or the second data block contained in the second blockchain; The initial data block and the target data block are added to the blockchain for processing to obtain the target blockchain; The process of obtaining the first and second blockchains to be processed includes: Obtain a first consortium blockchain and a second consortium blockchain, each of which deploys multiple sub-blockchains; wherein, different sub-blockchains contained in the same consortium blockchain correspond to different consensus algorithms; The first blockchain is obtained from multiple sub-blockchains of the first consortium blockchain, and the second blockchain is obtained from multiple sub-blockchains of the second consortium blockchain.
2. The method according to claim 1, characterized in that, Before selecting the target consensus algorithm from a variety of pre-deployed consensus algorithms, the process includes: Construct an encoding list, wherein the encoding list stores the encoding identifiers corresponding to each consensus algorithm; The step of obtaining the target consensus algorithm from a variety of pre-deployed consensus algorithms includes: Obtain the target code identifier from the code list, and obtain the consensus algorithm corresponding to the target code identifier based on the target code identifier, which is then used as the target consensus algorithm.
3. A blockchain cross-chain device, characterized in that, The device includes: The blockchain acquisition module is used to acquire the first blockchain and the second blockchain to be processed, and to acquire the first data block contained in the first blockchain and the second data block contained in the second blockchain; The consensus algorithm acquisition module is used to acquire the target consensus algorithm from a variety of pre-deployed consensus algorithms. The data block consensus module is used to obtain a target data block that is consistent with the consensus from the first data block and the second data block using the target consensus algorithm. The data block on-chain module is used to process the target data block on the blockchain to obtain the target blockchain, and the number of target blockchains is multiple. The blockchain confirmation module is used to confirm one target blockchain as the main chain from multiple target blockchains, and to designate the target blockchains other than the main chain as secondary chains. An interactive verification module is used to perform interactive verification on the third data block and the fourth data block if the consensus result of the third data block in the main chain is inconsistent with that of the fourth data block corresponding to the third data block in the sub-chain, so as to make the consensus results of the third data block and the fourth data block consistent; the interactive verification module includes a re-consensus unit and a consensus result processing unit. The second consensus unit is used to conduct a second consensus on the third data block in the main chain using the target consensus algorithm corresponding to the main chain. A consensus result processing unit is configured to, if the result of the second consensus is consistent with the consensus result of the first consensus, use the consensus result of the third data block as the consensus result of the fourth data block, so that the consensus results of the third data block and the fourth data block are consistent. The data block on-chain module includes an initial data acquisition unit and a target blockchain acquisition unit; The initial data acquisition unit is used to acquire an initial data block; the initial data block is the first data block contained in the first blockchain, or the second data block contained in the second blockchain; The target blockchain acquisition unit is used to process the initial data block and the target data block on the blockchain to obtain the target blockchain; The blockchain acquisition module includes a consortium blockchain acquisition unit and a blockchain acquisition unit; The consortium blockchain acquisition unit is used to acquire a first consortium blockchain and a second consortium blockchain, wherein the first consortium blockchain and the second consortium blockchain respectively deploy multiple sub-blockchains; wherein, different sub-blockchains contained in the same consortium blockchain correspond to different consensus algorithms. The blockchain acquisition unit is used to acquire the first blockchain from multiple sub-blockchains of the first consortium blockchain, and to acquire the second blockchain from multiple sub-blockchains of the second consortium blockchain.
4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method of claim 1 or 2.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 1 or 2.
6. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 1 or 2.
Citation Information
Patent Citations
Block chain data interaction method and device capable of switching consensus algorithms
CN110365695A
Cross-chain transaction method for block chain heterogeneous chain
CN112150284A