CN114584326B - Block chain data processing method and device, electronic equipment and storage medium - Google Patents

Block chain data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114584326B
CN114584326B CN202210492585.8A CN202210492585A CN114584326B CN 114584326 B CN114584326 B CN 114584326B CN 202210492585 A CN202210492585 A CN 202210492585A CN 114584326 B CN114584326 B CN 114584326B
Authority
CN
China
Prior art keywords
block
target
configuration change
height
verification 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
CN202210492585.8A
Other languages
Chinese (zh)
Other versions
CN114584326A (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 CN202210492585.8A priority Critical patent/CN114584326B/en
Publication of CN114584326A publication Critical patent/CN114584326A/en
Application granted granted Critical
Publication of CN114584326B publication Critical patent/CN114584326B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3263Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0823Network architectures or network communication protocols for network security for authentication of entities using certificates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/46Secure multiparty computation, e.g. millionaire problem
    • H04L2209/463Electronic voting

Abstract

The embodiment of the application discloses a block chain data processing method, a device, an electronic device and a storage medium, wherein the block chain data processing method extracts the target block height of a target configuration change block from the configuration change block to be verified, further determines a target verification node list corresponding to the target block height according to preset first mapping information, because the target configuration change block is a block which is commonly recognized by verification nodes in a block chain network, and then quickly matches the target verification node list corresponding to the target block height through the preset first mapping information, the target verification node list is effective and is consistent among different verification nodes, when the common recognition processing is carried out on the configuration change block to be verified according to the target verification node list, the reliability of the common recognition processing can be improved, and the running stability of the block chain network can be improved, the method can be widely applied to the technical fields of block chains, cloud computing and the like.

Description

Block chain data processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a block chain data processing method and apparatus, an electronic device, and a storage medium.
Background
In the related art, the common identification processing of the block to be verified is generally performed by introducing a generation manner, when the master node generates the block to be verified, the current generation information of the master node is added to the block to be verified, when the verification node receives the block to be verified, it first determines whether the generation information in the block to be verified is consistent with the current generation information of the verification node, and when the generation information in the block to be verified is consistent with the current generation information of the verification node, the verification node performs subsequent common identification processing on the block to be verified.
However, the chain HotStuff consensus is performed in a pipeline manner, that is, in the proposal phase of the fourth block, the voting phase of the third block, the pre-submission phase of the second block, and the submission phase of the first block are completed simultaneously. Therefore, when the first block is a block for changing the node configuration of the blockchain network, the verification node list is changed after the first block is submitted, and the generation of the verification node is also switched accordingly, and at this time, since the three blocks subsequent to the first block are proposals generated before the generation switching, the generation information cannot be matched during the consensus process, so that the three blocks subsequent to the first block are discarded, and the reliability of the consensus process is reduced.
Disclosure of Invention
The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
The embodiment of the application provides a block chain data processing method and device, electronic equipment and a storage medium, and the reliability of consensus processing can be improved.
In one aspect, an embodiment of the present application provides a method for processing block chain data, including:
receiving a configuration change block to be verified, which is used for carrying out node configuration change on a block chain network;
extracting the target block height of the target configuration change block from the configuration change block to be verified; the target configuration change block is a previous configuration change block which is effective and corresponds to the configuration change block to be verified;
acquiring preset first mapping information, and determining a target verification node list corresponding to the height of the target block according to the first mapping information; the first mapping information is used for representing a corresponding relation between a block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and checking the permission of consensus processing according to the target verification node list, and performing consensus processing on the configuration change block to be verified when the checking result is that the checking is passed.
On the other hand, an embodiment of the present application further provides a block chain data processing method, including:
receiving a transaction request for node configuration change of a blockchain network; wherein, the transaction request carries node configuration information;
acquiring the height of a target block of a target configuration change block and a target verification node list corresponding to the target configuration change block, and generating a configuration change block to be verified according to the node configuration information and the height of the target block; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and sending the configuration change block to be verified to a verification node in the target verification node list, so that the verification node in the target verification node list determines the target verification node list according to the height of the target block and preset first mapping information, verifies the permission of consensus processing according to the target verification node list, and when the verification result is that verification is passed, the verification node in the target verification node list performs consensus processing on the configuration change block to be verified.
On the other hand, an embodiment of the present application further provides a block chain data processing apparatus, including:
the block receiving module is used for receiving a configuration change block to be verified, wherein the configuration change block is used for carrying out node configuration change on a block chain network;
the block height extraction module is used for extracting the target block height of the target configuration change block from the configuration change block to be verified; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified;
the mapping module is used for acquiring preset first mapping information and determining a target verification node list corresponding to the height of the target block according to the first mapping information; the first mapping information is used for representing a corresponding relation between a block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and the first consensus module is used for verifying the consensus processing authority according to the target verification node list, and performing consensus processing on the configuration change block to be verified when the verification result is that the verification is passed.
Further, the block height extracting module is specifically configured to:
extracting target block information from the block head of the configuration change block to be verified;
and extracting the target block height of the target configuration change block from the additional field of the target block information.
Further, the first common identification module is further configured to:
when the result of the consensus processing on the configuration change block to be verified is that consensus is achieved, adding the configuration change block to be verified to a block chain, and extracting the updated block height corresponding to the configuration change block to be verified from the block height field of the target block information;
extracting node configuration information from the block body of the configuration change block to be verified;
determining an updated verification node list of the block chain network after node configuration change is carried out according to the node configuration information;
adding a correspondence between the update block height and the update verification node list to the first mapping information.
Further, the mapping module is specifically configured to:
acquiring first mapping information from a memory; wherein the first mapping information comprises a plurality of mapping entries, each mapping entry comprising a candidate block height and a candidate verification node list corresponding to the candidate block height;
and determining a target verification node list corresponding to the target block height from a plurality of candidate verification node lists according to the matching relation between the target block height and the candidate block height.
Further, the mapping module is specifically configured to:
when the mapping item is a key value pair, the key information of the key value pair is the height of the candidate block, and the value information of the key value pair is the candidate verification node list, determining target value information from the value information according to the matching relation between the height of the target block and the key information, and obtaining a target verification node list corresponding to the height of the target block according to the target value information;
or when the mapping entries are character strings, dividing each mapping entry according to a preset dividing rule to obtain a first character string corresponding to the height of the candidate block and a second character string corresponding to the candidate verification node list, determining a target character string from a plurality of second character strings according to the matching relation between the height of the target block and the first character string, and obtaining a target verification node list corresponding to the height of the target block according to the target character string.
Further, the mapping module is further configured to:
determining capacity information of the first mapping information; wherein the capacity information includes a block height number or a memory occupation size of the candidate block height;
and when the capacity information is greater than or equal to a preset threshold, deleting a plurality of mapping entries from the first mapping information according to the block height of the candidate block height or the generation time of the mapping entries.
Further, the first common identification module is specifically configured to:
determining a plurality of first node identifications according to the target verification node list;
acquiring a second node identifier stored locally, and checking the permission of consensus processing according to the matching relation between the second node identifier and the first node identifier;
and when the second node identification is matched with any one of the first node identifications, determining that the verification result is that the verification is passed, and performing consensus processing on the configuration change block to be verified.
On the other hand, an embodiment of the present application further provides a block chain data processing apparatus, including:
the transaction request receiving module is used for receiving a transaction request for node configuration change of the blockchain network; the transaction request carries node configuration information;
the block generating module is used for acquiring the target block height of a target configuration change block and a target verification node list corresponding to the target configuration change block, and generating a configuration change block to be verified according to the node configuration information and the target block height; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and the second consensus module is used for sending the configuration change block to be verified to the verification nodes in the target verification node list, so that the verification nodes in the target verification node list determine the target verification node list according to the height of the target block and preset first mapping information, verify the consensus processing authority according to the target verification node list, and when the verification result is that the verification is passed, make the verification nodes in the target verification node list perform consensus processing on the configuration change block to be verified.
Further, the block generation module is specifically configured to:
acquiring preset second mapping information from a memory; wherein the second mapping information comprises a plurality of mapping entries, each mapping entry comprising a candidate block height and a candidate verification node list corresponding to the candidate block height;
determining the target block height from a plurality of candidate block heights according to the block height of the candidate block heights or the generation time of the mapping entries, and acquiring the target block height;
and determining the candidate verification node list corresponding to the height of the target block as a target verification node list corresponding to the target configuration change block, and acquiring the target verification node list.
Further, the block generation module is further configured to:
receiving a program restarting instruction, and acquiring a historical configuration change block from a preset database according to the height of the block or the effective time of the block when the program restarting instruction is executed;
determining the height of a historical block of the historical configuration change block and a historical verification node list corresponding to the historical configuration change block, wherein the historical verification node list comprises verification nodes in the block chain network after the historical configuration change block takes effect;
and taking the height of the historical block as the height of the target block, taking the historical verification node list as the target verification node list, generating a mapping item corresponding to the height of the target block and the target verification node list, and preloading the mapping item into the memory.
Further, the block generation module is specifically configured to:
writing the node configuration information into a block body of a configuration change block to be verified;
acquiring the update block height corresponding to the configuration change block to be verified, taking the update block height as a block height field of target block information of the configuration change block to be verified, taking the target block height as an additional field of the target block information, and writing the target block information into a block head of the configuration change block to be verified;
and generating the configuration change block to be verified according to the block body and the block head.
On the other hand, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above block chain data processing method when executing the computer program.
On the other hand, an embodiment of the present application further provides a computer-readable storage medium, where the storage medium stores a program, and the program is executed by a processor to implement the above block chain data processing method.
In another aspect, an embodiment of the present application further provides a computer program product, where the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the block chain data processing method.
The embodiment of the application at least comprises the following beneficial effects: by extracting the target block height of the target configuration change block from the configuration change block to be verified, thereby quickly matching a target verification node list corresponding to the height of the target block according to the preset first mapping information, since the target configuration change block is the previous valid configuration change block corresponding to the configuration change block to be verified, the target allocation change block is therefore a block that is agreed upon by a verification node in the blockchain network, the matched target verification node list comprises verification nodes in the blockchain network after the target configuration change block takes effect, therefore, the target verification node list is effective and consistent among different verification nodes, and when the consensus processing is subsequently performed on the configuration change block to be verified according to the target verification node list, the reliability of the consensus processing can be improved, and the stability of the operation of the block chain network can be improved. Moreover, the method can support the consensus processing on the continuous configuration change blocks to be verified, thereby being capable of processing the continuous node configuration change, shortening the effective time delay of the continuous node configuration change and improving the efficiency of the node configuration change.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the claimed subject matter and are incorporated in and constitute a part of this specification, illustrate embodiments of the subject matter and together with the description serve to explain the principles of the subject matter and not to limit the subject matter.
Fig. 1 is a schematic flowchart of a chain type HotStuff consensus process provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a consensus process in the related art according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a generation switching process in the related art according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
fig. 5 is a flowchart illustrating a method for processing blockchain data according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a configuration change block to be verified according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of first mapping information provided in an embodiment of the present application;
fig. 8 is another schematic structural diagram of first mapping information provided in an embodiment of the present application;
fig. 9 is a detailed flowchart of a block chain data processing method applied to a verification node according to an embodiment of the present disclosure;
fig. 10 is a flowchart illustrating a block chain data processing method according to an embodiment of the present disclosure;
fig. 11 is a detailed flowchart of a method for processing blockchain data applied to a master node according to an embodiment of the present disclosure;
fig. 12 is a schematic diagram illustrating an actual example of a block chain data processing method according to an embodiment of the present application;
fig. 13 is a schematic diagram illustrating another practical example of a block chain data processing method according to an embodiment of the present application;
fig. 14 is a schematic diagram illustrating another practical example of a block chain data processing method according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of a block chain data processing apparatus according to an embodiment of the present application;
fig. 16 is a schematic structural diagram of a block chain data processing apparatus according to an embodiment of the present application;
fig. 17 is a block diagram of a partial structure of a terminal according to an embodiment of the present application;
fig. 18 is a block diagram of a partial structure of a server according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
For the convenience of understanding the technical solutions provided by the embodiments of the present application, some key terms used in the embodiments of the present application are explained first:
blockchain (Blockchain): the method is a novel application mode of computer technologies such as distributed data storage, point-to-point 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 blockchain underlying platform may include processing modules for user management, basic services, and intelligent contracts. 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, contract triggering and contract execution, developers can define contract logic through a certain programming language, issue the contract logic to a block chain (contract registration), call keys or other event triggering execution according to the logic of contract terms, complete the contract logic, and provide the function of upgrading and canceling the contracts. The platform product service layer provides basic capability and an implementation framework of typical application, and developers can complete block chain implementation of business logic based on the basic capability and the characteristics of the superposed business. The application service layer provides the application service based on the block chain scheme for the business participants to use.
Block: i.e., a packet carrying transaction data (i.e., transaction traffic) on a blockchain network, is a data structure that is tagged with a timestamp and a hash value of a previous block, which is validated through a consensus mechanism of the network and determines the transaction in the block.
And (4) deserializing, wherein the process of restoring the byte sequence into the object is called deserializing of the object.
Block height: for identifying the number of tiles connected on the blockchain, can be used to determine the position of a certain tile in the blockchain.
Generation: the block chain node divides time into different time periods according to a time cycle, each time period is called generation, and each block has the corresponding generation.
A master node: also known as the leader node, is the node in the block chain that generates the block.
Verifying the node: also called consensus node, is a node in the block chain that performs consensus processing on the blocks generated by the leader node.
The proposal is that: the master node sends a request or proposal to the verifying node to consensus on a block.
Referring to fig. 1, fig. 1 is a schematic flow chart of a chain type HotStuff consensus process provided in an embodiment of the present application, where for the consensus process of a certain block, a proposal phase, a voting phase, a pre-submission phase, and a submission phase need to be performed, specifically:
in the proposal stage, the blockchain network may first select a master node according to a verifiable random manner, the master node generates a proposal, and sends the proposal to a corresponding verification node according to a verification node list stored in the master node, after the verification node receives the proposal, it determines whether the verification node needs to vote for the proposal according to a verification node list stored in the master node (the verification node and the master node maintain verification node list information respectively), if so, the verification node signs the proposal (one signature represents one vote), and returns to the master node, the master node receives a sufficient number of votes (for example, at least 2/3f +1 votes, where f is the total number of the verification nodes), packages the signatures of the verification nodes to generate a Quorum Certificate (Quorum Certificate, QC).
In the voting stage, similarly, the main node sends the quorum certificate in the proposal stage to the corresponding verification node, if the verification node confirms that the quorum certificate in the proposal stage needs to be voted and is legal, the verification node signs the quorum certificate in the proposal stage and returns to the main node, and after the main node receives a sufficient number of votes, the signatures of the verification nodes are packaged to generate the quorum certificate in the voting stage.
In the pre-submission stage, similarly, the main node sends the quorum certificate in the voting stage to the corresponding verification node, if the verification node confirms that the quorum certificate in the voting stage needs to be voted and is legal, the verification node signs the quorum certificate in the voting stage and returns the quorum certificate to the main node, and the main node receives a sufficient number of votes and packages the signatures of the verification nodes to generate the quorum certificate in the pre-submission stage.
In the submission stage, similarly, the master node sends the quorum certificate in the pre-submission stage to the corresponding verification node, and if the verification node confirms that the quorum certificate in the pre-submission stage needs to be voted and is legal, the proposal is indicated to be agreed to the consensus process, and the corresponding block is added to the block chain.
At present, the chain HotStuff consensus is performed in a pipeline manner, that is, in the proposal stage of the fourth block, the voting stage of the third block, the pre-submission stage of the second block, and the submission stage of the first block are completed at the same time. In this case, if the first block is a block for performing node configuration change on the blockchain network, that is, after the transaction corresponding to the first block is executed, the verification node in the blockchain network may be changed, and at this time, the verification node lists used by the verification nodes in the blockchain network may be different, so that the verification of the block that is valid and valid originally may fail by the honest verification node.
For example, when the number of the verification nodes is increased from 4 to 5, the master node uses a new verification node list, considers that there are 5 verification nodes in the current block chain network, and needs to receive at least 2/3f +1 votes, that is, 4 votes can achieve consensus, if the new verification node uses an old verification node list at this time, the new verification node considers that it does not need to vote, meanwhile, 1 verification node in the original 4 verification nodes in the block chain network is down, and the master node can only receive 3 votes at this time, the proposal of the block will fail to verify, the verification nodes cannot achieve consensus, and the block cannot be added to the block chain, thereby affecting the execution of related transactions.
In order to solve the above problem, it may be required that all the verification nodes use the same verification node list when performing the consensus process. In the related art, the common identification processing of the block to be verified is generally performed by introducing a generation manner, when the master node generates the block to be verified, the current generation information of the master node is added to the block to be verified, when the verification node receives the block to be verified, it first determines whether the generation information in the block to be verified is consistent with the current generation information of the verification node, and when the generation information in the block to be verified is consistent with the current generation information of the verification node, the verification node performs subsequent common identification processing on the block to be verified.
For example, referring to fig. 2, fig. 2 is a schematic flow chart of a consensus process in the related art provided by an embodiment of the present application, where each block has its corresponding generation, and when a master node generates a proposal, generation information is added to the proposal, where the generation information includes a generation identifier corresponding to a current generation of the master node and a verification node list corresponding to the current generation. After receiving the proposal sent by the master node, the verification node takes out the generation identification corresponding to the master node from the proposal, compares the generation identification with the current generation identification of the verification node, and discards the proposal if the generation identification corresponding to the master node is inconsistent with the generation identification corresponding to the verification node; if the generation identifier corresponding to the master node is identical to the generation identifier corresponding to the verification node, the verification node performs a subsequent verification operation (consensus process) according to the verification node list in the proposal.
On this basis, referring to fig. 3, fig. 3 is a schematic diagram of a generation switching process in the related art according to an embodiment of the present application, where when a block that has already been submitted is determined to be a configuration change block for performing node configuration change on a blockchain network, a new generation is created using verification node list information described in the block, and then the block is switched to the newly created generation, so that information (including the verification node list information) of a previous generation is completely destroyed. In this case, when the first block is a block for changing the node configuration of the blockchain network, the verification node list is changed after the first block is submitted, and the generation of the verification node is also switched accordingly, at this time, since three blocks subsequent to the first block are proposals generated before the generation switching, when the subsequent three blocks are subjected to consensus processing, the verification node has been switched to a new generation, and the verification node list information of the previous generation has been destroyed, so that matching of the generation information cannot be performed during the consensus processing, and the subsequent three blocks of the first block are discarded, thereby reducing the reliability of the consensus processing.
Moreover, when the following three blocks are also blocks for node configuration change, the three blocks following the first block are discarded, which also results in the block chain network being unable to process consecutive node configuration changes.
Based on this, embodiments of the present application provide a method and an apparatus for processing block chain data, an electronic device, and a storage medium, which can improve reliability of consensus processing.
Referring to fig. 4, fig. 4 is a schematic diagram of an implementation environment provided by an embodiment of the present application, where the implementation environment includes a terminal 401 and a plurality of servers 402, where the terminal 401 and one of the servers 402 are connected through a communication network. The server 402 is a node server in a blockchain network, and a plurality of servers 402 form the blockchain network.
The server 402 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform.
The terminal 401 may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, and the like. The terminal 401 and the server 402 may be directly or indirectly connected through wired or wireless communication, and the embodiment of the present application is not limited herein.
The terminal 401 may initiate a transaction request for node configuration change of the blockchain network, and send the transaction request to the server 402 serving as a master node.
The server 402 serving as the master node may obtain a target block height of the target configuration change block and a target verification node list corresponding to the target configuration change block according to the transaction request for performing node configuration change on the blockchain network, generate a configuration change block to be verified according to the node configuration information and the target block height, and send the configuration change block to be verified to a target verification node in the target verification node list.
The server 402 serving as the verification node may extract a target block height of the target configuration change block from the configuration change block to be verified, determine a target verification node list corresponding to the target block height according to the preset first mapping information, and perform consensus processing on the configuration change block to be verified according to the target verification node list.
The method provided by the embodiment of the application can be applied to various technical fields including but not limited to the technical fields of block chains, cloud technology and the like.
Referring to fig. 5, fig. 5 is a flowchart illustrating a blockchain data processing method according to an embodiment of the present disclosure, where the blockchain data processing method may be executed by a server serving as a verification node in a blockchain network, and it can be understood that if an electronic device serving as a verification node in a blockchain network is a terminal, the blockchain data processing method may also be executed by the terminal, and the blockchain data processing method includes, but is not limited to, the following steps 501 to 504.
Step 501: receiving a configuration change block to be verified for node configuration change of the blockchain network.
In one possible implementation, the configuration change block to be verified is generated by a master node in the blockchain network and broadcast to the verification nodes. The node configuration change is performed on the blockchain network, so that the verification node list in the blockchain network can be changed, for example, a new verification node is added to the verification node list, or the verification node is deleted from the verification node list. The configuration change block to be verified may be broadcast by the master node as part of the proposal.
In one possible implementation, the configuration change block to be verified carries node configuration information for performing node configuration change on the blockchain network.
For example, the current verification node list of the blockchain network includes a verification node a, a verification node B, a verification node C, and a verification node D, and the node configuration information carried in the configuration change block to be verified may be "add verification node E", and when the configuration change block to be verified is added to the blockchain through consensus processing (that is, the configuration change block to be verified is valid), the verification node list of the blockchain network includes the verification node a, the verification node B, the verification node C, the verification node D, and the verification node E. Or, the node configuration information carried in the configuration change block to be verified may be "delete verification node D", and after the configuration change block to be verified is added to the blockchain through the consensus process, the verification node list of the blockchain network includes verification node a, verification node B, and verification node C.
In addition to the above example, the node configuration information may also be used to directly describe the verification node in the verification node list after the node configuration change is performed, for example, the node configuration information may be "verification node a, verification node B, verification node C, verification node D, and verification node E", and after the configuration change block to be verified is added to the blockchain through the consensus process, the verification node list of the blockchain network includes the verification node a, the verification node B, the verification node C, the verification node D, and the verification node E, which is equivalent to the verification node E being added; similarly, the node configuration information may also be "verification node a, verification node B, and verification node C", and after the configuration change block to be verified is added to the blockchain through the consensus process, the verification node list of the blockchain network includes the verification node a, the verification node B, and the verification node C, which is equivalent to deleting the verification node D.
For adding a verification node to a blockchain network, the method can be applied to a scenario of a federation chain, specifically, a new organization needs to be added to the federation chain and needs to participate in consensus processing of the blockchain, and at this time, a new configuration change transaction needs to be initiated to add the verification node to the blockchain network.
The method for deleting the verification node in the blockchain network can be applied to a scenario of a federation chain, and specifically, when a certain organization in the federation chain needs to quit, a new configuration change transaction needs to be initiated to delete the corresponding verification node. Or, when a certain verification node in the blockchain network fails down, in order to not affect the work of other verification nodes, a new configuration change transaction needs to be initiated to delete the failed verification node.
Step 502: and extracting the target block height of the target configuration change block from the configuration change block to be verified.
The target configuration change block is a configuration change block which is valid before and corresponds to the configuration change block to be verified, that is, the target configuration change block is also used for node configuration change of the blockchain network, and the target configuration change block is a block which is commonly recognized by the verification nodes in the blockchain network.
The block height of the target configuration change block can be adjacent to the block height of the configuration change block to be verified, and the target configuration change block and the configuration change block to be verified are two continuous configuration change blocks; or, the block height of the target configuration change block may not be adjacent to the block height of the configuration change block to be verified, and there may be other types of blocks which are not used for node configuration change between the target configuration change block and the configuration change block to be verified.
In one possible implementation, the target block height of the target configuration change block may be added to the configuration change block to be verified by the master node when generating the configuration change block to be verified.
For example, referring to fig. 6, fig. 6 is a schematic structural diagram of a configuration change block to be verified according to an embodiment of the present disclosure, where the configuration change block to be verified includes a block header and a block body, the block body is used to carry node configuration information, and the block header is used to carry target block information of the configuration change block to be verified, and the target block information may include a block height field, a timestamp field, a difficulty value field, and the like.
Therefore, when the target block height of the target configuration change block is extracted from the configuration change block to be verified, the target block information can be extracted from the block head of the configuration change block to be verified, the target block height of the target configuration change block is extracted from the additional field of the target block information, the target block height of the target configuration change block can be obtained simply, conveniently and quickly, and the efficiency of subsequent consensus processing is improved.
Step 503: and acquiring preset first mapping information, and determining a target verification node list corresponding to the height of the target block according to the first mapping information.
The first mapping information is used for representing the corresponding relation between the block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect. The first mapping information may comprise a plurality of mapping entries, each mapping entry comprising a candidate tiling height and a candidate verification node list corresponding to the candidate tiling height, different mapping entries corresponding to different candidate tiling heights.
In a possible implementation manner, the first mapping information may be preset in the verification node, and when the verification node receives the configuration change block to be verified, which is sent by the master node, the verification node obtains the preset first mapping information first, and since the verification node has extracted the target block height of the target configuration change block from the configuration change block to be verified, a target verification node list corresponding to the target block height may be matched from a plurality of candidate verification node lists according to the first mapping information, so that the target verification node list may be obtained simply and quickly, and the efficiency of subsequent consensus processing is improved.
Step 504: and checking the authority of the consensus processing according to the target verification node list, and performing the consensus processing on the configuration change block to be verified when the checking result is that the checking is passed.
The verification node firstly determines whether the verification node has the permission for performing consensus processing on the configuration change block to be verified according to the target verification node list, namely, whether the verification node exists in the target verification node list is determined, and if the verification node exists in the target verification node list, a verification result is that the verification is passed, namely, the verification node has the permission for performing consensus processing.
For example, the currently executed block chain data processing method is the verification node a, although the verification node a receives a proposal from the master node, that is, the verification node a is a verification node with a consensus processing authority from the perspective of the master node, but because the master node may have an abnormal condition, the verification node a is not a verification node with a consensus processing authority, so for the verification node a, it is also necessary to determine whether the verification node a has the consensus processing authority according to a target verification node list maintained by the verification node a, and if the verification node a exists in the target verification node list, it indicates that the verification node a has the consensus processing authority, that is, the verification node a needs to perform consensus processing on the configuration change block to be verified, so as to obtain a consensus result corresponding to the configuration change block to be verified; if the verification node A does not exist in the target verification node list, the verification node A does not have the consensus processing authority, namely the verification node A does not need to perform consensus processing on the configuration change block to be verified.
In a possible implementation manner, a plurality of first node identifiers may be determined according to a target verification node list, a second node identifier stored locally is acquired, the permission of consensus processing is checked according to a matching relationship between the second node identifier and the first node identifier, when the second node identifier is matched with any one of the plurality of first node identifiers, a verification result is determined to be passed, and consensus processing is performed on the configuration change block to be verified. Specifically, the target verification node list may include a plurality of first node identifiers, for example, a first node identifier "a", a first node identifier "B", a first node identifier "C", a first node identifier "D", where the first node identifier "a" corresponds to the verification node a, and so on. If the currently executed blockchain data processing method is the verification node A, the local of the verification node A stores the corresponding second node identifier "A", and at this time, the second node identifier "A" is matched with the first node identifier "A", which indicates that the verification node A has the consensus processing authority, and can perform consensus processing on the configuration change block to be verified. Whether the verification node has the consensus processing authority or not can be rapidly determined by the mode of matching the first node identification and the second node identification, and therefore the efficiency of consensus processing is improved.
It can be seen that, since the target configuration change block is the previous valid configuration change block corresponding to the configuration change block to be verified, the target configuration change block is a block which is commonly recognized by the verification nodes in the blockchain network, and the matched target verification node list includes the verification nodes in the blockchain network after the target configuration change block is valid, so that the target verification node list is valid and is consistent among different verification nodes, and when the common recognition processing is subsequently performed on the configuration change block to be verified according to the target verification node list, the reliability of the common recognition processing can be improved, and the stability of the operation of the blockchain network is improved.
In addition, when the number of the configuration change blocks to be verified is multiple and continuous, the method can support the consensus processing on the continuous configuration change blocks to be verified, so that the continuous node configuration change can be processed, the effective time delay of the continuous node configuration change is shortened, and the efficiency of the node configuration change is improved.
In a possible implementation manner, the first mapping information may be preset in the memory, that is, the preset first mapping information is obtained, when the target verification node list corresponding to the target block height is determined according to the first mapping information, the first mapping information may be specifically obtained from the memory, and the target verification node list corresponding to the target block height is determined from the multiple candidate verification node lists according to the matching relationship between the target block height and the candidate block height.
For example, the target block height is H1, the mapping entries include H1-L1, H2-L2, and H3-L3 (i.e., the candidate block height H1 corresponds to the candidate verification node list L1, the candidate block height H2 corresponds to the candidate verification node list L2, and the candidate block height H3 corresponds to the candidate verification node list L3), and then the target verification node list corresponding to the target block height H1 is the candidate verification node list L1.
By presetting the first mapping information in the memory, the acquisition speed of the first mapping information can be increased, and the efficiency of subsequent consensus processing can be improved. In addition, compared with the method that the first mapping information is preset in the block chain database of the verification node, the method that the first mapping information is preset in the memory can reduce the storage space occupation of the block chain database.
Referring to fig. 7, fig. 7 is a schematic structural diagram of first mapping information provided in this embodiment, in a possible implementation manner, a mapping entry may be a key-value pair, and accordingly, key information of the key-value pair is a candidate block height, and value information of the key-value pair is a candidate verification node list, so that the structure shown in fig. 7 may be formed, that is, height 1, height 2, height 3, and height 4 are key information, and verification node list 1, verification node list 2, verification node list 3, and verification node list 4 are corresponding value information.
In this case, when the target verification node list corresponding to the target block height is determined from the plurality of candidate verification node lists according to the matching relationship between the target block height and the candidate block height, the target value information may be determined from the plurality of pieces of value information according to the matching relationship between the target block height and the key information, and the target verification node list corresponding to the target block height may be obtained according to the target value information.
In addition, referring to fig. 8, fig. 8 is another structural diagram of the first mapping information provided in the embodiment of the present application, and in a possible implementation manner, the mapping entry may also be a character string, that is, the candidate block height and the candidate verification node list may be connected end to form a character string, so that the structure shown in fig. 8 may be formed, for example, the character strings "0100 ABCD", "0101 ABC", "0102 AC", "0103 AB", and the like.
In this case, when the target verification node list corresponding to the target block height is determined from the multiple candidate verification node lists according to the matching relationship between the target block height and the candidate block height, each mapping entry may be divided according to a preset division rule to obtain a first character string corresponding to the candidate block height and a second character string corresponding to the candidate verification node list, a target character string is determined from the multiple second character strings according to the matching relationship between the target block height and the first character string, and the target verification node list corresponding to the target block height is obtained according to the target character string.
Wherein, the dividing rule may be: the first character string composed of the first 4 characters of the character string corresponding to the mapping entry is the candidate block height, and the second character string composed of the rest characters is the candidate verification node list. Taking the character string "0100 ABCD" as an example, the first character string is "0100" representing the candidate block height, and the second character string is "ABCD" representing the candidate verification node list. It is understood that the preset partitioning rule may be determined according to actual situations, for example, the number of bits of the first character string may be increased according to the total number of the verification nodes, that is, the first character string may be "00100", and in addition, the second character string may be determined according to node identifiers of different verification nodes, for example, the second character string may also be "A1 A2A3a 4", which is not limited in the embodiment of the present application.
In a possible implementation manner, when the result of performing the consensus processing on the configuration change block to be verified is that the consensus is achieved, the configuration change block to be verified may be added to the block chain, the update block height corresponding to the configuration change block to be verified is extracted from the block height field of the target block information, the node configuration information is extracted from the block body of the configuration change block to be verified, the update verification node list of the block chain network after the node configuration change is performed is determined according to the node configuration information, and the correspondence between the update block height and the update verification node list is added to the first mapping information.
Specifically, after the configuration change block to be verified is added to the blockchain, the node configuration change action corresponding to the configuration change block to be verified is effective, and at this time, the verification node list of the blockchain network changes, so that for the next consensus processing, the corresponding relationship between the updated block height and the updated verification node list is added to the first mapping information, so as to achieve the updating effect of the first mapping information, so that the next consensus processing can accurately determine the corresponding target verification node list according to the target block height, thereby improving the reliability of the consensus processing and improving the running stability of the blockchain network, wherein the updated block height is the block height corresponding to the configuration change block to be verified.
For example, before node configuration change is performed, the verification node list of the block chain network includes a verification node a, a verification node B, a verification node C, and a verification node D, the node configuration information is "add verification node E", after the configuration change block to be verified takes effect (i.e., after node configuration change is performed), the update verification node list Lm of the block chain network includes the verification node a, the verification node B, the verification node C, the verification node D, and the verification node E, and the update block height of the configuration change block to be verified is Hm, the corresponding relation Hm-Lm is added to the first mapping information as a new mapping entry.
In a possible implementation manner, the verification node may be provided with a consensus module, and after the configuration change block to be verified is successfully submitted, the verification node may call a callback method of the consensus module to notify the consensus module that the block with a certain block height is successfully submitted, thereby triggering the update action on the first mapping information.
In a possible implementation manner, in addition to storing the first mapping information in the memory, the first mapping information may be further stored in a Write-Ahead Logging (WAL) system, so that data atomicity and data durability of the first mapping information can be maintained.
In a possible implementation manner, after a new mapping entry is added to the first mapping information, capacity information of the first mapping information may be determined, and when the capacity information of the first mapping information is greater than or equal to a preset threshold, a plurality of mapping entries may be deleted from the first mapping information according to the block height size of the candidate block height or the generation time of the mapping entry.
The capacity information may include the block height number of the candidate block height, and the larger the block height number is, the larger the memory occupation size is, and the preset threshold is the block height number threshold correspondingly; in addition, the capacity information may also include a memory size, and accordingly the preset threshold is a memory size threshold.
The smaller the block height is, the earlier the generation time of the corresponding mapping entry is indicated, and when the capacity information of the first mapping information is greater than or equal to the preset threshold, the mapping entries with smaller block height number or earlier generation time can be deleted from the first mapping information, so that the occupation of a memory can be reduced, and the running stability of the verification node can be improved.
It is understood that the preset threshold may be determined according to actual requirements, for example, when the capacity information may include the number of block heights of the candidate block heights, the preset threshold may be 3, because in the application scenario of the chain HotStuff consensus process, the configuration change block to be verified is at most 3 block heights higher than the previous effective block. In addition, the number of the deleted mapping entries may also be determined according to actual requirements, for example, the number of the mapping entries may be 1 or 2, and the embodiment of the present application is not limited.
In a possible implementation manner, deleting a plurality of mapping entries from the first mapping information may be performed after adding a new mapping entry to the first mapping information, or may be performed before adding a new mapping entry to the first mapping information, for example, a plurality of mapping entries may be periodically deleted from the first mapping information according to a preset frequency, which is not limited in the embodiment of the present application.
The following describes a detailed flow of the block chain data processing method applied to the verification node according to the embodiment of the present application.
Referring to fig. 9, fig. 9 is a detailed flowchart of the method for processing blockchain data applied to a verification node according to the embodiment of the present application, which specifically includes the following steps 901 to 906.
Step 901: deserializing target block information of the configuration change block to be verified;
step 902: extracting the target block height of the target configuration change block from the target block information;
step 903: inquiring a target verification node list corresponding to the height of the target block from the memory;
step 904: judging whether the target verification node list can be successfully inquired, if so, skipping to a step 905, otherwise, skipping to a step 906;
step 905: performing consensus processing on the configuration change block to be verified according to the target verification node list, and ending the process;
step 906: and determining that the consensus of the configuration change blocks to be verified fails, and ending the process.
If the common identification of the configuration change block to be verified is determined to fail, the verification node may return an exception message to the master node. It can be appreciated that, due to the presence of multiple verification nodes in the blockchain network, even if the current verification node fails to agree on the configuration change block to be verified, the configuration change block to be verified can still be added to the blockchain as long as the other verification nodes in the blockchain network agree on and the number of agreed verification nodes meets the requirements. If the configuration change block to be verified is indeed a legal and effective block, the current verification node fails to recognize in common, and then the configuration change block to be verified can be synchronized to the verification node which fails in common according to a synchronization mechanism of the block chain network, so that the action of adding the configuration change block to be verified to the block chain is completed, and the reliability of executing the transaction corresponding to the configuration change block to be verified is improved. The synchronization mechanism may be implemented based on a synchronization module of the verification node.
In a possible implementation manner, the block received by the verification node is not necessarily the configuration change block used for performing node configuration change on the blockchain network, and may also be a normal transaction block, so before the step 901, the verification node may first determine the type of the received block, and when it is determined that the currently received block is the configuration change block used for performing node configuration change on the blockchain network, further perform the steps 901 to 906. Correspondingly, if the result of performing consensus processing on a certain block is consensus, the verification node may further determine the type of the consensus-achieved block, and when the consensus-achieved block is determined to be a configuration change block for performing node configuration change on the blockchain network, add the block height corresponding to the consensus-achieved block and the verification node list to the first mapping information of the memory, so as to reduce the invalid corresponding relationship in the first mapping information, thereby achieving the structure optimization effect on the first mapping information.
Referring to fig. 10, fig. 10 is a flowchart illustrating a method for processing blockchain data according to an embodiment of the present invention, where the method for processing blockchain data may be executed by a server serving as a master node in a blockchain network, and it can be understood that, if an electronic device serving as a master node in a blockchain network is a terminal, the method for processing blockchain data may also be executed by the terminal, and the method for processing blockchain data includes, but is not limited to, the following steps 1001 to 1003.
Step 1001: a transaction request for a node configuration change to a blockchain network is received.
The transaction request carries node configuration information, which may refer to the foregoing explanation and is not described herein again.
Step 1002: and acquiring the height of the target block of the target configuration change block and a target verification node list corresponding to the target configuration change block, and generating the configuration change block to be verified according to the node configuration information and the height of the target block.
The target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, that is, the target configuration change block is adjacent to the block height of the configuration change block to be verified, or is not adjacent to the block height of the configuration change block to be verified.
The target configuration change block is a previous configuration change block which corresponds to the configuration change block to be verified and has been in effect, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block is in effect, so that the target configuration change block is a block which is commonly recognized by the verification nodes in the block chain network, the corresponding target verification node list can be determined according to the height of the target block, the target verification node list is valid and is consistent with target verification node lists in different verification nodes, and when the common recognition processing is subsequently performed on the configuration change block to be verified according to the target verification node list, the reliability of the common recognition processing can be improved, and the running stability of the block chain network is improved.
Step 1003: and sending the configuration change block to be verified to verification nodes in a target verification node list, so that the verification nodes in the target verification node list determine the target verification node list according to the height of the target block and preset first mapping information, verify the authority of consensus processing according to the target verification node list, and when the verification result is that verification is passed, make the verification nodes in the target verification node list perform consensus processing on the configuration change block to be verified.
The master node may determine the verification node that performs consensus processing on the current configuration change block to be verified through the target verification node list, for example, if the target verification node list includes verification node a, verification node B, verification node C, and verification node D, the target verification nodes are verification node a, verification node B, verification node C, and verification node D, and the master node may send the configuration change block to be verified to verification node a, verification node B, verification node C, and verification node D.
After receiving the configuration change block to be verified, the verification node may determine a target verification node list corresponding to the height of the target block according to the preset first mapping information, and perform consensus processing on the configuration change block to be verified when determining that the configuration change block to be verified has the consensus processing right according to the target verification node list, and the principle that the target verification node determines the target verification node list corresponding to the height of the target block according to the preset first mapping information may refer to the foregoing explanation, which is not described herein again.
In a possible implementation manner, when the target block height of the target configuration change block and the target verification node list corresponding to the target configuration change block are obtained, preset second mapping information may be specifically obtained from a memory, the target block height is determined from the candidate block heights according to the block height size of the candidate block height or the generation time of the mapping entry, the target block height is obtained, the candidate verification node list corresponding to the target block height is determined as the target verification node list corresponding to the target configuration change block, and the target verification node list is obtained.
Specifically, the second mapping information may be preset in the master node, and the principle of the second mapping information is similar to that of the first mapping information, which can be referred to the foregoing explanation and is not described herein again. When generating the configuration change block to be verified, the master node needs to determine a corresponding target verification node list according to the target block height and the second mapping information, where, since the target configuration change block is a previous configuration change block that has been validated and corresponds to the configuration change block to be verified, the master node may determine the target block height according to the block height size of the candidate block height or the generation time of the mapping entry, for example, the candidate block height with a higher block height is the target block height, or the candidate block height in the mapping entry with a later generation time is the target block height. Correspondingly, the candidate verification node corresponding to the height of the target block is the target verification node list. Similarly, the target verification node list can be obtained simply, conveniently and quickly through the second mapping information, and the efficiency of subsequent consensus processing is improved.
In a possible implementation manner, for the master node, when the master node receives the program restart instruction and the program restart instruction is executed completely, the second mapping information in the memory of the master node is cleared, at this time, the master node may also obtain the historical configuration change block from the preset database according to the block height or the block effective time, determine the historical block height of the historical configuration change block and the historical verification node list corresponding to the historical configuration change block, use the historical block height as the target block height, use the historical verification node list as the target verification node list, generate the mapping entry corresponding to the target block height and the target verification node list, and preload the mapping entry into the memory.
The preset database may be a blockchain database of the master node, the height of the block of the historically-configured changed block may be the highest height in the blockchain database, or the effective time of the historically-configured changed block may be the latest time in the blockchain database, and the historically-configured changed block list includes verification nodes in the blockchain network after the historically-configured changed block takes effect. When a block is added to a block chain, a node in the block chain network stores the block in a block chain database of the node, after a master node is restarted, because the master node is an initiator for performing consensus processing on a configuration change block to be verified, a historical configuration change block acquired from the block chain database of the master node is generally a configuration change block which is effective before the configuration change block to be verified, a corresponding historical verification node list can be obtained according to node configuration information explanation carried by the historical configuration change block, the historical block height of the historical configuration change block can be used as an effective target block height, the historical verification node list can be used as an effective target verification node list, and therefore mapping entries corresponding to the target block height and the target verification node list can be generated and preloaded into a memory, the subsequent main node can obtain the corresponding mapping item from the memory, so that the condition that the main node cannot obtain the height of the target block and the target verification node list after restarting is avoided, and the stability of the main node for generating the configuration change block to be verified is improved.
It can be understood that, after the master node obtains the historical block height and the historical verification node list from the block chain database, the master node may also directly generate the corresponding mapping entry, but the mapping entry is preloaded in the memory, so that the efficiency of consensus processing can be improved.
Of course, when the previous configuration change block of the configuration change block to be verified is not stored in the blockchain database during the consensus process, or when the blockchain database of the master node fails, the historical configuration change block acquired from the blockchain database of the master node may not be the configuration change block that has been validated before the configuration change block to be verified, that is, the historical verification node list at this time is not up-to-date, and the consensus process on the configuration change block to be verified based on the historical verification node list may fail, and at this time, the master node may send a notification message to the terminal to notify the terminal to re-initiate a transaction request after a period of time.
In a possible implementation manner, when the master node generates the configuration change block to be verified according to the node configuration information and the target block height, the master node can write the node configuration information into a block body of the configuration change block to be verified; acquiring the height of an updating block corresponding to the configuration change block to be verified, taking the height of the updating block as a block height field of target block information of the configuration change block to be verified, taking the height of the target block as an additional field of the target block information, and writing the target block information into a block head of the configuration change block to be verified; and generating a configuration change block to be verified according to the block body and the block head.
The target block height is added to the additional field of the target block information, and other original fields of the target block information are not affected, so that the integrity of the target block information of the target configuration change block is kept.
Similarly, for the master node, when the result of the consensus process for the change block of the configuration to be verified is consensus achieved, similarly, the configuration change block to be verified is added to the block chain, the update block height corresponding to the configuration change block to be verified is extracted from the block height field of the target block information, the node configuration information is extracted from the block body of the configuration change block to be verified, determining an update verification node list of the blockchain network after the node configuration change is performed according to the node configuration information, adding a corresponding relationship between the update block height and the update verification node list to the second mapping information, therefore, the updating effect of the second mapping information is achieved, the next consensus processing can accurately determine the target verification node list, the reliability of the consensus processing is improved, and the stability of the operation of the block chain network is improved.
Similarly, the master node may also determine capacity information of the second mapping information, delete a plurality of mapping entries from the second mapping information according to the block height size of the candidate block height or the generation time of the mapping entry when the capacity information of the second mapping information is greater than or equal to a preset threshold, and delete a mapping entry with a smaller block height number or an earlier generation time from the second mapping information when the capacity information of the second mapping information is greater than or equal to the preset threshold, so as to reduce the memory usage and improve the operation stability of the master node.
Referring to fig. 11, fig. 11 is a detailed flowchart of a method for processing blockchain data applied to a master node according to an embodiment of the present disclosure, which specifically includes the following steps 1101 to 1108.
Step 1101: receiving a configuration change request carrying node configuration information, and generating a configuration change block to be verified according to the node configuration information;
step 1102: inquiring a target verification node list corresponding to the maximum block height from the memory;
step 1103: judging whether the target verification node list can be successfully inquired from the memory, if so, skipping to step 1104, otherwise skipping to step 1105;
step 1104: adding the maximum block height to the configuration change block to be verified, sending the configuration change block to be verified to the verification nodes in the target verification node list so as to perform consensus processing on the configuration change block to be verified, and ending the process;
step 1105: searching a block chain database for the newly submitted configuration change block to the block chain;
step 1106: judging whether the latest configuration change block submitted to the block chain can be successfully inquired from the block chain database, if so, skipping to a step 1107, otherwise, skipping to a step 1108;
step 1107: analyzing a target verification node list from the newly submitted configuration change block to the block chain, and skipping to step 1104;
step 1108: and determining that the consensus of the configuration change blocks to be verified fails, and ending the process.
The following describes a complete flow of the block chain data processing method provided in the embodiment of the present application by using a practical example.
Referring to fig. 12, fig. 12 is a schematic diagram of an actual example of a method for processing blockchain data according to an embodiment of the present invention, where a current blockchain network includes a master node, a verification node a, a verification node B, a verification node C, and a verification node D, specifically:
the terminal sends a transaction request for carrying out node configuration change on the blockchain network to the main node, and requests to add a verification node E to the blockchain network;
the main node generates a configuration change block to be verified according to the transaction request, acquires preset second mapping information from a memory, wherein mapping items of a block height 1 and a verification node list 1, a block height 2 and a verification node list 2, and a block height 3 and a verification node list 3 exist in the second mapping information, and the block height 3 is added to an additional field of the configuration change block to be verified as the block height 3 is the highest;
the master node confirms that the verification nodes of the current block chain network are verification node A, verification node B, verification node C and verification node D according to a verification node list 3 (for convenience of understanding, the verification node list is shown as verification node ABCD in the figure) corresponding to the block height 3, and broadcasts a proposal for performing consensus processing on the configuration change block to be verified to the verification node A, the verification node B, the verification node C and the verification node D, wherein the proposal carries the configuration change block to be verified;
the verification node A, the verification node B, the verification node C and the verification node D respectively receive the proposals, the block height 3 is extracted from the configuration change block to be verified, the preset first mapping information is obtained from the memory, the corresponding verification node list 3 is matched according to the block height 3, whether the block has the consensus processing authority or not is confirmed according to the verification node list 3, if the block has the consensus processing authority, the configuration change block to be verified is subjected to the consensus processing, and the consensus result is returned to the main node;
after the proposal stage, the voting stage, the pre-submission stage and the submission stage, all the verification nodes achieve the consensus of the change blocks to be verified and configured, and the master node, the verification node A, the verification node B, the verification node C and the verification node D all add the change blocks to be verified and configured to the block chain;
the master node determines, according to the configuration change block to be verified, that the verification nodes of the blockchain network after the node configuration change are verification node a, verification node B, verification node C, verification node D, and verification node E as corresponding verification node list 4 (for convenience of understanding, shown as verification node ABCDE in the figure), determines the block height of the configuration change block to be verified as block height 4, adds the correspondence between block height 4 and verification node list 4 to the second mapping information, and deletes the correspondence between block height 1 and verification node list 1;
the verification node A, the verification node B, the verification node C and the verification node D respectively determine that the verification nodes of the block chain network after the node configuration change are the verification node A, the verification node B, the verification node C, the verification node D and the verification node E according to the configuration change block to be verified, serve as corresponding verification node lists 4, determine that the block height of the configuration change block to be verified is the block height 4, add the corresponding relation between the block height 4 and the verification node lists 4 into the first mapping information, and delete the corresponding relation between the block height 1 and the verification node lists 1;
before the configuration change block to be verified is added to the blockchain, the verification node E is also a synchronization node, after the configuration change block to be verified is added to the blockchain, based on a data synchronization mechanism of the blockchain network, the verification node E also receives the configuration change block to be verified and adds the configuration change block to be verified to the blockchain, and adds a corresponding relationship between the block height 4 and the verification node list 4 to mapping information of a memory of the verification node E, and when the next consensus processing is performed, the verification node E can normally serve as the verification node to perform the consensus processing.
The following describes a complete flow of the block chain data processing method provided in the embodiment of the present application by using another practical example.
Referring to fig. 13, fig. 13 is a schematic diagram of another practical example of the method for processing blockchain data according to the embodiment of the present invention, where the current blockchain network includes a master node, a verification node a, a verification node B, a verification node C, and a verification node D, specifically:
the terminal sends a transaction request for carrying out node configuration change on the blockchain network to the main node, and the request is to delete the verification node D in the blockchain network;
the main node generates a configuration change block to be verified according to the transaction request, acquires preset second mapping information from a memory, wherein mapping items of a block height 1 and a verification node list 1, a block height 2 and a verification node list 2, and a block height 3 and a verification node list 3 exist in the second mapping information, and the block height 3 is added to an additional field of the configuration change block to be verified as the block height 3 is the highest;
the master node confirms that the verification nodes of the current block chain network are verification node A, verification node B, verification node C and verification node D according to a verification node list 3 (for convenience of understanding, the verification node list is shown as verification node ABCD in the figure) corresponding to the block height 3, and broadcasts a proposal for performing consensus processing on the configuration change block to be verified to the verification node A, the verification node B, the verification node C and the verification node D, wherein the proposal carries the configuration change block to be verified;
the verification node A, the verification node B, the verification node C and the verification node D respectively receive the proposals, the block height 3 is extracted from the configuration change block to be verified, the preset first mapping information is obtained from the memory, the corresponding verification node list 3 is matched according to the block height 3, whether the block has the consensus processing authority or not is confirmed according to the verification node list 3, if the block has the consensus processing authority, the configuration change block to be verified is subjected to the consensus processing, and the consensus result is returned to the main node;
after the proposal stage, the voting stage, the pre-submission stage and the submission stage, all the verification nodes achieve the consensus of the change blocks to be verified and configured, and the master node, the verification node A, the verification node B, the verification node C and the verification node D all add the change blocks to be verified and configured to the block chain;
the main node determines that the verification nodes of the block chain network after the node configuration change are verification node A, verification node B and verification node C as corresponding verification node list 4 (for convenience of understanding, verification node ABC is shown in the figure) according to the configuration change block to be verified, determines that the block height of the configuration change block to be verified is block height 4, adds the corresponding relation between the block height 4 and the verification node list 4 to the second mapping information, and deletes the corresponding relation between the block height 1 and the verification node list 1;
the verification node A, the verification node B, the verification node C and the verification node D respectively determine that the verification nodes of the block chain network after the node configuration change are the verification node A, the verification node B and the verification node C as corresponding verification node lists 4 according to the configuration change block to be verified, determine that the block height of the configuration change block to be verified is the block height 4, add the corresponding relation between the block height 4 and the verification node lists 4 to the first mapping information, and delete the corresponding relation between the block height 1 and the verification node lists 1;
for the verification node D, after the configuration change block to be verified is added to the blockchain, the verification node D is no longer used as a verification node of the blockchain network.
The following describes a complete flow of the block chain data processing method provided in the embodiment of the present application by using another practical example.
Referring to fig. 14, fig. 14 is a schematic diagram of another practical example of a blockchain data processing method provided in this embodiment of the present application, where a current blockchain network includes a master node, a verification node a, a verification node B, a verification node C, and a verification node D, and the master node has just been restarted, specifically:
the terminal sends a transaction request for carrying out node configuration change on the blockchain network to the main node, and the request is to delete the verification node D in the blockchain network;
the main node generates a configuration change block to be verified according to the transaction request, acquires preset second mapping information from the memory, and at the moment, as the main node is just restarted, the second mapping information in the memory is emptied, the main node can acquire the configuration change block with the highest block height from the block chain database, preloads the block height 3 of the configuration change block and a corresponding verification node list 3 into the memory, reads the block height 3 from the memory, and adds the block height 3 to an additional field of the configuration change block to be verified;
the subsequent processing is similar to the example shown in fig. 13, and is not described again here.
It is to be understood that, in the examples shown in fig. 12 and fig. 13, the mapping information in the memories of the master node and each of the verification nodes is the same, and in the example shown in fig. 14, the mapping information in the memories of the master node and the mapping information in the block chain database are the same, actually, fig. 12, fig. 13, and fig. 14 are only used for a schematic description, the mapping information in the memories of the master node and each of the verification nodes may also be partially different, the mapping information in the memories of the master node and the mapping information in the block chain database may also be partially different, and the operation condition of the view chain network is determined, and the embodiment of the present application is not limited.
It can be understood that in the most extreme case, assuming that all blocks to be verified are configuration change blocks, when a fifth block is generated, it is specified to use the verification node list corresponding to the first block to perform consensus processing on the fifth block, when a sixth block is generated, it is specified to use the verification node list corresponding to the second block to perform consensus processing on the sixth block, and so on, it appears that the configuration change is split into different links: in fact, based on the blockchain data processing method provided in the embodiment of the present application, only the verification node list used when performing consensus processing on the configuration change blocks to be verified is changed, and the execution sequence of the configuration change transactions in the configuration change blocks is not affected, that is, the processing sequence of the configuration change transactions is not affected by the blockchain data processing method provided in the embodiment of the present application, and the processing sequence of the configuration change transactions is still consistent with the sequence of the block heights, that is, the first block, the second block, the third block, and the fourth block.
It will be understood that, although the steps in the respective flowcharts described above are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in a strict order unless explicitly stated in the present embodiment, and may be performed in other orders. Moreover, at least a part of the steps in the above-mentioned flowcharts may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or the stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or the stages in other steps.
In each embodiment of the present application, when data related to the characteristics of the target object, such as attribute information or attribute information sets of the target object, is processed, permission or approval of the target object is obtained, and the data is collected, used, processed, and the like, so that laws and regulations and standards of relevant countries and regions are complied with. In addition, when the embodiment of the present application needs to acquire the attribute information of the target object, the individual permission or the individual agreement of the target object may be acquired in a manner of popping up a window or jumping to a confirmation page, and after the individual permission or the individual agreement of the target object is definitely acquired, the necessary relevant data of the target object for enabling the embodiment of the present application to normally operate may be acquired.
Referring to fig. 15, fig. 15 is a schematic structural diagram of a block chain data processing apparatus according to an embodiment of the present application, where the first block chain data processing apparatus 1500 includes:
a block receiving module 1501, configured to receive a configuration change block to be verified, where the configuration change block is used to perform node configuration change on a block chain network;
a block height extracting module 1502, configured to extract a target block height of a target configuration change block from the configuration change blocks to be verified; the target configuration change block is a previous valid configuration change block corresponding to the configuration change block to be verified;
the mapping module 1503 is configured to obtain preset first mapping information, and determine a target verification node list corresponding to the height of a target block according to the first mapping information; the first mapping information is used for representing the corresponding relation between the block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
the first consensus module 1504 is configured to check the permission of the consensus process according to the target verification node list, and perform the consensus process on the configuration change block to be verified when the check result is that the check is passed.
Further, the block height extracting module 1502 is specifically configured to:
extracting target block information from a block header of a configuration change block to be verified;
and extracting the target block height of the target configuration change block from the additional field of the target block information.
Further, the first consensus module 1504 is further configured to:
when the result of the consensus processing on the configuration change blocks to be verified is that consensus is achieved, adding the configuration change blocks to be verified to the block chain, and extracting the update block height corresponding to the configuration change blocks to be verified from the block height field of the target block information;
extracting node configuration information from the block body of the configuration change block to be verified;
determining an updated verification node list of the block chain network after node configuration change according to the node configuration information;
adding the correspondence between the update block height and the update verification node list to the first mapping information.
Further, the mapping module 1503 is specifically configured to:
acquiring first mapping information from a memory; the first mapping information comprises a plurality of mapping entries, and each mapping entry comprises a candidate block height and a candidate verification node list corresponding to the candidate block height;
and determining a target verification node list corresponding to the target block height from the multiple candidate verification node lists according to the matching relation between the target block height and the candidate block height.
Further, the mapping module 1503 is specifically configured to:
when the mapping item is a key value pair, the key information of the key value pair is the height of a candidate block, and the value information of the key value pair is a candidate verification node list, determining target value information from the value information according to the matching relation between the height of the target block and the key information, and obtaining a target verification node list corresponding to the height of the target block according to the target value information;
or when the mapping entries are character strings, dividing each mapping entry according to a preset dividing rule to obtain a first character string corresponding to the height of the candidate block and a second character string corresponding to the candidate verification node list, determining target character strings from the plurality of second character strings according to the matching relation between the height of the target block and the first character string, and obtaining the target verification node list corresponding to the height of the target block according to the target character strings.
Further, the mapping module 1503 is further configured to:
determining capacity information of the first mapping information; the capacity information comprises the block height number of the candidate block height or the memory occupation size;
and when the capacity information is larger than or equal to a preset threshold value, deleting a plurality of mapping entries from the first mapping information according to the block height of the candidate block height or the generation time of the mapping entries.
Further, the first consensus module 1504 is specifically configured to:
determining a plurality of first node identifications according to a target verification node list;
acquiring a second node identifier stored locally, and checking the permission of consensus processing according to the matching relation between the second node identifier and the first node identifier;
and when the second node identifier is matched with any one of the plurality of first node identifiers, determining that the verification result is verification passing, and performing consensus processing on the configuration change block to be verified.
The first blockchain data processing apparatus 1500 is based on the same inventive concept as the above-mentioned blockchain data processing method applied to the verification node, so that the first blockchain data processing apparatus 1500 can quickly match a target verification node list corresponding to the target block height according to a preset first mapping information by extracting the target block height of the target configuration change block from the configuration change block to be verified, because the target configuration change block is a configuration change block that is validated before the configuration change block to be verified, the target configuration change block is a block that is commonly recognized by the verification nodes in the blockchain network, and the matched target verification node list includes the verification nodes in the blockchain network after the target configuration change block is validated, and the target verification node list is valid and consistent among different verification nodes, and when the consensus processing is subsequently carried out on the configuration change block to be verified according to the target verification node list, the reliability of the consensus processing can be improved, and the stability of the operation of the block chain network can be improved. Moreover, the method can support the consensus processing on the continuous configuration change blocks to be verified, thereby being capable of processing the continuous node configuration change, shortening the effective time delay of the continuous node configuration change and improving the efficiency of the node configuration change.
Referring to fig. 16, fig. 16 is a schematic diagram of another structure of a blockchain data processing apparatus according to an embodiment of the present disclosure, in which the second blockchain data processing apparatus 1600 includes:
a transaction request receiving module 1601, configured to receive a transaction request for node configuration change of a blockchain network; the transaction request carries node configuration information;
a block generating module 1602, configured to obtain a target block height of the target configuration change block and a target verification node list corresponding to the target configuration change block, and generate a configuration change block to be verified according to the node configuration information and the target block height; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, and the target verification node list comprises verification nodes in the blockchain network after the target configuration change block takes effect;
the second consensus module 1603 is configured to send the configuration change block to be verified to the verification nodes in the target verification node list, so that the verification nodes in the target verification node list determine the target verification node list according to the height of the target block and preset first mapping information, verify the permission of consensus processing according to the target verification node list, and perform consensus processing on the configuration change block to be verified by the verification nodes in the target verification node list when the verification result is that verification is passed.
Further, the block generation module 1602 is specifically configured to:
acquiring preset second mapping information from the memory; the second mapping information comprises a plurality of mapping entries, and each mapping entry comprises a candidate block height and a candidate verification node list corresponding to the candidate block height;
determining a target block height from the candidate block heights according to the block height of the candidate block heights or the generation time of the mapping entries, and acquiring the target block height;
and determining the candidate verification node list corresponding to the height of the target block as a target verification node list corresponding to the target configuration change block, and acquiring the target verification node list.
Further, the block generating module 1602 is further configured to:
receiving a program restarting instruction, and acquiring a historical configuration change block from a preset database according to the height of the block or the block effective time when the program restarting instruction is executed;
determining the height of a historical block of the historical configuration change block and a historical verification node list corresponding to the historical configuration change block, wherein the historical verification node list comprises verification nodes in a block chain network after the historical configuration change block takes effect;
and taking the height of the historical block as the height of a target block, taking the historical verification node list as a target verification node list, generating a mapping item corresponding to the height of the target block and the target verification node list, and preloading the mapping item into a memory.
Further, the block generation module 1602 is specifically configured to:
writing the node configuration information into a block body of the configuration change block to be verified;
acquiring the update block height corresponding to the configuration change block to be verified, taking the update block height as a block height field of target block information of the configuration change block to be verified, taking the target block height as a target block information additional field, and writing the target block information into a block head;
and generating the configuration change block to be verified according to the block body and the block head.
The second blockchain data processing apparatus 1600 is based on the same inventive concept as the above-mentioned blockchain data processing method applied to the master node, so that the second blockchain data processing apparatus 1600 generates the configuration change block to be verified according to the node configuration information and the target block height by obtaining the target block height of the target configuration change block and the target verification node list corresponding to the target configuration change block, so that the target verification node can extract the target block height of the target configuration change block from the configuration change block to be verified after receiving the configuration change block to be verified, and further determine the target verification node list corresponding to the target block height according to the preset first mapping information, because the target configuration change block is the previous valid configuration change block corresponding to the configuration change block to be verified, the target configuration change block is a block commonly recognized by the verification nodes in the blockchain network, the target verification node list obtained through matching comprises verification nodes in the block chain network after the target configuration change block takes effect, so that the target verification node list is effective and consistent among different verification nodes, and when the consensus processing is performed on the configuration change block to be verified according to the target verification node list, the reliability of the consensus processing can be improved, and the running stability of the block chain network is improved. Moreover, the method can support the consensus processing on the continuous configuration change blocks to be verified, thereby being capable of processing the continuous node configuration change, shortening the effective time delay of the continuous node configuration change and improving the efficiency of the node configuration change.
The electronic device for executing the block chain data processing method provided in the embodiment of the present application may be a terminal, and referring to fig. 17, fig. 17 is a partial structural block diagram of the terminal provided in the embodiment of the present application, where the terminal includes: radio Frequency (RF) circuit 1710, memory 1720, input unit 1730, display unit 1740, sensor 1750, audio circuit 1760, wireless fidelity (WiFi) module 1770, processor 1780, and power supply 1790. Those skilled in the art will appreciate that the terminal structure shown in fig. 17 is not intended to be limiting of handsets, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The RF circuit 1710 can be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing the received downlink information of the base station in the processor 1780; in addition, data for designing uplink is transmitted to the base station.
The memory 1720 can be used for storing software programs and modules, and the processor 1780 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 1720.
The input unit 1730 may be used to receive input numeric or character information and generate key signal inputs related to setting and function control of the cellular phone. Specifically, the input unit 1730 may include a touch panel 1731 and other input devices 1732.
The display unit 1740 may be used to display input information or provided information as well as various menus of the mobile phone. The display unit 1740 may include a display panel 1741.
Audio circuitry 1760, speaker 1761, and microphone 1762 may provide an audio interface.
In this embodiment, the processor 1780 included in the terminal can perform the block chain data processing method of the previous embodiment.
The electronic device for performing the above-described blockchain data Processing method according to an embodiment of the present disclosure may also be a server, referring to fig. 18, fig. 18 is a partial block diagram of the server according to an embodiment of the present disclosure, and the server 1800 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1822 (e.g., one or more processors) and a memory 1832, and one or more storage media 1830 (e.g., one or more mass storage devices) for storing applications 1842 or data 1844. The memory 1832 and the storage medium 1830 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 1830 may include one or more modules (not shown), each of which may include a sequence of instructions that operate on the server 1800. Still further, a central processor 1822 may be provided in communication with the storage medium 1830 to execute a series of instruction operations in the storage medium 1830 on the server 1800.
The server 1800 may also include one or more power supplies 1826, one or more wired or wireless network interfaces 1850, one or more input-output interfaces 1858, and/or one or more operating systems 1841, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so forth.
A processor in the server 1800 may be configured to perform the blockchain data processing method.
The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium is used for storing a program code, and the program code is used for executing the block chain data processing method in the foregoing embodiments.
Embodiments of the present application also provide a computer program product, which includes a computer program, and the computer program is stored in a computer readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the block chain data processing method implemented above.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It should be understood that in the description of the embodiments of the present application, a plurality (or a plurality) means two or more, and more than, less than, more than, etc. are understood as excluding the present number, and more than, less than, etc. are understood as including the present number.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should also be appreciated that the various implementations provided in the embodiments of the present application can be combined arbitrarily to achieve different technical effects.
While the preferred embodiments of the present invention have been described, the present invention is not limited to the above embodiments, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and such equivalent modifications or substitutions are included in the scope of the present invention defined by the claims.

Claims (15)

1. A method for processing blockchain data, comprising:
receiving a configuration change block to be verified, which is used for carrying out node configuration change on a block chain network;
extracting the target block height of the target configuration change block from the configuration change block to be verified; the target configuration change block is a previous configuration change block which is effective and corresponds to the configuration change block to be verified, and the target block height is added to the configuration change block to be verified when the configuration change block to be verified is generated;
acquiring preset first mapping information, and determining a target verification node list corresponding to the height of the target block according to the first mapping information; the first mapping information is used for representing a corresponding relation between a block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and checking the permission of the consensus processing according to the target verification node list, and performing the consensus processing on the configuration change block to be verified when the checking result is that the checking is passed.
2. The method of claim 1, wherein said extracting a target block height of a target configuration change block from the configuration change block to be verified comprises:
extracting target block information from the block head of the configuration change block to be verified;
and extracting the target block height of the target configuration change block from the additional field of the target block information.
3. The method of claim 2, further comprising:
when the result of the consensus processing on the configuration change block to be verified is that consensus is achieved, adding the configuration change block to be verified to a block chain, and extracting the updated block height corresponding to the configuration change block to be verified from the block height field of the target block information;
extracting node configuration information from the block body of the configuration change block to be verified;
determining an updated verification node list of the block chain network after node configuration change is carried out according to the node configuration information;
adding a correspondence between the update block height and the update verification node list to the first mapping information.
4. The method as claimed in any one of claims 1 to 3, wherein said obtaining preset first mapping information and determining a target verification node list corresponding to the target block height according to the first mapping information includes:
acquiring first mapping information from a memory; wherein the first mapping information comprises a plurality of mapping entries, each mapping entry comprising a candidate block height and a candidate verification node list corresponding to the candidate block height;
and determining a target verification node list corresponding to the target block height from a plurality of candidate verification node lists according to the matching relation between the target block height and the candidate block height.
5. The blockchain data processing method according to claim 4, wherein said determining a target verification node list corresponding to the target block height from a plurality of candidate verification node lists according to the matching relationship between the target block height and the candidate block height comprises:
when the mapping item is a key value pair, the key information of the key value pair is the height of the candidate block, and the value information of the key value pair is the candidate verification node list, determining target value information from the value information according to the matching relation between the height of the target block and the key information, and obtaining a target verification node list corresponding to the height of the target block according to the target value information;
or when the mapping entries are character strings, dividing each mapping entry according to a preset dividing rule to obtain a first character string corresponding to the height of the candidate block and a second character string corresponding to the candidate verification node list, determining a target character string from a plurality of second character strings according to the matching relation between the height of the target block and the first character string, and obtaining a target verification node list corresponding to the height of the target block according to the target character string.
6. The blockchain data processing method of claim 4, wherein the blockchain data processing method further comprises:
determining capacity information of the first mapping information; wherein the capacity information includes a block height number or a memory footprint of the candidate block height;
and when the capacity information is greater than or equal to a preset threshold, deleting a plurality of mapping entries from the first mapping information according to the block height of the candidate block height or the generation time of the mapping entries.
7. The method as claimed in claim 1, wherein the checking the permission of the consensus process according to the target verification node list, and performing the consensus process on the configuration change block to be verified when the checking result is that the checking passes, comprises:
determining a plurality of first node identifications according to the target verification node list;
acquiring a second node identifier stored locally, and checking the permission of consensus processing according to the matching relation between the second node identifier and the first node identifier;
and when the second node identification is matched with any one of the first node identifications, determining that the verification result is that the verification is passed, and performing consensus processing on the configuration change block to be verified.
8. A method for processing blockchain data, comprising:
receiving a transaction request for node configuration change of a blockchain network; wherein, the transaction request carries node configuration information;
acquiring the height of a target block of a target configuration change block and a target verification node list corresponding to the target configuration change block, and generating a configuration change block to be verified according to the node configuration information and the height of the target block; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and sending the configuration change block to be verified to a verification node in the target verification node list, so that the verification node in the target verification node list determines the target verification node list according to the height of the target block and preset first mapping information, verifies the permission of consensus processing according to the target verification node list, and when the verification result is that verification is passed, the verification node in the target verification node list performs consensus processing on the configuration change block to be verified.
9. The method of claim 8, wherein said obtaining a target block height of a target configuration change block and a target verification node list corresponding to the target configuration change block comprises:
acquiring preset second mapping information from the memory; wherein the second mapping information comprises a plurality of mapping entries, each mapping entry comprising a candidate block height and a candidate verification node list corresponding to the candidate block height;
determining the target block height from a plurality of candidate block heights according to the block height of the candidate block heights or the generation time of the mapping entries, and acquiring the target block height;
and determining the candidate verification node list corresponding to the height of the target block as a target verification node list corresponding to the target configuration change block, and acquiring the target verification node list.
10. The method of claim 9, wherein before the obtaining the predetermined second mapping information from the memory, the method further comprises:
receiving a program restarting instruction, and acquiring a historical configuration change block from a preset database according to the height of the block or the block effective time when the program restarting instruction is executed;
determining the height of a historical block of the historical configuration change block and a historical verification node list corresponding to the historical configuration change block, wherein the historical verification node list comprises verification nodes in the block chain network after the historical configuration change block takes effect;
and taking the height of the historical block as the height of the target block, taking the historical verification node list as the target verification node list, generating a mapping item corresponding to the height of the target block and the target verification node list, and preloading the mapping item into the memory.
11. The method according to any of claims 8 to 10, wherein said generating a configuration change block to be verified according to the node configuration information and the target block height comprises:
writing the node configuration information into a block body of a configuration change block to be verified;
acquiring the update block height corresponding to the configuration change block to be verified, taking the update block height as a block height field of target block information of the configuration change block to be verified, taking the target block height as an additional field of the target block information, and writing the target block information into a block head of the configuration change block to be verified;
and generating the configuration change block to be verified according to the block body and the block head.
12. A block chain data processing apparatus, comprising:
the block receiving module is used for receiving a configuration change block to be verified, wherein the configuration change block is used for carrying out node configuration change on a block chain network;
the block height extraction module is used for extracting the target block height of the target configuration change block from the configuration change block to be verified; the target configuration change block is a previous configuration change block which is effective and corresponds to the configuration change block to be verified, and the target block height is added to the configuration change block to be verified when the configuration change block to be verified is generated;
the mapping module is used for acquiring preset first mapping information and determining a target verification node list corresponding to the height of the target block according to the first mapping information; the first mapping information is used for representing a corresponding relation between a block height and a verification node list, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and the first consensus module is used for verifying the consensus processing authority according to the target verification node list, and performing consensus processing on the configuration change block to be verified when the verification result is that the verification is passed.
13. A block chain data processing apparatus, comprising:
the transaction request receiving module is used for receiving a transaction request for node configuration change of the blockchain network; wherein, the transaction request carries node configuration information;
the block generating module is used for acquiring the target block height of a target configuration change block and a target verification node list corresponding to the target configuration change block, and generating a configuration change block to be verified according to the node configuration information and the target block height; the target configuration change block is a previous effective configuration change block corresponding to the configuration change block to be verified, and the target verification node list comprises verification nodes in the block chain network after the target configuration change block takes effect;
and the second consensus module is used for sending the configuration change block to be verified to the verification nodes in the target verification node list, so that the verification nodes in the target verification node list determine the target verification node list according to the height of the target block and preset first mapping information, verify the consensus processing authority according to the target verification node list, and when the verification result is that the verification is passed, make the verification nodes in the target verification node list perform consensus processing on the configuration change block to be verified.
14. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the block chain data processing method according to any one of claims 1 to 11 when executing the computer program.
15. A computer-readable storage medium, which stores a computer program, wherein the computer program, when executed by a processor, implements the block chain data processing method of any one of claims 1 to 11.
CN202210492585.8A 2022-05-07 2022-05-07 Block chain data processing method and device, electronic equipment and storage medium Active CN114584326B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210492585.8A CN114584326B (en) 2022-05-07 2022-05-07 Block chain data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210492585.8A CN114584326B (en) 2022-05-07 2022-05-07 Block chain data processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114584326A CN114584326A (en) 2022-06-03
CN114584326B true CN114584326B (en) 2022-08-30

Family

ID=81769182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210492585.8A Active CN114584326B (en) 2022-05-07 2022-05-07 Block chain data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114584326B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115186035B (en) * 2022-09-13 2022-11-22 腾讯科技(深圳)有限公司 Block processing method, related system, storage medium and server

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108365993A (en) * 2018-03-09 2018-08-03 深圳前海微众银行股份有限公司 Block chain link point dynamic altering method, system and computer readable storage medium
CN110543488A (en) * 2019-09-11 2019-12-06 深圳市网心科技有限公司 Verification node updating method, device and equipment
CN111522683A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Consensus node changing method and related device for badger Byzantine fault-tolerant consensus mechanism
CN112581126A (en) * 2020-12-08 2021-03-30 腾讯科技(深圳)有限公司 Block chain-based platform data management method and device and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109410045B (en) * 2018-08-30 2020-08-14 杭州复杂美科技有限公司 Parallel chain consensus method, equipment and storage medium
CN111628868B (en) * 2020-05-26 2021-08-13 腾讯科技(深圳)有限公司 Digital signature generation method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108365993A (en) * 2018-03-09 2018-08-03 深圳前海微众银行股份有限公司 Block chain link point dynamic altering method, system and computer readable storage medium
CN110543488A (en) * 2019-09-11 2019-12-06 深圳市网心科技有限公司 Verification node updating method, device and equipment
CN111522683A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Consensus node changing method and related device for badger Byzantine fault-tolerant consensus mechanism
CN112581126A (en) * 2020-12-08 2021-03-30 腾讯科技(深圳)有限公司 Block chain-based platform data management method and device and storage medium

Also Published As

Publication number Publication date
CN114584326A (en) 2022-06-03

Similar Documents

Publication Publication Date Title
CN107396360B (en) Block verification method and device
CN107579848B (en) Method for dynamically changing consensus node in practical Byzantine fault-tolerant consensus mechanism
CN110383279B (en) System and method for detecting replay attacks
CN112685796B (en) Block chain-based block consensus method and related equipment
CN110431577B (en) System and method for detecting replay attacks
CN108769230B (en) Transaction data storage method, device, server and storage medium
CN110569251A (en) Data processing method, related equipment and computer readable storage medium
CN110690974B (en) Block chain based data verification method, device, equipment and readable storage medium
CN111092896B (en) Food source tracing distributed data synchronization method based on optimized PAXOS
CN112527912B (en) Data processing method and device based on block chain network and computer equipment
CN110572450A (en) Data synchronization method and device, computer readable storage medium and computer equipment
CN111931220B (en) Consensus processing method, device, medium and electronic equipment for block chain network
CN110597918A (en) Account management method and device and computer readable storage medium
CN111654395B (en) Voting information processing method, device, equipment and storage medium
US20230259938A1 (en) Blockchain-based data processing method and apparatus, device, readable storage medium and computer program product
CN114584326B (en) Block chain data processing method and device, electronic equipment and storage medium
CN110730081A (en) Block chain network-based certificate revocation method, related equipment and medium
US20230370285A1 (en) Block-chain-based data processing method, computer device, computer-readable storage medium
US20220239668A1 (en) Blockchain-based message processing method and apparatus, device, and storage medium
CN112507019A (en) PBFT consensus system and method based on intelligent contracts
CN112200680B (en) Block link point management method, device, computer and readable storage medium
US11558179B2 (en) Distributed data storage
CN108882230B (en) Call record management method, device and system
CN112417052B (en) Data synchronization method, device, equipment and storage medium in block chain network
CN117010889A (en) Data processing method, device, equipment, medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant