WO2021108978A1 - 验证人节点选择方法、电子设备、系统及介质 - Google Patents

验证人节点选择方法、电子设备、系统及介质 Download PDF

Info

Publication number
WO2021108978A1
WO2021108978A1 PCT/CN2019/122628 CN2019122628W WO2021108978A1 WO 2021108978 A1 WO2021108978 A1 WO 2021108978A1 CN 2019122628 W CN2019122628 W CN 2019122628W WO 2021108978 A1 WO2021108978 A1 WO 2021108978A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
nodes
validator
score
proposer
Prior art date
Application number
PCT/CN2019/122628
Other languages
English (en)
French (fr)
Inventor
仵小勇
来鑫
陈磊
Original Assignee
深圳市网心科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市网心科技有限公司 filed Critical 深圳市网心科技有限公司
Priority to PCT/CN2019/122628 priority Critical patent/WO2021108978A1/zh
Priority to CN201980004692.8A priority patent/CN113383364B/zh
Publication of WO2021108978A1 publication Critical patent/WO2021108978A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present invention relates to the field of blockchain technology, and in particular to a method, electronic equipment, system and medium for selecting a verifier node.
  • Blockchain is a new type of distributed system technology, and the consensus mechanism is an extremely important part of it. Through the consensus mechanism, each node in the distributed system can directly reach a consistent understanding of the data, thereby ensuring the consistency of data storage. With the continuous development of blockchain technology, various consensus mechanisms have emerged. Among them, the “BFT (Byzantine Fault Tolerance, Byzantine Fault Tolerance)" consensus mechanism is the most representative type of consensus mechanism.
  • the consensus mechanism uses the "Byzantine mechanism" between nodes to reach a consensus, and it has derived PBFT (Practical Byzantine Fault Tolerance), RBFT (Redundant Byzantine Fault Tolerance, redundant Byzantine Fault Tolerance) and SBFT ( Simplified Byzantine Fault Tolerance, simple Byzantine fault tolerance) and other derivative mechanisms.
  • PBFT Practical Byzantine Fault Tolerance
  • RBFT Redundant Byzantine Fault Tolerance, redundant Byzantine Fault Tolerance
  • SBFT Simplified Byzantine Fault Tolerance, simple Byzantine fault tolerance
  • the main purpose of the present invention is to provide a validator node selection method, electronic equipment, system and medium, which can evaluate each elected proposer node based on service data, and then update the validator node set to realize the dynamics of the validator node set
  • the adjustment has improved the efficiency of the blockchain system, and further improved the quality of service of the system.
  • the present invention provides a method for selecting a validator node, and the method includes:
  • Acquiring information of X candidate nodes in the blockchain system where the information of the candidate nodes includes the historical service quality score of the candidate node;
  • Y validator nodes are selected from the X candidate nodes to form the validator node set of the target block; where X and Y are both positive integers, and X is less than or equal to Y.
  • the selection of Y validator nodes from the X candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes includes:
  • the method further includes:
  • the historical service quality score of the proposer node is updated.
  • the evaluating the proposer node according to the service data to obtain the service quality score within a preset time period includes:
  • the proposer node when it is determined that the proposer node proposes valid blocks in M consecutive services including the current service, or proposes invalid blocks and/or blocks in N consecutive services , Update the historical service quality score of the proposer node and retain the proposer node; or
  • the proposer node when it is determined that the proposer node has proposed invalid blocks and/or unproposed blocks in consecutive Q services including the current service, update the historical service quality of the proposer node Score and remove the proposer node;
  • M, N, and Q are integers greater than 0, and Q is greater than N.
  • the method further includes:
  • the proposer node proposes invalid blocks and/or unproposed blocks in N consecutive services including the current service
  • the current score is reduced by the preset score.
  • the method further includes:
  • the obtained node is added to the set of validator nodes.
  • the method further includes:
  • the method further includes:
  • the score of the detected node is set to zero, and the detected node is deleted from the X candidate nodes.
  • the present invention further provides an electronic device, the electronic device including:
  • Memory storing at least one instruction
  • the processor executes the instructions stored in the memory to implement the verifier node selection method.
  • the electronic device is a node constituting a content distribution network or a blockchain network.
  • the present invention further provides a validator node selection system, the system includes:
  • An obtaining unit configured to obtain information of N candidate nodes in the blockchain system, where the information of the candidate nodes includes the historical service quality score of the candidate node;
  • the construction unit is used to select M validator nodes from the N candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes; where N and M are both positive integers, and M Less than or equal to N.
  • the construction unit selects Y validator nodes from the X candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes, including:
  • the system further includes:
  • the selection unit is configured to select one of the validator nodes from the set of validator nodes as the proposer node of the target block;
  • the obtaining unit is further configured to obtain service data generated by the proposer node within a preset time period
  • An evaluation unit configured to evaluate the proposer node according to the service data to obtain a service quality score within a preset time period
  • the update unit is configured to update the historical service quality score of the proposer node according to the service quality score.
  • the evaluation unit is specifically used for:
  • the proposer node when it is determined that the proposer node proposes valid blocks in M consecutive services including the current service, or proposes invalid blocks and/or unproposed blocks in N consecutive services , Update the historical service quality score of the proposer node and retain the proposer node; or
  • the proposer node when it is determined that the proposer node has proposed invalid blocks and/or unproposed blocks in consecutive Q services including the current service, update the historical service quality of the proposer node Score and remove the proposer node;
  • M, N, and Q are integers greater than 0, and Q is greater than N.
  • the obtaining unit is further configured to obtain the current score of the proposer node when the historical service quality score of the proposer node is updated and the proposer node is retained;
  • the promotion unit is configured to increase the current score by a preset value when the proposer node proposes valid blocks in M consecutive services including the current service; or
  • the reduction unit is configured to reduce the current score by the preset score when the proposer node proposes invalid blocks and/or blocks that have not been proposed for N consecutive services including the current service .
  • the obtaining unit is further configured to obtain the current score of the proposer node when the historical service quality score of the proposer node is updated and the proposer node is removed;
  • a removing unit configured to reduce the current score by a preset score, and remove the proposer node from the set of validator nodes
  • the obtaining unit is further configured to obtain the node with the highest score among the rest of the X candidate nodes except the validator node set;
  • the joining unit is used to add the obtained node to the set of validator nodes.
  • the system further includes:
  • the sorting unit is used to sort the nodes among the X candidate nodes according to the score from high to low after the configuration block;
  • the construction unit is further configured to obtain the nodes ranked in the front preset position to reconstruct the set of validator nodes.
  • the system further includes:
  • the deleting unit is used to set the score of the detected node to zero when it is detected that a node does not accept verification and/or repeated voting among X candidate nodes, and delete the detection from the X candidate nodes To the node.
  • the present invention can obtain the information of X candidate nodes in the blockchain system.
  • the information of the candidate nodes includes the historical service quality scores of the candidate nodes, and is based on the historical service of the candidate nodes.
  • Quality score select Y validator nodes from X candidate nodes to form the validator node set of the target block; where X and Y are both positive integers, and X is less than or equal to Y, and then the set of validator nodes is realized
  • the dynamic adjustment of the blockchain system improves the verification efficiency of the blockchain system, thereby improving the service quality of the blockchain system and accelerating the transaction speed.
  • FIG. 1 is a schematic flowchart of an embodiment of the present invention
  • FIG. 2 is a schematic diagram of the internal structure of an electronic device disclosed in an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of functional modules of the validator node selection system of the present invention.
  • the invention provides a method for selecting a validator node.
  • FIG. 1 it is a schematic flowchart of an embodiment of the present invention. According to different needs, the sequence of the steps in the flow diagram can be changed, and some steps can be omitted.
  • the method for selecting a validator node is applied to one or more electronic devices.
  • the electronic device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • the hardware equipment includes but not limited to microprocessors, application specific integrated circuits (ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded Equipment, etc.
  • the electronic device may be any electronic product that can interact with a user with a human machine, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
  • a personal computer for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television ( Internet Protocol Television, IPTV), smart wearable devices, etc.
  • PDA personal digital assistant
  • IPTV Internet Protocol Television
  • smart wearable devices etc.
  • the electronic device may also include a network device and/or user equipment.
  • the network device includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing.
  • the network where the electronic device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), etc.
  • the method includes:
  • the X candidate nodes correspond to validator nodes, and the validator nodes have the right to participate in the verification of the block, and/or generate the block, and/or the packaging area Block, multiple verifier nodes constitute the set of verifier nodes.
  • the X candidate nodes may include a large number of nodes, and the electronic device may also randomly select multiple nodes from the X candidate nodes to construct the validator node set.
  • the electronic device may also extract multiple nodes from the X candidate nodes according to other rules to construct the validator node set, which is not limited in the present invention.
  • the electronic device may determine the deposit amount of each node itself, and obtain nodes whose deposit amount is greater than or equal to a preset value to construct the validator node set, and the electronic device may also compare the amount of the deposit The nodes are sorted, and the nodes before the designated ranking are obtained to construct the set of validator nodes.
  • S12 according to the historical service quality score of the candidate nodes, select Y validator nodes from the X candidate nodes to form the validator node set of the target block; where X and Y are both positive integers, and X is less than or equal to Y.
  • the electronic device selects Y validator nodes from the X candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes, including:
  • the electronic device selects the top Y nodes with the highest historical service quality score from the X candidate nodes to form a set of validator nodes of the target block.
  • the historical service quality score may only be used as an evaluation dimension, and it may also be based on information such as the amount of deposits, and/or load conditions, and/or network delays of each node. Comprehensively decide which nodes to select as validator nodes, and preferentially select nodes with high historical service quality score, high deposit amount, low load, and low network delay to form the validator node set.
  • the method further includes:
  • the electronic device selects one of the validator nodes as the proposer node of the target block from the set of validator nodes, and obtains the service data generated by the proposer node within a preset time period. According to the service data, the proposer node is evaluated to obtain a service quality score within a preset time period, and the historical service quality score of the proposer node is updated according to the service quality score.
  • the electronic device may randomly acquire any verifier node from the set of verifier nodes as the proposer node.
  • the electronic device in order to ensure that each verifier node has the same chance of being selected as the proposer node, randomly acquires any verifier node from the set of verifier nodes as the place The proposer node, and since each validator node has the same probability of being selected as the proposer node, each validator node also has the same probability of being removed, so that subsequent updates to the set of validator nodes More fair.
  • the electronic device can determine whether the proposer node proposes a block during the service period, and at the same time can determine whether the proposed block is valid, the electronic device It can also be determined how many times the proposer node has been elected, and whether a valid block has been proposed each time it is elected.
  • each validator node in the set of validator nodes may be selected as the proposer node.
  • the validator node selected as the proposer node is not only responsible for The proposed block, like other validator nodes in the set of validator nodes, has the right to vote on the proposed block.
  • the electronic device determines that the block is valid. On the contrary, when there is a validator node less than the preset threshold When the block is not recognized, the electronic device determines that the block is invalid.
  • the preset threshold may be configured to be greater than or equal to 2/3, and since the larger the preset threshold, the lower the fault tolerance of the system, so the preset threshold is lower than 2/3 is the best.
  • that the electronic device evaluates the proposer node according to the service data, and obtains the service quality score within a preset time period includes:
  • the electronic device obtains the current service data of the proposer node from the service data and the previously preset number of times adjacent to the current service as the service data generated when the proposer node performs the service. Further, The electronic device evaluates the proposer node according to the obtained service data, including, but not limited to, any of the following situations:
  • the electronic device updates the historical service quality score of the proposer node and retains the proposer node.
  • the electronic device updates the historical service of the proposer node Quality score and remove the proposer node.
  • M, N, and Q are integers greater than 0, and Q is greater than N.
  • the electronic device obtains the service data of the proposer node for three consecutive services, including: current service data, last service data, and previous service data.
  • One-time service data the value of M may be 3, the value of N may be 2, and the value of Q may be 3.
  • the electronic device determines that the proposer node is in the current service.
  • the electronic device updates the historical service quality score of the proposer node and retains all The proposer node; or when the electronic device determines that the proposer node has proposed invalid blocks and/or unproposed blocks in three consecutive services including the current service, the electronic device updates Score the historical service quality of the proposer node and remove the proposer node.
  • each validator node before any service is performed, each validator node has an initial score of the same value (such as 100). Once serviced, service data will be generated, and after service data is generated, The electronic device can then evaluate each verifier node based on the generated service data, thereby generating a change in the score, and the change in the score also reflects the service quality of each verifier node.
  • the electronic device can set a maximum value (such as 500) and a minimum value (such as 500) of the score. 0), the highest score of a validator node can be raised to the highest value, and the lowest can be reduced to the lowest value.
  • a maximum value such as 500
  • a minimum value such as 500
  • the method further includes:
  • the electronic device obtains the current score of the proposer node.
  • the proposer node includes the current service
  • the electronic device will increase the current score by a preset value; or when the proposer node is in N consecutive services including the current service.
  • the electronic device reduces the current score by the preset score.
  • the electronic device will The current score is increased by the preset score to characterize the better service of the proposer node. Obviously, since each validator node may be selected as the proposer node multiple times, the score can be continuously accumulated , The higher the score, the better the service of the corresponding validator node.
  • the electronic device reduces the current score by the preset score to characterize the poor service of the proposer node.
  • the score can be continuously changed. The lower the score, the worse the service of the corresponding validator node.
  • the electronic device When updating the historical service quality score of the proposer node and removing the proposer node, the electronic device obtains the current score of the proposer node, and further reduces the current score by a preset value , And remove the proposer node from the set of validator nodes, the electronic device obtains the node with the highest score among the rest of the X candidate nodes except the set of validator nodes, and further obtains Join the set of validator nodes.
  • the electronic device may directly reduce the current score by a preset value.
  • the proposer node is removed from the set of validator nodes to prevent the proposer node from continuing to affect the service. After removal, one place in the set of validator nodes will be free.
  • the electronic device obtains X candidates The node with the highest score among the rest of the nodes except the set of validator nodes, and the obtained node is added to the set of validator nodes, which not only fills the vacancy of the set of validator nodes, but also fills in the validators that come in The service quality of the node among the remaining nodes is the best, and the set of validator nodes is further optimized for better service.
  • the preset score can be customized configuration, for example: 1 point, etc.
  • the electronic device can continuously update the score of each validator node in the validator node set, so as to quantify the service quality of each validator node, and at the same time can update the The composition of the validator node set can further improve the service quality of the system by optimizing the validator node set.
  • the method further includes:
  • the electronic device sorts the nodes among the X candidate nodes according to the scores from high to low, and obtains the nodes ranked in the front preset position to reconstruct the set of validator nodes.
  • the electronic device rebuilds the validator node set according to the score every time the block is configured, so as to remove the validators with good service quality but accidentally removed.
  • the person node rejoins the set of validator nodes, so that each validator node in the set of validator nodes is the best service among all nodes at the beginning, and then the set of validator nodes is updated to achieve further The purpose of optimization.
  • the electronic device may also rank the nodes among the X candidate nodes in combination with the deposit amount and score of each node.
  • the electronic device may configure different weights for the deposit amount and the score, and then calculate the comprehensive score of each node based on the weight, and further sort the nodes of the X candidate nodes according to the obtained comprehensive score, to Achieve a multi-dimensional and more comprehensive comprehensive evaluation of each node.
  • the method further includes:
  • the electronic device when it is detected that a node does not accept verification and/or repeated voting, the electronic device resets the score of the detected node to zero, and deletes the detected node from the X candidate nodes Node.
  • malicious nodes can be deleted directly to prevent them from continuing to affect the services of the system, and the stability of the system is improved.
  • the score of each validator node is dynamically adjusted, and then combined with the score, the set of validator nodes is dynamically adjusted, so that the block can be stably produced.
  • Nodes have greater advantages to be elected as validator nodes, and can eliminate malicious nodes in time, or reduce the probability of not being elected as validator nodes, thereby effectively reducing the useless functions performed by the system when these nodes act as proposer nodes. , Thereby improving the efficiency and stability of the entire blockchain system.
  • the present invention can obtain the information of X candidate nodes in the blockchain system.
  • the information of the candidate nodes includes the historical service quality scores of the candidate nodes, and is based on the historical service of the candidate nodes.
  • Quality score select Y validator nodes from X candidate nodes to form the validator node set of the target block; where X and Y are positive integers, and X is less than or equal to Y, and then the set of validator nodes is realized
  • the dynamic adjustment of the blockchain system improves the verification efficiency of the blockchain system, thereby improving the service quality of the blockchain system and accelerating the transaction speed.
  • the electronic device 1 may be a node forming a blockchain network.
  • the electronic device 1 may include a memory 12, a processor 13, and a bus, and may also include a computer program stored in the memory 12 and running on the processor 13, such as a verifier node selection program.
  • the electronic device 1 may have a bus structure or a star structure.
  • the device 1 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.
  • the electronic device 1 may also include an input/output device, a network access device, and the like.
  • the electronic device 1 is only an example. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference. .
  • the memory 12 includes at least one type of readable storage medium, the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. .
  • the memory 12 may be an internal storage unit of the electronic device 1 in some embodiments, for example, a mobile hard disk of the electronic device 1.
  • the memory 12 may also be an external storage device of the electronic device 1, for example, a plug-in mobile hard disk equipped on the electronic device 1, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital, SD). ) Card, Flash Card, etc.
  • the memory 12 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 12 can be used not only to store application software and various data installed in the electronic device 1, such as the code of the verifier node selection program, etc., but also to temporarily store data that has been output or will be output.
  • the processor 13 may be composed of integrated circuits in some embodiments, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units. Combinations of central processing unit (CPU), microprocessor, digital processing chip, graphics processor, and various control chips.
  • the processor 13 is the control unit of the electronic device 1, which uses various interfaces and lines to connect the various components of the entire electronic device 1, and runs or executes programs or modules stored in the memory 12 (such as executing Verifier node selection program, etc.), and call data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
  • the processor 13 executes the operating system of the electronic device 1 and various installed applications.
  • the processor 13 executes the application program to implement the steps in the above embodiments of each validator node selection method, for example, steps S11 and S12 shown in FIG. 1.
  • the processor 13 implements the functions of the modules/units in the foregoing device embodiments when executing the computer program, for example:
  • Acquiring information of X candidate nodes in the blockchain system where the information of the candidate nodes includes the historical service quality score of the candidate node;
  • Y validator nodes are selected from the X candidate nodes to form the validator node set of the target block; where X and Y are both positive integers, and X is less than or equal to Y.
  • the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to complete the present invention.
  • the one or more modules/units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 1.
  • the computer program can be divided into a construction unit 110, an acquisition unit 111, an evaluation unit 112, an update unit 113, a sorting unit 114, a deletion unit 115, a promotion unit 116, a reduction unit 117, a removal unit 118, and an addition unit 119.
  • the selection unit 120 can be divided into a construction unit 110, an acquisition unit 111, an evaluation unit 112, an update unit 113, a sorting unit 114, a deletion unit 115, a promotion unit 116, a reduction unit 117, a removal unit 118, and an addition unit 119.
  • the selection unit 120 can be divided into a construction unit
  • the bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one arrow is used to indicate in FIG. 2, but it does not mean that there is only one bus or one type of bus.
  • the bus is configured to implement connection and communication between the memory 12 and the at least one processor 13 and the like.
  • the electronic device 1 may also include a power source (such as a battery) for supplying power to various components.
  • the power source may be logically connected to at least one processor 13 through a power management device, so as to manage charging through the power management device. , Discharge, and power management and other functions.
  • the power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators.
  • the electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface.
  • the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may also include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visualized user interface.
  • the above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium.
  • the above-mentioned software function module is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor to execute the method described in each embodiment of the present invention part.
  • the integrated module/unit of the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the present invention implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing related hardware devices through a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the foregoing method embodiments.
  • the computer program includes computer program code
  • the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) .
  • FIG. 2 only shows the electronic device 1 with the components 12-13 and the verifier node selection program. Those skilled in the art can understand that the structure shown in FIG. 2 does not constitute a limitation on the electronic device 1. It may include fewer or more components than shown, or a combination of some components, or a different component arrangement.
  • the memory 12 in the electronic device 1 stores multiple instructions to implement a method for selecting a validator node, and the processor 13 can execute the multiple instructions to achieve:
  • Acquiring information of X candidate nodes in the blockchain system where the information of the candidate nodes includes the historical service quality score of the candidate node;
  • Y validator nodes are selected from the X candidate nodes to form the validator node set of the target block; where X and Y are both positive integers, and X is less than or equal to Y.
  • the validator node selection system 11 includes a construction unit 110, an acquisition unit 111, an evaluation unit 112, an update unit 113, a sorting unit 114, a deletion unit 115, a promotion unit 116, a reduction unit 117, a removal unit 118, a joining unit 119, and Select unit 120.
  • the module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and can complete fixed functions, and are stored in the memory 12. In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
  • the obtaining unit 111 obtains information of X candidate nodes in the blockchain system, where the information of the candidate nodes includes historical service quality scores of the candidate nodes.
  • the X candidate nodes correspond to validator nodes, and the validator nodes have the right to participate in the verification of the block, and/or generate the block, and/or the packaging area Block, multiple verifier nodes constitute the set of verifier nodes.
  • the X candidate nodes may include a large number of nodes, and the construction unit 110 may also randomly select multiple nodes from the X candidate nodes to construct the validator node set.
  • the construction unit 110 may also extract multiple nodes from the X candidate nodes according to other rules to construct the validator node set, which is not limited in the present invention.
  • the construction unit 110 may determine the deposit amount of each node itself, and obtain nodes whose deposit amount is greater than or equal to a preset value to construct the validator node set, and the construction unit 110 may also compare the deposit amount according to the level of the deposit amount. The nodes are sorted, and the nodes before the designated ranking are obtained to construct the set of validator nodes.
  • the construction unit 110 selects Y validator nodes from the X candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes; wherein, X and Y are both positive integers, and X Less than or equal to Y.
  • the construction unit 110 selects Y validator nodes from the X candidate nodes to form the validator node set of the target block according to the historical service quality scores of the candidate nodes, including:
  • the construction unit 110 selects the top Y nodes with the highest historical service quality scores from the X candidate nodes to form a set of validator nodes of the target block.
  • the historical service quality score may only be used as an evaluation dimension, and it may also be based on information such as the amount of deposits, and/or load conditions, and/or network delays of each node. Comprehensively decide which nodes to select as validator nodes, and preferentially select nodes with high historical service quality score, high deposit amount, low load, and low network delay to form the validator node set.
  • the selection unit 120 selects one of the validator nodes from the set of validator nodes as the proposer node of the target block, and the acquisition unit 111 acquires the proposer node at a preset time.
  • the evaluation unit 112 evaluates the proposer node according to the service data to obtain the service quality score within a preset time period, and the update unit 113 updates the proposal according to the service quality score The historical service quality score of the node.
  • the obtaining unit 111 may randomly obtain any validator node as the proposer node from the set of validator nodes.
  • the obtaining unit 111 randomly obtains any validator node from the set of validator nodes as The proposer node, and since each validator node has the same probability of being selected as the proposer node, each validator node also has the same probability of being removed, so that the subsequent collection of the validator node The update is more fair.
  • the acquiring unit 111 can determine whether the proposer node proposes a block during the service period, and at the same time, can determine whether the proposed block is valid. The unit 111 can also determine how many times the proposer node has been elected, and whether a valid block is proposed each time it is elected.
  • each validator node in the set of validator nodes may be selected as the proposer node.
  • the validator node selected as the proposer node is not only responsible for The proposed block, like other validator nodes in the set of validator nodes, has the right to vote on the proposed block.
  • the preset threshold may be configured to be greater than or equal to 2/3, and since the larger the preset threshold, the lower the fault tolerance of the system, so the preset threshold is lower than 2/3 is the best.
  • the evaluation unit 112 evaluates the proposer node according to the service data, and obtains the service quality score within a preset time period includes:
  • the evaluation unit 112 obtains the current service data of the proposer node from the service data and the previous preset number of times adjacent to the current service as the service data generated when the proposer node performs the service. Further, The evaluation unit 112 evaluates the proposer node according to the acquired service data, including, but not limited to, any of the following situations:
  • the update unit 113 updates the historical service quality score of the proposer node and retains the proposer node.
  • the removal unit 118 updates the historical service of the proposer node Quality score and remove the proposer node.
  • M, N, and Q are integers greater than 0, and Q is greater than N.
  • the evaluation unit 112 obtains the service data of the proposer node during three consecutive services, including the current service data, the last service data, and the previous service data.
  • the last service data may be 3.
  • the value of M may be 3
  • the value of N may be 2
  • the value of Q may be 3, then when the evaluation unit 112 determines that the proposer node includes the current service
  • the update unit 113 updates the historical service quality score of the proposer node and Retain the proposer node; or when the evaluation unit 112 determines that the proposer node has proposed invalid blocks and/or unproposed blocks in three consecutive services including the current service
  • the removing unit 118 updates the historical service quality score of the proposer node and removes the proposer node.
  • each validator node before any service is performed, each validator node has an initial score of the same value (such as 100). Once serviced, service data will be generated, and after service data is generated, The update unit 113 can evaluate each verifier node according to the generated service data, and then produce a change in the score, and the change in the score also reflects the service quality of each verifier node.
  • the update unit 113 can set a maximum value (such as 500) and a minimum value (such as 0). ), the highest score of a validator node can be raised to the highest value, and the lowest score can be reduced to the lowest value.
  • the obtaining unit 111 obtains the current score of the proposer node.
  • the proposer node includes the current service
  • the promotion unit 116 will increase the current score by a preset value; or when the proposer node is in all N consecutive services including the current service.
  • the reduction unit 117 reduces the current score by the preset score.
  • the update unit 113 The current score is increased by the preset score to characterize the better service of the proposer node. Obviously, since each validator node may be selected as the proposer node multiple times, the score can be continuously performed. Accumulated, the higher the score, the better the service of the corresponding validator node.
  • the update unit 113 reduces the current score by the preset score to indicate that the service of the proposer node is poor. Obviously since each verifier node may be selected as the proposer node multiple times, the score can be continuously changed. The lower the score, the worse the service of the corresponding verifier node.
  • the acquiring unit 111 acquires the current score of the proposer node, and the reducing unit 117 further reduces the current score of the proposer node.
  • the score is reduced by a preset score
  • the removing unit 118 removes the proposer node from the set of validator nodes
  • the obtaining unit 111 obtains the rest of the X candidate nodes except the set of validator nodes
  • the adding unit 119 further adds the obtained node to the set of validator nodes.
  • the update unit 113 may directly reduce the current score by a preset value.
  • the proposer node is removed from the set of validator nodes to prevent the proposer node from continuing to affect the service. After removal, one spot in the set of validator nodes will be free.
  • the update unit 113 obtains X Among the candidate nodes, the node with the highest score among the remaining nodes except the set of validator nodes, and the obtained node is added to the set of validator nodes, which not only fills the vacancy of the set of validator nodes, but also fills the incoming ones
  • the service quality of the validator node among the remaining nodes is the best, and the set of validator nodes is further optimized for better service.
  • the preset score can be customized configuration, for example: 1 point, etc.
  • the update unit 113 can continuously update the score of each validator node in the validator node set, so as to quantify the service quality of each validator node, and at the same time can update all the validator nodes.
  • the composition of the set of validator nodes can further improve the service quality of the system by optimizing the set of validator nodes.
  • the sorting unit 114 sorts the nodes among the X candidate nodes according to the score from high to low, and the construction unit 110 obtains the top preset position The node reconstructs the set of validator nodes.
  • the construction unit 110 re-builds the validator node set according to the score every time the block is configured, so as to remove those with good service quality but accidentally removed.
  • the validator node rejoins the set of validator nodes, so that each validator node in the set of validator nodes has the best service among all nodes at the beginning, and then repeatedly calls the obtaining unit 111 and all the nodes.
  • the evaluation unit 112 and the update unit 113 update the set of validator nodes to achieve the purpose of further optimization.
  • the sorting unit 114 may also sort the nodes among the X candidate nodes in combination with the deposit amount and score of each node.
  • the sorting unit 114 may assign different weights to the deposit amount and the score, and then calculate the comprehensive score of each node based on the weight, and further sort the nodes of the X candidate nodes according to the obtained comprehensive score. In order to achieve a multi-dimensional and more comprehensive comprehensive evaluation of each node.
  • the deleting unit 115 when it is detected that a node does not accept verification and/or repeated voting, the deleting unit 115 resets the score of the detected node to zero, and removes it from Delete the detected node from the X candidate nodes.
  • malicious nodes can be deleted directly to prevent them from continuing to affect the services of the system, and the stability of the system is improved.
  • the score of each validator node is dynamically adjusted, and then combined with the score, the set of validator nodes is dynamically adjusted, so that the block can be stably produced.
  • Nodes have greater advantages to be elected as validator nodes, and can eliminate malicious nodes in time, or reduce the probability of not being elected as validator nodes, thereby effectively reducing the useless functions performed by the system when these nodes act as proposer nodes. , Thereby improving the efficiency and stability of the entire blockchain system.
  • the present invention can obtain the information of X candidate nodes in the blockchain system.
  • the information of the candidate nodes includes the historical service quality scores of the candidate nodes, and is based on the historical service of the candidate nodes.
  • Quality score select Y validator nodes from X candidate nodes to form the validator node set of the target block; where X and Y are positive integers, and X is less than or equal to Y, and then the set of validator nodes is realized
  • the dynamic adjustment of the blockchain system improves the verification efficiency of the blockchain system, thereby improving the service quality of the blockchain system and accelerating the transaction speed.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a server, data center and other equipment integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a mobile hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state mobile hard disk (SSD)).
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware equipment or in the form of software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.
  • sequence numbers of the above-mentioned embodiments of the present invention are only for description, and do not represent the superiority or inferiority of the embodiments.
  • the terms “include”, “include” or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes those elements that are not explicitly included.
  • the other elements listed may also include elements inherent to the process, device, article, or method. If there are no more restrictions, the element defined by the sentence "including a" does not exclude the existence of other identical elements in the process, device, article, or method that includes the element.

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明提供了一种验证人节点选择方法、电子设备、系统及介质。本发明能够获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分,并根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y,进而实现对验证人节点集合的动态调整,提高了区块链系统的验证效率,进而提升了区块链系统的服务质量,加快交易速度。

Description

验证人节点选择方法、电子设备、系统及介质 技术领域
本发明涉及区块链技术领域,尤其涉及验证人节点选择方法、电子设备、系统及介质。
背景技术
区块链作为一种新型的分布式系统技术,共识机制是其中极其重要的一环。通过共识机制,能够使得分布式系统中各个节点直接对数据达成一致性的认识,从而保证数据存储的一致性。而随着区块链技术的不断发展,也随之产生了多种多样的共识机制,其中,“类BFT(Byzantine Fault Tolerance,拜占庭容错算法)”共识机制是最具代表性的一类共识机制,该共识机制在节点间使用“拜占庭机制”来达成共识,并衍生出了PBFT(Practical Byzantine Fault Tolerance,实用拜占庭容错系统)、RBFT(Redundant Byzantine Fault Tolerance,冗余的拜占庭容错系统)以及SBFT(Simplified Byzantine Fault Tolerance,简易拜占庭容错)等各种衍生机制。
而在上述各种共识机制中,没有对验证人节点集合中的每个验证人节点的服务质量进行评估,也没有对验证人节点集合进行更新。因此,当出现作恶节点时,由于没有采取有效的应对措施,很可能导致系统效率降低,进而影响区块链系统的交易确认速度。
发明内容
本发明的主要目的在于提供验证人节点选择方法、电子设备、系统及介质,能够基于服务数据对每个当选的提议者节点进行评估,进而更新验证人节点集合,实现对验证人节点集合的动态调整,提高了区块链系统的效率,进而提升了系统的服务质量。
为实现上述目的,本发明提供一种验证人节点选择方法,所述方法包括:
获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
优选地,所述根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合包括:
从X个备选节点中选择历史服务质量评分最高的前Y个节点组成目标区块的验证人节点集合。
优选地,所述方法还包括:
从所述验证人节点集合中选择其中一个验证节点作为目标区块的提议者节点;
获取所述提议者节点在预设时间段内产生的服务数据;
根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分;及
根据所述服务质量评分,更新所述提议者节点的历史服务质量评分。
优选地,所述根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分包括:
从所述服务数据中获取所述提议者节点的当次服务数据,以及与当次服务相邻的前预设次数作为提议者节点进行服务时产生的服务数据;
根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块,或者连续N次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并保留所述提议者节点;或者
根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续Q次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并移除所述提议者节点;
其中,M、N、Q为大于0的整数,且Q大于N。
优选地,当所述服务质量评分为更新评分并保留时,在更新所述提议者节点的历史服务质量评分并保留所述提议者节点时,所述方法还包括:
获取所述提议者节点的当前评分;
当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,将所述当前评分提升预设分值;或者
当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,将所述当前评分降低所述预设分值。
优选地,当所述服务质量评分为更新评分并移除时,在更新所述提议者节点的历史服务质量评分并移除所述提议者节点时,所述方法还包括:
获取所述提议者节点的当前评分;
将所述当前评分降低预设分值,并将所述提议者节点从所述验证人节点集合中移除;
获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点;
将获取的节点加入所述验证人节点集合。
优选地,所述方法还包括:
经过配置区块后,对X个备选节点中的节点按照评分由高到低进行排序;
获取排在前预设位的节点重新构建所述验证人节点集合。
优选地,所述方法还包括:
在X个备选节点中,当检测到有节点不接受验证及/或重复投票时,将检测到的节点的评分置零,并从X个备选节点中删除所述检测到的节点。
为实现上述目的,本发明进一步提供一种电子设备,所述电子设备包括:
存储器,存储至少一个指令;及
处理器,执行所述存储器中存储的指令以实现所述验证人节点选择方法。
优选地,所述电子设备为组成内容分发网络或者区块链网络的节点。
为实现上述目的,本发明进一步提供一种验证人节点选择系统,所述系统包括:
获取单元,用于获取区块链系统中的N个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
构建单元,用于根据备选节点的历史服务质量评分,从N个备选节点中选择M个验证人节点组成目标区块的验证人节点集合;其中,N、M均为正整数,且M小于或等于N。
优选地,所述构建单元根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合包括:
从X个备选节点中选择历史服务质量评分最高的前Y个节点组成目标区块的验证人节点集合。
优选地,所述系统还包括:
选择单元,用于从所述验证人节点集合中选择其中一个验证节点作为目标区块的提议者节点;
所述获取单元,还用于获取所述提议者节点在预设时间段内产生的服务数据;
评估单元,用于根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分;及
更新单元,用于根据所述服务质量评分,更新所述提议者节点的历史服务质量评分。
优选地,所述评估单元具体用于:
从所述服务数据中获取所述提议者节点的当次服务数据,以及与当次服务相邻的前预 设次数作为提议者节点进行服务时产生的服务数据;
根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块,或者连续N次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并保留所述提议者节点;或者
根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续Q次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并移除所述提议者节点;
其中,M、N、Q为大于0的整数,且Q大于N。
优选地,所述获取单元,还用于在更新所述提议者节点的历史服务质量评分并保留所述提议者节点时,获取所述提议者节点的当前评分;
提升单元,用于当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,将所述当前评分提升预设分值;或者
降低单元,用于当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,将所述当前评分降低所述预设分值。
优选地,所述获取单元,还用于在更新所述提议者节点的历史服务质量评分并移除所述提议者节点时,获取所述提议者节点的当前评分;
移除单元,用于将所述当前评分降低预设分值,并将所述提议者节点从所述验证人节点集合中移除;
所述获取单元,还用于获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点;
加入单元,用于将获取的节点加入所述验证人节点集合。
优选地,所述系统还包括:
排序单元,用于经过配置区块后,对X个备选节点中的节点按照评分由高到低进行排序;
所述构建单元,还用于获取排在前预设位的节点重新构建所述验证人节点集合。
优选地,所述系统还包括:
删除单元,用于在X个备选节点中,当检测到有节点不接受验证及/或重复投票时,将检测到的节点的评分置零,并从X个备选节点中删除所述检测到的节点。
综上所述,本发明能够获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分,并根据备选节点的历史服务质量评分,从X 个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y,进而实现对验证人节点集合的动态调整,提高了区块链系统的验证效率,进而提升了区块链系统的服务质量,加快交易速度。
附图说明
图1为本发明一实施例的流程示意图;
图2为本发明一实施例揭露的电子设备的内部结构示意图;
图3为本发明验证人节点选择系统的功能模块示意图;
主要元件符号说明
电子设备 1
存储器 12
处理器 13
验证人节点选择系统 11
构建单元 110
获取单元 111
评估单元 112
更新单元 113
排序单元 114
删除单元 115
提升单元 116
降低单元 117
移除单元 118
加入单元 119
选择单元 120
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前 提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
本发明提供一种验证人节点选择方法。
参照图1,为本发明一实施例的流程示意图。根据不同的需求,该流程示意图中步骤的顺序可以改变,某些步骤可以省略。
所述验证人节点选择方法应用于一个或者多个电子设备中,所述电子设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,所述电子设备的硬件设备包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。
所述电子设备可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。
所述电子设备还可以包括网络设备和/或用户设备。其中,所述网络设备包括,但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云。
所述电子设备所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用 网络(Virtual Private Network,VPN)等。
在一实施例中,该方法包括:
S11,获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分。
在本发明的至少一个实施例中,X个备选节点与验证人节点(validator)相对应,所述验证人节点有权参与区块的验证、和/或生成区块、和/或打包区块,多个验证人节点构成所述验证人节点集合。
在本发明的至少一个实施例中,X个备选节点中可以包括大量节点,所述电子设备还可以从X个备选节点中随机抽取多个节点构建所述验证人节点集合。
当然,在其他实施例中,所述电子设备还可以根据其他规则从X个备选节点中抽取多个节点构建所述验证人节点集合,本发明在此不作限制。
例如:所述电子设备可以确定每个节点本身的存款数额,并获取存款数额大于或者等于预设值的节点构建所述验证人节点集合,所述电子设备还可以按照存款数额的高低对所述节点进行排序,并获取指定排位之前的节点构建所述验证人节点集合。
S12,根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
在本发明的至少一个实施例中,所述电子设备根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合包括:
所述电子设备从X个备选节点中选择历史服务质量评分最高的前Y个节点组成目标区块的验证人节点集合。
需要说明的是,在其他实施例中,所述历史服务质量评分可以仅作为一个评价维度,同时还可以根据每个节点的押金数量、和/或负载情况、和/或网络延时等信息来综合决定选取哪些节点成为验证人节点,优先选择历史服务质量评分高、押金数量高、负载低、网络延时低的节点组成验证人节点集合。
在本发明的至少一个实施例中,所述方法还包括:
所述电子设备从所述验证人节点集合中选择其中一个验证节点作为目标区块的提议者节点,并获取所述提议者节点在预设时间段内产生的服务数据,所述电子设备根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分,并根据所述服务质量评分,更新所述提议者节点的历史服务质量评分。
具体地,所述电子设备可以从所述验证人节点集合中随机获取任意验证人节点作为提 议者节点。
在本发明的至少一个实施例中,为了保证每个验证人节点具备被选择为所述提议者节点的同等机会,所述电子设备从所述验证人节点集合中随机获取任意验证人节点作为所述提议者节点,而由于每个验证人节点具备相同被选择为提议者节点的概率,因此每个验证人节点也就具备相同被移除的概率,使后续对所述验证人节点集合的更新更加具有公平性。
在本发明的至少一个实施例中,通过所述服务数据,所述电子设备能够确定所述提议者节点在服务期间是否提出了区块,同时能够确定提出的区块是否有效,所述电子设备还能够确定所述提议者节点一共当选了几次,并在每次当选时是否都提出了有效区块等。
在本发明的至少一个实施例中,在所述验证人节点集合中的每个验证人节点都有可能被选为提议者节点,此时,被选择为提议者节点的验证人节点不仅要负责提出区块,还与所述验证人节点集合中的其他验证人节点一样,具备对所提出的区块进行投票的权利。
具体地,当所述提议者节点提出了一个区块后,所述验证人节点集合中的所有验证人节点都要对该区块进行投票验证,包括所述提议者节点也具备投票的权利。
通常情况下,在共识算法中,当有达到预设阈值的验证人节点认可该区块时,则所述电子设备确定该区块有效,反之,当有小于所述预设阈值的验证人节点不认可该区块时,则所述电子设备确定该区块无效。
进一步地,为了确保验证的有效性,所述预设阈值可以配置为大于或者等于2/3,而由于所述预设阈值越大,系统的容错性则越低,因此所述预设阈值以2/3为最佳。
在本发明的至少一个实施例中,所述电子设备根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分包括:
所述电子设备从所述服务数据中获取所述提议者节点的当次服务数据,以及与当次服务相邻的前预设次数作为提议者节点进行服务时产生的服务数据,进一步地,所述电子设备根据获取的服务数据对所述提议者节点进行评估,包括,但不限于以下任意一种情况:
(1)当确定所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块,或者连续N次服务中都提出无效区块及/或未提出区块时,所述电子设备更新所述提议者节点的历史服务质量评分并保留所述提议者节点。
(2)当确定所述提议者节点在包括当次服务在内的连续Q次服务中都提出无效区块及/或未提出区块时,所述电子设备更新所述提议者节点的历史服务质量评分并移除所述提议者节点。
其中,M、N、Q为大于0的整数,且Q大于N。
例如:当所述预设次数为2次时,则所述电子设备获取了所述提议者节点在连续三次服务时的服务数据,包括:当次服务数据、上一次的服务数据,以及上上一次的服务数据。进一步地,所述M可以取值为3,所述N可以取值为2,所述Q可以取值为3,那么当所述电子设备确定所述提议者节点在包括当次服务在内的连续三次服务中都提出了有效区块,或者连续2次服务中都提出了无效区块及/或未提出区块时,所述电子设备更新所述提议者节点的历史服务质量评分并保留所述提议者节点;或者当所述电子设备确定所述提议者节点在包括当次服务在内的连续3次服务中都提出了无效区块及/或未提出区块时,所述电子设备更新所述提议者节点的历史服务质量评分并移除所述提议者节点。
在本发明的至少一个实施例中,在没有进行任何服务之前,每个验证人节点具有一个相同数值的初始评分(如100),一旦服务后,就会产生服务数据,而产生服务数据后,所述电子设备则可以根据产生的服务数据对每个验证人节点进行评估,进而产生了分数的变化,而分数的变化也正体现了每个验证人节点的服务质量。
可以理解的是,每个验证人节点的评分通常会不断变化,为了便于统一管理每个验证人节点的评分,所述电子设备可以设置一个评分的最高值(如500)及一个最低值(如0),一个验证人节点的评分最高可以升到所述最高值,最低可以降到所述最低值。
在本发明的至少一个实施例中,所述方法还包括:
(1)在更新所述提议者节点的历史服务质量评分并保留所述提议者节点时,所述电子设备获取所述提议者节点的当前评分,当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,所述电子设备将所述当前评分提升预设分值;或者当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,所述电子设备将所述当前评分降低所述预设分值。
可以理解的是,当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,说明所述提议者节点的服务质量较佳,因此,所述电子设备将所述当前评分提升所述预设分值,以表征所述提议者节点的服务较优,显然,由于每个验证人节点都可能被多次选择为提议者节点,因此分数可以进行不断地累加,分数越高,则表明对应验证人节点的服务越好。
反之,当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,说明所述提议者节点的服务质量较差,要么连续提出无效区块,要么在应该提出区块的时候没有提出区块,因此,所述电子设备将所述当前评分降低所述预设分值,以表征所述提议者节点的服务较差,显然,由于每个验证人节点都可能被多次选择为 提议者节点,因此分数可以进行不断地改变,分数越低,则表明对应验证人节点的服务越差。
(2)在更新所述提议者节点的历史服务质量评分并移除所述提议者节点时,所述电子设备获取所述提议者节点的当前评分,进一步将所述当前评分降低预设分值,并将所述提议者节点从所述验证人节点集合中移除,所述电子设备获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点,进一步将获取的节点加入所述验证人节点集合。
可以理解的是,当从验证人节点集合中选出的提议者节点不作为或者恶意提出无效区块时,如果不采取措施,该提议者节点在下一轮选举时仍然与其他验证人节点具有相同的被选概率,这必然导致整个系统效率降低,进而影响区块链系统的交易确认速度。
因此,当所述服务质量评分为更新评分并移除时,说明所述提议者节点的服务质量过差,所述电子设备可以在将所述当前评分降低预设分值后,直接将所述提议者节点从所述验证人节点集合中移除,避免该提议者节点继续影响服务,移除后,所述验证人节点集合中将空闲一个名额,因此,所述电子设备获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点,并将获取的节点加入所述验证人节点集合,不仅填补了所述验证人节点集合的空缺,且填补进来的验证人节点在其余节点中的服务质量是最好的,进一步优化了所述验证人节点集合,以便进行更好的服务。
其中,所述预设分值可以进行自定义配置,例如:1分等。
在本发明的至少一个实施例中,所述电子设备能够不断更新所述验证人节点集合中每个验证人节点的评分,以便对每个验证人节点的服务质量进行量化,同时能够更新所述验证人节点集合的组成,通过优化所述验证人节点集合,进一步提升系统的服务质量。
在本发明的至少一个实施例中,所述方法还包括:
经过配置区块后,所述电子设备对X个备选节点中的节点按照评分由高到低进行排序,并获取排在前预设位的节点重新构建所述验证人节点集合。
可以理解的是,当受到外界因素干扰(如:机房掉线等)时,有些验证人节点在作为提议者节点时也可能由于无法提出区块等原因被移除所述验证人节点集合,但这并不表示这些验证人节点的服务质量不佳,因此,所述电子设备每经过配置区块则重新根据评分构建所述验证人节点集合,以便将服务质量较好却被意外移除的验证人节点重新加入所述验证人节点集合,这样,所述验证人节点集合中的每个验证人节点在开始时都是所有节点中服务较优的,再更新所述验证人节点集合,达到进一步优化的目的。
当然,在其他实施例中,所述电子设备还可以结合每个节点的存款数额及评分对X个备选节点中的节点进行排序。
具体地,所述电子设备可以通过对存款数额及评分分别配置不同的权重,再依据权重计算每个节点的综合评分,进一步根据得到的综合评分对X个备选节点中的节点进行排序,以实现对每个节点进行多维度且更全面地综合评估。
在本发明的至少一个实施例中,所述方法还包括:
在X个备选节点中,当检测到有节点不接受验证及/或重复投票时,所述电子设备将检测到的节点的评分置零,并从X个备选节点中删除所述检测到的节点。
通过上述实施方式,能够直接删除作恶节点,避免其继续影响系统的服务,提升了系统的稳定性。
显然,在本案中,通过每个验证人节点在当选为提议者节点时的服务数据,动态调整每个验证人节点的评分,再结合评分动态进行验证人节点集合的调整,使得能够稳定出块的节点具有更大的优势当选为验证人节点,并能够及时排除作恶节点,或降低不作为节点当选为验证人节点的几率,进而有效降低了系统在这些节点作为提议者节点时所进行的无用功,从而提升了整个区块链系统的效率及稳定性。
综上所述,本发明能够获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分,并根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y,进而实现对验证人节点集合的动态调整,提高了区块链系统的验证效率,进而提升了区块链系统的服务质量,加快交易速度。
参见图2,在本实施例中,所述电子设备1可以是组成区块链网络的节点。
所述电子设备1可以包括存储器12、处理器13和总线,还可以包括存储在所述存储器12中并可在所述处理器13上运行的计算机程序,例如验证人节点选择程序。
本领域技术人员可以理解,所述示意图仅仅是电子设备1的示例,并不构成对电子设备1的限定,所述电子设备1既可以是总线型结构,也可以是星形结构,所述电子设备1还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置,例如所述电子设备1还可以包括输入输出设备、网络接入设备等。
需要说明的是,所述电子设备1仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。
其中,存储器12至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器12在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。存储器12在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器12还可以既包括电子设备1的内部存储单元也包括外部存储设备。存储器12不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如验证人节点选择程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器13在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。处理器13是所述电子设备1的控制核心(Control Unit),利用各种接口和线路连接整个电子设备1的各个部件,通过运行或执行存储在所述存储器12内的程序或者模块(例如执行验证人节点选择程序等),以及调用存储在所述存储器12内的数据,以执行电子设备1的各种功能和处理数据。
所述处理器13执行所述电子设备1的操作系统以及安装的各类应用程序。所述处理器13执行所述应用程序以实现上述各个验证人节点选择方法实施例中的步骤,例如图1所示的步骤S11、S12。
或者,所述处理器13执行所述计算机程序时实现上述各装置实施例中各模块/单元的功能,例如:
获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器12中,并由所述处理器13执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述电子设备1中的执行过程。例如,所述计算机程序可以被分割成构建单元110、获取单元111、评估单元112、更新单元113、排序单元114、删除单元115、 提升单元116、降低单元117、移除单元118、加入单元119以及选择单元120。
总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图2中仅用一根箭头表示,但并不表示仅有一根总线或一种类型的总线。所述总线被设置为实现所述存储器12以及所述至少一个处理器13等之间的连接通信。
尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选的,电源可以通过电源管理装置与至少一个处理器13逻辑相连,从而通过电源管理装置实现管理充电、放电、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,计算机设备,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分。
所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指示相关的硬件设备来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。
其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
图2仅示出了具有组件12-13,以及验证人节点选择程序的电子设备1,本领域技术人员可以理解的是,图2示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
结合图1,所述电子设备1中的所述存储器12存储多个指令以实现一种验证人节点选择方法,所述处理器13可执行所述多个指令从而实现:
获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
具体地,所述处理器13对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
参照图3,为本发明验证人节点选择系统的功能模块示意图。所述验证人节点选择系统11包括构建单元110、获取单元111、评估单元112、更新单元113、排序单元114、删除单元115、提升单元116、降低单元117、移除单元118、加入单元119以及选择单元120。本发明所称的模块/单元是指一种能够被处理器13所执行,并且能够完成固定功能的一系列计算机程序段,其存储在存储器12中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。
获取单元111获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分。
在本发明的至少一个实施例中,X个备选节点与验证人节点(validator)相对应,所述验证人节点有权参与区块的验证、和/或生成区块、和/或打包区块,多个验证人节点构成所述验证人节点集合。
在本发明的至少一个实施例中,X个备选节点中可以包括大量节点,构建单元110还可以从X个备选节点中随机抽取多个节点构建所述验证人节点集合。
当然,在其他实施例中,所述构建单元110还可以根据其他规则从X个备选节点中 抽取多个节点构建所述验证人节点集合,本发明在此不作限制。
例如:所述构建单元110可以确定每个节点本身的存款数额,并获取存款数额大于或者等于预设值的节点构建所述验证人节点集合,所述构建单元110还可以按照存款数额的高低对所述节点进行排序,并获取指定排位之前的节点构建所述验证人节点集合。
所述构建单元110根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
在本发明的至少一个实施例中,所述构建单元110根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合包括:
所述构建单元110从X个备选节点中选择历史服务质量评分最高的前Y个节点组成目标区块的验证人节点集合。
需要说明的是,在其他实施例中,所述历史服务质量评分可以仅作为一个评价维度,同时还可以根据每个节点的押金数量、和/或负载情况、和/或网络延时等信息来综合决定选取哪些节点成为验证人节点,优先选择历史服务质量评分高、押金数量高、负载低、网络延时低的节点组成验证人节点集合。
在本发明的至少一个实施例中,选择单元120从所述验证人节点集合中选择其中一个验证节点作为目标区块的提议者节点,所述获取单元111获取所述提议者节点在预设时间段内产生的服务数据,评估单元112根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分,更新单元113根据所述服务质量评分,更新所述提议者节点的历史服务质量评分。
具体地,所述获取单元111可以从所述验证人节点集合中随机获取任意验证人节点作为提议者节点。
在本发明的至少一个实施例中,为了保证每个验证人节点具备被选择为所述提议者节点的同等机会,所述获取单元111从所述验证人节点集合中随机获取任意验证人节点作为所述提议者节点,而由于每个验证人节点具备相同被选择为提议者节点的概率,因此每个验证人节点也就具备相同被移除的概率,使后续对所述验证人节点集合的更新更加具有公平性。
在本发明的至少一个实施例中,通过所述服务数据,所述获取单元111能够确定所述提议者节点在服务期间是否提出了区块,同时能够确定提出的区块是否有效,所述获取单元111还能够确定所述提议者节点一共当选了几次,并在每次当选时是否都提出了有效区 块等。
在本发明的至少一个实施例中,在所述验证人节点集合中的每个验证人节点都有可能被选为提议者节点,此时,被选择为提议者节点的验证人节点不仅要负责提出区块,还与所述验证人节点集合中的其他验证人节点一样,具备对所提出的区块进行投票的权利。
具体地,当所述提议者节点提出了一个区块后,所述验证人节点集合中的所有验证人节点都要对该区块进行投票验证,包括所述提议者节点也具备投票的权利。
通常情况下,在共识算法中,当有达到预设阈值的验证人节点认可该区块时,则确定该区块有效,反之,当有小于所述预设阈值的验证人节点不认可该区块时,则确定该区块无效。
进一步地,为了确保验证的有效性,所述预设阈值可以配置为大于或者等于2/3,而由于所述预设阈值越大,系统的容错性则越低,因此所述预设阈值以2/3为最佳。
在本发明的至少一个实施例中,所述评估单元112根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分包括:
所述评估单元112从所述服务数据中获取所述提议者节点的当次服务数据,以及与当次服务相邻的前预设次数作为提议者节点进行服务时产生的服务数据,进一步地,所述评估单元112根据获取的服务数据对所述提议者节点进行评估,包括,但不限于以下任意一种情况:
(1)当确定所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块,或者连续N次服务中都提出无效区块及/或未提出区块时,所述更新单元113更新所述提议者节点的历史服务质量评分并保留所述提议者节点。
(2)当确定所述提议者节点在包括当次服务在内的连续Q次服务中都提出无效区块及/或未提出区块时,移除单元118更新所述提议者节点的历史服务质量评分并移除所述提议者节点。
其中,M、N、Q为大于0的整数,且Q大于N。
例如:当所述预设次数为2次时,则所述评估单元112获取了所述提议者节点在连续三次服务时的服务数据,包括:当次服务数据、上一次的服务数据,以及上上一次的服务数据。进一步地,所述M可以取值为3,所述N可以取值为2,所述Q可以取值为3,那么当所述评估单元112确定所述提议者节点在包括当次服务在内的连续三次服务中都提出了有效区块,或者连续2次服务中都提出了无效区块及/或未提出区块时,所述更新单元113更新所述提议者节点的历史服务质量评分并保留所述提议者节点;或者当所述评估单 元112确定所述提议者节点在包括当次服务在内的连续3次服务中都提出了无效区块及/或未提出区块时,所述移除单元118更新所述提议者节点的历史服务质量评分并移除所述提议者节点。
在本发明的至少一个实施例中,在没有进行任何服务之前,每个验证人节点具有一个相同数值的初始评分(如100),一旦服务后,就会产生服务数据,而产生服务数据后,所述更新单元113则可以根据产生的服务数据对每个验证人节点进行评估,进而产生了分数的变化,而分数的变化也正体现了每个验证人节点的服务质量。
可以理解的是,每个验证人节点的评分通常会不断变化,为了便于统一管理每个验证人节点的评分,更新单元113可以设置一个评分的最高值(如500)及一个最低值(如0),一个验证人节点的评分最高可以升到所述最高值,最低可以降到所述最低值。
在本发明的至少一个实施例中,进一步地:
(1)在更新所述提议者节点的历史服务质量评分并保留所述提议者节点时,所述获取单元111获取所述提议者节点的当前评分,当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,提升单元116将所述当前评分提升预设分值;或者当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,降低单元117将所述当前评分降低所述预设分值。
可以理解的是,当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,说明所述提议者节点的服务质量较佳,因此,所述更新单元113将所述当前评分提升所述预设分值,以表征所述提议者节点的服务较优,显然,由于每个验证人节点都可能被多次选择为提议者节点,因此分数可以进行不断地累加,分数越高,则表明对应验证人节点的服务越好。
反之,当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,说明所述提议者节点的服务质量较差,要么连续提出无效区块,要么在应该提出区块的时候没有提出区块,因此,所述更新单元113将所述当前评分降低所述预设分值,以表征所述提议者节点的服务较差,显然,由于每个验证人节点都可能被多次选择为提议者节点,因此分数可以进行不断地改变,分数越低,则表明对应验证人节点的服务越差。
(2)在更新所述提议者节点的历史服务质量评分并移除所述提议者节点时,所述获取单元111获取所述提议者节点的当前评分,所述降低单元117进一步将所述当前评分降低预设分值,移除单元118将所述提议者节点从所述验证人节点集合中移除,所述获取单 元111获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点,加入单元119进一步将获取的节点加入所述验证人节点集合。
可以理解的是,当从验证人节点集合中选出的提议者节点不作为或者恶意提出无效区块时,如果不采取措施,该提议者节点在下一轮选举时仍然与其他验证人节点具有相同的被选概率,这必然导致整个系统效率降低,进而影响区块链系统的交易确认速度。
因此,当所述服务质量评分为更新评分并移除时,说明所述提议者节点的服务质量过差,所述更新单元113可以在将所述当前评分降低预设分值后,直接将所述提议者节点从所述验证人节点集合中移除,避免该提议者节点继续影响服务,移除后,所述验证人节点集合中将空闲一个名额,因此,所述更新单元113获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点,并将获取的节点加入所述验证人节点集合,不仅填补了所述验证人节点集合的空缺,且填补进来的验证人节点在其余节点中的服务质量是最好的,进一步优化了所述验证人节点集合,以便进行更好的服务。
其中,所述预设分值可以进行自定义配置,例如:1分等。
在本发明的至少一个实施例中,所述更新单元113能够不断更新所述验证人节点集合中每个验证人节点的评分,以便对每个验证人节点的服务质量进行量化,同时能够更新所述验证人节点集合的组成,通过优化所述验证人节点集合,进一步提升系统的服务质量。
在本发明的至少一个实施例中,经过配置区块后,排序单元114对X个备选节点中的节点按照评分由高到低进行排序,所述构建单元110获取排在前预设位的节点重新构建所述验证人节点集合。
可以理解的是,当受到外界因素干扰(如:机房掉线等)时,有些验证人节点在作为提议者节点时也可能由于无法提出区块等原因被移除所述验证人节点集合,但这并不表示这些验证人节点的服务质量不佳,因此,所述构建单元110每经过配置区块则重新根据评分构建所述验证人节点集合,以便将服务质量较好却被意外移除的验证人节点重新加入所述验证人节点集合,这样,所述验证人节点集合中的每个验证人节点在开始时都是所有节点中服务较优的,再重复调用所述获取单元111、所述评估单元112以及所述更新单元113更新所述验证人节点集合,达到进一步优化的目的。
当然,在其他实施例中,所述排序单元114还可以结合每个节点的存款数额及评分对X个备选节点中的节点进行排序。
具体地,所述排序单元114可以通过对存款数额及评分分别配置不同的权重,再依据权重计算每个节点的综合评分,进一步根据得到的综合评分对X个备选节点中的节点进行 排序,以实现对每个节点进行多维度且更全面地综合评估。
在本发明的至少一个实施例中,在X个备选节点中,当检测到有节点不接受验证及/或重复投票时,所述删除单元115将检测到的节点的评分置零,并从X个备选节点中删除所述检测到的节点。
通过上述实施方式,能够直接删除作恶节点,避免其继续影响系统的服务,提升了系统的稳定性。
显然,在本案中,通过每个验证人节点在当选为提议者节点时的服务数据,动态调整每个验证人节点的评分,再结合评分动态进行验证人节点集合的调整,使得能够稳定出块的节点具有更大的优势当选为验证人节点,并能够及时排除作恶节点,或降低不作为节点当选为验证人节点的几率,进而有效降低了系统在这些节点作为提议者节点时所进行的无用功,从而提升了整个区块链系统的效率及稳定性。
综上所述,本发明能够获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分,并根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y,进而实现对验证人节点集合的动态调整,提高了区块链系统的验证效率,进而提升了区块链系统的服务质量,加快交易速度。
在上述实施例中,可以全部或部分地通过软件、硬件设备、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等设备。所述可用介质可以是磁性介质,(例如,软盘、移动硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态移动硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装 置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件设备的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (11)

  1. 一种验证人节点选择方法,其特征在于,所述方法包括:
    获取区块链系统中的X个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
    根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合;其中,X、Y均为正整数,且X小于或等于Y。
  2. 根据权利要求1所述的验证人节点选择方法,其特征在于,所述根据备选节点的历史服务质量评分,从X个备选节点中选择Y个验证人节点组成目标区块的验证人节点集合包括:
    从X个备选节点中选择历史服务质量评分最高的前Y个节点组成目标区块的验证人节点集合。
  3. 根据权利要求1所述的验证人节点选择方法,其特征在于,所述方法还包括:
    从所述验证人节点集合中选择其中一个验证节点作为目标区块的提议者节点;
    获取所述提议者节点在预设时间段内产生的服务数据;
    根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分;及
    根据所述服务质量评分,更新所述提议者节点的历史服务质量评分。
  4. 如权利要求3所述的验证人节点选择方法,其特征在于,所述根据所述服务数据,对所述提议者节点进行评估,得到预设时间段内的服务质量评分包括:
    从所述服务数据中获取所述提议者节点的当次服务数据,以及与当次服务相邻的前预设次数作为提议者节点进行服务时产生的服务数据;
    根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块,或者连续N次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并保留所述提议者节点;或者
    根据获取的服务数据,当确定所述提议者节点在包括当次服务在内的连续Q次服务中都提出无效区块及/或未提出区块时,更新所述提议者节点的历史服务质量评分并移除所述提议者节点;
    其中,M、N、Q为大于0的整数,且Q大于N。
  5. 如权利要求4所述的验证人节点选择方法,其特征在于,在更新所述提议者节点 的历史服务质量评分并保留所述提议者节点时,所述方法还包括:
    获取所述提议者节点的当前评分;
    当所述提议者节点在包括当次服务在内的连续M次服务中都提出有效区块时,将所述当前评分提升预设分值;或者
    当所述提议者节点在包括当次服务在内的连续N次服务中都提出无效区块及/或未提出区块时,将所述当前评分降低所述预设分值。
  6. 如权利要求4所述的验证人节点选择方法,其特征在于,在更新所述提议者节点的历史服务质量评分并移除所述提议者节点时,所述方法还包括:
    获取所述提议者节点的当前评分;
    将所述当前评分降低预设分值,并将所述提议者节点从所述验证人节点集合中移除;
    获取X个备选节点中除所述验证人节点集合外的其余节点中评分最高的节点;
    将获取的节点加入所述验证人节点集合。
  7. 如权利要求1所述的验证人节点选择方法,其特征在于,所述方法还包括:
    经过配置区块后,对X个备选节点中的节点按照评分由高到低进行排序;
    获取排在前预设位的节点重新构建所述验证人节点集合。
  8. 如权利要求1所述的验证人节点选择方法,其特征在于,所述方法还包括:
    在X个备选节点中,当检测到有节点不接受验证及/或重复投票时,将检测到的节点的评分置零,并从X个备选节点中删除所述检测到的节点。
  9. 一种电子设备,其特征在于,所述电子设备包括:
    存储器,存储至少一个指令;及
    处理器,执行所述存储器中存储的指令以实现如权利要求1至8中任意一项所述的验证人节点选择方法。
  10. 一种验证人节点选择系统,其特征在于,所述系统包括:
    获取单元,用于获取区块链系统中的N个备选节点的信息,所述备选节点的信息包括所述备选节点的历史服务质量评分;
    构建单元,用于根据备选节点的历史服务质量评分,从N个备选节点中选择M个验证人节点组成目标区块的验证人节点集合;其中,N、M均为正整数,且M小于或等于N。
  11. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有验证人节点选择程序,所述验证人节点选择程序可被一个或者多个处理器执行,以实现如权利要求1至8中任一项所述的验证人节点选择方法。
PCT/CN2019/122628 2019-12-03 2019-12-03 验证人节点选择方法、电子设备、系统及介质 WO2021108978A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/122628 WO2021108978A1 (zh) 2019-12-03 2019-12-03 验证人节点选择方法、电子设备、系统及介质
CN201980004692.8A CN113383364B (zh) 2019-12-03 2019-12-03 验证人节点选择方法、电子设备、系统及介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/122628 WO2021108978A1 (zh) 2019-12-03 2019-12-03 验证人节点选择方法、电子设备、系统及介质

Publications (1)

Publication Number Publication Date
WO2021108978A1 true WO2021108978A1 (zh) 2021-06-10

Family

ID=76222156

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122628 WO2021108978A1 (zh) 2019-12-03 2019-12-03 验证人节点选择方法、电子设备、系统及介质

Country Status (2)

Country Link
CN (1) CN113383364B (zh)
WO (1) WO2021108978A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113672680A (zh) * 2021-07-19 2021-11-19 哈尔滨工业大学(深圳) 区块链中的轻量级概率验证方法、装置、区块链节点及介质
US20220164795A1 (en) * 2020-11-23 2022-05-26 Beijing University Of Posts And Telecommunications Cross-chain Communication Method, Device and Storage Medium thereof
CN116015936A (zh) * 2022-12-30 2023-04-25 中国联合网络通信集团有限公司 一种安全能力编排方法、装置及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108320155A (zh) * 2017-12-21 2018-07-24 中国科学院信息工程研究所 一种实现区块链共识机制的方法
CN108377206A (zh) * 2018-03-12 2018-08-07 众安信息技术服务有限公司 用于配置共识算法的方法、装置及计算机可读存储介质
CN109427012A (zh) * 2017-08-22 2019-03-05 汇链丰(北京)科技有限公司 一种基于区块链的交易和验证方法
CN109639837A (zh) * 2019-01-31 2019-04-16 东南大学 基于信任机制的区块链DPoS共识方法
KR101975822B1 (ko) * 2018-10-26 2019-05-08 (주)리그시스템 프라이빗 블록체인 네트워크 시스템 및 경량화된 고성능 블록체인 기반 합의 방법

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10331511B1 (en) * 2015-02-18 2019-06-25 Amazon Technologies, Inc. Poison pill prevention for consensus protocols
WO2017167550A1 (en) * 2016-03-30 2017-10-05 British Telecommunications Public Limited Company Blockchain state reliability determination
CN107341702B (zh) * 2017-03-08 2020-06-23 创新先进技术有限公司 一种业务处理的方法及装置
JP2019101719A (ja) * 2017-12-01 2019-06-24 株式会社bitFlyer ブロックチェーン・ネットワークにおいてスマートコントラクトを実行可能にするための方法及び当該ネットワークを構成するためのノード
US20190287107A1 (en) * 2018-03-15 2019-09-19 International Business Machines Corporation Resource equity for blockchain
CN109241359A (zh) * 2018-08-18 2019-01-18 深圳市网心科技有限公司 区块链节点设备、区块链系统、区块数据处理系统和方法
CN110290021B (zh) * 2019-06-19 2022-07-19 辽宁大学 基于动态规划算法的跨链共识时延优化方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109427012A (zh) * 2017-08-22 2019-03-05 汇链丰(北京)科技有限公司 一种基于区块链的交易和验证方法
CN108320155A (zh) * 2017-12-21 2018-07-24 中国科学院信息工程研究所 一种实现区块链共识机制的方法
CN108377206A (zh) * 2018-03-12 2018-08-07 众安信息技术服务有限公司 用于配置共识算法的方法、装置及计算机可读存储介质
KR101975822B1 (ko) * 2018-10-26 2019-05-08 (주)리그시스템 프라이빗 블록체인 네트워크 시스템 및 경량화된 고성능 블록체인 기반 합의 방법
CN109639837A (zh) * 2019-01-31 2019-04-16 东南大学 基于信任机制的区块链DPoS共识方法

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220164795A1 (en) * 2020-11-23 2022-05-26 Beijing University Of Posts And Telecommunications Cross-chain Communication Method, Device and Storage Medium thereof
US11631080B2 (en) * 2020-11-23 2023-04-18 Beijing University Of Posts And Telecommunications Cross-chain communication method, device and storage medium thereof
CN113672680A (zh) * 2021-07-19 2021-11-19 哈尔滨工业大学(深圳) 区块链中的轻量级概率验证方法、装置、区块链节点及介质
CN116015936A (zh) * 2022-12-30 2023-04-25 中国联合网络通信集团有限公司 一种安全能力编排方法、装置及计算机可读存储介质
CN116015936B (zh) * 2022-12-30 2024-05-03 中国联合网络通信集团有限公司 一种安全能力编排方法、装置及计算机可读存储介质

Also Published As

Publication number Publication date
CN113383364A (zh) 2021-09-10
CN113383364B (zh) 2023-05-16

Similar Documents

Publication Publication Date Title
CN109150971B (zh) 超级节点投票和选举方法、装置和网络节点
WO2021108978A1 (zh) 验证人节点选择方法、电子设备、系统及介质
WO2021093244A1 (zh) 随机数生成方法、区块链节点、系统及介质
JP5735969B2 (ja) コミュニティ内の接続を決定するためのソーシャルグラフデータ解析用システムおよび方法
US9805140B2 (en) Striping of directed graphs and nodes with improved functionality
JP5664098B2 (ja) 複合イベント分散装置、複合イベント分散方法および複合イベント分散プログラム
WO2011134086A1 (en) Systems and methods for conducting reliable assessments with connectivity information
CN110909034B (zh) 一种业务数据的分配方法、装置、终端设备及存储介质
WO2020258252A1 (zh) 一种区块链数据的共识方法及相关设备
CN112738172B (zh) 区块链节点的管理方法、装置、计算机设备和存储介质
CN110570311B (zh) 区块链的共识方法、装置及设备
CN111767270A (zh) 数据迁移方法、装置、服务器及存储介质
WO2022121216A1 (zh) 一种数据处理方法、装置、终端和可读存储介质
CN104506636B (zh) 一种数据同步方法及装置
US10437806B2 (en) Database management method and information processing apparatus
CN111905362A (zh) 游戏公会的加载方法和服务器
CN103414756A (zh) 一种任务分发方法、分发节点及系统
CN110703986B (zh) 云硬盘创建方法、装置、设备及存储介质
US20170300995A1 (en) System and method to optimize cluster inventory
CN111813761A (zh) 一种数据库管理方法、装置以及计算机存储介质
CN112764935A (zh) 大数据处理方法、装置、电子设备及存储介质
CN117493342B (zh) 商品数据更新方法、装置、电子设备和存储介质
JP2016130962A (ja) データ退避制御方法、データ退避制御プログラム、及びデータ退避制御装置
US11914603B2 (en) Data layout model generation system
CN108399170A (zh) 数据挖掘方法以及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19955115

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19955115

Country of ref document: EP

Kind code of ref document: A1