CN111444210B - Block chain consensus node management method, device, equipment and storage medium - Google Patents

Block chain consensus node management method, device, equipment and storage medium Download PDF

Info

Publication number
CN111444210B
CN111444210B CN202010224168.6A CN202010224168A CN111444210B CN 111444210 B CN111444210 B CN 111444210B CN 202010224168 A CN202010224168 A CN 202010224168A CN 111444210 B CN111444210 B CN 111444210B
Authority
CN
China
Prior art keywords
node
list
consensus
block
consensus node
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010224168.6A
Other languages
Chinese (zh)
Other versions
CN111444210A (en
Inventor
李茂材
周开班
王宗友
刘攀
张劲松
朱耿良
孔利
时一防
黄焕坤
刘区城
杨常青
蓝虎
崔嘉辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010224168.6A priority Critical patent/CN111444210B/en
Publication of CN111444210A publication Critical patent/CN111444210A/en
Application granted granted Critical
Publication of CN111444210B publication Critical patent/CN111444210B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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

Abstract

The embodiment of the application provides a block chain consensus node management method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a first node updating request aiming at a block chain network, and determining an updating node according to the first node updating request; generating a candidate consensus node list according to the updated node and the source consensus node list, and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area; and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area. By adopting the embodiment of the application, the consensus accuracy of the block chains can be improved.

Description

Block chain consensus node management method, device, equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a device, and a storage medium for managing blockchain consensus nodes.
Background
The block chain is a decentralized distributed account book system and has the characteristics of data non-tampering, decentralized and openness. The consensus mechanism is used as a core in the blockchain technology, can ensure that the latest block is accurately added to the blockchain, and the blockchain information stored by the node is consistent and not forked, even can resist malicious attacks, and the consensus node plays an important role in the consensus mechanism.
In the prior art, after the verification of a new tile is completed, each consensus node needs to broadcast a verification result to other consensus nodes in the tile chain network by verifying the generated new tile, and when the consensus node in the tile chain system exceeding a quantity threshold (for example, 2/3 of the consensus node) passes the verification of the new tile, it indicates that the new tile consensus passes. In the process of identifying a new tile, the number of common nodes in the blockchain system may change, and if a plurality of common nodes are added, the number threshold in the process of identifying becomes large. However, it takes a certain time to establish a network connection between the newly added consensus node and the original consensus node, thereby reducing the consensus accuracy of the new block.
Disclosure of Invention
The embodiment of the application provides a block chain consensus node management method, device, equipment and storage medium, which can improve the consensus accuracy of a block chain.
An aspect of the present application provides a method for managing a blockchain consensus node, including:
acquiring a first node updating request aiming at a block chain network, and determining an updating node according to the first node updating request;
generating a candidate consensus node list according to the updated node and the source consensus node list, and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area.
An aspect of the present embodiment provides a device for managing a blockchain consensus node, where the device includes:
the determining module is used for acquiring a first node updating request aiming at the block chain network and determining an updating node according to the first node updating request;
the cache module is used for generating a candidate consensus node list according to the updated node and the source consensus node list and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
and the switching module is used for switching the source consensus node list into a candidate consensus node list in the second storage area when the node progress state information in the block chain network meets the list switching period.
Wherein the determining module comprises:
the device comprises a vote value acquisition unit, a vote value generation unit and a vote value generation unit, wherein the vote value acquisition unit is used for acquiring a first node updating request aiming at a block chain network and acquiring a vote value of a consensus node in a source consensus node list to the first node updating request;
and a node acquisition unit configured to acquire the update node associated with the first node update request when the vote value is greater than or equal to the vote threshold.
The first node updating request comprises a consensus node increasing request, and the updating node comprises a newly added node;
the cache module is specifically configured to:
and adding the newly added node to the source consensus node list, generating a candidate consensus node list, and caching the candidate consensus node list to the first storage area.
Wherein, the buffer module includes:
the weight obtaining unit is used for determining the consensus nodes contained in the newly added node and the source consensus node list as candidate consensus nodes and obtaining weight values corresponding to the candidate consensus nodes;
and the sorting unit is used for sorting the candidate consensus nodes according to the weight values and generating a candidate consensus node list from the sorted candidate consensus nodes.
Wherein, the device still includes:
the connection establishing module is used for establishing network connection between the newly added node and the identified node; the network connection is used for communication between the newly added node and the identified node.
The first node updating request comprises a consensus node deleting request, and the updating node comprises a node to be deleted;
the cache module is specifically configured to:
and deleting the nodes to be deleted from the source consensus node list to obtain a candidate consensus node list, and caching the candidate consensus node list into the first storage area.
Wherein, the device still includes:
the updating request obtaining module is used for obtaining a second node updating request aiming at the candidate consensus node list and determining a node to be selected according to the second node updating request;
and the updating module is used for updating the candidate consensus node list according to the nodes to be selected in the first storage area to obtain the updated candidate consensus node list.
The node progress state information comprises block heights corresponding to the blocks to be identified;
the switching module is specifically configured to:
acquiring the block height corresponding to a block to be identified in the block chain network, deleting the source common node list stored in the second storage area through internal transaction of the block in the block to be identified when the block height meets the list switching period, and copying the candidate common node list to the second storage area; the intra-block transaction is a transaction at the end of the block to be identified, and the intra-block transaction includes list switching period information corresponding to the source identification node list.
Wherein, the device still includes:
and the period information adding module is used for acquiring list switching period information aiming at the source consensus node list, adding the list switching period information to the block internal transaction, and writing the block internal transaction containing the list switching period information into the block to be consensus.
The node progress state information comprises system time information;
the switching module is specifically configured to:
and when detecting that the system time information of the local node in the block chain network meets the list switching period, deleting the source consensus node list stored in the second storage area, and copying the candidate consensus node list to the second storage area.
An aspect of the embodiments of the present application provides a computer device, including a memory and a processor, where the memory stores a computer program, and the computer program, when executed by the processor, causes the processor to execute the steps of the method in the aspect of the embodiments of the present application.
An aspect of the embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, the computer program comprising program instructions that, when executed by a processor, perform the steps of the method as in an aspect of the embodiments of the present application.
According to the embodiment of the application, an update node can be determined according to a first node update request aiming at a block chain network, a candidate consensus node list is generated according to the update node and a source consensus node list, the candidate consensus node list is cached to a first storage area, wherein the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage block; and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area. Therefore, by creating two storage areas, one is used for storing the source consensus node list in an effective working state in the block chain network, and the other is used for storing the updated source consensus node list, namely the candidate consensus node list, when the list switching period is met, the source consensus node list can be switched into the candidate consensus node list, namely the update of the consensus nodes in the block chain network can be realized in an accurate period, and the consensus accuracy in the block chain can be further improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a diagram of a network architecture provided by an embodiment of the present application;
fig. 2 is a schematic diagram of a management scenario of a blockchain consensus node according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating a method for managing a blockchain consensus node according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a verification process of a node update request according to an embodiment of the present application;
fig. 5 is a schematic diagram of generating a candidate consensus node list according to an embodiment of the present application;
fig. 6 is a schematic switching diagram of a consensus node list provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a device for managing a blockchain consensus node according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The Blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission (P2P transmission), a consensus mechanism, an encryption algorithm and the like. The blockchain is essentially a decentralized database, which is a string of data blocks associated by using cryptography, each data block contains information of a batch of network transactions, and the information is used for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
An intelligent contract may be understood as a computer program that runs on a distributed ledger (i.e., blockchain) that presets rules, has status, conditional responses, can encapsulate, validate, execute complex behaviors of distributed nodes, and performs information exchange, value transfer, and asset management. Based on a distributed architecture, a consensus algorithm and the like of a block chain, the intelligent contracts allow users who are not trusted to finish transactions without any trusted intermediary or authority of a third party, and meanwhile, the digital intelligent contracts can be flexibly embedded into various tangible or intangible assets, transactions and data, so that active or passive assets, information management and control are realized, and programmable intelligent assets, systems and the like are gradually constructed.
Fig. 1 is a diagram of a network architecture according to an embodiment of the present application. As shown in fig. 1, the network architecture may include a plurality of blockchain nodes (specifically, as shown in fig. 1, may include a node server 10a, a node server 10b, a node server 10c, and a node server 10d), and a terminal device 10 e. Each block link point may locally store a common node list (also referred to as a committee or an accounting node list) in the block chain network, where the common node list includes all common nodes in the block chain network, an arrangement order of the common nodes in the common node list may be a block order generated for the common nodes, any block link point in the block chain network may add, delete, modify, and the like the common nodes included in the common node list, and the block link points may include common nodes and synchronization nodes, the common nodes may share block chain data in the block chain network and may participate in a block common process in the block chain network, and the synchronization nodes may share block chain data in the block chain network and may not have a right to participate in the block chain network common process. It should be understood that a blockchain link point may be a node server in a blockchain network, or other node device in a blockchain network.
The terminal device 10e may refer to a user terminal, and the terminal device 10e may upload data (e.g., newly generated transaction data) to be uplinked to one or more node servers in the blockchain network and request the blockchain network to write the uploaded data into a blockchain in a packet. After the terminal device 10e uploads data to the blockchain network, the blockchain link points in the blockchain network may pack the data uploaded by the terminal device 10e into a new block. Since the blocks generated in the block chain network all need to be identified together, only the blocks with passed identities can be added to the block chain, that is, after the blocks obtain the consistent votes of most of the common identity nodes in the block chain network (the specific votes of the common identity nodes are related to the adopted common identity algorithm, if the votes of the common identity nodes exceeding 2/3 in the block chain network pass, the new blocks are indicated to be passed together), the new blocks can be confirmed to be legal blocks, and can be added to the block chain. Therefore, after the block chain node generates the new block, the new block needs to be broadcast to all the consensus nodes in the block chain network, for example, when the node server 10a, the node server 10b, the node server 10c, and the node server 10d are all the consensus nodes in the block chain network, after the block chain node generates the new block, the new block can be broadcast to the node server 10a, the node server 10b, the node server 10c, and the node server 10d, so that each consensus node can verify the new block to obtain the voting information of the new block.
The terminal device 10e may include a mobile phone, a tablet computer, a notebook computer, a palm computer, a Mobile Internet Device (MID), a wearable device (e.g., a smart watch, a smart bracelet, etc.), and the like.
Please refer to fig. 2, which is a block chain consensus node management scenario diagram according to an embodiment of the present disclosure. In each blockchain node of the blockchain network, a common node list can be stored, and all common nodes in the blockchain network in an effective working state are included in the common node list. The embodiment of the present application takes the node server 10a in the embodiment corresponding to fig. 1 as an example, and describes a scheme for managing the blockchain consensus node. As shown in fig. 2, the node server 10a may be a common node in a blockchain network, the node server 10a may create a storage area 1 locally, where the storage area 1 may be used to store a source common node list 20a in the blockchain network, a common node included in the source common node list 20a is a common node in an active working state in the blockchain network, and when n (n is a positive integer greater than 0) active common nodes exist in the blockchain network, the source common node list 20a may be formed by the n common nodes. It should be appreciated that the consensus nodes contained in the source consensus node list 20a may be used to generate a new block and participate in the consensus process for the new block. The common nodes included in the source common node list 20a in the blockchain network may be updated, for example, the blockchain network may delete the common nodes with lower liveness from the source common node list 20a according to the liveness of the blockchain link points participating in the transaction, or select the nodes with higher liveness from the participating nodes (i.e., the rest nodes except the common nodes in the blockchain network) of the blockchain network to add to the source common node list 20a, and so on. It is understood that nodes outside the blockchain network may also apply to the blockchain network as common nodes in the blockchain network.
The terminal device 20b may send a node addition request for a blockchain network consensus node to the node server 10a, where the terminal device 20b may be any blockchain node in the blockchain network, or may be a device outside the blockchain network. After receiving the node addition request sent by the terminal device 20b, the node server 10a may broadcast the node addition request in the blockchain network, so that the consensus node in the blockchain network performs verification voting on the node addition request. If the consensus node in the blockchain network that exceeds the number threshold (the number threshold is determined by the consensus algorithm used in the consensus process, and the number thresholds corresponding to different consensus algorithms may have a difference, such as the number threshold in some consensus algorithms is 2/3 corresponding to the number of consensus nodes in the blockchain network, and the number threshold in some consensus algorithms is 2/4 corresponding to the number of consensus nodes in the blockchain network), verifies that the node addition request passes, that is, the consensus node in the blockchain network that exceeds the number threshold agrees to vote on the node addition request, the node server 10a may obtain the new node associated with the node addition request, and configure the new node and the consensus nodes included in the source consensus node list 20a into the candidate consensus node list 20 c. Further, the node server 10a may maintain the arrangement order of the common nodes in the source common node list 20a, and add the new node as the (n +1) th common node at the end of the source common node list 20a to obtain the candidate common node list 20 c. Optionally, the node server 10a may further obtain weight values corresponding to the consensus nodes in the newly added node and the source consensus node list 20a, and sort the consensus nodes in the newly added node and the source consensus node list 20a according to the weight values to obtain a candidate consensus node list 20 c.
Since data transmission is required between the consensus nodes in the blockchain network, such as broadcasting of the consensus message, the newly added node in the candidate consensus node list 20c needs to establish network connection with the other consensus nodes, and the establishment of the network connection needs time, that is, the newly added node cannot be immediately effective in the blockchain network after being successfully added. In order not to affect the current consensus process in the blockchain network (the number of consensus nodes in the blockchain network increases, which indicates that the number of votes required for a block to pass the consensus increases), the node server 10a may create a storage area 2 locally, store the candidate consensus node list 20c in the storage area 2, and temporarily not update the consensus nodes in the source consensus node list 20 a. In other words, the node server 10a may create two storage areas, respectively a storage area 1 and a storage area 2, the storage area 1 is used for storing the source consensus node list 20a, the storage area 2 is used for storing the candidate consensus node list 20c, and the change of the consensus node may be completed in the candidate consensus node list 20c of the storage area 2. It should be noted that each consensus node in the blockchain network may create two storage areas locally, and store the source consensus node list and the candidate consensus node list separately.
After the terminal device 20d uploads the transaction data to the blockchain network, the node server 10a in the blockchain network may package the transaction data uploaded by the terminal device 20d into a block 20e, where the block 20e may include a block header and a block body, the block header includes information such as a generation timestamp, a block height, a current block hash, and a previous block hash of the block 20e, and the block body includes the transaction data uploaded by the terminal device 20 d. When the node server 10a detects that the block height of the block 20e satisfies the list switching period, the source common node list 20a in the storage area 1 is switched to the candidate common node list 20c, and the update operation of the common nodes in the blockchain network is completed.
The source common node list 20a may include switching period information of the blockchain system list, which includes but is not limited to: a point in time for list switching, an interval time for list switching, a number of interval blocks for list switching, and a block height for list switching. For example, when the switching period information is the block height of the list switching, and the node server 10a detects that the block height of the block 20e is consistent with the block height of the list switching, the source consensus node list 20a in the storage area 1 may be deleted, and the candidate consensus node list 20c may be copied into the storage area 1. In other words, the consensus verification process for the block 20e is performed by the consensus nodes in the candidate consensus node list 20c, and the consensus verification process for the block immediately preceding the block 20e is performed by the consensus nodes in the source consensus node list 20 a.
Referring to fig. 3, which is a flowchart illustrating a method for managing blockchain common nodes according to an embodiment of the present disclosure, it can be understood that the method can be performed by any blockchain node in a blockchain network, where the blockchain node can be a common node in the blockchain network or a synchronization node in the blockchain network. As shown in fig. 3, the method for managing a blockchain consensus node may include the following steps:
step S101, a first node updating request aiming at the block chain network is obtained, and an updating node is determined according to the first node updating request.
Specifically, the valid consensus nodes in the blockchain network may form a consensus node list (which may be referred to as an accounting node or a node committee list), the consensus nodes in the consensus node list may be used to collect transaction data in the blockchain network, verify the transaction data and pack the transaction data that passes the verification into blocks, broadcast the newly generated blocks to the other consensus nodes, add the new blocks to the local blockchain after the new blocks pass the verification, and the ordering order of the consensus nodes in the consensus node list may be the block-out order of the consensus nodes in the blockchain network. The consensus node list formed by the consensus nodes currently in an active working state in the blockchain network may be referred to as a source consensus node list. The consensus nodes in the blockchain network can be changed, that is, the consensus nodes included in the source consensus node list can be deleted, added, modified, and the like. The requesting node may send a first node update request to the blockchain network to request an update of the source consensus node list to the blockchain network; after receiving the first node update request sent by the requesting node, the blockchain network may obtain an update node associated with the first update request. The request node may refer to any blockchain node in the blockchain network, or may refer to a device outside the blockchain network; the first node update request refers to an update request for a consensus node in the blockchain network, and may include, but is not limited to: a request to add a consensus node, a request to delete a consensus node, and a request to modify a consensus node.
After obtaining the first node update request, the blockchain network may further obtain a vote value of the consensus node in the source consensus node list to the first node update request, and when the vote value is greater than or equal to a vote threshold, obtain an update node associated with the first node update request. In other words, after any one of the blockchain nodes in the blockchain network receives the first node update request, the received first node update request may be broadcast to the consensus node in the blockchain network; after receiving the first node update request, the consensus node may verify the first node update request, for example, verify a signature of the first node update request, verify a node requested by the first node update request, and the like, obtain a verification result corresponding to the first node update request, and broadcast the verification result. After receiving the verification result of each consensus node, the voting value corresponding to the first node update request (where the voting value is the vote value that is defaulted, i.e., the number of consensus nodes that pass the verification) may be counted according to the verification result of each consensus node, and when the voting value is greater than or equal to the voting threshold (e.g., the number of consensus nodes in the source consensus node list 2/3), it is determined that the first node update request passes the consensus, and then the update node corresponding to the first node consensus node is obtained. It should be appreciated that when a synchronization node in the blockchain network receives a first node update request, the synchronization node may broadcast the received first node update request to all consensus nodes in the blockchain network, such that each consensus node verifies the first node update request; when a consensus node in the blockchain network receives a first node update request, the consensus node may broadcast the received first node update request to the remaining consensus nodes, so that the remaining consensus nodes verify the first node update request, and certainly, the consensus node receiving the first node update request may also verify the first node update request.
Wherein the consensus node in the blockchain network may validate the first node update request based on a consensus mechanism, which includes but is not limited to: proof of Work (PoW), Proof of rights (PoS), a mixture of Proof of Work and Proof of rights (PoW + PoS), Proof of equity authorization (Delegated Proof of stamp, DPoS), a Practical Byzantine Fault Tolerance algorithm (PBFT), and a Rayleigh Consensus Protocol (RCP).
The first node update request may include a consensus node addition request, a consensus node deletion request, and the like. When the first node update request is a consensus node increase request, verifying a newly added node corresponding to the consensus node increase request, and if the newly added node meets the conditions of the consensus node in the blockchain network (for example, the activity degree of the node participating in message event processing in the blockchain network is greater than a preset value and the like), indicating that the consensus node increase request passes verification, namely agreeing to change the newly added node into the consensus node; and if the newly added node does not meet the condition of the consensus node in the blockchain network, the verification of the consensus node increase request is not passed, namely the newly added node is not agreed to become the consensus node. When the first node update request is a consensus node deletion request, verifying a to-be-deleted node corresponding to the consensus node deletion request, and if the to-be-deleted node does not meet the conditions of the consensus node in the blockchain network (for example, the activity degree of the node participating in message event processing in the blockchain network is smaller than a preset numerical value, or the activity degree drops quickly within a certain time interval, and the like), indicating that the consensus node deletion request is verified to be passed, that is, deleting the to-be-deleted node from the agreement source consensus node list; and if the deletion node meets the condition of the consensus node in the blockchain network, the verification of the consensus node deletion request is not passed, namely the deletion of the node to be deleted from the source consensus node list is not agreed.
Fig. 4 is a schematic diagram of a verification process of a node update request according to an embodiment of the present application. As shown in fig. 4, after the consensus node 30b in the blockchain network receives the node update request of the terminal device 30a, the consensus node 30b may broadcast the node update request to the remaining consensus nodes, for example, n +1(n is a positive integer greater than 0) consensus nodes exist in the blockchain network, the consensus node 30b may broadcast the node update request to the remaining n consensus nodes, the remaining n consensus nodes may all verify the node update request to obtain a verification result of the node update request, and the remaining n consensus nodes may also broadcast the verification result. In other words, the consensus node 30b may obtain the verification results corresponding to the remaining n consensus nodes, i.e., obtain n verification results. The consensus node 30b may count the vote value for the node update request according to the verification result of the consensus node b and the obtained n verification results, where the counted vote value for approval is: if the value 1 reaches the quantity threshold (e.g., the quantity threshold is 2/3(n + 1)), the update node corresponding to the node update request may be obtained.
Step S102, generating a candidate consensus node list according to the updated node and the source consensus node list, and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in the second storage area.
Specifically, the block link point may generate a candidate consensus node list according to consensus nodes included in the updated node and the source consensus node list, and cache the candidate consensus node list in the first storage area. The source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in the second storage area. In other words, each block link point in the block chain network may locally create two storage areas, namely a first storage area and a second storage area, where the first storage area is used for storing a candidate consensus node list (which may also be referred to as a temporary consensus node list), and the second storage area is used for storing a source consensus node list in effect in the block chain.
It is understood that the block link point may initially create two storage areas, the first storage area may be empty before the first node update request is not received, and the second storage area stores the source common node list; after receiving the first node update request, the source consensus node list may be acquired from the second storage area, the acquired source consensus node may be updated according to the first update node request, a candidate consensus node list is obtained, and the candidate consensus node list is stored in the first storage area. Optionally, the block link point may first create a second storage area for storing the source common node list; after receiving the first node updating request, the consensus node creates a first storage area again, obtains a source consensus node list in the second storage area, updates the obtained source consensus node according to the first node updating request to obtain a candidate consensus node list, and stores the candidate consensus node list in the first storage area.
And when the first node updating request is a consensus node adding request and the updating node is a new node, adding the new node to the source consensus node list, generating a candidate consensus node list, and caching the candidate consensus node list into the first storage area. In other words, the block chain node acquires the source consensus node list from the second storage area, and adds the new node to the tail position of the source consensus node list to obtain the candidate consensus node list.
It should be understood that data transmission is required between nodes included in the candidate consensus node list, for example, after the candidate consensus node list is validated, transaction information needs to be collected and packaged into a block, and the block is broadcast to other nodes, so that a network connection needs to be established between nodes in the candidate consensus node list for communication. Network connection is already established between the consensus nodes included in the source consensus node, and network connection between the newly added node and each consensus node in the source consensus node list needs to be established. Network connection between the newly added node and each common-known node in the source common-known node list can be established, and after the network connection is successful, the newly added node and each common-known node in the source common-known node list can communicate, that is, data transmission is performed. It should be noted that it takes a certain time to establish a network connection between the new node and each node in the source consensus node list, so that the candidate consensus node list including the new node does not take effect immediately, and the candidate consensus node list can be temporarily stored in the first storage area.
Optionally, the consensus nodes included in the newly added node and the source consensus node list may be determined as candidate consensus nodes, and weight values corresponding to the candidate consensus nodes are obtained; and sorting the candidate consensus nodes according to the weight values, and generating a candidate consensus node list from the sorted candidate consensus nodes. In other words, after the block chain node acquires the new node, it may acquire weight values corresponding to the consensus node and the new node in the source consensus node list, sort the consensus node and the new node in the source consensus node list based on the weight values, and determine the sorted consensus node and the new node as the candidate consensus node list. When the candidate consensus node list formally takes effect and new transaction data is received, the candidate consensus nodes can be selected according to the node sorting sequence in the candidate consensus node list, and the new transaction data is packaged into blocks.
Wherein the weight value may be determined based on the contribution each candidate consensus node makes to the blockchain network. For example, if the number of the history blocks generated by the candidate consensus node a is 10, and all the 10 history blocks generated by the candidate consensus node a pass the consistency approval of the block chain network, the formal uplink is finally completed; the number of history blocks generated by the candidate consensus node B is also 10, but only 5 history blocks pass the consistency approval of the blockchain network and complete the formal uplink, which means that the candidate consensus node a makes a larger contribution to the blockchain network than the candidate consensus node B does, i.e. the weight value of the candidate consensus node a is greater than that of the candidate consensus node B, and therefore the consensus node a should be arranged in front of the consensus node B. Optionally, the voting information of each candidate consensus node for the block within the height range of the to-be-consensus block may be counted, for example, when the maximum block height in the block chain is 99, the voting information of the candidate consensus node a and the candidate consensus node B for 10 blocks within the range of the block height 90 to the block height 99 may be counted; when the voting information of the candidate consensus node a for the 10 blocks is voted for, and only 7 votes in the voting information of the candidate consensus node B for the 10 blocks are voted for, it indicates that the contribution of the candidate consensus node a to the block chain network is greater than the contribution of the candidate consensus node B to the block chain network, that is, the weight value of the candidate consensus node a is greater than that of the candidate consensus node B, and therefore the consensus node a should be arranged in front of the consensus node B.
Please refer to fig. 5, which is a schematic diagram of generating a candidate consensus node list according to an embodiment of the present application. As shown in fig. 5, the node server 40b is a consensus node in the blockchain network, and the terminal device 40a is a user terminal that sends a consensus node addition request. After the node server 40b receives the consensus node addition request sent by the terminal device 40a, the node server 40b may obtain a new node corresponding to the consensus node addition request after passing the verification, obtain a source consensus node list 40c (composed of all consensus nodes in an effective working state in the block chain network) from the local storage area 1 (i.e., the second storage area), and obtain weight values corresponding to the new node and 10 consensus nodes in the source consensus node list 40c, respectively, if the weight values corresponding to the consensus node 1 are: the weight value corresponding to the consensus node 2 is 1: the weight 2, … …, the weight value corresponding to the consensus node 10 is: and (3) weighting 10, wherein the weighting value corresponding to the newly added node is as follows: the weight 11. The node server 40b may sort the obtained weight values, where the sorting order of the weight values is the sorting order of the corresponding nodes, and determine the newly added nodes and 10 consensus nodes after the re-sorting as the candidate consensus node list 40 e. The weight 2 is the largest weight value of the 11 weight values, and the weight 10 is the smallest weight value of the 11 weight values, so that the consensus node 2 corresponding to the weight 2 is arranged at the first position of the candidate consensus node list 40e, and the consensus node 10 corresponding to the weight 10 is arranged at the last position of the candidate consensus node list 40 e. The node server 40b may create a local storage area 2 (i.e., the first storage area) and store the candidate consensus node list 40e in the storage area 2, while the source consensus node list 40c stored in the storage area 1 remains unchanged.
Optionally, when the first node update request is a consensus node deletion request and the update node is a node to be deleted, the node to be deleted may be deleted from the source consensus node list to obtain a candidate consensus node list, and the candidate consensus node list is cached in the first storage area. The rank order of the consensus nodes in the candidate consensus node list may be kept unchanged from the rank order of the consensus nodes in the source consensus node list, for example, the source consensus node list includes 5 consensus nodes, and the rank order of the 5 consensus nodes is: when the node to be deleted corresponding to the consensus node deletion request is the consensus node 3, the candidate consensus node list may include 4 consensus nodes, and the arrangement order of the 4 consensus nodes is: a consensus node 1, a consensus node 2, a consensus node 4 and a consensus node 5.
It should be understood that operations such as deleting, adding, modifying, etc. may be performed as well for the candidate consensus node list in the first memory area. The block chain node may obtain a second node update request for the candidate consensus node list, determine a candidate node according to the second node update request, and update the candidate consensus node list according to the candidate node in the first storage area to obtain an updated candidate consensus node list. After the candidate consensus list is updated based on the second node update request, the candidate consensus node list before update may be replaced with the updated candidate consensus node list in the first storage area, that is, the original candidate consensus node list in the first storage area is deleted, and the updated candidate consensus node list is stored in the first storage area. When the second node update request is a node addition request for the candidate consensus node list, a node to be selected may be added to the candidate consensus node list; when the second node update request is a node deletion request for the candidate consensus node list, the node to be selected may be deleted in the candidate consensus node list.
And step S103, when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in a second storage area.
Specifically, before performing step S103, the common nodes in the source common node list may register list switching period information with the blockchain network, where the list switching period information is used to characterize a list switching period for switching the source common node list into the candidate common node list. The list switching period information may include a list switching period duration and a list switching time node, or may include a list switching period tile number and a list switching tile height. After the list switching period information is submitted to the block chain network and successfully registered, any block chain link point in the block chain network can acquire a switching trigger condition aiming at the source consensus node list in the second storage area. In other words, after each list switching period expires, the block link point may switch the source common node list in the local second storage area to the candidate common node list, where the candidate common node list in the second storage area is the source common node list in the next list switching period.
A block chain node in the block chain network can acquire node progress state information of a current node (also called as a local node), and when the node progress state information meets a list switching period, a source consensus node list in a second storage area can be triggered to be switched into a candidate consensus node list; after the list switching is completed in the second storage area, the subsequently generated blocks in the blockchain network may be subjected to consensus verification by the consensus nodes in the candidate consensus node list until the end of the current list switching period. The node progress status information may include a block height corresponding to a block to be commonly identified in the current node, or system time information corresponding to the current node.
It is to be understood that, after the source consensus node list in the second storage area is switched to the candidate consensus node list, the candidate consensus node list in the first storage area may be deleted or may be continuously retained, which is not limited herein. If the candidate consensus node list in the first storage area is deleted after the list switching is completed, then when a node updating request aiming at the block chain network is subsequently received, a source consensus node list in an effective working state needs to be obtained from the second storage area again; if the candidate consensus node list is continuously kept after the list switching is completed, the candidate consensus node list in the first storage area can be directly updated when a node updating request aiming at the block chain network is subsequently received.
When the list switching period information includes the list switching period block number and the list switching block height, the node progress state information may be a block height corresponding to a block to be identified in the local identified node; the block link point may first obtain a block height corresponding to the block to be identified in the local node, and switch the source common node list in the second storage area to the candidate common node list when the block height of the block to be identified is the same as the list switching block height. The to-be-identified block may refer to a block generated by the current node, or may refer to a block broadcast by the other blockchain nodes to the local node. For example, if the number of list switching cycle blocks in the list switching cycle information is 10, that is, the source common node list in the second storage area is switched once every 10 blocks, and the height of the list switching block in the current list switching cycle is 90, it may be determined that the height of the list switching block in the next list switching cycle is 100; after the block chain node generates the to-be-consensus node or receives the to-be-consensus block, the block height corresponding to the to-be-consensus block can be obtained, when the block height of the to-be-consensus block is smaller than 100, the source consensus node list in the second storage area is kept unchanged, namely, the consensus node in the current source consensus node list in the second storage area performs consensus verification on the current to-be-consensus node; when the block height of the block to be identified is equal to 100, the source common node list in the second storage area is switched to the candidate common node list, that is, the block to be identified with the block height of 100 can be identified and verified by the common nodes in the candidate common node list. Of course, the block height 100-.
Optionally, when the list switching period information includes a list switching period duration and a list switching time node, the node progress state information may be system time information of the current node; and when detecting that the system time information of the current node in the blockchain network meets the list switching period (namely the list switching time), deleting the source consensus node list stored in the second storage area, and copying the candidate consensus node list to the second storage area. The consensus node may first obtain the system time information, and switch the source consensus node list in the second storage area to the candidate consensus node list when the system time information satisfies the list switch time node. For example, if the duration of the list switching period in the list switching period information is 1 hour, that is, the source consensus node list in the second storage area is switched once every 1 hour, and the list switching time node of the current list switching period is 8:00, it may be determined that the list switching time node of the next list switching period is 9: 00; the block chain node can acquire the system time information of the current node in real time, and when the system time information is less than 9:00, the source consensus node list in the second storage area is kept unchanged; when the system time information is equal to 9:00, switching the source consensus node list in the second storage area to a candidate consensus node list, namely 9:00 to 10: the blocks generated between 00 can be identified and verified by the common nodes in the candidate common node list.
Optionally, the operation of switching the source consensus node list in the second storage area into the candidate consensus node list may be triggered by a block internal transaction (which may be referred to as a coinbase transaction) in the block to be consensus. The block internal transaction is a transaction added at the end of the block by the block generation node, and the block internal transaction can be used for rewarding the block generation node (the block internal transaction includes an account corresponding to the block generation node, and the reward of the block generation node can be transferred to the account), and can also be used for triggering a system contract to switch a source consensus node list in the second storage area, and the function of switching the source consensus node list can be understood as an extended function of the block internal transaction.
Taking the list switching cycle information including the list switching cycle block number and the list switching block height as an example, when the node progress state information is the block height corresponding to the block to be identified, the block link point may obtain the block height corresponding to the block to be identified in the block chain network, and when the block height corresponding to the block to be identified satisfies the list switching cycle (i.e., the list switching block height), the source common identification node list stored in the second storage area is deleted through the block internal transaction in the block to be identified, and the candidate common identification node list is copied to the second storage area. Each block generated in the block chain network can add a block internal transaction at the tail position of the block; in a blockchain network, a blocky internal transaction may correspond to a system contract, and the system contract includes execution logic corresponding to the blocky internal transaction (including execution logic for rewarding blocky generation nodes and execution logic for switching lists); when the internal transaction of the block is executed, the system contract corresponding to the internal transaction of the block can be called to obtain the execution result corresponding to the internal transaction of the block. When the height of the block corresponding to the block to be identified is the same as the height of the list switching block, calling a system contract corresponding to internal transaction of the block, not only transferring the reward fee into an account of the block generating node, but also switching the source identification node list in the second storage area into a candidate identification node list; when the block height corresponding to the block to be identified is different from the list switching block height, a system contract corresponding to the internal transaction of the block is called, the reward fee can be transferred to the account of the block generation node, and the source identification node list in the second storage area is kept unchanged.
It should be understood that triggering the intra-block transaction to invoke the system contract to implement the switching operation from the source consensus node list to the candidate consensus node list requires adding list switching period information in the system contract in advance. The consensus nodes in the source consensus node list may register an intelligent contract with the blockchain network (the intelligent contract includes list switching period information for the source consensus node list); after the intelligent contract is successfully registered in the block chain network, the consensus node can acquire the list switching period information in the intelligent contract, add the list switching period information to the block internal transaction, and add the block internal transaction containing the list switching period information to the to-be-consensus block generated by the local consensus node. In other words, after the intelligent contract containing the list switching period information is successfully registered in the blockchain network, the blockchain link point may obtain a system contract corresponding to the block internal transaction in the blockchain network, and add the list switching period information to the system contract corresponding to the block internal transaction; after the transaction data is packed into the block, the block internal transaction can be added to the tail position of the block by the block generation node, so as to obtain the block to be identified.
Please refer to fig. 6, which is a schematic diagram illustrating a handover of a consensus node list according to an embodiment of the present application. Taking any consensus node in the blockchain network as an example, a switching process of the consensus node list is described. As shown in fig. 6, the consensus node 50a may be any consensus node in a blockchain network, and the blockchain network may obtain list switching period information registered by the consensus node in the source consensus node list, and add the list switching period information to a system contract 50c corresponding to a blocky internal transaction (which may also be referred to as a coherence transaction); the end of each block generated in the blockchain network may be added with a block internal transaction by the block generation node, and the block internal transaction in each block may call the system contract 50 c. Taking the consensus node 50a in the blockchain network as an example, the consensus node 50a may create two storage areas locally, namely a first storage area and a second storage area, where the first storage area stores the candidate consensus node list 50d, and the second storage area stores the active consensus node list 50 e.
The client may upload transaction information 50f to the blockchain network, the transaction information 50f including transaction data generated by the client according to the transaction operation of the user, e.g., the transaction information 50f may include transaction data 1, transaction data 2, … …. After the consensus node 50a in the block chain network acquires the transaction information 50f uploaded by the client, the transaction information 50f can be checked, the block internal transaction 50g can be acquired after the check passes, and the transaction information 50f and the block internal transaction 50g are packaged into a block 50 h. The block 50h comprises a block head and a block body, the block head comprises information such as a generation timestamp, a block height, a current block hash value and a previous block hash value corresponding to the block 50h, the block body comprises transaction information 50f uploaded by a client and a block internal transaction 50g, and the block internal transaction 50g is located at the tail position of the block 50 h.
The consensus node 50a may sequentially execute the transaction data in the block body according to the sequence of the transaction data in the block body, and when executing the block internal transaction 50g, may invoke the system contract 50c through the block internal transaction 50g, may obtain an execution result corresponding to the block internal transaction 50g through the system contract 50c, and broadcast the execution result. When the tile height corresponding to the tile 50h is the same as the list switching tile height (i.e., the list switching period is satisfied), the system contract 50c may be invoked through the tile internal transaction 50g, the source consensus node list 50c in the second storage area is switched to the candidate consensus node list 50d, and the reward fee is transferred to the account corresponding to the consensus node 50a, that is, the execution result corresponding to the tile internal transaction 50g includes the reward fee and the switched candidate consensus node list 50 d; when the tile height corresponding to the tile 50h is different from the list switching tile height (i.e. the list switching period is not satisfied), the system contract 50c may be invoked through the tile internal transaction 50g, a reward fee may be transferred to the account corresponding to the consensus node 50a, and the source consensus node list 50c in the second storage area may be kept unchanged, that is, the execution result corresponding to the tile internal transaction 50g includes the reward fee and the source consensus node list 50c that is kept unchanged.
According to the embodiment of the application, an update node can be determined according to a first node update request aiming at a block chain network, a candidate consensus node list is generated according to the update node and a source consensus node list, the candidate consensus node list is cached to a first storage area, wherein the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage block; and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area. Therefore, by creating two storage areas, one is used for storing a source consensus node list in an effective working state in the block chain network, and the other is used for storing an updated source consensus node list, namely a candidate consensus node list, when a list switching period is met, the source consensus node list can be switched into the candidate consensus node list, namely, the consensus nodes in the block chain network can be updated in an accurate period, and the consensus accuracy in the block chain can be improved; the source consensus node list is automatically triggered to be switched into the candidate consensus node list by calling a system contract through the internal transaction of the block, so that the service processing efficiency can be improved.
Please refer to fig. 7, which is a schematic structural diagram of a device for managing a blockchain common node according to an embodiment of the present disclosure. The blockchain consensus node management apparatus may be a computer program (including program code) running on a computer device, such as the blockchain consensus node management apparatus being an application software; the apparatus may be used to perform the corresponding steps in the methods provided by the embodiments of the present application. As shown in fig. 7, the device 1 for managing blockchain consensus nodes may include: the device comprises a determining module 11, a caching module 12 and a switching module 13;
a determining module 11, configured to obtain a first node update request for a blockchain network, and determine an update node according to the first node update request;
the cache module 12 is configured to generate a candidate consensus node list according to the updated node and the source consensus node list, and cache the candidate consensus node list in the first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
and a switching module 13, configured to switch the source consensus node list into a candidate consensus node list in the second storage area when the node progress status information in the blockchain network satisfies the list switching period.
When the node progress status information includes the block height corresponding to the block to be identified, the switching module 13 is specifically configured to:
acquiring the block height corresponding to a block to be identified in the block chain network, deleting the source common node list stored in the second storage area through internal transaction of the block in the block to be identified when the block height meets the list switching period, and copying the candidate common node list to the second storage area; the intra-block transaction is a transaction at the end of the block to be identified, and the intra-block transaction includes list switching period information corresponding to the source identification node list.
Wherein, when the node progress status information includes system time information, the switching module 13 is specifically configured to:
and when detecting that the system time information of the local node in the block chain network meets the list switching period, deleting the source consensus node list stored in the second storage area, and copying the candidate consensus node list to the second storage area.
The specific functional implementation manners of the determining module 11, the caching module 12, and the switching module 13 may refer to steps S101 to S103 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, the blockchain consensus node management apparatus 1 may further include: a connection establishing module 14, an updating request acquiring module 15 and an updating module 16 are established;
a connection establishing module 14, configured to establish a network connection between the new node and the identified node; the network connection is used for communication between the newly added node and the identified node;
an update request obtaining module 15, configured to obtain a second node update request for the candidate consensus node list, and determine a node to be selected according to the second node update request;
and the updating module 16 is configured to update the candidate consensus node list according to the node to be selected in the first storage area, so as to obtain an updated candidate consensus node list.
The specific functional implementation manners of the connection establishing module 14, the update request obtaining module 15, and the update module 16 may refer to step S102 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, the blockchain consensus node management apparatus 1 may further include: a period information adding module 17;
the period information adding module 17 is configured to acquire list switching period information for the source consensus node list, add the list switching period information to the block internal transaction, and write the block internal transaction including the list switching period information into the block to be consensus.
Referring to fig. 7, the determining module 11 may include: a vote value acquisition unit 111, a node acquisition unit 112;
a vote value obtaining unit 111, configured to obtain a first node update request for a block chain network, and obtain a vote value of a consensus node in a source consensus node list for the first node update request;
a node obtaining unit 112, configured to obtain an update node associated with the first node update request when the vote value is greater than or equal to the vote threshold.
The specific functional implementation manners of the vote value obtaining unit 111 and the node obtaining unit 112 may refer to step S101 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, when the first node update request includes a consensus node addition request and the update node includes a newly added node, the cache module 12 is specifically configured to:
and adding the newly added node to the source consensus node list, generating a candidate consensus node list, and caching the candidate consensus node list to the first storage area.
The cache module 12 may include: a weight acquisition unit 121, a sorting unit 122;
a weight obtaining unit 121, configured to determine the consensus nodes included in the newly added node and the source consensus node list as candidate consensus nodes, and obtain weight values corresponding to the candidate consensus nodes;
the sorting unit 122 is configured to sort the candidate consensus nodes according to the weight values, and generate a candidate consensus node list from the sorted candidate consensus nodes.
When the first node update request includes a consensus node deletion request and the update node includes a node to be deleted, the cache module 12 is specifically configured to:
and deleting the nodes to be deleted from the source consensus node list to obtain a candidate consensus node list, and caching the candidate consensus node list into the first storage area.
The specific functional implementation manners of the weight obtaining unit 121 and the sorting unit 122 may refer to step S102 in the embodiment corresponding to fig. 3, which is not described herein again.
According to the embodiment of the application, an update node can be determined according to a first node update request aiming at a block chain network, a candidate consensus node list is generated according to the update node and a source consensus node list, the candidate consensus node list is cached to a first storage area, wherein the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage block; and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area. Therefore, by creating two storage areas, one is used for storing a source consensus node list in an effective working state in the block chain network, and the other is used for storing an updated source consensus node list, namely a candidate consensus node list, when a list switching period is met, the source consensus node list can be switched into the candidate consensus node list, namely, the consensus nodes in the block chain network can be updated in an accurate period, and the consensus accuracy in the block chain can be improved; the source consensus node list is automatically triggered to be switched into the candidate consensus node list by calling a system contract through the internal transaction of the block, so that the service processing efficiency can be improved.
Please refer to fig. 8, which is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 8, the computer apparatus 1000 may include: the processor 1001, the network interface 1004, and the memory 1005, and the computer apparatus 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1004 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 8, a memory 1005, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 1000 shown in fig. 8, the network interface 1004 may provide a network communication function; the user interface 1003 is an interface for providing a user with input; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
acquiring a first node updating request aiming at a block chain network, and determining an updating node according to the first node updating request;
generating a candidate consensus node list according to the updated node and the source consensus node list, and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
and when the node progress state information in the block chain network meets the list switching period, switching the source consensus node list into a candidate consensus node list in the second storage area.
It should be understood that the computer device 1000 described in this embodiment of the present application may perform the description of the method for managing the blockchain common node in the embodiment corresponding to fig. 3, and may also perform the description of the device 1 for managing the blockchain common node in the embodiment corresponding to fig. 7, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.
Further, here, it is to be noted that: an embodiment of the present invention further provides a computer-readable storage medium, where a computer program executed by the device 1 for managing blockchain common knowledge nodes is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the method for managing blockchain common knowledge nodes in the embodiment corresponding to fig. 3 can be performed, so that details are not repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. As an example, the program instructions may be deployed to be executed on one computing device or on multiple computing devices at one site or distributed across multiple sites and interconnected by a communication network, which may constitute a block chain system.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (13)

1. A method for managing a blockchain consensus node, comprising:
acquiring a first node updating request aiming at a block chain network, and determining an updating node according to the first node updating request;
generating a candidate consensus node list according to the updated node and the source consensus node list, and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
when the node progress state information in the block chain network meets a list switching period, the source consensus node list is switched into the candidate consensus node list in the second storage area by calling a system contract corresponding to a block internal transaction in a block to be identified; the block internal transaction is a transaction at the tail of the block to be identified, the block internal transaction includes list switching cycle information corresponding to the source identification node list, and the system contract includes list switching execution logic corresponding to the block internal transaction.
2. The method of claim 1, wherein obtaining a first node update request for a blockchain network, and determining an update node according to the first node update request comprises:
acquiring a first node updating request aiming at the block chain network, and acquiring a vote value of a consensus node in the source consensus node list to the first node updating request;
when the vote value is greater than or equal to a vote threshold, retrieving the update node associated with the first node update request.
3. The method of claim 1, wherein the first node update request comprises a consensus node addition request, and wherein the updated node comprises a newly added node;
the generating a candidate consensus node list according to the update node and the source consensus node list, and caching the candidate consensus node list into a first storage area includes:
and adding the newly added node to the source consensus node list, generating the candidate consensus node list, and caching the candidate consensus node list to a first storage area.
4. The method of claim 3, wherein adding the new node to the list of source consensus nodes, generating the list of candidate consensus nodes, comprises:
determining the consensus nodes contained in the newly added node and the source consensus node list as candidate consensus nodes, and acquiring weight values corresponding to the candidate consensus nodes;
and sequencing the candidate consensus nodes according to the weight values, and generating the candidate consensus node list from the sequenced candidate consensus nodes.
5. The method of claim 3, further comprising:
establishing network connection between the newly-added node and the consensus node; the network connection is used for communication between the newly added node and the consensus node.
6. The method of claim 2, wherein the first node update request comprises a consensus node delete request, and wherein the update node comprises a node to be deleted;
the generating a candidate consensus node list according to the update node and the source consensus node list, and caching the candidate consensus node list into a first storage area includes:
and deleting the node to be deleted from the source consensus node list to obtain a candidate consensus node list, and caching the candidate consensus node list to a first storage area.
7. The method of claim 1, further comprising:
acquiring a second node updating request aiming at the candidate consensus node list, and determining a node to be selected according to the second node updating request;
and updating the candidate consensus node list according to the to-be-selected node in the first storage area to obtain an updated candidate consensus node list.
8. The method of claim 1, wherein the node progress status information comprises a block height corresponding to the block to be identified;
when the node progress state information in the blockchain network meets the list switching period, the source consensus node list is switched into the candidate consensus node list in the second storage area by calling a system contract corresponding to the block internal transaction in the block to be consensus, and the method comprises the following steps:
and obtaining the block height corresponding to the block to be identified in the block chain network, deleting the source common node list stored in the second storage area through internal transaction of the block in the block to be identified when the block height meets the list switching period, and copying the candidate common node list to the second storage area.
9. The method of claim 8, further comprising:
and acquiring list switching period information aiming at the source consensus node list, adding the list switching period information to the block internal transaction, and writing the block internal transaction containing the list switching period information into the block to be consensus.
10. The method of claim 1, wherein the node progress status information comprises system time information;
when the node progress state information in the blockchain network meets the list switching period, the source consensus node list is switched into the candidate consensus node list in the second storage area by calling a system contract corresponding to the block internal transaction in the block to be consensus, and the method comprises the following steps:
and when detecting that the system time information of the local node in the block chain network meets a list switching period, deleting the source consensus node list stored in the second storage area by calling a system contract corresponding to the block internal transaction in the block to be consensus, and copying the candidate consensus node list to the second storage area.
11. A device for managing a blockchain consensus node, comprising:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for acquiring a first node updating request aiming at a block chain network and determining an updating node according to the first node updating request;
the cache module is used for generating a candidate consensus node list according to the updated node and the source consensus node list and caching the candidate consensus node list into a first storage area; the source consensus node list comprises consensus nodes in an effective working state in the block chain network, and the source consensus node list is stored in a second storage area;
a switching module, configured to, when node progress state information in the block chain network satisfies a list switching period, switch the source consensus node list to the candidate consensus node list in the second storage area by invoking a system contract corresponding to a block internal transaction in a block to be identified; the block internal transaction is a transaction at the tail of the block to be identified, the block internal transaction includes list switching cycle information corresponding to the source identification node list, and the system contract includes list switching execution logic corresponding to the block internal transaction.
12. A computer arrangement comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the steps of the method according to any one of claims 1 to 10.
CN202010224168.6A 2020-03-26 2020-03-26 Block chain consensus node management method, device, equipment and storage medium Active CN111444210B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010224168.6A CN111444210B (en) 2020-03-26 2020-03-26 Block chain consensus node management method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010224168.6A CN111444210B (en) 2020-03-26 2020-03-26 Block chain consensus node management method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111444210A CN111444210A (en) 2020-07-24
CN111444210B true CN111444210B (en) 2021-11-05

Family

ID=71648014

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010224168.6A Active CN111444210B (en) 2020-03-26 2020-03-26 Block chain consensus node management method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111444210B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112087521B (en) * 2020-09-17 2021-12-17 山东诺蓝信息科技有限公司 Block chain link point authority control method based on big data and block chain system
CN112040015B (en) * 2020-11-06 2021-02-12 腾讯科技(深圳)有限公司 Consensus node list generation method and related device
CN112436962B (en) * 2020-11-12 2023-04-18 迅鳐成都科技有限公司 Block chain consensus network dynamic expansion method, electronic device, system and medium
CN112200680B (en) * 2020-12-03 2021-03-05 腾讯科技(深圳)有限公司 Block link point management method, device, computer and readable storage medium
CN112487496B (en) * 2020-12-07 2024-04-16 合肥达朴汇联科技有限公司 Block chain consensus system
CN112765264A (en) * 2020-12-29 2021-05-07 中国人寿保险股份有限公司上海数据中心 Block chain intelligent contract-based uplink voting control method
CN112954009B (en) * 2021-01-27 2023-05-02 咪咕音乐有限公司 Block chain consensus method, equipment and storage medium
CN112559637B (en) * 2021-02-19 2021-06-18 腾讯科技(深圳)有限公司 Data processing method, device, equipment and medium based on distributed storage
CN112995317B (en) * 2021-02-26 2023-04-07 中国工商银行股份有限公司 Block chain consensus method and block chain link points
CN112991067B (en) * 2021-04-28 2021-08-03 支付宝(杭州)信息技术有限公司 Block chain consensus method, device and system
CN113783699B (en) * 2021-06-02 2022-06-14 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium
CN113783965A (en) * 2021-09-18 2021-12-10 北京俩撇科技有限公司 Block chaining-out method, device, equipment and storage medium
CN114499846A (en) * 2022-01-20 2022-05-13 浙江吉利控股集团有限公司 Verification node distribution method, device, equipment and storage medium
CN114254050B (en) * 2022-03-02 2022-06-07 恒生电子股份有限公司 Block chain network consensus preloading method, device, equipment and storage medium
CN114710504A (en) * 2022-03-31 2022-07-05 蚂蚁区块链科技(上海)有限公司 Rotation method of common nodes in block chain system, nodes and block chain system
CN114726866A (en) * 2022-04-07 2022-07-08 网易(杭州)网络有限公司 Method for maintaining consensus node of alliance chain, electronic device and storage medium
CN117082075B (en) * 2023-10-13 2024-01-26 德德市界(深圳)科技有限公司 Block chain consensus mechanism processing system based on weight distribution computing scene
CN117478299B (en) * 2023-12-27 2024-03-01 湖南天河国云科技有限公司 Block chain consensus algorithm switching method, device and computer equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN109309723A (en) * 2018-08-18 2019-02-05 上海分布信息科技有限公司 A kind of common recognition node variation and its realize system
CN110569251A (en) * 2019-09-23 2019-12-13 腾讯科技(深圳)有限公司 Data processing method, related equipment and computer readable storage medium
CN110661658A (en) * 2019-09-23 2020-01-07 腾讯科技(深圳)有限公司 Node management method and device of block chain network and computer storage medium
CN110708171A (en) * 2019-12-13 2020-01-17 腾讯科技(深圳)有限公司 Block chain consensus voting method, device, equipment and storage medium
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107360001B (en) * 2017-07-26 2021-12-14 创新先进技术有限公司 Digital certificate management method, device and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN109309723A (en) * 2018-08-18 2019-02-05 上海分布信息科技有限公司 A kind of common recognition node variation and its realize system
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
CN110569251A (en) * 2019-09-23 2019-12-13 腾讯科技(深圳)有限公司 Data processing method, related equipment and computer readable storage medium
CN110661658A (en) * 2019-09-23 2020-01-07 腾讯科技(深圳)有限公司 Node management method and device of block chain network and computer storage medium
CN110708171A (en) * 2019-12-13 2020-01-17 腾讯科技(深圳)有限公司 Block chain consensus voting method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111444210A (en) 2020-07-24

Similar Documents

Publication Publication Date Title
CN111444210B (en) Block chain consensus node management method, device, equipment and storage medium
CN110933163B (en) Block chain contract deployment method, device, equipment and storage medium
CN111445333B (en) Block generation method, device, computer equipment and storage medium
CN111382456B (en) Proposal message processing method, device, equipment and storage medium
CN111291060B (en) Method, device and computer readable medium for managing blockchain nodes
WO2021233049A1 (en) Blockchain–based data processing method, apparatus, device, and readable storage medium
CN108712488B (en) Data processing method and device based on block chain and block chain system
CN111444211B (en) Block chain consensus node checking method, device, equipment and storage medium
CN111884807B (en) Article reservation method, apparatus, device and medium based on block chain
EP4216077A1 (en) Blockchain network-based method and apparatus for data processing, and computer device
CN111464353B (en) Block link point management method, device, computer and readable storage medium
Wang et al. A simulation approach for studying behavior and quality of blockchain networks
CN111654395B (en) Voting information processing method, device, equipment and storage medium
CN112818414B (en) Data processing method, data processing device, computer equipment and storage medium
CN111311211A (en) Data processing method and device based on block chain
JP2021103342A (en) Information processing device, information processing method, and program
CN114493865A (en) Decentralized internet cooperative system and data interaction method based on block chain
CN110930254A (en) Data processing method, device, terminal and medium based on block chain
CN111934870A (en) Method, apparatus, device and medium for updating root certificate in block chain network
CN112364059A (en) Correlation matching method, device, equipment and storage medium under multi-rule scene
CN110599144B (en) Network access method and device for blockchain nodes
CN110599384A (en) Organization relation transfer method, device, equipment and storage medium
CN111343212B (en) Message processing method, device, equipment and storage medium
CN112200680B (en) Block link point management method, device, computer and readable storage medium
CN112417052B (en) Data synchronization method, device, equipment and storage medium in block chain network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40026356

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant