Block chain node processing method and device, equipment, medium and product
By comprehensively considering multiple performance dimensions and asset pledge amount in blockchain nodes and generating election indicators, the problem of inaccurate master node selection in existing technologies is solved, thereby improving the performance and security of the blockchain system.
Patent Information
- Application Number
- CN202410747873.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2025-12-12
AI Technical Summary
Existing methods for selecting blockchain nodes typically rely on a single-dimensional metric, leading to inaccurate node selection.
By comprehensively considering multiple performance dimensions of blockchain nodes and the amount of assets pledged, an election metric is generated through weighted fusion to improve the accuracy of selecting master nodes.
By comprehensively considering data from multiple dimensions, election metrics can more accurately select master nodes, thereby improving the overall performance and security of the blockchain system.
Smart Images

Figure CN121125733A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a blockchain node processing method, a blockchain node processing device, a computer device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] In the blockchain consensus process, leader selection is often involved. Leader selection refers to the process of electing one or more blockchain nodes to serve as master nodes through a certain mechanism. Master nodes are typically responsible for key tasks such as generating new blocks, processing transactions, and initiating consensus processes. The methods for leader selection vary across different blockchain consensus mechanisms. For example, in the Proof-of-Work (PoW) mechanism, leaders are selected by solving complex mathematical problems; in the Proof-of-Stake (PoS) mechanism, leaders are usually selected based on the amount of staked assets. It can be seen that current leader selection methods often rely on a single-dimensional indicator of the node, which is not accurate enough. Summary of the Invention
[0003] This application provides a blockchain node processing method, apparatus, device, medium, and product that can comprehensively consider multiple performance dimensions of node performance and node staking amount to determine node election indicators, thereby improving the accuracy of selecting master nodes during the consensus process.
[0004] On one hand, its embodiments provide a blockchain node processing method, wherein the blockchain includes N blockchain nodes, and the method is executed by a first blockchain node, which is any one of the N blockchain nodes, where N is an integer greater than or equal to 2; the method includes:
[0005] Obtain the node performance data of the second blockchain node in the k-th consensus process. The node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension. The second blockchain node is any blockchain node in the blockchain other than the first blockchain node.
[0006] Obtain the asset staking data of the second blockchain node in the k-th consensus process. The asset staking data includes the amount of digital assets pledged by the second blockchain node in the k-th consensus process.
[0007] The node performance data and asset staking data are weighted and fused to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
[0008] On one hand, its embodiments provide a blockchain node processing device, wherein the blockchain includes N blockchain nodes, and the device is executed by a first blockchain node in the blockchain, wherein the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2; the device includes:
[0009] The acquisition unit is used to acquire the node performance data of the second blockchain node in the k-th consensus process. The node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension. The second blockchain node is any blockchain node in the blockchain other than the first blockchain node.
[0010] The acquisition unit is also used to acquire the asset pledge data of the second blockchain node in the k-th consensus process. The asset pledge data includes the amount of pledged digital assets set by the second blockchain node in the k-th consensus process.
[0011] The processing unit is used to perform weighted fusion of node performance data and asset staking data to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
[0012] On one hand, embodiments of this application provide a computer device, which includes a processor, an input device, an output device, and a memory; the memory stores a computer program; when the computer program is executed by the processor, it performs the aforementioned blockchain node processing method.
[0013] On the one hand, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the aforementioned blockchain node processing method.
[0014] On the one hand, embodiments of this application provide a computer program product, which includes a computer program. When the computer program is executed by a processor, it performs the above-described blockchain node processing method.
[0015] In this embodiment, any blockchain node (such as the first blockchain node) can obtain the node performance data of the second blockchain node in the k-th consensus process. This node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension. Here, the second blockchain node is any blockchain node other than the first blockchain node. The asset staking data of the second blockchain node in the k-th consensus process is obtained. The asset staking data includes the amount of digital assets pledged by the second blockchain node in the k-th consensus process. The node performance data and the asset staking data are weighted and fused to obtain the election index of the second blockchain node. This election index is used to indicate the probability that the second blockchain node will be elected as the master node in the k+1-th consensus process. As can be seen, the election index of any blockchain node in this application comprehensively considers the node's performance in multiple performance dimensions and the amount of assets pledged by the node. Since the election index is obtained by comprehensively weighting data from multiple dimensions, this application can calculate the election index more accurately than the method of calculating the election index from a single dimension. Furthermore, since the master node in the k+1th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes, the determined master node can be more accurate and reliable. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application;
[0018] Figure 2 This is a schematic diagram of a blockchain structure provided in an embodiment of this application;
[0019] Figure 3a This is a schematic diagram of the structure of a blockchain node processing system provided in an embodiment of this application;
[0020] Figure 3b This is a schematic diagram of the structure of a blockchain node provided in an embodiment of this application;
[0021] Figure 4 This is a flowchart illustrating a blockchain node processing method provided in an embodiment of this application;
[0022] Figure 5This is a schematic diagram of a three-stage process for obtaining node performance data provided in an embodiment of this application;
[0023] Figure 6a This is a network topology diagram for obtaining asset pledge amount during the consensus process provided in an embodiment of this application;
[0024] Figure 6b This is a schematic diagram of the data storage structure of a first blockchain node provided in an embodiment of this application;
[0025] Figure 7 This is a schematic diagram of a process for determining election indicators provided in an embodiment of this application;
[0026] Figure 8 This is a flowchart illustrating another blockchain node processing method provided in an embodiment of this application;
[0027] Figure 9 This is a flowchart illustrating the acquisition of node performance data and asset pledge data provided in an embodiment of this application.
[0028] Figure 10 This is a flowchart of a comprehensive election process for a master node provided in an embodiment of this application;
[0029] Figure 11 This is a schematic diagram of the structure of a blockchain node processing device provided in an embodiment of this application;
[0030] Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0032] This application provides a blockchain node processing scheme, involving an adaptive performance evaluation and dynamically weighted staking mechanism for blockchain node election. This mechanism determines the election criteria for blockchain nodes by comprehensively weighting node performance and asset staking during the consensus process, thereby determining the master node based on these criteria. This node election mechanism, which combines performance and economic factors, improves the accuracy and reliability of master node selection, thus enhancing the overall performance and security of the blockchain system. Specifically, this scheme can be executed by the first blockchain node, which is any one of N (where N is an integer greater than or equal to 2) blockchain nodes. The principle of the proposed blockchain node processing scheme will be briefly explained below:
[0033] (1) Obtain the node performance data of the second blockchain node in the k-th consensus process. The k-th consensus process can be understood as any consensus process, and the second blockchain node is any blockchain node other than the first blockchain node. In addition, the node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension (e.g., transaction processing performance dimension, network performance dimension, processor performance dimension, storage performance dimension, etc.).
[0034] (2) Obtain the asset staking data of the second blockchain node in the k-th consensus process. Here, the asset staking data includes the amount of digital assets (e.g., digital assets of a preset type) pledged by the second blockchain node in the k-th consensus process.
[0035] (3) The node performance data and asset staking data of any second blockchain node are weighted and fused to obtain the election index of the current second blockchain node. Among them, the master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes; the election index here is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. For example, the election index can be an election score. The higher the election score of any blockchain node, the greater the probability that the blockchain node will be elected as the master node; conversely, the lower the election score, the smaller the probability that the blockchain node will be elected as the master node.
[0036] As can be seen above, on the one hand, the election index of any blockchain node in this application is generated by weighted fusion of node performance data and asset staking data. That is, the election index comprehensively considers the node's performance in multiple performance dimensions and the amount of asset staking of the node. Since the election index is obtained by comprehensive weighting of data from multiple dimensions, this application can calculate the election index more comprehensively and accurately than the method of calculating the election index from a single dimension. On the other hand, since the master node in the k+1th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes, the determined master node can be more accurate and reliable.
[0037] The following is a description of the key technical terms involved in this application.
[0038] I. Node performance data and asset pledge data.
[0039] Node performance data, as the name suggests, is data used to reflect the performance of a blockchain node. This data can be used to reflect the node performance of a blockchain node in at least one performance dimension. A performance dimension refers to a dimension or standard for the performance of a blockchain node. One performance dimension corresponds to a type of node performance, and a blockchain node corresponds to different types of node performance under different performance dimensions. For example, if the performance dimension is network, then the node performance under the network dimension can be network performance; if the performance dimension is processor, then the node performance under the processor dimension can be processor performance; if the performance dimension is storage, then the node performance under the storage dimension can be storage performance; and if the performance dimension is transaction processing, then the node performance under the transaction processing dimension can be transaction processing performance (such as TPS for block packaging and TPS for blockchain verification). In summary, the node performance under each of these performance dimensions can be combined to form the node performance data of a blockchain node.
[0040] Asset staking data refers to the data generated when blockchain nodes, in order to participate in the maintenance and decision-making process of the blockchain network, need to pre-deposit a certain amount of digital assets as "staking." Therefore, asset staking data includes the staking amount (also referred to as asset staking amount in this application) provided by the blockchain node for the staked digital assets. In Proof of Stake (PoS) or its variants, the amount of staked digital assets is usually associated with the probability of the blockchain node being elected as a master node. The purpose of staking is to provide economic incentives and penalties to encourage blockchain nodes to act honestly, as malicious behavior may result in the loss of staked digital assets. In this scheme, the asset staking amount is an important factor in electing the master node and can be used together with node performance data to evaluate and select the master node in the consensus process.
[0041] II. Election Indicators.
[0042] An election metric is an indicator used to indicate the probability that a second blockchain node will be elected as the master node in the (k+1)th consensus process. It should be understood that each blockchain node corresponds to one election metric. The data format of this metric can include, for example, any of the following: numerical value, string, or identifier. Taking a numerical election metric as an example, the election metric can be an election score. A higher election score for a blockchain node indicates a greater probability of it being elected as the master node; conversely, a lower election score indicates a lower probability of it being elected as the master node.
[0043] In this application, the election metric is obtained by weighted fusion of the node performance data and asset staking data of the blockchain node. Therefore, the election metric comprehensively considers the node performance under multiple performance dimensions and the asset staking amount of the blockchain node itself. The election metric can more comprehensively and accurately reflect the probability of the current blockchain node being elected as the master node.
[0044] III. Blockchain.
[0045] A blockchain is essentially a decentralized database, a chain of data blocks linked together using cryptographic methods. Each block contains relevant information used to verify the validity of that information (anti-counterfeiting) and to generate the next block. Specifically, this application will provide a detailed introduction to blockchain systems and related terminology, including their structure.
[0046] (1) Blockchain system:
[0047] Please see Figure 1 , Figure 1This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application. Figure 1 As shown, the blockchain system can be a data sharing system, which refers to a system used for data sharing between node devices. This data sharing system 100 can include multiple node devices 101, which can refer to various computer devices within the data sharing system. These computer devices can be, for example, terminal devices or servers. The device types of different node devices 101 can be the same or different; for example, one node device 101 can be a terminal device, while another node device 101 can be a server.
[0048] Specifically, each node device 101 can receive input information during normal operation and maintain shared data within the data sharing system based on the received input information. For example, when any node device 101 in the blockchain system receives input information (such as receiving an asset swap transaction that carries the contract identifier of the target smart contract to be invoked), the node device 101 can retrieve the target smart contract to be invoked from the blockchain based on the contract identifier carried in the transaction, invoke the target smart contract to execute the transaction, and then write the execution result of the transaction into the blockchain so that all blockchain nodes on the blockchain can jointly maintain the transaction data of the transaction.
[0049] (2) Blockchain Nodes:
[0050] ① Node functions:
[0051] a. Application functions: These functions are deployed in the blockchain to implement specific business needs. They record data related to the implementation of business functions (such as resource transfer functions, game business functions, etc.) to form record data. The record data carries a digital signature to indicate the source of the task data. The record data is sent to other nodes in the blockchain system so that when other nodes successfully verify the source and integrity of the record data, they can add the record data to a temporary block.
[0052] b. Contract Functionality: Any blockchain node in the blockchain system has the ability to call and execute corresponding smart contracts. Because smart contracts possess three key elements—commitment, protocol, and digital form—the application scope of blockchain can be extended to all aspects of transactions, payments, settlements, and clearing in the financial industry. A smart contract is one that executes its corresponding contract terms immediately when a pre-compiled condition is triggered, its working principle being similar to the if-then statement in a computer program. During the block consensus process, each blockchain node can call the corresponding smart contract based on the contract functionality to execute transactions and obtain execution results, thereby enabling each blockchain node to reach a block consensus based on its own execution results.
[0053] ② Node identifier:
[0054] Each node in a blockchain system has a corresponding node identifier, and each node can also store the node identifiers of other nodes in the blockchain system. This allows the generated blocks to be broadcast to other nodes in the blockchain system based on their node identifiers. Each node can maintain a node identifier list as shown in the table below, storing the node name and node identifier in this list.
[0055] The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node. Table 1 only uses IP address as an example.
[0056] Table 1. Node Identifier List
[0057] Node Name Node identifier Node 1 000.000.000.000 Node 2 111.111.111.111 … … Node N xxx.xxx.xxx.xxx
[0058] In the transaction processing scheme based on blockchain contracts in this application, each transaction in the transaction pool is packaged into a new block and then subjected to block consensus processing. During the block consensus process, interaction between various blockchain nodes is often involved. Optionally, during the interaction between various blockchains, any node can carry its own node identifier, so that other nodes can perform node verification processing based on the corresponding node identifier before performing consensus processing, thereby improving the data security of the node interaction process.
[0059] (3) Block structure:
[0060] Please see Figure 2 , Figure 2 This is a schematic diagram of a blockchain structure provided in an embodiment of this application. For example... Figure 2 As shown, a blockchain consists of multiple blocks, and each blockchain contains a genesis block, which, as the name suggests, is the first or initial block. The genesis block includes a block header and a block body. The block header stores input information features, a version number, a timestamp, and a difficulty value, while the block body stores the input information. The next block is a parent block of the genesis block, and it also includes a block header and a block body. The block header stores the input information features of the current block, the block header features of the parent block, the version number, the timestamp, and the difficulty value, and so on. This ensures that the transaction data stored in each block is related to the transaction data stored in the parent block, guaranteeing the security of the transaction data within each block.
[0061] In this application, any consensus process (e.g., the k-th consensus process, the k+1-th consensus process) involves consensus on blocks. That is, any block in the blockchain is reached through consensus. Therefore, the transaction data of each transaction stored in the block body in this application has the characteristics of being immutable, traceable, and jointly maintained. Based on this, the data security of the blockchain node processing process can be improved.
[0062] IV. Artificial Intelligence.
[0063] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to have perception, reasoning, and decision-making capabilities. AI technology is a comprehensive discipline involving a wide range of fields, encompassing both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technology, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0064] In this application, machine learning techniques from the field of artificial intelligence can be used to train an AI model (such as a performance prediction model). The trained performance prediction model can be used to predict the node performance of a blockchain node according to at least one performance dimension to obtain a performance prediction score for the blockchain node. This performance prediction score can then be used to determine the election criteria for the current blockchain node. By using an AI model with performance prediction capabilities to predict the performance of blockchain nodes, the performance prediction score of the blockchain node can be predicted automatically and accurately, thereby improving the accuracy and reliability of determining the election criteria.
[0065] V. Cloud technology.
[0066] The blockchain node processing scheme proposed in this application involves numerous data computing and data storage services, thus requiring significant computer operation costs. Therefore, this application can leverage cloud storage technology within cloud technology to perform corresponding data processing operations. Specifically, this includes: calling data storage services within the blockchain to store the asset staking data of each blockchain node separately, for example, in a state database; and calling data computing services to weightedly fuse the node performance data and asset staking data of any blockchain node to obtain the election index (such as an election score) for that blockchain node. Cloud technology, based on the cloud computing business model, encompasses network technology, information technology, integration technology, management platform technology, and application technology, which can form resource pools for flexible and convenient on-demand use. Cloud technology can include cloud storage technology. Cloud storage is a new concept extended and developed from cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that, through cluster applications, grid technology, and distributed storage file systems, aggregates a large number of various types of storage devices (also called storage nodes) in a network to work collaboratively, providing data storage and business access functions.
[0067] It should be specifically noted that the data involved in the blockchain node processing in this application (e.g., node performance data, asset staking data, election indicators, etc.) requires the permission or consent of the target entity when applied to specific products or technologies. Furthermore, the collection, use, and processing of related data must comply with relevant local laws, regulations, and standards, adhering to the principles of legality, legitimacy, and necessity, and must not involve acquiring data types prohibited or restricted by laws and regulations. In some optional embodiments, the related data involved in the embodiments of this application is obtained after separate authorization from the target entity. Additionally, when obtaining separate authorization from the target entity, the purpose of the related data is explained to the target entity.
[0068] The following is combined Figure 3a and Figure 3b This application provides a detailed description of the blockchain node processing system.
[0069] (1) Introduction to the overall architecture of the blockchain node processing system.
[0070] Please see Figure 3a , Figure 3a This is a schematic diagram of the architecture of a blockchain node processing system provided in an embodiment of this application. Figure 3aAs shown in the diagram, the architecture of the blockchain node processing system may include at least: a first blockchain node 301, at least one second blockchain node 302, and a client 303. The first blockchain node 301 and each of the second blockchain nodes 302 constitute a blockchain network, and the number of nodes in this blockchain network is for illustrative purposes only and does not specifically limit the number of nodes in this application. Furthermore, any blockchain node in the blockchain network (either the first blockchain node 301 or the second blockchain node 302) can be directly or indirectly connected to the client 303 via the network; the aforementioned network may include, but is not limited to, wired networks and wireless networks. The wired network includes local area networks (LANs), metropolitan area networks (MANs), and wide area networks (WANs), and the wireless network includes Bluetooth, Wi-Fi, and other networks that enable wireless communication.
[0071] In one possible implementation, any computer device in the blockchain node processing system (first blockchain node 301, second blockchain node 302, or client 303) can be a mobile phone, tablet, laptop, PDA, mobile internet device (MID), vehicle, in-vehicle equipment, roadside equipment, aircraft, wearable devices such as smartwatches, smart bracelets, pedometers, virtual reality devices, etc. In another possible implementation, any computer device (first blockchain node 301, second blockchain node 302, or client 303) can also be a server. Specifically, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0072] It is understood that the types of computer devices in the blockchain node processing system of this application may be the same or different. For example, the first blockchain node 301 may be a server, the second blockchain node 302 may be a laptop computer, and the client 303 may be a mobile phone; or, for example, both the first blockchain node 301 and the second blockchain node 302 may be laptop computers, and the client 303 may be a server; this application does not limit the number and type of each computer device.
[0073] The following section uses a blockchain with N (N≥2) nodes as an example to detail the data interaction process between the first blockchain node 301 and the second blockchain node 302:
[0074] ① The first blockchain node 301 obtains the node performance data of any second blockchain node 302 during the k-th consensus process. The node performance data is used to reflect the node performance of the second blockchain node 302 in at least one performance dimension (e.g., transaction processing performance dimension, network performance dimension, processor performance dimension, storage performance dimension, etc.).
[0075] ② The first blockchain node 301 obtains the asset staking data of the second blockchain node during the k-th consensus process. This asset staking data includes the amount of digital assets (e.g., preset type digital assets) pledged by the second blockchain node during the k-th consensus process.
[0076] ③ The first blockchain node 301 performs a weighted fusion of the node performance data and asset staking data of any second blockchain node to obtain the election index of the current second blockchain node 302. The first blockchain node 301 can broadcast the election index of the current second blockchain node 302 to the other N-2 blockchain nodes in the blockchain; it should be understood that any blockchain node other than the first blockchain node 301 can also calculate the election index of the current second blockchain node 302.
[0077] Optionally, the first blockchain node 301 can also receive election indicators sent by the other N-2 blockchain nodes in the blockchain, and then the first blockchain node 301 comprehensively determines the election indicators of the second blockchain node 302 based on the election indicators calculated by itself and the other N-2 election indicators.
[0078] ④ The first blockchain node 301 can also obtain N-1 scoring indicators about itself sent by the other N-1 second blockchain nodes, thereby determining its own election indicators; furthermore, the first blockchain node 301 can select the master node (such as the first blockchain node 301) from the N blockchain nodes in the k+1 consensus process according to the election indicators of the N blockchain nodes.
[0079] ⑤ Subsequently, the first blockchain node 301 can obtain the business transaction sent by the client 303 in the business scenario and execute the business transaction based on the master node. The business scenario here includes any of the following: financial scenario, supply chain management scenario, identity verification scenario, Internet of Things scenario, and gaming scenario.
[0080] (2) Introduction to the module structure of blockchain nodes.
[0081] Please see Figure 3b , Figure 3b This is a modular structure diagram of a blockchain node provided in an embodiment of this application. The blockchain node can refer to the first blockchain node or the second blockchain node mentioned above. Figure 3b As shown below, the internal implementation of any blockchain node and the interaction between its various modules are described in detail. The main modules include the following:
[0082] (1) Network Module: The network module is responsible for handling network communication between blockchain nodes, including sending and receiving data. It is used to handle all network-level operations, such as connection management, implementation of data transmission protocols, node discovery, and data synchronization.
[0083] (2) Verification Module: The verification module is responsible for verifying transactions and blocks to ensure their legality and correctness. It includes two sub-modules: certificate verification and permission verification.
[0084] a. Certificate Verification Module: Responsible for verifying the certificates of blockchain nodes to ensure the legitimacy of the node's identity.
[0085] b. Permission verification module: Responsible for verifying the permissions of a transaction, ensuring that the initiator of the transaction has the right to conduct the transaction.
[0086] (3) Transaction pool module: Used to store transactions that have not yet been packaged into blocks. It allows nodes to manage and maintain a buffer of pending transactions.
[0087] (4) Scheduling Module: Responsible for coordinating various activities of blockchain nodes, including transaction reception, processing, and block generation. It comprises four sub-modules: block generator, transaction scheduling module, contract repository, and contract process pool.
[0088] a. Block generator: Responsible for generating new blocks and ensuring the correct construction and validity of blocks.
[0089] b. Transaction scheduling module: responsible for scheduling transactions from the transaction pool to the contract process pool for execution.
[0090] c. Contract repository: Stores the code and related data of smart contracts.
[0091] d. Contract process pool: Manages the execution environment of smart contracts, providing resource isolation and execution efficiency.
[0092] (5) Consensus Module: This module implements the consensus mechanism in the blockchain network, ensuring that all blockchain nodes agree on the state of the blockchain. This may include Proof-of-Work (PoW), Proof-of-Stake (PoS), or other consensus algorithms. It includes a machine learning performance prediction model and a comprehensive election module.
[0093] a. Machine Learning Performance Prediction Model: This model uses machine learning algorithms to predict the performance of blockchain nodes and obtain performance prediction scores, thereby providing data support for blockchain node election.
[0094] b. Comprehensive Election Module: Combines node performance prediction and staked amount to elect the master node.
[0095] (6) Performance Proof Module: Responsible for generating and verifying evidence of node performance to prove that the blockchain node's performance meets network requirements. It includes the following sub-modules:
[0096] a. Proof Package Generation and Verification Module: Generates and verifies performance proof data.
[0097] b. Network Performance Verification Module: Verifies the network performance of blockchain nodes.
[0098] c. CPU performance verification module: Verifies the computing power of blockchain nodes.
[0099] d. Storage performance verification module: Verifies the storage performance of blockchain nodes.
[0100] (7) Storage Module: The storage module is responsible for storing blockchain data, including blocks, transactions, and states. It consists of two sub-modules: the block ledger and the state database.
[0101] a. Block Ledger: Stores all blocks. The block ledger is the core data structure of the blockchain system, used to store and manage all confirmed blocks. The block ledger is organized in a chain-like structure, with each block containing a set of transactions, a block header (including metadata such as the hash value and timestamp of the previous block), and other information. The block ledger provides the blockchain system with a public, immutable history of transactions, ensuring the system's transparency and consistency.
[0102] b. State Database: Stores the current state of the blockchain. State data is the data structure used in a blockchain system to represent the current state of the system. State data includes the balances of all accounts, the state of smart contracts, and other relevant information. State data is continuously updated as transactions are executed, reflecting the global state of the blockchain system at a given point in time. In a blockchain system, state data is typically stored in the form of a Merkle tree or other cryptographic data structures to ensure its integrity and security.
[0103] Based on this, the network module, verification module, transaction pool module, scheduling module, consensus module, performance proof module, and storage module included in the above blockchain node architecture are the operating foundation of the blockchain node processing solution of this application. The above architecture can ensure the efficient and stable operation of the system.
[0104] In the aforementioned blockchain node processing system, on the one hand, the election index of any blockchain node is generated by weighted fusion of node performance data and asset staking data. That is, the election index comprehensively considers the node's performance in multiple performance dimensions and the amount of asset staking. Since the election index is obtained by comprehensive weighting of data from multiple dimensions, this application can calculate the election index more comprehensively and accurately than the method of calculating the election index from a single dimension. On the other hand, since the master node in the k+1th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes, the determined master node can be more accurate and reliable.
[0105] It is understood that the blockchain node processing system described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art know, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0106] The following detailed description of the embodiments involved in the blockchain node processing scheme, with reference to the accompanying drawings, is provided in detail.
[0107] Please see Figure 4 , Figure 4 This is a flowchart illustrating a blockchain node processing method provided in an embodiment of this application. This blockchain node processing method can be executed by a first blockchain node in the blockchain, wherein the blockchain includes N blockchain nodes, the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2. Figure 4 As shown, the blockchain node processing method provided in this application embodiment may include S401-S403:
[0108] S401: Obtain the node performance data of the second blockchain node during the k-th consensus process.
[0109] Node performance data reflects the performance of a second blockchain node in at least one performance dimension. A second blockchain node is any blockchain node other than the first blockchain node. A performance dimension refers to a performance aspect / standard of a blockchain node. One performance dimension corresponds to a specific type of node performance, and different performance dimensions correspond to different types of node performance. For example, performance dimensions may include, but are not limited to, transaction processing, network, processor, and storage dimensions. Accordingly, node performance data can include data from each of these performance dimensions, such as: first transaction processing volume (e.g., the TPS (Transactions Per Second) of the master node packaging blocks during the k-th consensus process), second transaction processing volume (e.g., the TPS of the slave node verifying blocks during the k-th consensus process), network performance proof metrics, processor performance proof metrics, and storage performance proof metrics—any one or more of these.
[0110] The following explains how to obtain the node performance data of any second blockchain node.
[0111] In one possible approach, the process by which the first blockchain node obtains the node performance data of the second blockchain node includes the following steps (1)-(2):
[0112] (1) During the k-th consensus process, the first blockchain node generates a performance proof package for the second blockchain node. This performance proof package is used to trigger the acquisition of node performance data of the second blockchain node. The performance proof package may include: processor computing tasks and stored data; that is, the performance proof package contains the task instructions set by the first blockchain node for the second blockchain node. These task instructions are used to instruct the computing tasks that the CPU (Central Processing Unit) of the second blockchain node needs to execute. In addition, the stored data here may be some or all of the data stored in the first blockchain node, and the stored data is stored in a format based on index keys and data values.
[0113] (2) Based on the performance proof package, the first blockchain node uses a multi-stage data interaction method to obtain the node performance data of the second blockchain node. Here, the multi-stage data interaction method indicates that at least one interaction stage is required to obtain the node performance data. The number of stages can be selected according to specific business needs and is not specifically limited.
[0114] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating a three-stage process for obtaining node performance data, as provided in an embodiment of this application. Figure 5 As shown, the multi-stage data interaction method here is a three-stage data interaction method, which includes: a first interaction stage, a second interaction stage, and a third interaction stage. The specific process for obtaining node performance data in these three stages is as follows:
[0115] ① In the first interaction phase, the first blockchain node sends a performance proof packet to the second blockchain node to obtain the network performance proof index returned by the second blockchain node. The network performance proof index is used to prove the response speed of the second blockchain node to the performance proof packet; that is, the network performance proof index is an indicator used to prove the network performance of the second blockchain node. Here, the network performance proof index can be a value of [0, 1]. The closer the value is to 1, the better the network performance of the second blockchain node; the closer the value is to 0, the worse the network performance of the second blockchain node.
[0116] ② In the second interaction phase, the first blockchain node obtains the processor performance proof metric returned by the second blockchain node. This processor performance proof metric is used to prove the computational performance of the second blockchain node after performing data computation based on the processor computing task. That is, the processor performance proof metric is used to prove the CPU computing performance of the second blockchain node. As above, this processor performance proof metric can be a value of [0, 1]. Optionally, in the second interaction phase, the storage result returned by the second blockchain phase can also be obtained. This storage result is used to prove the storage performance of the second blockchain phase.
[0117] ③ In the third interaction phase, the first blockchain node sends the target index key to the second blockchain node to obtain a storage performance proof indicator returned by the second blockchain node. This storage performance proof indicator is used to prove the storage performance of the second blockchain node in retrieving data values from the stored data based on the target index key. Specifically, since the stored data is stored in a KV (Key-Value) format, after the first blockchain node sends a specified key to the second blockchain node, the second blockchain node will query the stored data for the target data value associated with this specified key. If the target data value is correct, it proves that the storage performance of the second blockchain node is good; if the target data value is incorrect, it proves that the storage performance of the second blockchain node is poor.
[0118] Based on this, this application can employ a three-stage interaction method to obtain the node performance data of the second blockchain node, thereby acquiring performance data under different performance dimensions at different interaction stages; finally, the performance data under each dimension is combined to form the node performance data of the current blockchain node. It is evident that this multi-stage data acquisition method can improve the accuracy and comprehensiveness of node performance data.
[0119] S402: Obtain the asset staking data of the second blockchain node during the k-th consensus process.
[0120] The asset pledge data includes the amount of digital assets pledged by the second blockchain node during the k-th consensus process. The pledged digital assets can be a pre-defined type of digital asset or any type of digital asset. Furthermore, the types of pledged digital assets involved in different consensus processes can be the same or different. For example, if the pledged digital asset for the k-th consensus process is asset 1, and the pledged digital asset for the (k+1)-th consensus process is asset 2, then asset 1 and asset 2 can be the same or different; this application does not impose specific limitations on this.
[0121] In one possible implementation, the first blockchain node can directly obtain the asset staking data of the second blockchain node during the k-th consensus process from the second blockchain node's state database. Alternatively, the first blockchain node can request the asset staking data from the second blockchain node, and then the second blockchain node, in response to the request, returns its asset staking data from the k-th consensus process to the first blockchain node. Please see [link to relevant documentation]. Figure 6a , Figure 6a This is a network topology diagram illustrating the acquisition of asset collateral during a consensus process, as provided in an embodiment of this application. For example... Figure 6a As shown, during the consensus process, any blockchain node will send CPU proof, network proof, and storage proof to other blockchain nodes. At the same time, it also needs to count the asset staking data (such as the amount of asset staking) of other blockchain nodes. For example, blockchain node 1 can obtain the asset staking amounts of blockchain nodes 2, 3, and 4 respectively during the k-th consensus process.
[0122] Furthermore, after obtaining the node performance data and asset staking data of any second blockchain node in the blockchain, the first blockchain node can store the node performance data and asset staking data of the second blockchain node into the first blockchain node. Please see [link to relevant documentation]. Figure 6b , Figure 6b This is a schematic diagram of a data storage structure for a first blockchain node provided in an embodiment of this application. For example... Figure 6bAs shown, the first blockchain node can store the node performance data and asset staking data of the second blockchain node. As can be seen from step S401 above, the node performance data can include any one or more of the following: first transaction processing volume (node block production TPS), second transaction processing volume (node verification TPS), network performance proof metrics, processor performance proof metrics, and storage performance proof metrics. The first transaction processing volume indicates the maximum number of transactions that the master node can package into blocks per unit time during the k-th consensus process; the second transaction processing volume indicates the maximum number of transactions that any slave node can verify into blocks per unit time during the k-th consensus process. Further, the node performance data and asset staking data of the other N-1 blockchain nodes in the first blockchain node's blockchain can optionally be associated and stored with the node performance data and asset staking data of the corresponding blockchain nodes according to the node identifier (ID).
[0123] S403: Weighted fusion of node performance data and asset staking data yields the election index for the second blockchain node, which indicates the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process.
[0124] The following details the specific process for determining the election criteria for the second blockchain node.
[0125] In one possible implementation, the first blockchain node performs a weighted fusion of node performance data and asset staking data to obtain the election criteria for the second blockchain node, including the following steps:
[0126] ① The node performance data of the second blockchain node is analyzed and predicted to obtain a performance prediction score for the second blockchain node. Specifically, a performance prediction model is deployed in the first blockchain node. This performance prediction model is used to predict the node performance of the blockchain node according to at least one performance dimension. For example, the performance dimensions include any one or more of the following: transaction processing performance dimension, network performance dimension, computing performance dimension, and storage performance dimension. The performance prediction model can be a neural network model of any structure, such as CNN (Convolutional Neural Networks), RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), etc. This application does not specifically limit the model structure of the performance prediction model.
[0127] Optionally, the performance prediction model can be trained based on the historical node performance data of each blockchain node within a historical time period. A well-trained performance prediction model can then predict the future performance of each blockchain node. Therefore, during the consensus process, the performance prediction model can predict the future performance of a blockchain node based on its historical performance and real-time performance data. This approach, which comprehensively considers both historical and real-time performance, can improve the accuracy of node performance prediction.
[0128] In practice, the first blockchain node can call the performance prediction model to perform performance analysis and prediction on the node performance data of the second blockchain node across multiple performance dimensions, obtaining a performance prediction score for the second blockchain node. This performance prediction score can be a value between [0, 1]. A score closer to 1 indicates better node performance for the second blockchain node, and a higher probability that the node will be elected as the master node. Conversely, a score closer to 0 indicates poorer node performance for the second blockchain node, and a lower probability that the node will be elected as the master node.
[0129] ② Obtain N asset staking data corresponding to N blockchain nodes, and calculate the staking ratio of the second blockchain node based on the N asset staking data; where each blockchain node corresponds to one asset staking data. Specifically, in each consensus process, each blockchain node needs to pre-deposit a certain amount of digital assets as staking. After obtaining N asset staking data, N asset staking amounts can be obtained, that is, one blockchain node corresponds to one asset staking amount. The staking ratio here refers to the proportion of the second blockchain node's asset staking amount in the N asset staking amounts. Assuming the N asset staking amounts are represented as: x1, x2...xn, if the asset staking amount of the second blockchain node is x2, then the staking ratio of the second blockchain node is y = x2 / (x1+x2+...+xn).
[0130] ③Weigh and fuse the performance prediction score and the staking ratio score of the second blockchain node to calculate the election index of the second blockchain node.
[0131] Please see Figure 7 , Figure 7 This is a schematic diagram of a process for determining election indicators provided in an embodiment of this application. Figure 7As shown, the first blockchain node can obtain machine learning weights (first weights) and node staking weights (second weights). Based on the first weights, the performance prediction score of the second blockchain node is weighted to obtain a first score; and based on the second weights, the staking ratio score of the second blockchain node is weighted to obtain a second score. The first score and the second score are added together to obtain the election index (e.g., election score) of the second blockchain node. For example, if the first weight is 0.7, the second weight is 0.3, the first score is y1, and the second score is y2, then the election score L = 0.7 * y1 + 0.3 * y2. Optionally, the first and second weights can be obtained as follows:
[0132] Method 1: The first and second weights are different in different consensus processes. The first blockchain node can obtain the weights i and j corresponding to the k-th consensus process, and use weight i as the first weight and weight j as the second weight; wherein, the weight i-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process, and the weight j-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process.
[0133] Method 2: The first and second weights are preset and remain unchanged throughout different consensus processes. The first blockchain node can determine the first and second weights in the blockchain according to preset management rules; the first and second weights may be the same or different, for example, the first weight is 0.7 and the second weight is 0.3; or both the first and second weights are 0.5.
[0134] Based on the above steps ①-③, this application can comprehensively consider node performance data and node staking amount, and perform weighted fusion of performance prediction score and staking amount ratio score, thereby more comprehensively and accurately calculating the election index of the second blockchain node and ensuring the accuracy of the election index.
[0135] It should be understood that the method for determining the election index of any blockchain node in this application can refer to the specific process of determining the election index in step S403 above. Therefore, the election index of N blockchain nodes can be calculated. Furthermore, based on the election index of N blockchain nodes, the master node in the (k+1)th consensus process can be elected from the N blockchain nodes. For example, if the election index is the election score, then the blockchain node corresponding to the largest election score among the N election scores can be taken as the master node in the (k+1)th consensus process.
[0136] In this embodiment, the first blockchain node can obtain the node performance data of the second blockchain node in the k-th consensus process. This node performance data reflects the node performance of the second blockchain node in at least one performance dimension. Here, the second blockchain node is any blockchain node other than the first blockchain node. The first blockchain node can also obtain the asset staking data of the second blockchain node in the k-th consensus process. The asset staking data includes the amount of digital assets pledged by the second blockchain node in the k-th consensus process. The node performance data and the asset staking data are weighted and fused to obtain the election index of the second blockchain node. This election index indicates the probability that the second blockchain node will be elected as the master node in the k+1-th consensus process. As can be seen, the election index of any blockchain node in this application comprehensively considers the node's performance in multiple performance dimensions and the amount of assets pledged by the node. Since the election index is obtained by comprehensively weighting data from multiple dimensions, this application can calculate the election index more accurately than the method of calculating the election index from a single dimension. Furthermore, since the master node in the k+1th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes, the determined master node can be more accurate and reliable.
[0137] Please see Figure 8 , Figure 8 This is a flowchart illustrating another blockchain node processing method provided in an embodiment of this application. This blockchain node processing method can be executed by a first blockchain node in the blockchain, wherein the blockchain includes N blockchain nodes, the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2. Figure 8 As shown, the blockchain node processing method may include S801-S804:
[0138] S801: Obtain the node performance data of the second blockchain node during the k-th consensus process.
[0139] Specifically, node performance data reflects the performance of the second blockchain node in at least one performance dimension; the second blockchain node is any blockchain node other than the first blockchain node. It should be noted that detailed procedures for obtaining node performance data can be found in [reference needed]. Figure 4The relevant steps in step S401 of the embodiment will not be repeated here; for example, the obtained node performance data includes the following: first transaction processing volume (e.g., the TPS (Transactions Per Second) of the master node packaging blocks during the kth consensus process), second transaction processing volume (e.g., the TPS of the slave node verifying blocks during the kth consensus process), network performance proof indicators, processor performance proof indicators, and storage performance proof indicators, any one or more of them.
[0140] S802: Obtain the asset staking data of the second blockchain node during the k-th consensus process.
[0141] The asset pledge data includes the amount of digital assets pledged by the second blockchain node during the k-th consensus process. The pledged digital assets can be a pre-defined type of digital asset or any type of digital asset, and the types of pledged digital assets involved in different consensus processes can be the same or different.
[0142] The following details the specific process for determining the election criteria for the second blockchain node.
[0143] like Figure 8 As shown, the election criteria for the second blockchain node can be determined in two ways: Method 1 and Method 2. Method 1 indicates that the first blockchain node directly performs a weighted fusion of node performance data and asset staking data to obtain the election criteria for the second blockchain node. Method 2 indicates that the election criteria for the second blockchain node are calculated by the other N-1 blockchain nodes.
[0144] Method 1 (S803): Weighted fusion of node performance data and asset staking data to obtain the election index of the second blockchain node.
[0145] In one possible approach, the first blockchain node performs a weighted fusion of node performance data and asset staking data to obtain the election index for the second blockchain node. This includes the following steps: ① Analyzing and predicting the node performance data of the second blockchain node to obtain its performance prediction score. ② Obtaining N asset staking data points corresponding to N blockchain nodes and calculating the staking ratio score for the second blockchain node based on these N data points; where each blockchain node corresponds to one asset staking data point. ③ Weighting and fusing the performance prediction score and the staking ratio score of the second blockchain node to calculate the election index for the second blockchain node.
[0146] As can be seen from the above method one, this application can comprehensively consider node performance data and node staking amount, and perform weighted fusion of performance prediction score and staking amount ratio score, so as to calculate the election index of the second blockchain node more comprehensively and accurately, and ensure the accuracy of the election index.
[0147] Method 2: The election indicators are calculated by all other blockchain nodes (S8031-S8033).
[0148] S8031: Weighted fusion of node performance data and asset staking data yields the first scoring index for the second blockchain node.
[0149] It should be noted that for details on the specific implementation process of weighted fusion of node performance data and asset staking data, please refer to [link / reference needed]. Figure 4 The specific process in step S403 of the embodiment will not be repeated here.
[0150] S8032: Receive N-2 second scoring indicators about the second blockchain node from N-2 blockchain nodes other than the first and second blockchain nodes.
[0151] In this process, any one of the second scoring indicators is calculated by any one of the N-2 blockchain nodes for the second blockchain node. It should be understood that the detailed steps for any blockchain node to calculate the second scoring indicator for the second blockchain node can be referred to the detailed process of the first blockchain node calculating the election indicator in the above steps of this application, and will not be repeated here. That is, any blockchain node can obtain the second scoring indicator by weighted fusion of the node performance data and asset staking data of the second blockchain node.
[0152] S8033: Based on the first scoring metric and N-2 second scoring metrics, the election metrics for the second blockchain node are obtained.
[0153] Specifically, the first blockchain node can perform a comprehensive calculation on the first scoring indicator and N-2 second scoring indicators according to a preset processing method to obtain the election indicators for the second blockchain node; the preset processing method includes any one of the following: the first processing method, the second processing method, and the third processing method; wherein,
[0154] The first processing method is used to indicate that the election index is obtained by averaging the first scoring index and N-2 second scoring indices; that is, the final election index of the current second blockchain node is obtained by averaging these N-1 scoring indices.
[0155] The second processing method is used to indicate: randomly select one scoring indicator from the first scoring indicator and N-2 second scoring indicators as the election indicator.
[0156] The third processing method refers to: screening the first scoring indicator and N-2 second scoring indicators (for example, filtering out abnormal scoring indicators, which are scoring indicators whose difference from other scoring indicators is greater than or equal to a preset number threshold), and then weighting the selected scoring indicators to obtain the election indicators.
[0157] As can be seen from the above-mentioned Method 2, on the one hand, this application can comprehensively consider node performance data and node staking amount, and perform weighted fusion of performance prediction score and staking amount ratio score, so as to calculate the election index of the second blockchain node more comprehensively and accurately; on the other hand, the election index of any blockchain node is based on the calculation of each other blockchain node in the blockchain, and finally the final election index of the current blockchain node is obtained by averaging the score index calculated by each blockchain node, which can further improve the accuracy and reliability of the election index.
[0158] S804: Based on the election criteria of N blockchain nodes, elect the master node from the N blockchain nodes in the (k+1)th consensus process.
[0159] In one possible implementation, the process of the first blockchain node electing the master node in the (k+1)th consensus process from N blockchain nodes includes the following steps (1)-(3):
[0160] (1) Receive N-1 rating indicators about the first blockchain node from N-1 other second blockchain nodes in the blockchain, excluding the first blockchain node. Among them, one second blockchain node generates a rating indicator for the first blockchain node (any second blockchain node can generate a rating indicator based on the node performance data and asset staking data of the first blockchain node. The generation method of the rating indicator can refer to the generation method of the election indicator in the above embodiment).
[0161] (2) Determine the election criteria for the first blockchain node based on N-1 scoring indicators. For example, the election criteria for the first blockchain node can be obtained by averaging the N-1 scoring indicators; or, any scoring indicator can be randomly selected from the N-1 scoring indicators as the election criteria for the first blockchain node; or, abnormal scoring indicators can be filtered out from the N-1 scoring indicators, and the election criteria for the first blockchain node can be obtained by weighting the filtered scoring indicators.
[0162] (3) Select the master node in the k+1 consensus process from the N blockchain nodes according to the election criteria of the first blockchain node and the N-1 election criteria of the N-1 second blockchain nodes.
[0163] In practice, since each blockchain node corresponds to an election metric, such as the election score, the process for the first blockchain node to select the master node in the (k+1)th consensus process is as follows: The election scores of the N-1 second blockchain nodes are compared with the election score of the first blockchain node to determine the maximum election score from the N scores; in the blockchain, the blockchain node corresponding to the maximum election score is elected as the master node in the (k+1)th consensus process.
[0164] In one possible implementation, business transactions to be processed in a business scenario are acquired. This business scenario includes any of the following: financial scenario, supply chain management scenario, identity verification scenario, IoT scenario, and gaming scenario. The main node then performs business processing on these transactions within the business scenario. This business processing includes any of the following: financial business processing, supply chain goods transaction processing, identity verification processing, traffic management, and gaming business processing. It should be understood that the business processing operations performed on business transactions differ across different business scenarios. For example, in a financial scenario, financial transactions involve asset transfers and other financial processing operations; similarly, in a gaming scenario, game transactions involve game-related processing operations.
[0165] Furthermore, examples are provided to illustrate the application scenarios of this application solution on the product side.
[0166] (1) Decentralized Finance (DeFi) Platforms:
[0167] In DeFi platforms, this solution can be used to improve the efficiency and security of transaction processing. Through an adaptive performance evaluation and dynamically weighted blockchain node election mechanism based on staking volume, DeFi platforms can ensure that their smart contracts and transaction operations are processed by the most reliable and highest-performing nodes. This not only reduces transaction latency but also enhances the security of user assets. For example, on an asset trading platform, a fast and reliable node election mechanism can ensure that asset transactions are executed quickly and securely.
[0168] (2) Supply Chain Management System:
[0169] Supply chain management systems require real-time tracking and verification of vast amounts of product and transaction information. This solution's multi-stage verification and machine learning-assisted blockchain consensus node performance proof protocol ensure the accuracy and timeliness of supply chain data. By electing the best-performing master node in the blockchain to process and verify transactions, the possibility of errors and fraud can be reduced, thereby improving the transparency and efficiency of the entire supply chain.
[0170] (3) Authentication and data privacy protection services:
[0171] In applications requiring high privacy protection (such as authentication services), this solution provides a secure environment for handling sensitive data. By ensuring that only high-performance nodes with high staked amounts participate in the data verification and storage process, the risk of data leakage or tampering is reduced. This is crucial for any organization that handles personal data, such as healthcare providers.
[0172] (4) Smart Cities and the Internet of Things (IoT):
[0173] Smart cities and IoT devices generate massive amounts of real-time data that require rapid processing and response. This solution can help build an efficient blockchain network to support various smart city services, such as traffic management, energy distribution, and emergency response systems. By electing high-performance nodes to process the data, the timeliness and reliability of smart city services can be ensured.
[0174] (5) Gaming and entertainment platforms:
[0175] In blockchain games or entertainment platforms, user experience largely depends on the responsiveness of transactions and operations. This solution helps game platforms ensure that in-game transactions and smart contract operations are executed by the best nodes, thereby providing a smooth gaming experience and a fair gaming environment.
[0176] (6) Enterprise-level blockchain solutions:
[0177] Enterprise-level applications such as cross-border payments, asset management, and contract enforcement often require efficient and secure blockchain infrastructure. This solution provides enterprises with a reliable node election mechanism, ensuring that enterprise operations are executed quickly and in compliance with regulations.
[0178] As can be seen from the above application scenarios, this application not only improves the performance and security of blockchain networks, but also provides reliable blockchain services for various industries, thereby promoting the widespread application and development of blockchain technology.
[0179] In this embodiment, on the one hand, a dynamically adaptive blockchain node election mechanism is achieved by combining machine learning performance prediction and node staking, significantly improving the performance and security of the blockchain network. This scheme ensures the priority election of high-performance nodes, while the economic incentives introduced through staking reduce malicious behavior by nodes, thereby enhancing the stability and credibility of the entire blockchain system. On the other hand, this scheme is widely applicable to business scenarios in various fields (such as finance, gaming, and the Internet of Things), thus promoting the widespread application and development of blockchain technology.
[0180] The following section provides a detailed description of the entire lifecycle process provided by this application, with reference to the accompanying drawings.
[0181] Based on the processes described in the above embodiments, this application designs a full lifecycle process for a blockchain consensus node election strategy based on machine learning performance prediction and staking amount. It mainly includes: ① the process of acquiring node performance data and asset staking data (the execution process of blockchain nodes collecting node performance data and asset staking data); ② the comprehensive election process based on machine learning performance prediction and staking amount (the process of blockchain nodes electing the next round of master nodes based on a comprehensive weighted average of machine learning performance prediction and staking amount). The following sections, with reference to the accompanying drawings, elaborate on each of the above processes:
[0182] (1) The process of obtaining node performance data and asset pledge data.
[0183] Please see Figure 9 , Figure 9 This is a flowchart illustrating the acquisition of node performance data and asset pledge data provided in an embodiment of this application. Figure 9 As shown, the data acquisition process includes the following steps S1-S32:
[0184] S1, Begin.
[0185] S2. The user packages and encapsulates the transaction contract, methods, parameters, etc., and prepares to send the transaction to the blockchain for execution.
[0186] S3. The user signs the above packaged content.
[0187] S4. The user sends the packaged content and signature together to the blockchain node.
[0188] S5, the blockchain master node network module received the above request.
[0189] S6. The blockchain node authentication module verifies the certificate and signature of the above request and checks whether the verification is successful. If successful, proceed to S8; otherwise, proceed to S7.
[0190] S7. Returns a result indicating that signature verification failed. Execute S32.
[0191] S8. The authentication module verifies the permissions of the above request and checks whether the verification is successful. If successful, proceed to S10; otherwise, proceed to S9.
[0192] S9. Returns the result that permission verification failed. Execute S32.
[0193] S10. The scheduling module block generator obtains this ordinary transaction from the transaction pool, prepares to execute the transaction, and packages it into a new block.
[0194] S11. The transaction scheduling module starts the contract corresponding to this ordinary transaction and executes the transaction.
[0195] S12, The system contract writes the execution result into the block.
[0196] S13. The blockchain master node block generator module encapsulates blocks and forwards them to the blockchain slave nodes.
[0197] S14. After receiving a block from a node, the blockchain begins to verify the transaction.
[0198] S15. The blockchain initiates the same contract from the node to process this ordinary transaction.
[0199] S16. Check if the contract execution result is consistent with the master node. If yes, proceed to S17; otherwise, proceed to S18.
[0200] S17. The blockchain slave nodes acknowledge the execution result of the master node's transaction. Execute S19.
[0201] S18. The blockchain slave node denies the execution result of the master node's transaction.
[0202] S19. All blockchain nodes broadcast blocks and reach consensus.
[0203] S20. All nodes record the block production TPS of the master node and the verification TPS of the slave node.
[0204] S21. All nodes begin probing the network, storage, and CPU performance of other nodes.
[0205] S22. The proof package generation and verification module of all nodes generates a proof package and sends it to other nodes.
[0206] S23. Other nodes return data for both stages according to the proof process.
[0207] S24. All nodes randomly select stored data and send it to other nodes for verification.
[0208] S25. Check if the node verification passed. If yes, proceed to S27; otherwise, proceed to S26.
[0209] S26. Set the storage performance of the above nodes to 0.
[0210] S27. Collect the network data of all nodes, calculate and store the time consumption as machine learning performance data.
[0211] S28. Has consensus been reached among all nodes successfully, i.e., has a majority of nodes agreed? If yes, proceed to S29; otherwise, proceed to S32.
[0212] S29. All nodes collect the amount of assets pledged by the nodes.
[0213] S30. All nodes append new blocks to the block ledger.
[0214] S31. All nodes store the latest data in the status database.
[0215] S32, End.
[0216] In the process of acquiring node performance data and asset staking data, this application can obtain node performance data under multiple performance dimensions, which can improve the accuracy and comprehensiveness of node performance data; in addition, the asset staking amount obtained in each blockchain stage can also provide an important data source for master node election.
[0217] (2) A comprehensive election process based on machine learning performance prediction and pledge amount.
[0218] Please see Figure 10 , Figure 10 This is a flowchart illustrating a comprehensive election process for a master node, as provided in an embodiment of this application. Figure 10 As shown, the comprehensive election process for the master node includes the following steps S101-S112:
[0219] S101, Begin.
[0220] S102, Consensus Phase 1: The master node sends the blocks it generates to other slave nodes.
[0221] S103, Consensus Phase 2: Slave nodes broadcast their verification results to other slave nodes.
[0222] S104, Consensus Phase 3: All nodes record the performance data of other nodes and the amount of assets pledged.
[0223] S105, All nodes enter the first stage of election.
[0224] S106. All nodes use the machine learning performance data just collected to make model predictions, and obtain the machine learning performance score (i.e., performance prediction score) for all nodes.
[0225] S107. All nodes retrieve the asset pledge amount of all nodes from the state database.
[0226] S108. All nodes are weighted by machine learning and multiplied by performance prediction score, and then the node staking weight is multiplied by staking ratio score to obtain the final election score (i.e., election metric) for all nodes.
[0227] S109. All nodes enter the second stage of the election and broadcast their calculated election scores to all other nodes.
[0228] S110. All nodes calculate the final election score of each node broadcast by all nodes.
[0229] S111. All nodes enter the third stage of the election. The node with the highest calculated score automatically becomes the master node, and the other nodes automatically become slave nodes.
[0230] S112, End.
[0231] In the comprehensive election process based on machine learning performance prediction and staking amount, this application can comprehensively consider node performance data and node staking amount, and perform weighted fusion of performance prediction score and staking amount ratio score, so as to calculate the election index of each blockchain node more comprehensively and accurately. This election mechanism that combines performance and economic factors improves the overall performance and security of the blockchain system.
[0232] In summary, this application implements a dynamically adaptive blockchain node election mechanism by combining machine learning performance prediction and node staking. This application not only predicts the future performance of nodes based on their historical performance and real-time performance data, but also incorporates the node's staking amount as a crucial factor. This adaptive performance evaluation mechanism utilizes machine learning algorithms to predict node performance, thereby ensuring that elected nodes can efficiently process transactions in the blockchain network. Simultaneously, the dynamic weighting of staking ensures that nodes have sufficient economic incentives to maintain network security and stability. This election mechanism, combining performance and economic factors, improves the overall performance and security of the blockchain system.
[0233] The following describes the relevant apparatus of the blockchain node processing scheme provided in the embodiments of this application.
[0234] It should be noted that, in the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0235] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of a blockchain node processing device provided in an embodiment of this application. Figure 11As shown, the blockchain node processing device 1100 can be applied to the first blockchain node mentioned in the foregoing embodiments. Specifically, the blockchain node processing device 1100 can be a computer program (including program code) running on the blockchain node, for example, the blockchain node processing device 1100 is an application software; the blockchain node processing device 1100 can be used to execute the corresponding steps in the blockchain node processing method provided in the embodiments of this application. In specific implementation, the blockchain includes N blockchain nodes, and the device is executed by the first blockchain node in the blockchain, where the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2; the blockchain node processing device 1100 may specifically include:
[0236] The acquisition unit 1101 is used to acquire the node performance data of the second blockchain node in the k-th consensus process; wherein, the node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension, the second blockchain node is any blockchain node in the blockchain other than the first blockchain node, and k is a positive integer.
[0237] The acquisition unit 1101 is also used to acquire the asset pledge data of the second blockchain node in the k-th consensus process. The asset pledge data includes the amount of pledged digital assets set by the second blockchain node in the k-th consensus process.
[0238] The processing unit 1102 is used to perform weighted fusion of node performance data and asset staking data to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
[0239] In one possible implementation, processing unit 1102 performs a weighted fusion of node performance data and asset staking data to obtain election indicators for the second blockchain node, which are used to perform the following operations:
[0240] The performance data of the second blockchain node is analyzed and predicted to obtain the performance prediction score of the second blockchain node.
[0241] Obtain N asset pledge data corresponding to N blockchain nodes, and calculate the pledge ratio of the second blockchain node based on the N asset pledge data; wherein, each blockchain node corresponds to one of the asset pledge data;
[0242] The election index of the second blockchain node is calculated by weighting and fusing the performance prediction score and the staking ratio score of the second blockchain node.
[0243] In one possible implementation, a performance prediction model is deployed in the first blockchain node. The performance prediction model is used to predict the node performance of the blockchain node according to at least one performance dimension. The performance dimension includes any one or more of the following: transaction processing performance dimension, network performance dimension, computing performance dimension, and storage performance dimension.
[0244] Processing unit 1102 analyzes and predicts the node performance data of the second blockchain node to obtain the performance prediction score of the second blockchain node, which is used to perform the following operations:
[0245] The performance prediction model is invoked to perform performance analysis and prediction on the node performance data of the second blockchain node under multiple performance dimensions, and the performance prediction score of the second blockchain node is obtained.
[0246] Node performance data includes any one or more of the following: first transaction processing volume, second transaction processing volume, network performance verification metrics, processor performance verification metrics, and storage performance verification metrics;
[0247] The first transaction processing volume is used to indicate the maximum number of transactions that the master node can package into a block within a unit of time during the k-th consensus process; the second transaction processing volume is used to indicate the maximum number of transactions that any slave node can verify into a block within a unit of time during the k-th consensus process.
[0248] In one possible implementation, the processing unit 1102 performs a weighted fusion of the performance prediction score and the staking ratio score of the second blockchain node to calculate the election index of the second blockchain node, which is used to perform the following operations:
[0249] Obtain the first and second weights;
[0250] The performance prediction score of the second blockchain node is weighted based on the first weight to obtain the first score; and,
[0251] The second score is obtained by weighting the staking ratio of the second blockchain node based on the second weight.
[0252] The election index for the second blockchain node is obtained by adding the first score and the second score.
[0253] In one possible implementation, processing unit 1102 obtains the first weight and the second weight, and performs the following operations:
[0254] Obtain the weights i and j corresponding to the k-th consensus process, and use weight i as the first weight and weight j as the second weight; wherein, the weight i-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process, and the weight j-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process; or,
[0255] In the blockchain, the first and second weights are determined according to preset management rules;
[0256] The first weight and the second weight may be the same or different.
[0257] In one possible implementation, the processing unit 1102 performs a weighted fusion of node performance data and asset staking data to obtain the election index for the second blockchain node, and is also used to perform the following operations:
[0258] The node performance data and asset staking data are weighted and fused to obtain the first scoring index of the second blockchain node;
[0259] Receive N-2 second scoring indicators about the second blockchain node from N-2 blockchain nodes other than the first and second blockchain nodes; wherein each second scoring indicator is calculated by any one of the N-2 blockchain nodes for the second blockchain node, and N>2.
[0260] Based on the first scoring metric and N-2 second scoring metrics, the election metrics for the second blockchain node are obtained.
[0261] In one possible implementation, processing unit 1102 obtains the election index of the second blockchain node based on the first scoring index and N-2 second scoring indices, and uses it to perform the following operations:
[0262] The election index for the second blockchain node is obtained by comprehensively calculating the first scoring index and N-2 second scoring indexes according to a preset processing method; the preset processing method includes any one of the following: the first processing method, the second processing method, and the third processing method; wherein,
[0263] The first processing method is used to indicate that the election index is obtained by averaging the first scoring index and N-2 second scoring indices.
[0264] The second processing method is used to indicate: randomly select one scoring indicator from the first scoring indicator and N-2 second scoring indicators as the election indicator;
[0265] The third processing method refers to: filtering the first scoring indicator and N-2 second scoring indicators, and then weighting the filtered scoring indicators to obtain the election indicators.
[0266] In one possible implementation, the acquisition unit 1101 acquires the node performance data of the second blockchain node during the k-th consensus process, and performs the following operations:
[0267] During the k-th consensus process, a performance proof package for the second blockchain node is generated; the performance proof package is used to trigger the acquisition of the node performance data of the second blockchain node, and the performance proof package includes: processor computing tasks and storage data;
[0268] Based on the performance proof package, a multi-stage data interaction method is used to obtain the node performance data of the second blockchain node.
[0269] In one possible implementation, the multi-stage data interaction method is a three-stage data interaction method, which includes: a first interaction stage, a second interaction stage, and a third interaction stage; the stored data is data stored in association based on the format of index key and data value;
[0270] Unit 1101, based on the performance proof package, uses a multi-stage data interaction method to obtain the node performance data of the second blockchain node, and performs the following operations:
[0271] In the first interaction phase, the performance proof packet is sent to the second blockchain node to obtain the network performance proof metric returned by the second blockchain node. The network performance proof metric is used to prove the response speed of the second blockchain node to the performance proof packet.
[0272] In the second interaction phase, the processor performance proof index returned by the second blockchain node is obtained. The processor performance proof index is used to prove the computing performance of the second blockchain node after performing data calculation based on the processor computing task.
[0273] In the third interaction phase, the target index key is sent to the second blockchain node to obtain the storage performance proof metric returned by the second blockchain node. The storage performance proof metric is used to prove the storage performance of the second blockchain node in querying the associated target data value from the stored data based on the target index key.
[0274] In one possible implementation, the processing unit 1102 is further configured to perform the following operations:
[0275] Receive N-1 rating metrics about the first blockchain node from N-1 other second blockchain nodes besides the first blockchain node; wherein, one second blockchain node generates one rating metric for the first blockchain node;
[0276] Based on N-1 scoring indicators, the election indicators for the first blockchain node are determined;
[0277] Based on the election criteria of the first blockchain node and the N-1 election criteria of the N-1 second blockchain nodes, the master node in the k+1th consensus process is selected from the N blockchain nodes.
[0278] In one possible implementation, each blockchain node corresponds to an election index, which includes the election score of each blockchain node; the processing unit 1102 selects the master node for the (k+1)th consensus process from the N blockchain nodes according to the election index of the first blockchain node and the N-1 election indexes of the N-1 second blockchain nodes, and performs the following operations:
[0279] The election scores of N-1 second blockchain nodes are compared with the election scores of the first blockchain node to determine the maximum election score from the N election scores.
[0280] In a blockchain, the blockchain node with the highest election score is elected as the master node in the (k+1)th consensus process.
[0281] In one possible implementation, the processing unit 1102 is further configured to perform the following operations:
[0282] Acquire pending business transactions in business scenarios, including any of the following: financial scenarios, supply chain management scenarios, identity verification scenarios, IoT scenarios, and gaming scenarios;
[0283] The master node performs business processing on business transactions within the business scenario;
[0284] The business processing includes any of the following: financial business processing, supply chain commodity transaction processing, identity verification processing, traffic management, and game business processing.
[0285] In this embodiment, the election metric for any blockchain node comprehensively considers the node's performance across multiple performance dimensions and the amount of assets pledged by the node. Since the election metric is obtained by comprehensively weighting data from multiple dimensions, this application can calculate the election metric more accurately than calculating it from a single dimension. Furthermore, since the master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election metric of N blockchain nodes, the determined master node can be more accurate and reliable.
[0286] Please see Figure 12 , Figure 12This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 1200 is used to execute the steps performed by the first blockchain node in the aforementioned method embodiment. The computer device 1200 may include one or more independent devices (such as servers, nodes, terminals, etc.), or it may include components within independent devices (such as chips, software modules, or hardware modules). The computer device may include at least one processor 1201 and a communication interface 1202. Further optionally, the computer device may also include at least one memory 1203 and a bus 1204. Additionally, the processor 1201, communication interface 1202, and memory 1203 are connected via the bus 1204.
[0287] 1) Processor 1201 is a module that performs arithmetic and / or logical operations. Specifically, it may be one or a combination of processing modules such as a central processing unit (CPU), graphics processing unit (GPU), microprocessor unit (MPU), application specific integrated circuit (ASIC), field programmable gate array (FPGA), complex programmable logic device (CPLD), coprocessor (to assist the central processing unit in completing corresponding processing and applications), and micro controller unit (MCU).
[0288] 2) Communication interface 1202 can be used to provide information input or output to at least one processor 1201. And / or, communication interface 1202 can be used to receive externally transmitted data and / or transmit data externally, and can be a wired link interface including Ethernet cables, or a wireless link interface (Wi-Fi, Bluetooth, general wireless transmission, vehicular short-range communication technology, and other short-range wireless communication technologies, etc.). Communication interface 1202 can serve as a network interface.
[0289] 3) The memory 1203 provides storage space, in which data such as the operating system and computer programs can be stored. The memory 1203 can be one or a combination of multiple types of random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or compact disc read-only memory (CD-ROM).
[0290] In specific implementation, processor 1201 is used to call program instructions stored in memory 1203 to perform the following operations:
[0291] Obtain the node performance data of the second blockchain node in the k-th consensus process; wherein, the node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension, the second blockchain node is any blockchain node other than the first blockchain node in the blockchain, and k is a positive integer;
[0292] Obtain the asset staking data of the second blockchain node in the k-th consensus process. The asset staking data includes the amount of digital assets pledged by the second blockchain node in the k-th consensus process.
[0293] The node performance data and asset staking data are weighted and fused to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
[0294] In one possible implementation, the processor 1201 performs a weighted fusion of node performance data and asset staking data to obtain election metrics for the second blockchain node, which are then used to perform the following operations:
[0295] The performance data of the second blockchain node is analyzed and predicted to obtain the performance prediction score of the second blockchain node.
[0296] Obtain N asset pledge data corresponding to N blockchain nodes, and calculate the pledge ratio of the second blockchain node based on the N asset pledge data; wherein, each blockchain node corresponds to one of the asset pledge data;
[0297] The election index of the second blockchain node is calculated by weighting and fusing the performance prediction score and the staking ratio score of the second blockchain node.
[0298] In one possible implementation, a performance prediction model is deployed in the first blockchain node. The performance prediction model is used to predict the node performance of the blockchain node according to at least one performance dimension. The performance dimension includes any one or more of the following: transaction processing performance dimension, network performance dimension, computing performance dimension, and storage performance dimension.
[0299] The processor 1201 analyzes and predicts the node performance data of the second blockchain node to obtain a performance prediction score for the second blockchain node, which is used to perform the following operations:
[0300] The performance prediction model is invoked to perform performance analysis and prediction on the node performance data of the second blockchain node under multiple performance dimensions, and the performance prediction score of the second blockchain node is obtained.
[0301] Node performance data includes any one or more of the following: first transaction processing volume, second transaction processing volume, network performance verification metrics, processor performance verification metrics, and storage performance verification metrics;
[0302] The first transaction processing volume is used to indicate the maximum number of transactions that the master node can package into a block within a unit of time during the k-th consensus process; the second transaction processing volume is used to indicate the maximum number of transactions that any slave node can verify into a block within a unit of time during the k-th consensus process.
[0303] In one possible implementation, the processor 1201 performs a weighted fusion of the performance prediction score and the staking ratio score of the second blockchain node to calculate the election index of the second blockchain node, which is used to perform the following operations:
[0304] Obtain the first and second weights;
[0305] The performance prediction score of the second blockchain node is weighted based on the first weight to obtain the first score; and,
[0306] The second score is obtained by weighting the staking ratio of the second blockchain node based on the second weight.
[0307] The election index for the second blockchain node is obtained by adding the first score and the second score.
[0308] In one possible implementation, the processor 1201 acquires the first weight and the second weight, and uses them to perform the following operations:
[0309] Obtain the weights i and j corresponding to the k-th consensus process, and use weight i as the first weight and weight j as the second weight; wherein, the weight i-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process, and the weight j-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process; or,
[0310] In the blockchain, the first and second weights are determined according to preset management rules;
[0311] The first weight and the second weight may be the same or different.
[0312] In one possible implementation, the processor 1201 performs a weighted fusion of node performance data and asset staking data to obtain election indicators for the second blockchain node, and is also used to perform the following operations:
[0313] The node performance data and asset staking data are weighted and fused to obtain the first scoring index of the second blockchain node;
[0314] Receive N-2 second scoring indicators about the second blockchain node from N-2 blockchain nodes other than the first and second blockchain nodes; wherein each second scoring indicator is calculated by any one of the N-2 blockchain nodes for the second blockchain node, and N>2.
[0315] Based on the first scoring metric and N-2 second scoring metrics, the election metrics for the second blockchain node are obtained.
[0316] In one possible implementation, processor 1201 obtains the election index for the second blockchain node based on a first scoring index and N-2 second scoring indices, and uses it to perform the following operations:
[0317] The election index for the second blockchain node is obtained by comprehensively calculating the first scoring index and N-2 second scoring indexes according to a preset processing method; the preset processing method includes any one of the following: the first processing method, the second processing method, and the third processing method; wherein,
[0318] The first processing method is used to indicate that the election index is obtained by averaging the first scoring index and N-2 second scoring indices.
[0319] The second processing method is used to indicate: randomly select one scoring indicator from the first scoring indicator and N-2 second scoring indicators as the election indicator;
[0320] The third processing method refers to: filtering the first scoring indicator and N-2 second scoring indicators, and then weighting the filtered scoring indicators to obtain the election indicators.
[0321] In one possible implementation, the processor 1201 obtains the node performance data of the second blockchain node during the k-th consensus process, and uses it to perform the following operations:
[0322] During the k-th consensus process, a performance proof package for the second blockchain node is generated; the performance proof package is used to trigger the acquisition of the node performance data of the second blockchain node, and the performance proof package includes: processor computing tasks and storage data;
[0323] Based on the performance proof package, a multi-stage data interaction method is used to obtain the node performance data of the second blockchain node.
[0324] In one possible implementation, the multi-stage data interaction method is a three-stage data interaction method, which includes: a first interaction stage, a second interaction stage, and a third interaction stage; the stored data is data stored in association based on the format of index key and data value;
[0325] Processor 1201, based on the performance proof package, uses a multi-stage data interaction method to obtain the node performance data of the second blockchain node, and performs the following operations:
[0326] In the first interaction phase, the performance proof packet is sent to the second blockchain node to obtain the network performance proof metric returned by the second blockchain node. The network performance proof metric is used to prove the response speed of the second blockchain node to the performance proof packet.
[0327] In the second interaction phase, the processor performance proof index returned by the second blockchain node is obtained. The processor performance proof index is used to prove the computing performance of the second blockchain node after performing data calculation based on the processor computing task.
[0328] In the third interaction phase, the target index key is sent to the second blockchain node to obtain the storage performance proof metric returned by the second blockchain node. The storage performance proof metric is used to prove the storage performance of the second blockchain node in querying the associated target data value from the stored data based on the target index key.
[0329] In one possible implementation, processor 1201 is also used to perform the following operations:
[0330] Receive N-1 rating metrics about the first blockchain node from N-1 other second blockchain nodes besides the first blockchain node; wherein, one second blockchain node generates one rating metric for the first blockchain node;
[0331] Based on N-1 scoring indicators, the election indicators for the first blockchain node are determined;
[0332] Based on the election criteria of the first blockchain node and the N-1 election criteria of the N-1 second blockchain nodes, the master node in the k+1th consensus process is selected from the N blockchain nodes.
[0333] In one possible implementation, each blockchain node corresponds to an election index, which includes the election score of each blockchain node; the processor 1201 selects the master node for the (k+1)th consensus process from the N blockchain nodes according to the election index of the first blockchain node and the N-1 election indexes of the N-1 second blockchain nodes, and performs the following operations:
[0334] The election scores of N-1 second blockchain nodes are compared with the election scores of the first blockchain node to determine the maximum election score from the N election scores.
[0335] In a blockchain, the blockchain node with the highest election score is elected as the master node in the (k+1)th consensus process.
[0336] In one possible implementation, processor 1201 is also used to perform the following operations:
[0337] Acquire pending business transactions in business scenarios, including any of the following: financial scenarios, supply chain management scenarios, identity verification scenarios, IoT scenarios, and gaming scenarios;
[0338] The master node performs business processing on business transactions within the business scenario;
[0339] The business processing includes any of the following: financial business processing, supply chain commodity transaction processing, identity verification processing, traffic management, and game business processing.
[0340] In this embodiment, the election metric for any blockchain node is generated by weighted fusion of node performance data and asset staking data. That is, the election metric comprehensively considers the node's performance in multiple performance dimensions and the amount of assets staked by the node. Since the election metric is obtained by comprehensive weighting of data from multiple dimensions, this application can calculate the election metric more comprehensively and accurately than the method of calculating the election metric from a single dimension. In addition, since the master node in the k+1th consensus process is selected from N blockchain nodes based on the election metric of N blockchain nodes, the determined master node can be more accurate and reliable.
[0341] According to one aspect of this application, embodiments of this application also provide a computer storage medium storing a computer program, the computer program including program instructions. When a processor executes the program instructions, it can perform the methods described in the preceding embodiments; therefore, further details will not be repeated here. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application. As an example, the program instructions can be deployed on a computer device, executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network.
[0342] According to one aspect of this application, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, enabling the computer device to perform the methods described in the preceding embodiments; therefore, further details will not be provided here.
[0343] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data processing device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0344] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A blockchain node processing method, characterized in that, The blockchain comprises N blockchain nodes, and the method is executed by a first blockchain node in the blockchain, where the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2; the method includes: Obtain the node performance data of the second blockchain node in the k-th consensus process; wherein, the node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension, the second blockchain node is any blockchain node in the blockchain other than the first blockchain node, and k is a positive integer; Obtain the asset staking data of the second blockchain node in the k-th consensus process, wherein the asset staking data includes: the amount of digital assets pledged by the second blockchain node in the k-th consensus process; The node performance data and the asset staking data are weighted and fused to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
2. The method as described in claim 1, characterized in that, The weighted fusion of the node performance data and the asset staking data to obtain the election indicators for the second blockchain node includes: The node performance data of the second blockchain node is analyzed and predicted to obtain the performance prediction score of the second blockchain node; Obtain N asset staking data corresponding to N blockchain nodes, and calculate the staking ratio of the second blockchain node based on the N asset staking data; wherein, each blockchain node corresponds to one asset staking data. The performance prediction score and the staking ratio score of the second blockchain node are weighted and fused to calculate the election index of the second blockchain node.
3. The method as described in claim 2, characterized in that, The first blockchain node is equipped with a performance prediction model, which is used to predict the node performance of the blockchain node according to at least one performance dimension. The performance dimensions include any one or more of the following: transaction processing performance dimension, network performance dimension, computing performance dimension, and storage performance dimension; The analysis and prediction of the node performance data of the second blockchain node to obtain the performance prediction score of the second blockchain node includes: The performance prediction model is invoked to perform performance analysis and prediction on the node performance data of the second blockchain node under multiple performance dimensions, and the performance prediction score of the second blockchain node is obtained. The node performance data includes any one or more of the following: first transaction processing volume, second transaction processing volume, network performance verification index, processor performance verification index, and storage performance verification index; Wherein, the first transaction processing volume is used to indicate the maximum number of transactions that the master node can package into a block within a unit of time during the k-th consensus process; the second transaction processing volume is used to indicate the maximum number of transactions that any slave node can verify into a block within a unit of time during the k-th consensus process.
4. The method as described in claim 2, characterized in that, The election index for the second blockchain node is calculated by weighting and fusing the performance prediction score and the staking ratio score of the second blockchain node, including: Obtain the first and second weights; The performance prediction score of the second blockchain node is weighted and calculated based on the first weight to obtain a first score; and, The second score is obtained by weighting the staking ratio of the second blockchain node based on the second weight. The election index of the second blockchain node is obtained by adding the first score and the second score.
5. The method as described in claim 4, characterized in that, The process of obtaining the first weight and the second weight includes: Obtain the weights i and j corresponding to the k-th consensus process, and use weight i as the first weight and weight j as the second weight; wherein, the weight i-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process, and the weight j-1 corresponding to the (k-1)-th consensus process is different from the weight i corresponding to the k-th consensus process; or, In the blockchain, a first weight and a second weight are determined according to preset management rules; The first weight and the second weight may be the same or different.
6. The method according to any one of claims 1-5, characterized in that, The step of weightedly fusing the node performance data and the asset staking data to obtain the election index for the second blockchain node also includes: The node performance data and the asset staking data are weighted and fused to obtain the first scoring index of the second blockchain node; The system receives N-2 second scoring indicators about the second blockchain node from N-2 blockchain nodes other than the first and second blockchain nodes; wherein each of the second scoring indicators is calculated by any one of the N-2 blockchain nodes for the second blockchain node, and N > 2. Based on the first scoring indicator and the N-2 second scoring indicators, the election indicators for the second blockchain node are obtained.
7. The method as described in claim 6, characterized in that, The election criteria for the second blockchain node, derived based on the first scoring metric and the N-2 second scoring metrics, include: The election index for the second blockchain node is obtained by comprehensively calculating the first scoring indicator and the N-2 second scoring indicators according to a preset processing method; the preset processing method includes any one of the following: a first processing method, a second processing method, and a third processing method; wherein... The first processing method is used to indicate that the election index is obtained by averaging the first scoring index and the N-2 second scoring indices; The second processing method is used to indicate: randomly select one scoring indicator from the first scoring indicator and the N-2 second scoring indicators as the election indicator; The third processing method refers to: filtering the first scoring indicator and the N-2 second scoring indicators, and then performing a weighted calculation on each of the filtered scoring indicators to obtain the election indicator.
8. The method as described in claim 1, characterized in that, The acquisition of node performance data of the second blockchain node during the k-th consensus process includes: During the k-th consensus process, a performance proof package for the second blockchain node is generated; wherein, the performance proof package is used to trigger the acquisition of node performance data of the second blockchain node, and the performance proof package includes: processor computing tasks and storage data; Based on the performance proof package, the node performance data of the second blockchain node is obtained using a multi-stage data interaction method.
9. The method as described in claim 8, characterized in that, The multi-stage data interaction method is a three-stage data interaction method, which includes: a first interaction stage, a second interaction stage, and a third interaction stage; the stored data is data stored in association based on an index key and data value format; the acquisition of node performance data of the second blockchain node based on the performance proof package using the multi-stage data interaction method includes: In the first interaction phase, the performance proof packet is sent to the second blockchain node to obtain the network performance proof metric returned by the second blockchain node. The network performance proof metric is used to prove the response speed of the second blockchain node to the performance proof packet. In the second interaction phase, the processor performance proof index returned by the second blockchain node is obtained. The processor performance proof index is used to prove the computing performance of the second blockchain node after performing data calculation based on the processor computing task. In the third interaction phase, the target index key is sent to the second blockchain node to obtain the storage performance proof indicator returned by the second blockchain node. The storage performance proof indicator is used to prove the storage performance of the second blockchain node in querying the associated target data value from the stored data based on the target index key.
10. The method as described in claim 1, characterized in that, The method further includes: Receive N-1 rating indicators about the first blockchain node from N-1 other second blockchain nodes in the blockchain, excluding the first blockchain node; wherein, one second blockchain node generates one rating indicator for the first blockchain node; Based on the N-1 scoring indicators, the election indicators for the first blockchain node are determined; Based on the election criteria of the first blockchain node and the N-1 election criteria of the N-1 second blockchain nodes, the master node in the k+1th consensus process is selected from the N blockchain nodes.
11. The method as described in claim 10, characterized in that, Each blockchain node corresponds to an election metric, which includes the election score of each blockchain node; the process of selecting the master node for the (k+1)th consensus process from N blockchain nodes according to the election metric of the first blockchain node and the N-1 election metric of the N-1 second blockchain nodes includes: The election scores of the N-1 second blockchain nodes are compared with the election scores of the first blockchain node to determine the maximum election score from the N election scores. In the blockchain, the blockchain node corresponding to the maximum election score is elected as the master node in the (k+1)th consensus process.
12. The method as described in claim 10 or 11, characterized in that, The method further includes: Acquire pending business transactions in business scenarios, including any of the following: financial scenarios, supply chain management scenarios, identity verification scenarios, Internet of Things scenarios, and gaming scenarios; The master node performs business processing on the business transactions in the business scenario. The business processing includes any of the following: financial business processing, supply chain commodity transaction processing, identity verification processing, traffic management, and game business processing.
13. A blockchain node processing device, characterized in that, The blockchain comprises N blockchain nodes, and the device is executed by a first blockchain node in the blockchain, wherein the first blockchain node is any one of the N blockchain nodes, and N is an integer greater than or equal to 2; the device comprises: An acquisition unit is used to acquire node performance data of the second blockchain node in the k-th consensus process; wherein, the node performance data is used to reflect the node performance of the second blockchain node in at least one performance dimension, the second blockchain node is any blockchain node in the blockchain other than the first blockchain node, and k is a positive integer; The acquisition unit is further configured to acquire the asset staking data of the second blockchain node in the k-th consensus process, wherein the asset staking data includes the amount of digital assets pledged by the second blockchain node in the k-th consensus process. The processing unit is used to perform weighted fusion of the node performance data and the asset staking data to obtain the election index of the second blockchain node. The election index is used to indicate the probability that the second blockchain node will be elected as the master node in the (k+1)th consensus process. The master node in the (k+1)th consensus process is selected from N blockchain nodes based on the election index of N blockchain nodes.
14. A computer device, characterized in that, include: Memory and processor; The memory stores one or more computer programs; A processor for loading one or more computer programs to implement the blockchain node processing method as described in any one of claims 1-12.
15. A computer-readable storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, performs the blockchain node processing method as described in any one of claims 1-12.
16. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, performs the blockchain node processing method as described in any one of claims 1-12.