Relay chain cross-chain consensus method based on priority
Through the priority-based cross-chain consensus method of relay chain, the transaction verification problem caused by the large load of relay nodes is solved, and rapid emergency transaction verification and large-scale cross-chain transaction processing capabilities are achieved.
Patent Information
- Application Number
- CN202510484366.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-06-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing relay chain technology, the relay nodes have a large load, which leads to the inability to verify emergency transactions in time, and the verification process of cross-chain interaction is inefficient.
The priority-based cross-chain consensus method of relay chain is adopted, and the optimal main consensus node is calculated through transaction priority evaluation, genetic algorithm selection, and combining cross-chain transaction priority with node load, historical reputation, etc. to ensure rapid verification of high-priority transactions.
The consensus verification speed of emergency transactions and important transactions has been accelerated, the pressure on relay chain nodes has been reduced, the ability to handle large-scale cross-chain transactions has been improved, and the real-time and stability of cross-chain transactions has been ensured.
Smart Images

Figure CN120151348A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and particularly relates to a cross-chain consensus method and system for a relay chain based on priorities. Background Art
[0002] With the continuous development of blockchain technology, more and more public blockchains, private blockchains, consortium blockchains and other various types of blockchains have emerged. However, due to the differences in the architectures, consensus algorithms, block generation mechanisms, etc. of these blockchain systems, it has become very difficult to perform data interaction between blockchains, which has given rise to cross-chain technology. The core of cross-chain technology lies in breaking the information barriers between different chains and realizing the interconnection of values on different chains. Among the mainstream cross-chain solutions, the notary mechanism, the hash locking mechanism and the relay chain mechanism are three of the most representative technical paths. The notary mechanism introduces one or more centralized nodes as trusted third parties to achieve asset transfer between two independent blockchain systems. This method is relatively simple to implement, but it partially sacrifices the decentralization characteristics of the blockchain, thereby reducing the security and censorship resistance of the system. To reduce the centralized dependence in the cross-chain process, the hash locking mechanism is introduced. This mechanism allows both parties to a transaction to complete the transaction payment by solving a hash puzzle within a specified time. The combination of the hash lock and the time lock can ensure the atomicity and security of the transaction, and the cross-chain transfer of assets can be completed without relying on a trusted third party. However, since this mechanism can only be used between a small number of blockchains, its application scope is very limited. The relay chain mechanism introduces a third-party chain to be responsible for processing transactions between different blockchain systems in a blockchain network. A cross-chain gateway is used as a component for connecting the relay chain and different blockchains, and is responsible for data conversion, verification, etc. of cross-chain transactions, avoiding the centralized risks that are prone to occur in the notary mechanism. At the same time, the relay chain can also perform consensus, verification, etc., which can significantly improve the performance of the overall blockchain system. However, although the existing relay chain cross-chain solutions have achieved cross-chain data transmission to a certain extent, due to the inherent transaction consensus and verification mechanisms of the blockchain system, in an unstable network environment, the verification time of relay nodes is relatively long, and in the case of large-scale cross-chain transactions, the relay nodes are overloaded, etc., which will all lead to an inefficient verification process for cross-chain interaction, making it difficult for the cross-chain system to process emergency transactions within the specified time. Summary of the Invention
[0003] The present invention aims to overcome the problems still existing in the existing relay chain technology, such as large load on relay nodes and inability to verify emergency transactions in a timely manner, and provides a cross-chain consensus method and system for a relay chain based on priorities.
[0004] First, the content involved in the present invention will be described.
[0005] Parallel chain: It refers to a blockchain with independent structure and functions in a cross-chain system, which can independently process local transactions. Each parallel chain joining the relay chain system needs to be registered on the relay chain. The parallel chain that sends cross-chain transactions is called the source chain, and the parallel chain that receives cross-chain transactions is called the destination chain.
[0006] Relay chain: It refers to a blockchain that provides services for cross-chain transactions. By receiving cross-chain requests forwarded by the source chain gateway, it conducts consensus and verification for cross-chain transactions, and forwards the successfully verified cross-chain transactions to the destination chain gateway.
[0007] Cross-chain gateway: It refers to the interaction component between the parallel chain and the relay chain, which is a node independent of the parallel chain and the relay chain. Its main functions include listening for and receiving cross-chain requests from the parallel chain, packing them and sending them to the corresponding nodes of the relay chain, receiving cross-chain transactions verified by the relay chain, unpacking them and forwarding them to the relevant nodes of the parallel chain.
[0008] Relay chain consensus node: It refers to the node in the relay chain responsible for conducting consensus on cross-chain transactions.
[0009] Parallel chain leader node: It refers to the node in the parallel chain responsible for packing the transactions in the memory pool. There is one and only one leader node in a parallel chain. The leader node is updated regularly to prevent node failures or overloading.
[0010] The technical solution of the present invention is: A relay chain cross-chain consensus method based on priority, including the following steps: Step 1: The user submits a transaction request to the parallel chain node. After receiving the transaction request, the parallel chain node checks the transaction information. After successful checking, it forwards the cross-chain transaction to the corresponding cross-chain gateway of the parallel chain where it is located, and forwards the local transaction to the parallel chain leader node; Step 2: Transaction priority evaluation. When the cross-chain gateway receives cross-chain transactions forwarded by multiple parallel chain nodes at the same time, it will send them to the consensus nodes of the relay chain in the order of the evaluated transaction priorities, that is, the high-priority transaction first sending mechanism; for transactions with the same priority, they will be transmitted according to the principle of first in first out; Step 3: Selection of relay chain consensus nodes. For a relay chain with N nodes, when the master node receives more than two-thirds of the successfully verified feedback messages, it means that the cross-chain transaction consensus is successful; the cross-chain transaction P is broadcast by the node M to the consensus time set of N-1 other nodes , and L nodes with the fastest consensus verification speed are selected through the genetic algorithm to participate in the consensus, and L satisfies the following conditions: ; Step 4: Consensus of cross-chain transactions. When a cross-chain gateway node sends a cross-chain transaction, the optimal node is selected from the consensus node group selected in Step 3 as the primary consensus node for sending; the cross-chain gateway node forwards the cross-chain transaction to the primary consensus node, verifies it according to the cross-chain transaction consensus process, forwards the successfully verified cross-chain transaction to the destination chain gateway node, and the destination chain gateway node unpacks the cross-chain transaction and forwards it to the destination chain leader node; Step 5: Sorting and packaging of transactions. Any parallel chain leader node re-evaluates the priority of the received cross-chain transactions; the parallel chain leader node stores the received local transactions and cross-chain transactions in the queue of the memory pool according to the priority. Whenever the block production cycle is reached, the transactions are packaged in descending order until the memory pool is emptied or the size of the packaged transactions has reached the maximum block size.
[0011] Further, the transaction information includes the source chain id, destination chain id, transaction type, transaction content, identity information, and maximum allowed waiting time.
[0012] Further, in Step 2, the priority evaluation formula for transaction P is: (1) where is the maximum allowed waiting time of the transaction, is the level of the transaction sender, is the highest priority, is the emergency weight parameter, is the identity weight parameter; where , .
[0013] Further, the consensus time for consensus node N to process the cross-chain transaction of primary consensus node M is: Sending process of cross-chain transaction: The cross-chain transaction needs to be broadcast from the primary node responsible for this transaction to other consensus nodes; assume the size of cross-chain transaction P is b, and the bandwidth between node M and node N on the relay chain is , then the time for cross-chain transaction P to be sent from node M to node N is:
[0014] Processing process of cross-chain transaction: The cross-chain transaction needs to be verified for data integrity and authenticity on the consensus node. Assume the computing power of node N is , then the verification time of cross-chain transaction P on node N is:
[0015] Feedback process of cross-chain transactions: After a cross-chain transaction is verified by a consensus node, it is necessary to feedback a verification result to the main node. Assume the size of the feedback message is , then the time for the cross-chain transaction P to be fed back from node M to node N is: Therefore, the consensus time for the consensus node N to process the cross-chain transaction of the main consensus node M is: .
[0016] Furthermore, the specific process of selecting consensus nodes using the genetic algorithm is as follows: Select M relay nodes to submit cross-chain requests at the same time, and randomly broadcast the cross-chain requests to L nodes to participate in the consensus, that is, M cross-chain transactions are all consensus-verified by different consensus node groups. Use the random strategy to generate K populations, where each population includes M relay node group schemes; Evaluate the fitness of the population, with the average consensus delay of cross-chain transactions as the evaluation criterion; for the cross-chain transaction P, its consensus delay set , the consensus delay set of M cross-chain transactions in population Q , then the fitness of population Q:
[0017] Evaluate the fitness of each population, and use the roulette wheel random method to select the individual with the best performance in the population. The probability selection function for population Q to be selected is: (2) After calculation, establish a probability space corresponding to each population in the [0,1] space, randomly generate numbers on [0,1], and continue until two individuals that meet the conditions are selected as the parents for crossover; During the crossover process, the genes of the consensus node group scheme will be replaced and recombined, thereby generating new individuals. The crossover process can increase the probability of searching for the optimal consensus node group scheme; The iteration process uses the elite strategy to replace the sample with the lowest fitness evaluation value each time with the new offspring sample generated after crossover and mutation; when the maximum iteration number is reached or the fitness evaluation values of three consecutive generations are close to convergence, that is, the termination condition is reached, the optimal fitness transmission strategy is obtained.
[0018] Furthermore, in step 4, the selection process of the main consensus node is as follows: The cross-chain gateway node will record a reputation evaluation table according to the historical transaction times and success rates with the consensus nodes, and consider the completion status of cross-chain transactions at each priority level, Represents the reputation evaluation of the cross-chain gateway node M for the consensus node N; uses a sliding window mechanism, taking the past N transactions instead of all historical transactions as the evaluation criterion; Meanwhile, the cross-chain gateway node monitors the queuing situation of cross-chain transactions inside the consensus node in real time; Suppose the priority of the cross-chain transaction P to be sent is V, and the transmission time of each cross-chain transaction is , combined with the transaction sorting rule, the queuing time function of this transaction P is:
[0019] Among them, is the number of cross-chain transactions with priority , and K is the maximum priority in step 2; The cross-chain gateway node will evaluate the current state of the consensus node, and the evaluation function is:
[0020] Among them, , .
[0021] Furthermore, considering the time of cross-chain consensus and transmission, for the cross-chain transaction P, its priority evaluation formula is:
[0022] Among them, is the processed time of the cross-chain transaction, is the maximum allowed waiting time of the transaction, is the level of the transaction sender, is the highest priority, is the emergency weight parameter, is the identity weight parameter.
[0023] An electronic device, which includes: At least one processor; A memory; At least one application program, where the at least one application program is stored in the memory and is configured to be executed by the at least one processor, and the at least one application program is configured to: execute the above method.
[0024] A computer-readable storage medium, including: a computer program stored with the ability to be loaded and executed by a processor to execute the above method.
[0025] Compared with the prior art, the present invention has the following advantages and beneficial effects: for the generation and forwarding of transactions, the priority of transactions is evaluated according to the urgency of transactions and the identity weight. The genetic algorithm is used to regularly update the nodes participating in the consensus on the relay chain according to the network conditions and node conditions. Combining the cross-chain transaction priority with the node load, historical reputation, etc., the optimal main consensus node is calculated. The cross-chain transactions and local transactions are stored together, and the parallel chain leader node is used to package and generate blocks. By using the present invention, the consensus verification speed for urgent transactions and important transactions can be accelerated. The relay chain nodes focus on the consensus process of cross-chain transactions and hand over the task of packaging and generating blocks to the parallel chain for processing, which can effectively reduce the pressure on the relay chain nodes and improve the ability to process large-scale cross-chain transactions.
[0026] The present invention can meet the requirement of transaction real-time performance. For cross-chain transactions that have been verified for a long time, both the cross-chain transactions and local transactions are stored in the same memory pool in the order of priority from high to low. Compared with the traditional first-in-first-out mechanism, the processing time of high-priority transactions can be greatly reduced. At the same time, processing cross-chain transactions and local transactions together can also better reduce the processing pressure on the relay chain.
[0027] The present invention proposes an algorithm for the selection and update of consensus nodes, which ensures the stability of the cross-chain transaction consensus process, prevents the situation where cross-chain transactions cannot be verified in time due to excessive node load or network fluctuations. At the same time, combined with the design of priority, the consensus order of cross-chain transactions is ensured, and the waiting time for high-priority transactions to be verified at the relay chain consensus nodes is greatly reduced, which can meet the real-time requirements of urgent transactions and important transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flowchart of the method of the present invention.
[0029] Figure 2 is a schematic diagram of the overall structure of the relay chain technology used in the present invention.
[0030] Figure 3 is a flowchart of the genetic algorithm for selecting and updating the consensus node group.
[0031] Figure 4 is a schematic diagram of the main node selection algorithm. DETAILED DESCRIPTION OF THE INVENTION
[0032] The present invention will be further described in detail below in conjunction with the embodiments and the accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0033] A relay chain cross-chain consensus method based on priority includes the following steps: Step 1: The user submits a transaction request to the parallel chain node. After receiving the transaction request, the parallel chain node checks the transaction information. After successful checking, it forwards the cross-chain transaction to the cross-chain gateway corresponding to the parallel chain where it is located, and forwards the local transaction to the parallel chain leader node.
[0034] Step 2: The relay chain node consists of two parts: a consensus node and an ordinary node. Among them, the consensus node is responsible for the consensus of the cross-chain transactions forwarded by the cross-chain gateway, while the ordinary node only participates in the process of going on-chain. At the same time, the main node responsible for transaction consensus is also a relay chain consensus node. In order to prevent node failures caused by long-term transaction processing, the consensus node will be updated regularly.
[0035] Step 3: The source chain gateway evaluates the priority of the cross-chain transaction according to the relevant information of the received cross-chain transaction, and determines the priority of each cross-chain transaction among k priorities. For the cross-chain transactions received from parallel chain nodes at the same time, the sending order of the cross-chain transactions will be determined according to the evaluated priority, that is, ensuring that the higher-priority cross-chain transactions can be processed first.
[0036] Step 4: The consensus process of each cross-chain transaction needs to be responsible for by a main node. Each cross-chain gateway monitors and collects the real-time information of the consensus node. Whenever the cross-chain gateway needs to forward a cross-chain transaction, it will select the best consensus node as the main node according to the collected real-time information of the consensus node.
[0037] Each main node responsible for the consensus of cross-chain transactions distributes it to the consensus node group selected in Step 2, and the cross-chain transaction is verified by each node in the consensus node group. The main node forwards the successfully verified cross-chain transaction to the destination chain gateway, and forwards the failed cross-chain transaction to the source chain gateway.
[0038] Step 5: The parallel chain leader node maintains a multi-priority queue in the memory pool. When receiving a cross-chain transaction or a local transaction, it will evaluate its priority according to Step 3 and queue the transaction into the corresponding priority queue. When the parallel chain reaches the block production period, the transactions in the memory pool are packed and written into the block in the order of queue priority from high to low. Embodiment
[0039] As Figure 1 shown, the present invention provides a priority-based cross-chain consensus method and system for a relay chain, and its specific implementation process is as follows: 1. Generation and forwarding of transactions The user invokes the smart contract and submits a transaction request to the parallel chain node. The transaction information needs to include necessary information such as the source chain id, destination chain id, transaction type, transaction content, identity information, maximum allowed waiting time, etc. After receiving the transaction request, the parallel chain node checks the transaction information, adds a transaction id and a timestamp to the transaction, forwards the local transaction to the parallel chain leader node, and forwards the cross-chain transaction to the cross-chain gateway node corresponding to the parallel chain where it is located. The cross-chain gateway signs and encrypts the cross-chain transaction, and then encapsulates and packages it to ensure the confidentiality and integrity of the transmission process.
[0040] As Figure 2 shown, in the relay chain technology, the relay chain is an independent blockchain that is interconnected with multiple blockchains of the blockchain system through cross-chain gateways. The main functions of the cross-chain gateway include listening for and receiving cross-chain requests from parallel chains, packaging them and sending them to the corresponding nodes of the relay chain, receiving the cross-chain transactions verified by the relay chain, and unpacking and forwarding them to the relevant nodes of the parallel chain.
[0041] The consensus process of specific cross-chain transactions is responsible by the consensus nodes of the relay chain. The relay chain nodes are divided into two parts: consensus nodes and ordinary nodes. The consensus nodes are responsible for the consensus process of cross-chain transaction signatures, and the ordinary nodes are only responsible for the process of uploading to the chain.
[0042] 2. Transaction Priority Evaluation The data structure of the cross-chain transaction after being processed by the cross-chain gateway node is shown in Table 1: Table 1 Data Structure of Cross-chain Transaction after being Processed by Cross-chain Gateway Node
[0043] In this embodiment, the priority evaluation formula for transaction P is: (1) where is the maximum allowed waiting time of the transaction, is the level of the transaction sender, is the highest priority, is the emergency weight parameter, is the identity weight parameter.
[0044] where , .
[0045] When the cross-chain gateway receives cross-chain transactions forwarded by multiple parallel chain nodes at the same time, it will send them to the consensus nodes of the relay chain in the order of the evaluated transaction priorities, that is, the high-priority transaction first sending mechanism. For transactions with the same priority, they will be transmitted according to the first-in, first-out principle.
[0046] 3. Selection of Relay Chain Consensus Nodes For any cross-chain transaction, the successful consensus verification on the relay chain requires the following process: Sending process of cross-chain transaction: The cross-chain transaction needs to be broadcast from the main node responsible for this transaction to other consensus nodes. Assume the size of cross-chain transaction P is b, and the bandwidth between node M and node N on the relay chain is , then the time for cross-chain transaction P to be sent from node M to node N is: (2) Processing process of cross-chain transaction: The cross-chain transaction needs to verify data integrity and authenticity on the consensus node. Assume the computing power of node N is , then the verification time of cross-chain transaction P on node N is: (3) Feedback process of cross-chain transaction: After the cross-chain transaction is verified on the consensus node, it needs to feedback a verification result to the main node. To reduce the communication pressure of transmission, only the important information of the transaction needs to be returned. Assume the size of the feedback message is , then the time for cross-chain transaction P to be fed back from node M to node N is: (4) Therefore, the consensus time for consensus node N to process the cross-chain transaction of main consensus node M is: (5) Assume a relay chain with N nodes. When the main node receives more than two-thirds of the feedback messages with successful verification, it represents the successful consensus of the cross-chain transaction. The consensus time set of cross-chain transaction P broadcast from node M to N - 1 other nodes , in this embodiment, without considering malicious nodes, to improve the link utilization rate, only the fastest L nodes with consensus verification speed need to be selected to participate in the consensus.
[0047] As Figure 3 shown, in the initial selection and timing update process of consensus nodes, all relay chain nodes have the opportunity to participate in the consensus verification process to compete to become consensus nodes. In this embodiment, the genetic algorithm is selected to select consensus nodes. This algorithm is memoryless during the iteration process and can select the most suitable consensus node group according to the current network state and node state. The specific selection process is as follows: In this embodiment, M relay nodes are selected to submit cross-chain requests at the same time, and the cross-chain requests are randomly broadcast to L nodes to participate in the consensus, that is, M cross-chain transactions are all consensus-verified by different consensus node groups. K populations are generated using the random strategy, and each population includes M relay node group solutions.
[0048] Evaluate the fitness of the population, and use the average consensus delay of cross-chain transactions as the evaluation criterion. For cross-chain transaction P, its consensus delay set , and the consensus delay set of M cross-chain transactions in population Q , then the fitness of population Q: (6) Evaluate the fitness of each population, and use the roulette wheel random method to select the individual with the best performance in the population. The probability selection function for population Q to be selected is: (7) After calculation, establish a probability space corresponding to each population in the space of [0,1]. For example, the distribution corresponding to population 1 is , and the distribution corresponding to population Q is . Randomly generate numbers on [0,1] until two individuals that meet the conditions are selected as the parents for crossover.
[0049] During the crossover process, the genes of the consensus node group scheme will be replaced and recombined, thereby generating new individuals. The crossover process can increase the probability of searching for the optimal consensus node group scheme.
[0050] To consider the sudden emergence of superior genes adapting to the new environment, set the mutation probability of the population to , which can also prevent the situation that the genetic iteration process is too fast to find the optimal solution.
[0051] The elite strategy is used in the iteration process, and the sample with the lowest fitness evaluation value in each iteration is replaced with the new offspring sample generated after crossover and mutation.
[0052] When the maximum iteration number is reached or the fitness evaluation values of three consecutive generations are close to convergence, that is, the termination condition is reached: (8) Among them, is a very small positive number, is the iteration number of the genetic algorithm.
[0053] After reaching the termination condition, obtain the transmission strategy with the optimal fitness, count the number of times each relay node participates in the consensus process under this strategy, and use these relay nodes as the consensus node group to be responsible for the cross-chain transaction consensus process in this cycle.
[0054] To prevent situations such as network fluctuations and node failures, it is necessary to dynamically adjust the consensus node group regularly.
[0055] 4. Consensus of Cross-Chain Transactions When the cross-chain gateway node sends a cross-chain transaction, it needs to consider aspects such as the load of the current consensus node and historical reputation, and select the optimal node from the consensus node group selected in step 3 as the primary node for sending. The selection process of the primary consensus node is as follows: As Figure 4 shown, the cross-chain gateway node will record a reputation evaluation table based on the historical transaction times and success rates with the consensus nodes. Considering the completion status of cross-chain transactions at each priority level, in this embodiment, represents the reputation evaluation of the cross-chain gateway node M for the consensus node N.
[0056] To reduce the impact of historical transactions on the reputation evaluation, a sliding window mechanism is used, and the past N transactions instead of all historical transactions are used as the evaluation criteria.
[0057] At the same time, the cross-chain gateway node also monitors the queuing situation of cross-chain transactions inside the consensus node in real time. In this embodiment, it is assumed that the priority of the cross-chain transaction P to be sent is V, and the transmission time of each cross-chain transaction is , combined with the transaction sorting rules introduced in step 2, the queuing time function of this transaction P is: (9) Among them, is the number of cross-chain transactions with priority , and K is the maximum priority mentioned in step 2.
[0058] Taking into account aspects such as the load and historical reputation of the consensus node, the cross-chain gateway node will evaluate the current state of the consensus node, and the evaluation function is: (10) Among them, , .
[0059] The cross-chain gateway node forwards the cross-chain transaction to the selected primary consensus node, verifies it according to the cross-chain transaction consensus process in step 3, forwards the successfully verified cross-chain transaction to the destination chain gateway node, and the destination chain gateway node unpacks the cross-chain transaction and forwards it to the destination chain leader node.
[0060] 5. Sorting and Packing of Transactions Any parallel chain leader node will re-evaluate the priority of the received cross-chain transactions according to the priority evaluation method in step 2. Considering the time of cross-chain consensus and transmission, the evaluation formula is modified. For the cross-chain transaction P in this embodiment, its priority evaluation formula is: (11) Among them It is the processed time of cross-chain transactions.
[0061] The parallel chain leader node stores the received local transactions and cross-chain transactions in the queue of the memory pool according to their priorities. Whenever the block production cycle is reached, the transactions are packaged in descending order until the memory pool is emptied or the size of the packaged transactions reaches the maximum block size.
[0062] An electronic device is provided in an embodiment of the present application. The electronic device includes: a processor and a memory. Among them, the processor and the memory are connected through a bus.
[0063] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in connection with the disclosure of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0064] The bus may include a path for transmitting information between the above components. The bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0065] The memory can be a ROM (Read Only Memory), or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory), or other types of dynamic storage devices that can store information and instructions. It can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0066] The memory is used to store the application program code for executing the solution of this application, and is controlled by the processor for execution. The processor is used to execute the application program code stored in the memory to implement the content shown in the foregoing method.
[0067] Among them, the electronic device includes but is not limited to: mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc.
[0068] The above embodiments are only used to illustrate the present invention. Any equivalent transformation and improvement made on the basis of the technical solution of the present invention should not be excluded from the protection scope of the present invention.
Claims
1. A priority-based relay chain cross-chain consensus method, characterized in that: The following steps are involved: Step 1: The user submits a transaction request to the parachain node. After receiving the transaction request, the parachain node checks the transaction information. If the check is successful, it forwards the cross-chain transaction to the cross-chain gateway corresponding to the parachain, and forwards the local transaction to the parachain leader node; Step 2: Transaction priority evaluation. When the cross-chain gateway receives cross-chain transactions forwarded by multiple parallel chain nodes at the same time, it will send them to the consensus node of the relay chain in the order of the priority of the evaluated transactions, that is, the high-priority transaction is sent first; for transactions of the same priority, they are transmitted according to the first-in-first-out principle; Step 3: Selection of the relay chain consensus node. A relay chain with N nodes. When the master node receives more than two-thirds of the verification success feedback messages, it means that the cross-chain transaction consensus is successful. The consensus time set of the cross-chain transaction P broadcast by node M to N-1 other nodes , select L nodes with the fastest consensus verification speed through genetic algorithm to participate in consensus, and L meets the following conditions: ; Step 4: Consensus of cross-chain transactions. When the cross-chain gateway node sends a cross-chain transaction, the best node is selected from the consensus node group selected in step 3 as the main consensus node for sending; The cross-chain gateway node forwards the cross-chain transaction to the main consensus node, verifies it according to the cross-chain transaction consensus process, and forwards the successfully verified cross-chain transaction to the destination chain gateway node. The destination chain gateway node unpacks the cross-chain transaction and forwards it to the destination chain leader node; Step 5: Sorting and packaging of transactions. Any parallel chain leader node will receive cross-chain transactions and re-evaluate the priority of cross-chain transactions; The parachain leader node stores the received local transactions and cross-chain transactions in the queue of the memory pool according to priority. Whenever a block cycle is reached, the transactions will be packaged in order from high to low until the memory pool is emptied or the packaged transaction size reaches the maximum block size.
2. A priority-based relay chain cross-chain consensus method according to claim 1, characterized in that: The transaction information includes the source chain ID, the destination chain ID, the transaction type, the transaction content, the identity information, and the maximum allowed waiting time.
3. A priority-based relay chain cross-chain consensus method according to claim 2, characterized in that: In step 2, the priority evaluation formula of transaction P is: (1) in, is the maximum allowed waiting time for a transaction, is the transaction sender level, The highest priority is is the emergency weight parameter, is the identity weight parameter; in, , .
4. A priority-based relay chain cross-chain consensus method according to claim 3, characterized in that: The consensus time for consensus node N to process the cross-chain transaction of main consensus node M : The sending process of cross-chain transactions: Cross-chain transactions need to be broadcast from the master node responsible for the transaction to other consensus nodes; assuming that the size of the cross-chain transaction P is b, the bandwidth between nodes M and N on the relay chain is , then the time it takes for a cross-chain transaction P to be sent from node M to node N is: ; Processing of cross-chain transactions: Cross-chain transactions require data integrity and authenticity verification on consensus nodes. Assuming that the computing power of node N is , then the verification time of the cross-chain transaction P on node N is: ; Feedback process of cross-chain transactions: After the cross-chain transaction is verified by the consensus node, a verification result needs to be fed back to the master node. Assuming that the size of the feedback message is , then the time it takes for the cross-chain transaction P to be fed back from node M to node N is: ; Therefore, the consensus time for consensus node N to process the cross-chain transaction of the main consensus node M is for: 。 5. A priority-based relay chain cross-chain consensus method according to claim 4, characterized in that: The specific process of selecting the consensus node by using the genetic algorithm is as follows: Select M relay nodes to submit cross-chain requests at the same time, and randomly broadcast the cross-chain requests to L nodes for consensus. That is, M cross-chain transactions are all verified by different consensus node groups. Use a random strategy to generate K populations, each of which includes M relay node group schemes. The fitness of the population is evaluated, and the average consensus delay of cross-chain transactions is used as the evaluation standard; for cross-chain transactions P, its consensus delay set , the consensus delay set of M cross-chain transactions in population Q , then the fitness of population Q is: ; The fitness of each population is evaluated, and the roulette random method is used to select the individual with the best performance in the population. The probability selection function of population Q being selected is: (2) After calculation, a probability space corresponding to various populations is established in the space of [0,1], and numbers on [0,1] are randomly generated until two individuals that meet the conditions are selected as parents for crossover; During the crossover process, the genes of the consensus node group solution will be replaced and reorganized, thereby generating new individuals. The crossover process can increase the probability of searching for the optimal consensus node group solution. The iterative process uses an elite strategy to replace the sample with the lowest fitness evaluation index each time with a new offspring sample generated after crossover mutation; When the maximum number of iterations is reached or the fitness evaluation values of three consecutive generations are close to convergence, the termination condition is reached and the transmission strategy with the optimal fitness is obtained.
6. A priority-based relay chain cross-chain consensus method according to claim 5, characterized in that: In step 4, the selection process of the main consensus node is as follows: The cross-chain gateway node will record a reputation evaluation table based on the number of historical transactions and success rates with the consensus node, and will consider the completion of cross-chain transactions at various priorities. Represents the reputation evaluation of the cross-chain gateway node M on the consensus node N; Use a sliding window mechanism to use the past N transactions instead of all historical transactions as the evaluation criteria; At the same time, the cross-chain gateway node monitors the cross-chain transaction queue status inside the consensus node in real time; Assume that the priority of the cross-chain transaction P to be sent is V, and the transmission time of each cross-chain transaction is , combined with the transaction sorting rules, the queuing time function of the transaction P is: ; in, The priority is The number of cross-chain transactions, K is the maximum priority in step 2; The cross-chain gateway node will evaluate the current status of the consensus node, and the evaluation function is: ; in, , .
7. A priority-based relay chain cross-chain consensus method according to claim 6, characterized in that: Taking into account the time of cross-chain consensus and transmission, the priority evaluation formula for cross-chain transaction P is: ; in, is the processing time of the cross-chain transaction, is the maximum allowed waiting time for a transaction, is the transaction sender level, The highest priority is is the emergency weight parameter, is the identity weight parameter.
8. An electronic device, characterized in that: The electronic device includes: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, the at least one application configured to: execute the consensus method described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that: include: A computer program is stored which can be loaded by a processor and execute the consensus method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Priority-based block chain consensus method and system in Internet of Vehicles
CN114189522A
Cross-domain vehicle identity authentication method based on master-slave multiple chains
CN116847349A
Node selection method, system and device based on block chain and storage medium
CN117675378A
Multi-verification-group collaborative verification method based on transaction packet slicing and node dynamic adjustment
CN118138379A
Blockchain-based crowdsourced initiatives tracking system
US20170236094A1