WO2023040453A1 - 一种交易信息处理方法及装置 - Google Patents

一种交易信息处理方法及装置 Download PDF

Info

Publication number
WO2023040453A1
WO2023040453A1 PCT/CN2022/106699 CN2022106699W WO2023040453A1 WO 2023040453 A1 WO2023040453 A1 WO 2023040453A1 CN 2022106699 W CN2022106699 W CN 2022106699W WO 2023040453 A1 WO2023040453 A1 WO 2023040453A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
transaction information
consensus node
information
consensus
Prior art date
Application number
PCT/CN2022/106699
Other languages
English (en)
French (fr)
Inventor
齐冀
陈旭升
姜云朋
崔鹤鸣
王森
王鹏
张弓
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023040453A1 publication Critical patent/WO2023040453A1/zh

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of communication technology, and in particular to a transaction information processing method and device.
  • Blockchain is a distributed ledger maintained by multiple nodes, which uses a special data structure "block" to record transactions.
  • Each block can include three components: the hash value of the previous block, a certain number and orderly arrangement of transactions, and metadata attached to the consensus protocol. Because each block stores the hash value of the previous block to form a chain structure, modifying the block in the middle of the chain will cause the hash value of the subsequent block to be inconsistent. This mechanism ensures that the blocks on the blockchain are very consistent. It is difficult to be tampered with, so it has received more and more attention and application.
  • the following two workflows are usually used to work: the first, execution-sorting workflow; the second, sorting-execution workflow.
  • the multiple nodes include endorsement nodes, sorting nodes and ordinary nodes.
  • the specific workflow process is shown in (a) in Figure 1, including: the transaction sent by the endorsement node to the client device Endorsement of information (referred to as endorsement), that is, to verify and execute the transaction information, and send the transaction execution result to the client device as an endorsement; the sorting node receives the transaction information of successful endorsement sent by the client device, and Multiple transaction information is packaged by consensus to obtain blocks (referred to as sorting); endorsement nodes and ordinary nodes verify each transaction information in the block (referred to as verification); endorsement nodes and ordinary nodes will verify successful blocks and endorsements Corresponding storage is carried out to complete the submission (referred to as submission).
  • the multiple nodes include sorting nodes and ordinary nodes.
  • the specific workflow process is shown in (b) in Figure 1, including: the sorting nodes agree on multiple received transaction information Package the block (referred to as sorting), and send the block to the common node; the sorting node and the common node execute the multiple transaction information in the order of the multiple transaction information in the block (referred to as execution); all nodes respectively
  • the transaction execution results of the plurality of transaction information and the block are correspondingly stored to complete submission (referred to as submission).
  • the sorting phase and the execution phase are executed serially, which results in a long delay in the processing of transaction information.
  • the transaction information has not been sorted in the endorsement stage, and different transaction information is executed independently, so that multiple transaction information with dependencies may enter the sorting stage. It will cause the transaction information that is ranked behind to be considered as an invalid transaction, thereby reducing the processing efficiency of the transaction information.
  • the present application provides a method and device for processing transaction information, which solves the problems of prolonged processing time and low processing efficiency of transaction information in the prior art.
  • a method for processing transaction information is provided, which is applied to a blockchain network, and the blockchain network includes a master consensus node, a slave consensus node, and an ordinary node.
  • the method includes: the master consensus node receives information from at least one client multiple transaction information of the end device; for each transaction information in the multiple transaction information, the master consensus node sends transaction indication information to the slave consensus node and the ordinary node respectively, and the transaction indication information includes the transaction information and sequence Index, the sequence index is used to indicate the sequence of the transaction information in the consensus process, for example, the sequence index can be a sequence number; the master consensus node agrees that the multiple transaction information is based on the sequence index of the multiple transaction information Get the first block.
  • each transaction instruction information includes a transaction information and a sequence index
  • the sequence index is used to indicate the order in which the transaction information is arranged in the consensus process, so that when the multiple transaction indication information is received from the consensus node and the common node, the master consensus node and the slave consensus node can follow the sequence of the multiple transaction information Index consensus on the multiple transaction information, and at the same time, the ordinary node can index and execute the multiple transaction information according to the order of the multiple transaction information, so that the consensus and execution of the multiple transaction information can be executed in parallel, thereby reducing the processing of transaction information Time delay, improve the execution efficiency of transaction information.
  • the sequence index in the transaction indication information is not signed.
  • the main consensus node does not sign the sequence index, so that other nodes do not need to perform signature verification on the sequence index when receiving transaction instruction information, thereby reducing the performance overhead of other nodes; in addition, the sequence index is not signed.
  • the signature can also prevent malicious nodes from exhausting the computing resources of other nodes by broadcasting a large number of transaction indication information carrying illegal signatures.
  • the first block includes multiple transaction hash values, and the multiple transaction hash values correspond to the multiple transaction information one by one
  • the method further includes: the main consensus The node sends the plurality of transaction hash values to the slave consensus node, and each transaction hash value in the plurality of transaction hash values is used by the slave consensus node to determine whether to obtain the transaction information corresponding to the transaction hash value.
  • the slave consensus node can determine whether to obtain the transaction information corresponding to the transaction hash value.
  • the method further includes: the master consensus node receiving an acquisition request from the slave consensus node, where the acquisition request is used to request acquisition of at least one transaction information in the plurality of transaction information , the acquisition request is sent when the slave consensus node determines that the at least one transaction information has not been acquired according to the plurality of transaction hash values; the master consensus node sends at least one transaction indication information to the slave consensus node, and the at least one transaction
  • the indication information includes the at least one transaction information and a sequence index corresponding to each transaction information in the at least one transaction information.
  • the first block includes multiple transaction hash values
  • the multiple transaction hash values correspond to the multiple transaction information one by one
  • the method further includes: the main consensus The node sends the first block to the ordinary node, so that the ordinary node verifies the consistency between the plurality of transaction hash values in the first block and the plurality of transaction hash values obtained by locally executing the plurality of transaction information.
  • the common node can verify the consistency between the multiple transaction hash values in the first block and the multiple transaction hash values obtained by locally executing the multiple transaction information.
  • the method further includes: the master consensus node acquires performance parameters during transaction information processing, and when the performance parameters meet the first preset condition, the master consensus node triggers the master The switching process of the consensus node.
  • the performance parameters include at least one of the following: consensus throughput, transaction delay, and number of transaction conflicts; the consensus throughput meeting the first preset condition includes that the consensus throughput is less than the preset throughput; the transaction delay Satisfying the first preset condition includes that the transaction delay is greater than a preset delay; the number of transaction conflicts meeting the first preset condition includes that the number of transaction conflicts is greater than the first preset number.
  • the method further includes: when the master consensus node determines that a certain transaction information has not been processed within a preset time period, the master consensus node triggers a switching process of the master consensus node.
  • the method further includes: when the master consensus node determines that the number of transaction conflicts of transaction information of a certain client device in at least one continuous switching period is greater than the second preset number of times , setting the client device as a blacklist; wherein, each switching cycle in the at least one switching cycle corresponds to a different master consensus node.
  • a method for processing transaction information is provided, which is applied to a block chain network.
  • the block chain network includes a master consensus node, a slave consensus node, and an ordinary node.
  • the method includes: the slave consensus node receives information from the master consensus A plurality of transaction instruction information of the node, each transaction instruction information in the plurality of transaction instruction information includes transaction information and a sequence index, and the sequence index is used to indicate the order in which the transaction information is arranged in the consensus process.
  • the sequence index can is a sequence number; the slave consensus node consensuses the plurality of transaction information to obtain the first block according to the sequence index of the plurality of transaction information.
  • each transaction instruction information includes a transaction information and a sequence index
  • the sequence index is used to indicate the order in which the transaction information is arranged in the consensus process, so that when the multiple transaction indication information is received from the consensus node and the common node, the master consensus node and the slave consensus node can follow the sequence of the multiple transaction information Index consensus on the multiple transaction information, and at the same time, the ordinary node can index and execute the multiple transaction information according to the order of the multiple transaction information, so that the consensus and execution of the multiple transaction information can be executed in parallel, thereby reducing the processing of transaction information Time delay, improve the execution efficiency of transaction information.
  • the sequence index in the transaction indication information is not signed.
  • the main consensus node does not sign the sequence index, so that other nodes do not need to perform signature verification on the sequence index when receiving transaction instruction information, thereby reducing the performance overhead of other nodes; in addition, the sequence index is not signed.
  • the signature can also prevent malicious nodes from exhausting the computing resources of other nodes by broadcasting a large number of transaction indication information carrying illegal signatures.
  • the first block includes a plurality of transaction hash values, and the plurality of transaction hash values correspond to the plurality of transaction information one-to-one
  • the method further includes: the slave consensus The node receives the plurality of transaction hash values from the master consensus node, and each transaction hash value in the plurality of transaction hash values is used for the slave consensus node to determine whether to obtain the transaction information corresponding to the transaction hash value .
  • the slave consensus node can determine whether to obtain the transaction information corresponding to the transaction hash value.
  • the method further includes: the slave The consensus node sends an acquisition request to the master consensus node, and the acquisition request is used to request acquisition of the at least one transaction information; the slave consensus node receives at least one transaction indication information from the master consensus node, and the at least one transaction indication information includes the at least A piece of transaction information, and a sequence index corresponding to each transaction information in the at least one piece of transaction information.
  • the slave consensus node can obtain the above multiple transaction information.
  • the method further includes: the slave consensus node receives a transaction execution result of the transaction information from the common node; the A response message is sent from the consensus node to the common node, and the response message is used to confirm that the transaction execution result is received successfully.
  • the transaction execution result of the transaction information can be successfully received from the consensus node.
  • the method further includes: the slave consensus node acquires performance parameters during transaction information processing, and when the performance parameters meet the first preset condition, the slave consensus node triggers the master The switching process of the consensus node.
  • the performance parameters include at least one of the following: consensus throughput, transaction delay, and number of transaction conflicts; the consensus throughput meeting the first preset condition includes that the consensus throughput is less than the preset throughput; the transaction delay Satisfying the first preset condition includes that the transaction delay is greater than a preset delay; the number of transaction conflicts meeting the first preset condition includes that the number of transaction conflicts is greater than the first preset number.
  • the method further includes: when the slave consensus node determines that a certain transaction information has not been processed within a preset time period or the master consensus node abstains before the next master consensus node switch , the slave consensus node triggers the switching process of the master consensus node.
  • the method further includes: when the slave consensus node determines that the number of transaction conflicts of transaction information of a certain client device in at least one continuous switching period is greater than the second preset number of times , setting the client device as a blacklist; wherein, each switching cycle in the at least one switching cycle corresponds to a different master consensus node.
  • a method for processing transaction information is provided, which is applied to a blockchain network.
  • the blockchain network includes a master consensus node, a slave consensus node, and a common node.
  • the method includes: the common node receives multiple A transaction indication information, the plurality of transaction indication information is sent by the master consensus node to the slave consensus node and the common node when receiving multiple transaction information, each transaction indication information in the plurality of transaction indication information includes transaction information and a sequence index, the sequence index is used to indicate the sequence of the transaction information in the consensus process; the ordinary node executes the multiple transaction information according to the sequence index of the multiple transaction information.
  • each transaction instruction information includes a transaction information and a sequence index
  • the sequence index is used to indicate the order in which the transaction information is arranged in the consensus process, so that when the multiple transaction indication information is received from the consensus node and the common node, the master consensus node and the slave consensus node can follow the sequence of the multiple transaction information Index consensus on the multiple transaction information, and at the same time, the ordinary node can index and execute the multiple transaction information according to the order of the multiple transaction information, so that the consensus and execution of the multiple transaction information can be executed in parallel, thereby reducing the processing of transaction information Time delay, improve the execution efficiency of transaction information.
  • the sequence index in the transaction indication information is not signed.
  • the main consensus node does not sign the sequence index, so that other nodes do not need to perform signature verification on the sequence index when receiving transaction instruction information, thereby reducing the performance overhead of other nodes; in addition, the sequence index is not signed.
  • the signature can also prevent malicious nodes from exhausting the computing resources of other nodes by broadcasting a large number of transaction indication information carrying illegal signatures.
  • the method further includes: the ordinary node receives the first block sent by the master consensus node and/or the slave consensus node, the first block includes multiple transaction hash values, The plurality of transaction hash values correspond to the plurality of transaction information; the common node verifies the plurality of transaction hash values in the first block and the plurality of transaction hash values obtained by locally executing the plurality of transaction information consistency.
  • the common node can verify the consistency between the multiple transaction hash values in the first block and the multiple transaction hash values obtained by locally executing the multiple transaction information.
  • the method further includes: the common node sends the transaction execution results of the plurality of transaction information to the slave consensus node and/or the master consensus node; And/or the response information of the main consensus node, which is used to confirm the successful reception of the transaction execution result.
  • a transaction information processing device which is used as a master consensus node and applied in a blockchain network, and the blockchain network also includes a slave consensus node and a common node, and the device includes: a receiving unit for Receive a plurality of transaction information; a sending unit, for each transaction information in the plurality of transaction information, respectively send transaction indication information to the slave consensus node and the ordinary node, the transaction indication information includes the transaction information and sequence index , the sequence index is used to indicate the arrangement sequence of the transaction information in the consensus process; the processing unit is configured to consensus the plurality of transaction information to obtain the first block according to the sequence index of the plurality of transaction information.
  • the sequence index in the transaction instruction information is not signed.
  • the first block includes multiple transaction hash values, and the multiple transaction hash values correspond to the multiple transaction information one-to-one
  • the sending unit is further configured to: send The slave consensus node sends the plurality of transaction hash values, and each transaction hash value in the plurality of transaction hash values is used for the slave consensus node to determine whether to obtain the transaction information corresponding to the transaction hash value.
  • the receiving unit is further configured to receive an acquisition request from the slave consensus node, where the acquisition request is used to request acquisition of at least one transaction information in the plurality of transaction information, the The acquisition request is sent when the slave consensus node determines that the at least one transaction information has not been acquired according to the plurality of transaction hash values; the sending unit is also used to send at least one transaction indication information to the slave consensus node, and the at least one The transaction instruction information includes the at least one transaction information and a sequence index corresponding to each transaction information in the at least one transaction information.
  • the first block includes multiple transaction hash values
  • the multiple transaction hash values correspond to the multiple transaction information one-to-one
  • the sending unit is further configured to: send The ordinary node sends the first block, so that the ordinary node verifies the consistency of the plurality of transaction hash values in the first block with the plurality of transaction hash values obtained by locally executing the plurality of transaction information.
  • the processing unit is further configured to: acquire a performance parameter during transaction information processing, and when the performance parameter satisfies a first preset condition, trigger a switching process of the master consensus node.
  • the performance parameters include at least one of the following: consensus throughput, transaction delay, and number of transaction conflicts; the consensus throughput meeting the first preset condition includes that the consensus throughput is less than the preset throughput; the transaction delay Satisfying the first preset condition includes that the transaction delay is greater than a preset delay; the number of transaction conflicts meeting the first preset condition includes that the number of transaction conflicts is greater than the first preset number.
  • the processing unit is further configured to trigger a switching process of the master consensus node when it is determined that certain transaction information has not been processed within a preset time period.
  • the processing unit is further configured to: when determining that the number of transaction conflicts of the transaction information of a certain client device in at least one continuous switching period is greater than the second preset number of times, Setting the client device as a blacklist; wherein, each switching cycle in the at least one switching cycle corresponds to a different master consensus node.
  • a transaction information processing device which is used as a slave consensus node in a blockchain network, and the blockchain network also includes a master consensus node and a common node, and the device includes: a receiving unit for Receive a plurality of transaction instruction information from the main consensus node, each transaction instruction information in the plurality of transaction instruction information includes transaction information and a sequence index, and the sequence index is used to indicate the sequence of the transaction information in the consensus process;
  • the processing unit is configured to consensus the plurality of transaction information to obtain the first block according to the sequence index of the plurality of transaction information.
  • the sequence index in the transaction indication information is not signed.
  • the first block includes multiple transaction hash values, and the multiple transaction hash values correspond to the multiple transaction information one by one, and the receiving unit is further configured to: receive The plurality of transaction hash values from the master consensus node, each transaction hash value in the plurality of transaction hash values is used for the slave consensus node to determine whether to obtain the transaction information corresponding to the transaction hash value.
  • the device when the slave consensus node does not obtain at least one transaction information in the plurality of transaction information, the device further includes a sending unit; the sending unit is configured to send the master The consensus node sends an acquisition request, the acquisition request is used to request acquisition of the at least one transaction information; the receiving unit is also used to receive at least one transaction indication information from the master consensus node, the at least one transaction indication information includes the at least one transaction information information, and a sequence index corresponding to each transaction information in the at least one transaction information.
  • the receiving unit is further configured to receive a transaction execution result of the transaction information from the common node; the sending unit , is also used to send a response message to the common node, and the response message is used to confirm that the transaction execution result is received successfully.
  • the processing unit is further configured to: obtain a performance parameter during transaction information processing, and when the performance parameter satisfies the first preset condition, the slave consensus node triggers the master consensus node to switching process.
  • the performance parameters include at least one of the following: consensus throughput, transaction delay, and number of transaction conflicts; the consensus throughput meeting the first preset condition includes that the consensus throughput is less than the preset throughput; the transaction delay Satisfying the first preset condition includes that the transaction delay is greater than a preset delay; the number of transaction conflicts meeting the first preset condition includes that the number of transaction conflicts is greater than the first preset number.
  • the processing unit is further configured to: trigger The switching process of the main consensus node.
  • the processing unit is further configured to: when determining that the number of transaction conflicts of transaction information of a certain client device in at least one continuous switching period is greater than the second preset number of times, Setting the client device as a blacklist; wherein, each switching cycle in the at least one switching cycle corresponds to a different master consensus node.
  • a transaction information processing device which is used as a common consensus node in a blockchain network, and the blockchain network also includes a master consensus node and a common node, and the device includes: a receiving unit for Receive multiple transaction instruction information from the master consensus node, the multiple transaction instruction information is sent by the master consensus node to the slave consensus node and the ordinary node when receiving multiple transaction information, each of the multiple transaction instruction information
  • Each transaction indication information includes transaction information and a sequence index, the sequence index is used to indicate the sequence of the transaction information in the consensus process; the processing unit is used to execute the plurality of transaction information according to the sequence index of the plurality of transaction information.
  • the sequence index in the transaction instruction information is not signed.
  • the receiving unit is also used to receive the first block sent by the master consensus node and/or the slave consensus node, the first block includes multiple transaction hash values, and the multiple The transaction hash value is in one-to-one correspondence with the plurality of transaction information; the processing unit is also used to verify the plurality of transaction hash values in the first block and the plurality of transaction hash values obtained by locally executing the plurality of transaction information consistency.
  • the common node can verify the consistency between the multiple transaction hash values in the first block and the multiple transaction hash values obtained by locally executing the multiple transaction information.
  • the device further includes a sending unit; the sending unit is configured to send the transaction execution results of the plurality of transaction information to the slave consensus node and/or the master consensus node; the receiving unit , which is also used to receive response information from the slave consensus node and/or the master consensus node, and the response information is used to confirm that the transaction execution result is received successfully.
  • a transaction information processing device in another aspect of the present application, includes a processor, a memory, a communication interface and a bus, the processor, the memory and the communication interface are connected through the bus; the memory is used to store program codes , when the program code is executed by the processor, the device is made to execute the transaction information processing method provided by the first aspect or any possible implementation manner of the first aspect.
  • a transaction information processing device in another aspect of the present application, includes a processor, a memory, a communication interface and a bus, the processor, the memory and the communication interface are connected through the bus; the memory is used to store program codes , when the program code is executed by the processor, the device is made to execute the transaction information processing method provided in the second aspect or any possible implementation manner of the second aspect.
  • a transaction information processing device in another aspect of the present application, includes a processor, a memory, a communication interface and a bus, the processor, the memory and the communication interface are connected through the bus; the memory is used to store program codes , when the program code is executed by the processor, the device is made to execute the transaction information processing method provided by the third aspect or any possible implementation manner of the third aspect.
  • a block chain network in another aspect of the present application, includes a master consensus node, a slave consensus node, and an ordinary node; wherein, the master consensus node is used to implement the first aspect or the first aspect
  • the transaction information processing method provided by any possible implementation the secondary consensus node is used to execute the second aspect or the transaction information processing method provided by any possible implementation of the second aspect
  • the common node is used to Execute the transaction information processing method provided by the third aspect or any possible implementation manner of the third aspect.
  • a computer-readable storage medium is provided, and a computer program or instruction is stored in the computer-readable storage medium.
  • the computer program or instruction is executed, the first aspect or the first aspect are realized.
  • a transaction information processing method provided by any possible implementation manner.
  • a computer-readable storage medium is provided, and a computer program or instruction is stored in the computer-readable storage medium.
  • the computer program or instruction is executed, the second aspect or the second aspect is realized.
  • a transaction information processing method provided by any possible implementation manner.
  • a computer-readable storage medium is provided, and a computer program or instruction is stored in the computer-readable storage medium.
  • the computer program or instruction is executed, the third aspect or the third aspect is realized.
  • a transaction information processing method provided by any possible implementation manner.
  • a computer program product includes: a computer program (also referred to as code, or instruction), which, when the computer program is executed, causes the computer to perform the above-mentioned first aspect. Or the transaction information processing method provided in any possible implementation manner of the first aspect.
  • a computer program product includes: a computer program (also referred to as code, or an instruction), which, when the computer program is executed, causes the computer to perform the above-mentioned second aspect. Or the transaction information processing method provided in any possible implementation manner of the second aspect.
  • a computer program product includes: a computer program (also referred to as code, or an instruction), which, when the computer program is executed, causes the computer to perform the above-mentioned third aspect. Or the transaction information processing method provided in any possible implementation manner of the third aspect.
  • FIG. 1 is a schematic diagram of a transaction information processing stage
  • FIG. 2 is a schematic structural diagram of an authenticated blockchain network provided by an embodiment of the present application.
  • FIG. 3 is a schematic flow diagram of confirming a request through a consensus protocol provided by an embodiment of the present application
  • FIG. 4 is a schematic flowchart of a method for processing transaction information provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a block chain network provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of transaction information processing provided by the embodiment of the present application.
  • FIG. 7 is a schematic diagram of a transaction information processing stage provided by the embodiment of the present application.
  • FIG. 8 is a schematic diagram of performance parameters of a blockchain network provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a main consensus node provided by the embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another main consensus node provided by the embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a slave consensus node provided by the embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of another slave consensus node provided by the embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of a common node provided in the embodiment of the present application.
  • FIG. 14 is a schematic structural diagram of another common node provided by the embodiment of the present application.
  • At least one means one or more, and “multiple” means two or more.
  • “And/or” describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the contextual objects are an “or” relationship.
  • “At least one of the following” or similar expressions refer to any combination of these items, including any combination of single or plural items.
  • At least one (unit) of a, b, or c may represent: a, b, c, a and b, a and c, b and c, or a, b and c, wherein a, b, c can be single or multiple.
  • the embodiments of the present application use words such as "first” and "second” to distinguish the same or similar items with basically the same function and effect.
  • the first threshold and the second threshold are only used to distinguish different thresholds, and their sequence is not limited. Those skilled in the art can understand that words such as “first” and “second” do not limit the quantity and execution order.
  • Blockchain is a distributed ledger maintained by multiple nodes, which uses a special data structure "block" to record transactions.
  • Each block can include three components: the hash value of the previous block, a certain number and orderly arrangement of transactions, and metadata attached to the consensus protocol. Because each block stores the hash value of the previous block to form a chain structure, modifying the block in the middle of the chain will cause the hash value of the subsequent block to be inconsistent. This mechanism ensures that the blocks on the blockchain are very consistent. Difficult to tamper with.
  • the nodes also known as blockchain nodes
  • the blockchain network also known as blockchain systems
  • the blockchain can be divided into a non-authentication blockchain and an authentication blockchain. The following is a brief description of the authentication-free blockchain and the authentication-type blockchain.
  • Authentication-less blockchains also known as "public blockchains," are primarily used for cryptocurrencies. Nodes usually adopt an anonymous mechanism: that is, nodes do not need identity authentication, and can open the client to join the blockchain network at any time. However, due to the following three reasons (1)-(3), the authentication-free blockchain is not suitable as a general-purpose information sharing platform.
  • the authentication-free blockchain must rely on the actual market value of the cryptocurrency to motivate or limit the behavior of nodes, so as to ensure security.
  • cryptocurrencies face strict regulatory issues; on the other hand, many enterprise applications (for example, electronic invoices) do not have monetary and financial attributes.
  • proof-of-work and proof-of-stake There are two main types of authentication-free blockchains, proof-of-work and proof-of-stake. Because any node in an authentication-free blockchain can join the blockchain network anytime, anywhere and anonymously, a method is needed to allow these nodes to "voluntarily" follow the protocol. Proof of work and proof of equity both require a node to make an initial investment, and then use the cost of this investment to motivate the node to follow the agreement to get rewards.
  • Certified blockchains can also be called “private blockchains” or “confederation blockchains”.
  • the certified blockchain requires nodes to join the blockchain network through an identity authentication service and maintain a node list, that is, the identities of all nodes in the blockchain network are known, which is more suitable as a data sharing platform.
  • Certified blockchains can use a distributed fault-tolerant protocol with higher performance and less energy consumption to agree on block content.
  • FIG. 2 is a schematic structural diagram of a blockchain network of an authenticated blockchain, and the blockchain network includes multiple consensus nodes and multiple common nodes.
  • the plurality of consensus nodes can run a distributed fault-tolerant protocol, responsible for reaching a consensus on the content and order of blocks included in the certified blockchain; the plurality of common nodes can be responsible for collecting user transactions from client devices , store confirmation blocks, and execute user transactions, etc.
  • a possible transaction confirmation process may include: S1. Common nodes receive user transactions from client devices; S2. Common nodes send received user transactions to the consensus Node; S3. Consensus between multiple consensus nodes on received user transactions to obtain blocks; S4. Consensus nodes send blocks to ordinary nodes to enable ordinary nodes to execute user transactions; S5. Each node stores blocks .
  • the above-mentioned distributed fault tolerance protocol may also be called a distributed consensus protocol (distributed consensus protocol).
  • the distributed consensus protocol means that in a distributed environment, multiple nodes communicate through the network to reach an agreement on a value X (also known as confirming the value of X). In actual use, it is common to reach consensus on a sequence of values (for example, X1, X2, ..., Xn, where n is a positive integer) by continuously running the individual distributed fault-tolerant algorithms.
  • the distributed consensus protocol can guarantee that even in the case of a small number of node failures, no two nodes will confirm different values Xi (i ranges from 1 to n).
  • distributed consensus algorithms can be divided into: 1) fault-tolerant protocols for crash faults; 2) Byzantine fault-tolerant protocols.
  • Blockchains usually adopt a Byzantine fault-tolerant (BFT) protocol.
  • Byzantine failure means that a faulty node can perform arbitrary behavior without having to follow the protocol.
  • Byzantine faulty nodes may be malicious or dishonest nodes and try to disrupt the normal operation of the system.
  • the BFT protocol can accommodate up to about 33% of faulty nodes (which can also be called malicious nodes).
  • the BFT protocol can accommodate up to f faulty nodes.
  • the practical byzantine fault tolerant (PBFT) protocol is the most classic complete BFT protocol, but its performance and scalability to the number of nodes are poor.
  • a typical BFT protocol can usually contain two sub-protocols: the consensus protocol and the master node switching protocol.
  • Figure 3 is a flow of a PBFT protocol confirming a request through a consensus protocol, which includes five stages: request, pre-prepare, prepare, commit, and reply ).
  • the client device C sends a transaction request to a consensus node N0 (also called the main consensus node), and the consensus node N0 sends the transaction that needs to reach a consensus to all consensus nodes in the pre-preparation stage, for example, to Consensus nodes N1, N2, and N3; consensus nodes N0 to N3 agree on the content and order of the transaction by preparing and confirming two-stage information exchange (for example, the hash value of the transaction); consensus nodes N0 to N3 report to the client device C sends a reply message.
  • FIG. 3 takes the consensus node N3 as an example for illustration.
  • the main consensus node is a malicious node
  • the malicious node can send different transactions to different consensus nodes, or not send any transactions to the consensus node, so that the nodes in the blockchain network cannot agree on any transaction Reach a consensus.
  • the Byzantine Fault Tolerance protocol replaces the malicious master consensus node by running the master node switching protocol.
  • the period during which a certain consensus node acts as the master consensus node is called a view.
  • Master consensus node switching can also be called view switching.
  • each transaction calls a smart contract, and the content of the transaction is used as the input of the smart contract.
  • a smart contract is a piece of executable code stored on the blockchain. Smart contracts are divided into deterministic smart contracts and non-deterministic smart contracts. A deterministic smart contract means that given the same input and in the same initial state, all nodes will get the same result when executing the smart contract. A transaction that invokes a deterministic smart contract is a deterministic transaction. A non-deterministic smart contract means that given the same input and in the same initial state, different nodes may get different results when executing the smart contract. A transaction that invokes a non-deterministic smart contract is a non-deterministic transaction.
  • HLF hyperledger fabric
  • its derived blockchain networks can support non-deterministic transactions (that is, non-deterministic transactions will not cause state inconsistencies between nodes ). If the node obtains different execution results during the execution of non-deterministic transactions, the node considers the transaction invalid and does not write the execution results to the local state database.
  • HLF identifies non-deterministic transactions as bugs in smart contracts, and can effectively prevent state inconsistencies caused by these bugs.
  • the nodes in the blockchain network also maintain a state database for storing each transaction in the blockchain. After the smart contract is executed, the node will modify the value of some variables in the state database. If the smart contract called by two transactions reads and writes the value of the same variable, the two transactions are considered to be dependent on each other.
  • the first, execution-sorting workflow; the second, sorting-execution workflow the multiple nodes include endorsement nodes, sorting nodes, and common nodes.
  • the specific workflow process includes: 1) Endorsement: a. The client device sends transaction information to N endorsement nodes; b. After each endorsement node receives the transaction information, it first verifies the client signature of the transaction information, then executes the smart contract corresponding to the transaction information, and signs the execution result as an endorsement and replies to the client device; c.
  • the ordering node receives the transaction information of the successful endorsement sent by the client device, and agrees on the multiple received transaction information 3) Verification: endorsement nodes and ordinary nodes verify each transaction information in the block; 4) submission: endorsement nodes and ordinary nodes will store the successfully verified blocks and endorsements accordingly, and Complete the submission.
  • the multiple nodes include sorting nodes and ordinary nodes.
  • the specific workflow process includes: 1) Sorting: sorting nodes perform consensus packaging on multiple received transaction information to obtain blocks, and The block is sent to the common node; 2) Execution: the sorting node and the common node execute the multiple transaction information according to the order of the multiple transaction information in the block; The transaction execution result and the block are stored accordingly to complete the submission.
  • the sorting phase and the execution phase are executed serially, resulting in a long delay in the processing of transaction information.
  • the transaction information has not been sorted in the endorsement stage, and different transaction information is executed independently, so that multiple transaction information with dependencies may enter the sorting stage. It will cause the transaction information that is ranked behind to be considered as an invalid transaction, thereby reducing the processing efficiency of the transaction information.
  • the embodiment of the present application provides a method for processing transaction information, which can parallelize the two stages of sorting and execution of transaction information in the processing process, thereby greatly reducing the confirmation delay of transaction information and improving the processing efficiency of transaction information .
  • the method can be applied to a data center network, and the data center network can include a single data center or multiple data centers connected by dedicated lines.
  • the data center network may also be referred to as a blockchain network or a blockchain system.
  • the data center network may include multiple nodes, and the multiple nodes may include three types: master consensus nodes, slave consensus nodes, and ordinary nodes, and the number of the slave consensus nodes and the ordinary nodes may be multiple.
  • the data center network has a multicast function, and the network delay between any two nodes in the data center network satisfies the triangle inequality characteristic.
  • the triangle inequality characteristic may refer to: the sum of the communication delay L ij between node i and node j and the communication delay L jk between node j and node k is greater than the communication delay Li ik between node i and node k (that is, L ij +L jk >L ik ), node i, node j and node k are any three nodes in the data center network.
  • Figure 4 is a schematic flow diagram of a method for processing transaction information provided by an embodiment of the present application.
  • the method is applied to a blockchain network, and the blockchain network includes a master consensus node, a slave consensus node, and a plurality of common nodes.
  • the method include the following steps.
  • S201 The main consensus node receives multiple transaction information.
  • the blockchain network may include multiple consensus nodes, and the multiple consensus nodes may include a master consensus node and multiple slave consensus nodes, and the master consensus node may be the slave consensus node of the multiple consensus nodes according to certain rules or principles.
  • a consensus node selected from the plurality of consensus nodes, the plurality of slave consensus nodes may be other consensus nodes in the plurality of consensus nodes except the master consensus node.
  • the master consensus node may be a consensus node selected by the plurality of consensus nodes according to the master node switching protocol, and the plurality of consensus nodes may be a consensus node selected according to the master node switching protocol at intervals.
  • the main consensus node can be assumed by different consensus nodes in different time periods.
  • each transaction information may represent a transaction (or referred to as a transaction transaction or a transaction event), and each transaction information may include one or more pieces of information related to the transaction.
  • the transaction information may be in the form of a header (header), for example, the transaction information may be expressed in the form of (from, to, value), the from may represent the source client information that initiated the transaction, the to can indicate the information of the destination client receiving the transaction, and the value can indicate the transaction amount corresponding to the transaction.
  • the master consensus node may receive a plurality of transaction information from at least one client device, and the at least one client device may directly or indirectly send the plurality of transaction information to the master consensus node, and the plurality of transaction information It can be multiple consecutive transaction information received by the master consensus node within a period of time.
  • the at least one client device may include one or more client devices capable of implementing transactions through the blockchain network.
  • the multiple client devices may be multiple client devices corresponding to the same client (also referred to as the same organization), or may be different clients (also known as the same organization). can be referred to as multiple devices corresponding to different organizations).
  • the above-mentioned client device may refer to an electronic device installed with a client, and a user can log in to the client and conduct transactions through the client.
  • the master consensus node For each transaction information in the plurality of transaction information, the master consensus node sends transaction instruction information to the slave consensus node and the common node respectively, the transaction instruction information includes the transaction information and a sequence index, and the sequence index is used to indicate The order in which the transaction information is arranged in the consensus process.
  • the master consensus node can sort the plurality of transaction information according to the receiving order of the plurality of transaction information, and the arrangement order of a transaction information in the plurality of transaction information can be represented by a sequence index.
  • the sequence of the plurality of transaction information in the subsequent consensus process may be consistent with the corresponding receiving sequence of the plurality of transaction information.
  • the master consensus node when the master consensus node receives any one of the multiple transaction information, the master consensus node can add a sequence index to the transaction information to obtain a transaction indication information, the sequence index can be a sequence number, The sequence number may be used to indicate the order in which the transaction information is received among the plurality of transaction information.
  • the master consensus node can send the transaction instruction information to multiple slave consensus nodes and multiple common nodes in the blockchain network respectively, for example, the master consensus node can broadcast to the multiple slave consensus nodes and The multiple common nodes send the transaction indication information.
  • the master consensus node sends a plurality of transaction instruction information to the plurality of slave consensus nodes and the plurality of common nodes respectively.
  • the at least one client device may include a first client device (for example, a device that installs shopping apps such as Taobao, JD.com, and Tmall), a second client device (for example, a device that installs payment apps such as Alipay and WeChat) and third client devices (for example, according to various banking apps), the multiple transaction information may include transaction information A (V.Tom) initiated by the first client device B.Ray$400), the transaction information B initiated by the second client device (expressed as P.Max B.Amy$1M), and the transaction information C (B.Bob P.Sam$100) initiated by the third client device, And the order in which the consensus node receives the plurality of transaction information is: transaction information C, transaction information A, and transaction information B.
  • V.Tom transaction information initiated by the first client device B.Ray$400
  • the transaction information B initiated by the second client device (expressed as P.Max B.Amy$1M)
  • the transaction information C (B.Bob P.Sam
  • the main consensus node When the main consensus node receives the transaction information C, the main consensus node can add the sequence number 1 to the transaction information C to obtain the transaction instruction information C'(1 B.Bob P.Sam$100), and broadcast the transaction instruction information C' ;
  • the main consensus node When the main consensus node receives the transaction information A, the main consensus node can add the serial number 2 to the transaction information A to obtain the transaction instruction information A'(2 V.Tom B.Ray$400), and broadcast the transaction instruction information A ';
  • the master consensus node receives transaction information B, the master consensus node can add sequence number 3 to transaction information B to obtain transaction instruction information B'(3 P.Max B.AMY$1M), and broadcast the transaction instruction Information B'.
  • the order of multiple transaction instruction information sent by the master consensus node to the plurality of slave consensus nodes and the plurality of common nodes is as follows: transaction instruction information C', transaction instruction information A', transaction instruction information B '.
  • the consensus stage and the execution stage can be executed in parallel according to the process described below.
  • the sequence index in each transaction indication information is not signed, that is, the master consensus node does not sign the sequence index.
  • the master consensus node does not sign the sequence number.
  • other nodes do not need to perform signature verification on the sequence index when receiving the transaction indication information, thereby reducing the performance overhead of other nodes.
  • not signing this sequential index also prevents malicious nodes from exhausting other nodes' computing resources. For example, a malicious node can broadcast a large number of illegal transaction instruction information, and each transaction instruction information carries an illegal signature, so that other nodes can only confirm that the corresponding signature is not correct after verifying the signatures in these transaction instruction information. legal, thus exhausting the computing resources of the other nodes.
  • S203a When the transaction instruction information corresponding to the plurality of transaction information is received from the consensus node, the master consensus node and the slave consensus node agree on the plurality of transaction information according to the sequence index of the plurality of transaction information to obtain the first block, And send the first block to the normal node.
  • the slave consensus node can receive multiple transaction indication information, that is, the slave consensus node can receive the transaction indication information corresponding to the multiple transaction information, and according to the The plurality of transaction instruction information can obtain the plurality of transaction information and the sequence index corresponding to each transaction information in the plurality of transaction information.
  • the master consensus node and the plurality of slave consensus nodes can consensus and package the plurality of transaction information according to the sequence index of the plurality of transaction information to obtain the first block.
  • the master consensus node and the multiple slave consensus nodes can respectively call the BFT protocol to reach a consensus on the content and order of the multiple transaction information, and share the multiple transaction information and the transaction hash value generated during the consensus process.
  • the slave consensus node can add the first block to the blockchain, and can also send the first block to each of the plurality of common nodes.
  • the slave consensus node may include a consensus module, through which the plurality of transaction information is consensused to obtain a block, the first block is added to the block chain, and the first Blocks are sent to normal nodes.
  • the first block includes a plurality of transaction hash values
  • the plurality of transaction hash values correspond to the plurality of transaction information
  • the plurality of transaction hash values may be the master consensus node in the plurality Generated during the consensus process of transaction information.
  • the master consensus node can send the plurality of transaction hash values to each of the plurality of slave consensus nodes, and the plurality of transaction hash values can be sent to each slave consensus node in the form of a hash value list .
  • each slave consensus node receives the multiple transaction hash values, it can determine whether to obtain the transaction corresponding to each transaction hash value in the multiple transaction hash values according to the multiple transaction hash values information.
  • each slave consensus node will locally generate a transaction hash value corresponding to each transaction information in the multiple transaction information (hereinafter referred to as a local transaction hash value) ; If each transaction hash value in the given hash value list has the same local transaction hash value, then the slave consensus node can confirm that it has obtained multiple transaction information sent by the master consensus node; if At least one transaction hash value in the fixed hash value list does not have the same local transaction hash value, then the slave consensus node can determine that the transaction information corresponding to the at least one transaction hash value has not been obtained, that is, the slave The consensus node has not obtained at least one transaction information.
  • a local transaction hash value a transaction hash value corresponding to each transaction information in the multiple transaction information
  • the slave consensus node when the slave consensus node determines that at least one transaction information in the plurality of transaction information has not been obtained according to the plurality of transaction hash values, the slave consensus node can report to the master consensus The node sends an acquisition request, where the acquisition request is used to request to acquire the at least one piece of transaction information.
  • the master consensus node receives the acquisition request, the master consensus node sends at least one transaction indication information to the slave consensus node, and the at least one transaction indication information includes the at least one transaction information and each transaction information in the at least one transaction information Sequential index of transaction information. This can ensure that the slave consensus node can obtain the above multiple transaction information.
  • S203b When the ordinary node receives the transaction instruction information corresponding to the plurality of transaction information, the ordinary node executes the plurality of transaction information according to the sequence index of the plurality of transaction information. S203a and S203b can be executed in parallel (or called simultaneous execution). In FIG. 4, S203b is located before the first block is sent from the consensus node as an example for illustration.
  • the ordinary node can receive a plurality of transaction instruction information, that is, the ordinary node can receive the transaction instruction information corresponding to the plurality of transaction information, and according to the plurality of transaction instruction information The information can acquire the plurality of transaction information and the sequence index corresponding to each transaction information in the plurality of transaction information. Afterwards, the ordinary node can execute the plurality of transaction information according to the sequence index of the plurality of transaction information. For example, the ordinary node can execute the smart contract corresponding to the transaction information related to itself in the plurality of transaction information to obtain the corresponding transaction execution result, so that multiple transaction execution results can be correspondingly obtained by executing the plurality of transaction information.
  • the transaction information related to each common node may refer to the transaction information corresponding to the client device of the organization (or client) to which the common node belongs or corresponds. For example, for transaction information T (A transfers 10 yuan to B), the transaction information needs to be executed by ordinary nodes corresponding to the organizations to which A and B belong. In addition, multiple nodes in the same organization trust each other, so each organization can designate a common node to execute the transaction information corresponding to the organization and sign the transaction execution result.
  • the ordinary node when the ordinary node executes the plurality of transaction information according to the sequence index of the plurality of transaction information, the ordinary node may execute the transaction information without dependencies in parallel, and execute the transaction information with dependencies in serial.
  • the ordinary node can infer the dependency relationship between transaction information according to prior knowledge.
  • the smart contract corresponding to each transaction information can mark the list of variables that the smart contract may need to read and write during operation, so that the ordinary node can infer the transaction information according to the input of the transaction information and the smart contract called dependencies between. If two transaction information need to modify the same variable, it can be considered that the two transaction information depend on each other, so they need to be executed serially according to the corresponding sequence index.
  • T1 and T2 call the transfer smart contract
  • the transfer smart contract is defined as transfer(from, to, money ), and marked the list of variables that need to be read and written as [from, to], that is, the two variables from and to (save the account balance) will be modified during the operation.
  • ordinary nodes can judge that T1 and T2 depend on each other according to the input of T1 and T2 and the read-write list defined by the smart contract, and execute the two transactions serially.
  • the smart contract can be a piece of code that completes specific functional logic, and only defines the control flow. All variables that need to be read and written during its operation can be marked or specified in the transaction information.
  • the common node receives the first block, and verifies the consistency between the multiple transaction hash values in the first block and the multiple transaction hash values obtained by locally executing the multiple transaction information.
  • the ordinary node taking the execution of the plurality of transaction information by the ordinary node as an example, the ordinary node will locally generate a transaction hash value corresponding to each transaction information in the plurality of transaction information during the execution of the plurality of transaction information (see below This article is referred to as the local transaction hash value), that is, the common node can obtain multiple local transaction hash values. If each of the multiple transaction hash values in the first block has an identical local transaction hash value, then the ordinary node can determine the multiple transaction hash values in the first block Consistent with multiple local transaction hashes. If the multiple transaction hash values in the first block are inconsistent with the multiple local transaction hash values, the common node can re-execute the multiple transaction information in the first block.
  • the local transaction hash value corresponding to each transaction information in the plurality of transaction information during the execution of the plurality of transaction information
  • the ordinary node when the ordinary node executes the corresponding transaction information to obtain the transaction execution result, the ordinary node can send the transaction execution result to multiple consensus nodes (including only the slave consensus nodes, or both the master consensus node and the slave consensus nodes ), the plurality of consensus nodes can send response information ACK to the common node, and the response information ACK is used to confirm that the transaction execution result is received successfully.
  • the blockchain network includes 3f+1 consensus nodes, the ordinary node can send the transaction execution result to 2f+1 consensus nodes, and the 2f+1 consensus nodes can send a response to the ordinary node information ACK, so that the common node can receive 2f+1 response information ACK.
  • the common node and the plurality of consensus nodes may store the plurality of transaction information and corresponding transaction execution results locally, and the common node may also store the plurality of transaction execution results in a state database.
  • the common node may include an execution module and a confirmation module, through which the execution module executes the plurality of transaction information, and after the confirmation module receives 2f+1 acknowledgment information ACK, the first Blocks are added to the blockchain, and the transaction execution results of the multiple transaction information are stored in the state database.
  • the blockchain network may include a master consensus node C0, slave consensus nodes C1 to C4, and common nodes N1 to N4.
  • the method specifically includes the following steps: S11. Multiple client devices UE0 to UEN send transaction information to the main consensus node C0 respectively, for example, the sent transaction information includes Ti, Tj and Tk; S12.
  • the main consensus node C0 adds a serial number to each transaction information and sends them to the consensus nodes C1 to C4 and ordinary nodes N1 to N4 respectively.
  • the order of the above multiple transaction information determined according to the serial number is 3Tk, 2Ti, 1Tj; S13a. From the consensus node C1 To C4 consensus on the received transaction information (for example, verification and transaction hash value of consensus transaction information) and packaging to obtain the first block, and send the first block to ordinary nodes N1 to N4; S3b. Ordinary nodes N1 to N4 verify the signature of each transaction information and execute the transaction information; S14. Ordinary nodes N1 to N4 receive the first block, and verify the transaction information based on the transaction hash value of each transaction information, and send The corresponding transaction execution results are stored in the local database. In FIG.
  • the nodes related to the transaction information Ti include N1 and N2
  • the nodes related to the transaction information Tj include N1 and N3
  • the nodes related to the transaction information Tk include N2 and N3.
  • S3a and S3b in the above steps are executed in parallel, and S13a can be called the sorting phase, S13b can be called the execution phase, and S14 can be called the commit (or confirmation) phase.
  • FIG. 7 shows the relationship between the above multiple stages, that is, the sorting stage and the execution stage are executed in parallel, and the submission stage is executed after the sorting stage and the execution stage are completed.
  • each transaction indication information includes a transaction information and a sequence index
  • the sequence index is used to indicate the sequence of the transaction information in the consensus process, so that when the multiple transaction indication information is received from the consensus node and the common node, the master consensus node and the slave consensus node can Sequential index consensus on the multiple transaction information, and the ordinary node can execute the multiple transaction information according to the sequence index of the multiple transaction information, so that the consensus and execution of the multiple transaction information can be executed in parallel, thereby reducing the transaction information. Processing time delay, improving the execution efficiency of transaction information.
  • the embodiment of the present application can also realize the monitoring of malicious nodes (for example, the main consensus node is a malicious node), so as to avoid the decline of the overall performance of the blockchain network due to the malicious behavior of the malicious nodes.
  • malicious nodes for example, the main consensus node is a malicious node
  • the master consensus node can send different transaction information to different slave consensus nodes so that the consensus cannot be reached, or the master consensus node sends transaction information to one or more nodes after delaying for a period of time, or the master consensus node sends transaction information to one or more nodes A node sends wrong transaction information, etc.
  • the slave consensus node monitors the behavior of the master consensus node, and switches the master consensus node when malicious behavior of the master consensus node is detected, so as to avoid the influence of malicious nodes on the performance of the blockchain network.
  • the slave consensus node can obtain the performance parameters in the process of transaction information processing, and when the performance parameters meet the first preset condition, the slave consensus node Triggering the switching process of the master consensus node can also be called the switching process of the slave consensus node initiating the master consensus node.
  • the master consensus node can also be executed in a manner similar to the above, and in the embodiment of this application, the slave consensus node is taken as an example for illustration.
  • the performance parameter includes at least one of the following: consensus throughput, transaction delay, and number of transaction conflicts.
  • the consensus throughput meeting the first preset condition includes that the consensus throughput is less than the preset throughput;
  • the transaction delay meeting the first preset condition includes that the transaction delay is greater than the preset delay;
  • the number of transaction conflicts satisfies
  • the first preset condition includes that the number of transaction conflicts is greater than the first preset number.
  • a slave consensus node initiates a master consensus node switching process may include: the slave consensus node broadcasts a master consensus node switch (view change) message to other consensus nodes. If any slave consensus node receives 2f+1 master consensus node switching messages, it means that 2f+1 slave consensus nodes initiate master consensus node switching, so that the slave consensus node can call the master node switching protocol of the BFT protocol To replace the current master consensus node.
  • the slave consensus node when the slave consensus node detects that the consensus throughput is less than the preset throughput, it can be considered that the performance of consensus sorting or transaction execution has declined, so that the slave consensus node can trigger the switching process of the master consensus node to switch The master consensus node.
  • the performance degradation of consensus sorting or transaction execution means that the current master consensus node may send different transaction information to different nodes, or delay the transaction information sent to some nodes.
  • each slave consensus node can monitor its own consensus throughput. If the current consensus throughput is lower than 90% of the previously observed highest consensus throughput, the slave consensus node can Initiate the switching process of the main consensus node.
  • each slave consensus node in order to detect performance degradation in transaction execution, can detect whether the transaction hash value in the transaction execution result sent by the common node and the transaction hash value of the transaction information under consensus Similarly, if the two transaction hash values are different, it means that the master consensus node may have sent wrong transaction information to the common node.
  • each slave consensus node can also detect the delay of the transaction execution result sent by the common node. If a slave consensus node has not received the transaction execution result within a period of time after completing the transaction information consensus, it means that the master consensus node may After delaying the transaction information sent to ordinary nodes, the slave consensus node can initiate the switching process of the master consensus node.
  • the slave consensus node determines that a certain transaction information has not been processed within the preset time period or the master consensus node abstains before the next master consensus node switch, the slave consensus node triggers the switch process of the master consensus node.
  • the client device that initiates a certain transaction information does not receive the reply information within the preset time period, the client device can send the transaction information to multiple consensus nodes, so that the slave consensus node can determine that the transaction information is in the not processed.
  • the slave consensus node when the slave consensus node detects that the master consensus node has not added the transaction information initiated by a certain client device to the block chain, the slave consensus node can initiate a switching process of the master consensus node.
  • a malicious master consensus node may deliberately not add transaction information from a certain client to the block (also known as joining the blockchain). In this way, if the client device determines that its own transaction information cannot be added to the blockchain, the client device can send the transaction information to multiple slave consensus nodes. The multiple consensus nodes then forward the transaction information to the current master consensus node. If the master consensus node still does not add the transaction information to the blockchain, it means that the master consensus node is a malicious node, so the slave consensus node can initiate the switching process of the master consensus node.
  • the slave consensus node can Initiate the switching process of the main consensus node. For example, during the switching process of the master consensus node, the switching period of each master consensus node is T. If the current master consensus node relinquishes sovereignty at T/2, the slave consensus node can initiate the master consensus node switching process.
  • the client device when it is determined from the consensus node or common node that the number of transaction conflicts of the transaction information of a certain client device in at least one continuous switching cycle is greater than the second preset number of times, the client device is set as a blacklist.
  • the switching period may refer to a switching period of the main consensus node, and each switching period in the at least one switching period corresponds to a different main consensus node.
  • the second preset number of times may be set in advance.
  • the main consensus node in the embodiment of the present application does not sign the serial number of the transaction information, so that malicious nodes can forge the transaction information sent by the main consensus node at will.
  • a malicious node can generate one or more transaction information, assign a fake serial number to these transaction information, and then send the fake transaction information to other nodes.
  • These falsified transaction information will cause transaction conflicts on other nodes (for example, two different transaction information have the same sequence number), so that other nodes cannot infer execution based on the sequence number (for example, do not know which transaction should be information shall prevail).
  • the above transaction conflict can be understood as: For a certain serial number, if a transaction hash value obtained from the consensus node’s local consensus on the transaction information corresponding to the serial number and the transaction information corresponding to the serial number generated by the main consensus node during the consensus process If the hash value of the transaction is inconsistent, the two transaction information is considered to be in conflict.
  • malicious nodes have the following characteristics: malicious nodes can only maliciously broadcast their own transaction information; malicious master consensus nodes may cause undetectable conflicts.
  • malicious master consensus nodes may cause undetectable conflicts. The specific analysis is as follows.
  • a malicious node may cause transaction conflicts in two ways.
  • Type 1 Malicious nodes conduct malicious attacks by maliciously broadcasting transaction information of other nodes, which is not feasible. In this attack, the malicious node modifies the serial number of the transaction information T sent by the master consensus node to generate a forged transaction information T', and forwards it to other nodes. Since the data center network satisfies the characteristics of the triangle inequality, other nodes will first receive the transaction information T, and then receive the transaction information T' (because T' is forwarded by malicious nodes after receiving the transaction information T), so other nodes will directly The fake transaction information T' is discarded (because the two transaction information have the same hash value).
  • Type 2 Malicious nodes broadcast their own transaction information maliciously, which can be detected in this way. In this attack, since the transaction information generated by the malicious node has its own valid signature, other nodes can judge the malicious node according to the signature of the client that received the transaction information.
  • the specific analysis of the undetectable conflicts caused by a malicious master consensus node is as follows: If the master consensus node is a malicious node, the master consensus node can cause arbitrary transaction conflicts, and there is no observable rule. At this point, if the total number of consensus nodes in the blockchain network is 3f+1, transaction conflicts can be detected in f+1 different views (corresponding to different master consensus nodes).
  • the transaction information received by the main consensus node from a certain client conflicts with the transaction information of multiple consensus nodes in the block of the consensus process (for example, the number of conflicts is greater than the second preset times), it can be suspected that the transaction information received locally from the consensus node is malicious.
  • the specific reasons are as follows: 1. For each sequence number, the first transaction information received is retained from the consensus node; 2. The master consensus node first broadcasts each transaction information, and then reaches a consensus on the hash list of transaction information; 3.
  • a malicious node If a malicious node is also maliciously broadcasting transaction information, it will occupy a certain serial number of the slave consensus node, resulting in inconsistent transaction information between the serial number on the slave consensus node and the corresponding serial number of the master consensus node (for example, the transaction hash value is inconsistent ). At this time, the conflict may be caused by a malicious master consensus node, or it may be caused by a malicious node randomly sending forged transaction information. Therefore, multiple consensus nodes can first add the client device (eg, client account) to the suspicion list, and continuously monitor the malicious behavior of the client device in multiple views.
  • client device eg, client account
  • the client can be determined The device is malicious.
  • the multiple consensus nodes can blacklist the malicious client device, and the transaction information initiated by the malicious client device will also be directly ignored by all nodes.
  • the transaction information sent by the malicious client device may be randomly divided into different views, that is, malicious Nodes cannot precisely control in which view (corresponding to different master consensus nodes) they cause conflicts. Therefore, the detection method of the above-mentioned malicious node can always add the malicious client device to the blacklist eventually.
  • FIG. 8 shows the relationship between throughput and acknowledgment delay corresponding to BIDL, FF, and SC, in which BIDL has the highest throughput, FF has the second highest throughput, SC has the lowest throughput, and SC has the lowest acknowledgment delay ,
  • the confirmation delay of BIDL is second, and the confirmation delay of FF is the largest.
  • FIG. 8 shows the relationship between the proportion of non-deterministic transactions and effective throughput under non-deterministic transactions of BIDL and FF, and the relationship between the proportion of conflicting transactions and effective throughput under conflicting transactions Relationship.
  • the effective throughput of BIDL that is, curve S1
  • the effective throughput of FF that is, curve S2
  • the effective throughput of BIDL is always higher than that of FF quantity.
  • the effective throughput of FF decreases slowly, because non-deterministic transactions in FF will be discovered earlier and deemed illegal in advance, and the client device can quickly submit the next transaction information.
  • BIDL can only discover non-deterministic transactions in the last stage and determine that they are illegal.
  • the client device must wait for the transaction information to go through the entire workflow before submitting the next transaction information.
  • the effective throughput of BIDL ie, curve S3
  • the effective throughput of FF drops significantly (ie, curve S4).
  • FF the transaction information has no order in the execution stage, and each node can only execute all transaction information independently, which leads to the execution results of a large number of transaction information being considered invalid.
  • BIDL will sequentially execute the conflicting transaction information according to the sequence number of the transaction information in the inference execution phase, so all transaction execution results are valid.
  • the embodiment of the present application also compares the effective throughput of BIDL, hyperledger fabric (HLF), FF and SC in the three scenarios of no malicious nodes, malicious main consensus nodes and malicious non-main consensus nodes respectively.
  • the test was carried out, and the specific results are shown in Table 1 below. According to Table 1, it can be seen that the BIDL provided by the embodiment of this application can maintain the parallelism between the consensus phase and the execution phase when malicious master consensus nodes and malicious non-master consensus nodes exist, so that the effective throughput is relatively high.
  • the method provided by the embodiment of the application has the advantage of high performance. kTxns/s represents the number of transaction information executed in thousands per second.
  • the client The device is added to the blacklist to ignore the transaction information of the client device, which can ensure the parallelism of the consensus phase and the execution phase in the case of malicious nodes in the blockchain network, thereby further improving the blockchain network performance.
  • the master consensus node, slave consensus node and common node include Corresponding hardware structures and/or software modules for performing various functions.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software in combination with the units and algorithm steps of each example described in the embodiments disclosed herein. Whether a certain function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
  • the embodiment of the present application can divide the functional modules of the master consensus node, slave consensus node and common node according to the above method example, for example, each functional module can be divided corresponding to each function, or two or more functions can be integrated in one in a processing module.
  • the above functional modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 9 shows a possible structural diagram of the transaction information processing device involved in the above embodiment, and the device can serve as the main consensus node.
  • the device includes: a receiving unit 301 , a sending unit 302 and a processing unit 303 .
  • the receiving unit 301 is used to support the device to perform S201 in the above method embodiment
  • the sending unit 302 is used to support the device to perform S202 in the above method embodiment, to send multiple transaction hash values to the slave consensus node, or to The common node sends one or more steps in the first block
  • the processing unit 303 is configured to support the device to execute S203a in the above method embodiment.
  • the processing unit 303 in the embodiment of the present application can be the processor of the device, the sending unit 302 can be the transmitter of the device, and the receiving unit 301 can be the receiver of the device.
  • the transmitter usually It can be integrated with the receiver as a transceiver, and the specific transceiver can also be called a communication interface or an interface circuit.
  • FIG. 10 it is a schematic diagram of another possible structure of the transaction information processing device involved in the above-mentioned embodiment provided by the embodiment of the present application, and the device can serve as the main consensus node.
  • the device includes: a processor 311 , and may further include a memory 312 , a communication interface 313 and a bus 314 , and the processor 311 , the memory 312 and the communication interface 313 are connected through the bus 314 .
  • the processor 311 is used for controlling and managing the actions of the device.
  • the processor 311 may be configured to support the device to execute S203a in the above method embodiment, and the steps of sending or receiving different information through the communication interface 313 .
  • the communication interface 313 is used to support the device to communicate, for example, to support the device to communicate with the slave consensus node and the common node.
  • the processor 311 may be a central processing unit, a general processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or other random combination. It can implement or execute the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • peripheral component interconnect standard peripheral component interconnect, PCI
  • extended industry standard architecture extended industry standard architecture, EISA
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the above-mentioned Fig. 10, but it does not mean that there is only one bus or one type of bus.
  • FIG. 11 shows a possible structural diagram of the transaction information processing device involved in the above embodiment, and the device can serve as a slave consensus node.
  • the device includes: a receiving unit 401 , a processing unit 402 and a sending unit 403 .
  • the receiving unit 401 is used to support the device to perform the steps of receiving transaction instruction information, receiving multiple transaction hash values, receiving transaction execution results and other steps in the above method embodiment;
  • the processing unit 402 is used to support the device to perform the steps in the above method embodiment S203a, and/or other technical processes described herein;
  • the sending unit 403 is used to support the device to execute steps such as sending the first block or sending response information in the above method embodiments.
  • the processing unit 402 in the embodiment of the present application may be the processor of the device, the receiving unit 401 may be the receiver of the device, and the sending unit 403 may be the transmitter of the device, and the transmitter and
  • the receivers can usually be integrated together as a transceiver, and a specific transceiver can also be called a communication interface or an interface circuit.
  • FIG. 12 it is a schematic diagram of another possible structure of the transaction information processing device involved in the above-mentioned embodiment provided by the embodiment of the present application, and the device can serve as a slave consensus node.
  • the device includes: a processor 411 , and may further include a memory 412 , a communication interface 413 and a bus 414 , and the processor 411 , the memory 412 and the communication interface 413 are connected through the bus 414 .
  • the processor 411 is used for controlling and managing the actions of the device.
  • the processor 411 may be configured to support the device to execute S203a in the above method embodiment, and the steps of sending or receiving different information through the communication interface 413 .
  • the communication interface 413 is used to support the device to communicate, for example, to support the device to communicate with the main consensus node and common nodes.
  • the processor 411 may be a central processing unit, a general processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or other random combination. It can implement or execute the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the above-mentioned bus 414 in FIG. 12 may be a PCI bus or an EISA bus or the like.
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the above-mentioned FIG. 12 , but it does not mean that there is only one bus or one type of bus.
  • FIG. 13 shows a possible structural diagram of the transaction information processing device involved in the above embodiment, which can be used as a common node.
  • the device includes: a receiving unit 501 , a processing unit 502 and a sending unit 503 .
  • the receiving unit 501 is used to support the device to perform steps such as receiving transaction instruction information, receiving the first block, and receiving response information in the above method embodiment
  • the processing unit 502 is used to support the device to perform S203b in the above method embodiment, and/or other technical processes described herein
  • the sending unit 503 is configured to support the device to perform steps such as sending transaction execution results in the above method embodiments.
  • the processing unit 502 in the embodiment of the present application may be the processor of the device, the receiving unit 501 may be the receiver of the device, and the sending unit 503 may be the transmitter of the device, and the transmitter and
  • the receivers can usually be integrated together as a transceiver, and a specific transceiver can also be called a communication interface or an interface circuit.
  • FIG. 14 it is a schematic diagram of another possible structure of the transaction information processing device involved in the above-mentioned embodiment provided by the embodiment of the present application, and the device can be used as a common node.
  • the device includes: a processor 511 , and may further include a memory 512 , a communication interface 513 and a bus 514 , and the processor 511 , the memory 512 and the communication interface 513 are connected through the bus 514 .
  • the processor 511 is used to control and manage the actions of the device.
  • the processor 511 may be configured to support the device to execute S203b in the above method embodiment and the steps of sending or receiving different information through the communication interface 513 .
  • the communication interface 513 is used to support the device to communicate, for example, to support the device to communicate with the master consensus node and common nodes.
  • the processor 511 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components, or other random combination. It can implement or execute the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the above-mentioned bus 514 in FIG. 14 may be a PCI bus or an EISA bus or the like.
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the above-mentioned FIG. 14 , but it does not mean that there is only one bus or one type of bus.
  • the embodiment of the present application also provides a blockchain network, which includes a master consensus node, a slave consensus node, and a common node.
  • the master consensus node, slave consensus node and common node can be used to implement any transaction information processing method provided in the foregoing embodiments.
  • each device (such as a terminal and/or network device) provided in the embodiments of the present application is used to perform the functions of the corresponding devices in the above embodiments, so the same effect as the above communication method can be achieved.
  • the functions or actions or operations or steps in the above embodiments may be fully or partially implemented by software, hardware, firmware or any combination thereof.
  • a software program When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server, or data center Transmission to another website site, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or may include one or more data storage devices such as servers and data centers that can be integrated with the medium.
  • the available medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (solid state disk, SSD)), etc.
  • an embodiment of the present application further provides a computer-readable storage medium, the computer-readable storage medium includes computer instructions, and when the computer instructions are executed, the steps of the master consensus node in the method embodiments are executed.
  • a computer-readable storage medium includes computer instructions, and when the computer instructions are executed, the steps of the slave consensus node in the above method embodiments are executed.
  • a computer-readable storage medium includes computer instructions, and when the computer instructions are executed, the steps of the common nodes in the above method embodiments are executed.
  • a computer program product containing instructions which, when run on a computer, enables the computer to execute the steps of the master consensus node in the above method embodiments.
  • a computer program product containing instructions is provided, and when it is run on a computer, the computer can execute the steps of the slave consensus node in the above method embodiments.
  • a computer program product containing instructions which, when run on a computer, enables the computer to execute the steps of the common nodes in the above method embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Marketing (AREA)
  • Signal Processing (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请提供一种交易信息处理方法,涉及通信技术领域,用于降低交易信息的处理时延。该方法应用于包括主共识节点、从共识节点和普通节点的区块链网络中,包括:该主共识节点接收多个交易信息;对于该多个交易信息中的每个交易信息,该主共识节点分别向该从共识节点和该普通节点发送交易指示信息,该交易指示信息包括该交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序;当该从共识节点接收到上述交易指示信息时,该从共识节点和该主共识节点根据该多个交易信息的该顺序索引,共识该多个交易信息以得到第一区块;并行地,当该普通节点接收上述交易指示信息时,该普通节点根据该顺序索引执行该多个交易信息。

Description

一种交易信息处理方法及装置
本申请要求于2021年09月15日提交国家知识产权局、申请号为202111080651.2、申请名称为“一种交易信息处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种交易信息处理方法及装置。
背景技术
区块链(blockchain)是一种多节点共同维护的分布式账本,采用一种特殊的数据结构“区块”来记录交易。每个区块可以包括三个组成部分:前一个区块的哈希值、一定数量且有序排列的交易、共识协议附加的元数据。因为每个区块存储前一个区块的哈希值,形成一个链状结构,修改链中间的区块会导致后续区块的哈希值不一致,这种机制保证了区块链上区块很难被篡改,从而受到人们越来越多的重视和应用。
目前,为了保证区块链网络中的多个节点能够按照同样的顺序执行同样的交易,通常采用以下两种工作流来工作:第一种、执行-排序工作流;第二种、排序-执行工作流。在第一种工作流中,该多个节点包括背书节点、排序节点和普通节点三种,具体工作流过程如图1中的(a)所示,包括:背书节点对客户端设备发送的交易信息进行背书(简称背书),即对该交易信息进行验证和执行,并将交易执行结果作为背书发送给客户端设备;排序节点接收客户端设备发送的背书成功的交易信息,并对接收到的多个交易信息进行共识打包得到区块(简称排序);背书节点和普通节点对该区块中的每个交易信息进行验证(简称验证);背书节点和普通节点将验证成功的区块和背书进行相应的存储,以完成提交(简称提交)。在第二种工作流中,该多个节点包括排序节点和普通节点两种,具体工作流过程如图1中的(b)所示,包括:排序节点对接收到的多个交易信息进行共识打包得到区块(简称排序),并将该区块发送给普通节点;排序节点和普通节点按照该多个交易信息在区块中的顺序执行该多个交易信息(简称执行);所有节点分别对该多个交易信息的交易执行结果和该区块进行相应的存储,以完成提交(简称提交)。
上述两种工作流中,排序阶段和执行阶段(第一种工作流中的执行阶段包括背书和验证)是串行执行的,从而导致交易信息的处理时延较长。此外,在上述第一种工作流中,交易信息在背书阶段时还没有被排序,且不同的交易信息之间是独立执行的,这样存在依赖关系的多个交易信息在进入排序阶段后,可能会导致排在后面的交易信息被认为是无效交易,从而降低了交易信息的处理效率。
发明内容
本申请提供一种交易信息处理方法及装置,解决了现有技术中交易信息的处理时延长、处理效率低的问题。
为达到上述目的,本申请采用如下技术方案:
第一方面,提供一种交易信息处理方法,应用于区块链网络中,该区块链网络包 括主共识节点、从共识节点和普通节点,该方法包括:该主共识节点接收来自至少一个客户端设备的多个交易信息;对于该多个交易信息中的每个交易信息,该主共识节点分别向该从共识节点和该普通节点发送交易指示信息,该交易指示信息包括该交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,比如该顺序索引可以为序列号;该主共识节点根据该多个交易信息的该顺序索引,共识该多个交易信息以得到第一区块。
上述技术方案中,当该主共识节点在接收到多个交易信息时,可以分别向从共识节点和普通节点发送多个交易指示信息,每个交易指示信息包括一个交易信息和一个顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,从而当从共识节点和普通节点接收到该多个交易指示信息时,主共识节点和从共识节点可以根据该多个交易信息的顺序索引共识该多个交易信息,同时该普通节点可以根据该多个交易信息的顺序索引执行该多个交易信息,从而使得该多个交易信息的共识和执行能够并行执行,从而降低交易信息的处理时延,提高交易信息的执行效率。
在第一方面的一种可能的实现方式中,该交易指示信息中的顺序索引未签名。上述可能的实现方式中,该主共识节点不对顺序索引进行签名,这样其他节点在接收到交易指示信息时无需对该顺序索引进行签名验证,从而降低了其他节点的性能开销;此外不对顺序索引进行签名还可以避免恶意节点通过广播大量携带有不合法的签名的交易指示信息的方式耗尽其他节点的计算资源。
在第一方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该方法还包括:该主共识节点向该从共识节点发送该多个交易哈希值,该多个交易哈希值中的每个交易哈希值用于该从共识节点确定是否获取到该交易哈希值对应的交易信息。上述可能的实现方式中,能够使得该从共识节点确定是否获取到该交易哈希值对应的交易信息。
在第一方面的一种可能的实现方式中,该方法还包括:该主共识节点接收来自该从共识节点的获取请求,该获取请求用于请求获取该多个交易信息中的至少一个交易信息,该获取请求是该从共识节点根据该多个交易哈希值确定未获取到该至少一个交易信息时发送的;该主共识节点向该从共识节点发送至少一个交易指示信息,该至少一个交易指示信息包括该至少一个交易信息、以及该至少一个交易信息中的每个交易信息对应的顺序索引。上述可能的实现方式中,确保了该从共识节点能够获取到上述多个交易信息。
在第一方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该方法还包括:该主共识节点向该普通节点发送第一区块,以使该普通节点验证第一区块中的该多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。上述可能的实现方式中,能够使得普通节点验证第一区块中的多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。
在第一方面的一种可能的实现方式中,该方法还包括:该主共识节点获取交易信息处理过程中的性能参数,当该性能参数满足第一预设条件时,该主共识节点触发主共识节点的切换流程。可选的,该性能参数包括以下至少一种:共识吞吐量、交易时 延、交易冲突次数;该共识吞吐量满足第一预设条件包括该共识吞吐量小于预设吞吐量;该交易时延满足第一预设条件包括该交易时延大于预设时延;该交易冲突次数满足第一预设条件包括该交易冲突次数大于第一预设次数。上述可能的实现方式中,能够避免恶意节点对于区块链网络性能的影响。
在第一方面的一种可能的实现方式中,该方法还包括:当该主共识节点确定某一交易信息在预设时长内未被处理时,该主共识节点触发主共识节点的切换流程。上述可能的实现方式中,能够避免恶意节点对于区块链网络性能的影响。
在第一方面的一种可能的实现方式中,该方法还包括:当该主共识节点确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将该客户端设备设置为黑名单;其中,该至少一个切换周期中的每个切换周期对应不同的主共识节点。上述可能的实现方式中,能够避免客户端设备对于区块链网络性能的影响。
第二方面,提供一种交易信息处理方法,应用于区块链网络中,该区块链网络包括主共识节点、从共识节点和普通节点,该方法包括:该从共识节点接收来自该主共识节点的多个交易指示信息,该多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,比如该顺序索引可以为序列号;该从共识节点根据该多个交易信息的该顺序索引,共识该多个交易信息以得到第一区块。上述技术方案中,当该主共识节点在接收到多个交易信息时,可以分别向从共识节点和普通节点发送多个交易指示信息,每个交易指示信息包括一个交易信息和一个顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,从而当从共识节点和普通节点接收到该多个交易指示信息时,主共识节点和从共识节点可以根据该多个交易信息的顺序索引共识该多个交易信息,同时该普通节点可以根据该多个交易信息的顺序索引执行该多个交易信息,从而使得该多个交易信息的共识和执行能够并行执行,从而降低交易信息的处理时延,提高交易信息的执行效率。
在第二方面的一种可能的实现方式中,该交易指示信息中的该顺序索引未签名。上述可能的实现方式中,该主共识节点不对顺序索引进行签名,这样其他节点在接收到交易指示信息时无需对该顺序索引进行签名验证,从而降低了其他节点的性能开销;此外不对顺序索引进行签名还可以避免恶意节点通过广播大量携带有不合法的签名的交易指示信息的方式耗尽其他节点的计算资源。
在第二方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该方法还包括:该从共识节点接收来自该主共识节点的该多个交易哈希值,该多个交易哈希值中的每个交易哈希值用于该从共识节点确定是否获取到该交易哈希值对应的交易信息。上述可能的实现方式中,能够使得该从共识节点确定是否获取到该交易哈希值对应的交易信息。
在第二方面的一种可能的实现方式中,当该从共识节点根据该多个交易哈希值确定未获取到该多个交易信息中的至少一个交易信息时,该方法还包括:该从共识节点向该主共识节点发送获取请求,该获取请求用于请求获取该至少一个交易信息;该从共识节点接收来自该主共识节点的至少一个交易指示信息,该至少一个交易指示信息 包括该至少一个交易信息、以及该至少一个交易信息中的每个交易信息对应的顺序索引。上述可能的实现方式中,确保了该从共识节点能够获取到上述多个交易信息。
在第二方面的一种可能的实现方式中,对于该多个交易信息中的每个交易信息,该方法还包括:该从共识节点接收来自该普通节点对于该交易信息的交易执行结果;该从共识节点向该普通节点发送应答信息,该应答信息用于确认该交易执行结果接收成功。上述可能的实现方式中,能够使得从共识节点成功接收到交易信息的交易执行结果。
在第二方面的一种可能的实现方式中,该方法还包括:该从共识节点获取交易信息处理过程中的性能参数,当该性能参数满足第一预设条件时,该从共识节点触发主共识节点的切换流程。可选的,该性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;该共识吞吐量满足第一预设条件包括该共识吞吐量小于预设吞吐量;该交易时延满足第一预设条件包括该交易时延大于预设时延;该交易冲突次数满足第一预设条件包括该交易冲突次数大于第一预设次数。上述可能的实现方式中,能够避免恶意节点对于区块链网络性能的影响。
在第二方面的一种可能的实现方式中,该方法还包括:当该从共识节点确定某一交易信息在预设时长内未被处理或者该主共识节点在下一次主共识节点切换之前弃权时,该从共识节点触发主共识节点的切换流程。上述可能的实现方式中,能够避免恶意节点对于区块链网络性能的影响。
在第二方面的一种可能的实现方式中,该方法还包括:当该从共识节点确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将该客户端设备设置为黑名单;其中,该至少一个切换周期中的每个切换周期对应不同的主共识节点。上述可能的实现方式中,能够避免客户端设备对于区块链网络性能的影响。
第三方面,提供一种交易信息处理方法,应用于区块链网络中,该区块链网络包括主共识节点、从共识节点和普通节点,该方法包括:普通节点接收来自主共识节点的多个交易指示信息,该多个交易指示信息是主共识节点在接收到多个交易信息时分别向从共识节点和普通节点发送的,该多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序;该普通节点根据该多个交易信息的顺序索引,执行该多个交易信息。
上述技术方案中,当该主共识节点在接收到多个交易信息时,可以分别向从共识节点和普通节点发送多个交易指示信息,每个交易指示信息包括一个交易信息和一个顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,从而当从共识节点和普通节点接收到该多个交易指示信息时,主共识节点和从共识节点可以根据该多个交易信息的顺序索引共识该多个交易信息,同时该普通节点可以根据该多个交易信息的顺序索引执行该多个交易信息,从而使得该多个交易信息的共识和执行能够并行执行,从而降低交易信息的处理时延,提高交易信息的执行效率。
在第三方面的一种可能的实现方式中,该交易指示信息中的顺序索引未签名。上述可能的实现方式中,该主共识节点不对顺序索引进行签名,这样其他节点在接收到交易指示信息时无需对该顺序索引进行签名验证,从而降低了其他节点的性能开销; 此外不对顺序索引进行签名还可以避免恶意节点通过广播大量携带有不合法的签名的交易指示信息的方式耗尽其他节点的计算资源。
在第三方面的一种可能的实现方式中,该方法还包括:该普通节点接收主共识节点和/或从共识节点发送的第一区块,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应;该普通节点验证第一区块中的该多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。上述可能的实现方式中,能够使得普通节点验证第一区块中的多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。
在第三方面的一种可能的实现方式中,该方法还包括:该普通节点向从共识节点和/或主共识节点发送该多个交易信息的交易执行结果;该普通节点接收来自从共识节点和/或主共识节点的应答信息,该应答信息用于确认交易执行结果接收成功。
第四方面,提供一种交易信息处理装置,该装置作为主共识节点,应用于区块链网络中,该区块链网络还包括从共识节点和普通节点,该装置包括:接收单元,用于接收多个交易信息;发送单元,用于对于该多个交易信息中的每个交易信息,分别向该从共识节点和该普通节点发送交易指示信息,该交易指示信息包括该交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序;处理单元,用于根据该多个交易信息的该顺序索引,共识该多个交易信息以得到第一区块。
在第四方面的一种可能的实现方式中,该交易指示信息中的该顺序索引未签名。
在第四方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该发送单元还用于:向该从共识节点发送该多个交易哈希值,该多个交易哈希值中的每个交易哈希值用于该从共识节点确定是否获取到该交易哈希值对应的交易信息。
在第四方面的一种可能的实现方式中,该接收单元,还用于接收来自该从共识节点的获取请求,该获取请求用于请求获取该多个交易信息中的至少一个交易信息,该获取请求是该从共识节点根据该多个交易哈希值确定未获取到该至少一个交易信息时发送的;该发送单元,还用于向该从共识节点发送至少一个交易指示信息,该至少一个交易指示信息包括该至少一个交易信息、以及该至少一个交易信息中的每个交易信息对应的顺序索引。
在第四方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该发送单元还用于:向该普通节点发送第一区块,以使该普通节点验证第一区块中的该多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。
在第四方面的一种可能的实现方式中,该处理单元还用于:获取交易信息处理过程中的性能参数,当该性能参数满足第一预设条件时,触发主共识节点的切换流程。可选的,该性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;该共识吞吐量满足第一预设条件包括该共识吞吐量小于预设吞吐量;该交易时延满足第一预设条件包括该交易时延大于预设时延;该交易冲突次数满足第一预设条件包括该交易冲突次数大于第一预设次数。
在第四方面的一种可能的实现方式中,该处理单元还用于:当确定某一交易信息 在预设时长内未被处理时,触发主共识节点的切换流程。
在第四方面的一种可能的实现方式中,该处理单元还用于:当确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将该客户端设备设置为黑名单;其中,该至少一个切换周期中的每个切换周期对应不同的主共识节点。
第五方面,提供一种交易信息处理装置,该装置作为从共识节点,应用于区块链网络中,该区块链网络还包括主共识节点和普通节点,该装置包括:接收单元,用于接收来自该主共识节点的多个交易指示信息,该多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序;处理单元,用于根据该多个交易信息的该顺序索引,共识该多个交易信息以得到第一区块。
在第五方面的一种可能的实现方式中,该交易指示信息中的该顺序索引未签名。
在第五方面的一种可能的实现方式中,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该接收单元还用于:接收来自该主共识节点的该多个交易哈希值,该多个交易哈希值中的每个交易哈希值用于该从共识节点确定是否获取到该交易哈希值对应的交易信息。
在第五方面的一种可能的实现方式中,当该从共识节点未获取到该多个交易信息中的至少一个交易信息时,该装置还包括发送单元;该发送单元,用于向该主共识节点发送获取请求,该获取请求用于请求获取该至少一个交易信息;该接收单元,还用于接收来自该主共识节点的至少一个交易指示信息,该至少一个交易指示信息包括该至少一个交易信息、以及该至少一个交易信息中的每个交易信息对应的顺序索引。
在第五方面的一种可能的实现方式中,对于该多个交易信息中的每个交易信息:该接收单元,还用于接收来自该普通节点对于该交易信息的交易执行结果;该发送单元,还用于向该普通节点发送应答信息,该应答信息用于确认该交易执行结果接收成功。
在第五方面的一种可能的实现方式中,该处理单元还用于:获取交易信息处理过程中的性能参数,当该性能参数满足第一预设条件时,该从共识节点触发主共识节点的切换流程。可选的,该性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;该共识吞吐量满足第一预设条件包括该共识吞吐量小于预设吞吐量;该交易时延满足第一预设条件包括该交易时延大于预设时延;该交易冲突次数满足第一预设条件包括该交易冲突次数大于第一预设次数。
在第五方面的一种可能的实现方式中,该处理单元还用于:当确定某一交易信息在预设时长内未被处理或者该主共识节点在下一次主共识节点切换之前弃权时,触发主共识节点的切换流程。
在第五方面的一种可能的实现方式中,该处理单元还用于:当确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将该客户端设备设置为黑名单;其中,该至少一个切换周期中的每个切换周期对应不同的主共识节点。
第六方面,提供一种交易信息处理装置,该装置作为普通共识节点,应用于区块 链网络中,该区块链网络还包括主共识节点和普通节点,该装置包括:接收单元,用于接收来自主共识节点的多个交易指示信息,该多个交易指示信息是主共识节点在接收到多个交易信息时分别向从共识节点和普通节点发送的,该多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序;处理单元,用于根据该多个交易信息的顺序索引,执行该多个交易信息。
在第六方面的一种可能的实现方式中,该交易指示信息中的顺序索引未签名。
在第六方面的一种可能的实现方式中,接收单元还用于接收主共识节点和/或从共识节点发送的第一区块,第一区块包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应;处理单元,还用于验证第一区块中的该多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。上述可能的实现方式中,能够使得普通节点验证第一区块中的多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。
在第六方面的一种可能的实现方式中,该装置还包括发送单元;该发送单元,用于向从共识节点和/或主共识节点发送该多个交易信息的交易执行结果;该接收单元,还用于接收来自从共识节点和/或主共识节点的应答信息,该应答信息用于确认交易执行结果接收成功。
在本申请的另一方面,提供一种交易信息处理装置,该装置包括处理器、存储器、通信接口和总线,该处理器、该存储器和该通信接口通过总线连接;该存储器用于存储程序代码,当该程序代码被该处理器执行时,使得该装置执行第一方面或第一方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种交易信息处理装置,该装置包括处理器、存储器、通信接口和总线,该处理器、该存储器和该通信接口通过总线连接;该存储器用于存储程序代码,当该程序代码被该处理器执行时,使得该装置执行第二方面或第二方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种交易信息处理装置,该装置包括处理器、存储器、通信接口和总线,该处理器、该存储器和该通信接口通过总线连接;该存储器用于存储程序代码,当该程序代码被该处理器执行时,使得该装置执行第三方面或第三方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种区块链网络,该区块链网络包括主共识节点、从共识节点和普通节点;其中,该主共识节点用于执行第一方面或第一方面的任一种可能的实现方式所提供的交易信息处理方法;该从共识节点用于执行第二方面或第二方面的任一种可能的实现方式所提供的交易信息处理方法;该普通节点用于执行第三方面或第三方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序或指令,当该计算机程序或指令被运行时,实现第一方面或第一方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序或指令,当该计算机程序或指令被运行时,实现第二方面或第二方 面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序或指令,当该计算机程序或指令被运行时,实现第三方面或第三方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供了一种计算机程序产品,该计算机程序产品包括:计算机程序(也可以称为代码,或指令),当该计算机程序被运行时,使得计算机执行上述第一方面或者第一方面的任一种可能的实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供了一种计算机程序产品,该计算机程序产品包括:计算机程序(也可以称为代码,或指令),当该计算机程序被运行时,使得计算机执行上述第二方面或者第二方面中任一种可能实现方式所提供的交易信息处理方法。
在本申请的另一方面,提供了一种计算机程序产品,该计算机程序产品包括:计算机程序(也可以称为代码,或指令),当该计算机程序被运行时,使得计算机执行上述第三方面或者第三方面中任一种可能实现方式所提供的交易信息处理方法。
可以理解地,上述提供的任一种交易信息处理、区块链网络、计算机可读存储介质或者计算机程序产品均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
附图说明
图1为一种交易信息处理的阶段示意图;
图2为本申请实施例提供的一种认证型区块链网络的结构示意图;
图3为本申请实施例提供的一种通过共识协议来确认一个请求的流程示意图;
图4为本申请实施例提供的一种交易信息处理方法的流程示意图;
图5为本申请实施例提供的一种区块链网络的结构示意图;
图6为本申请实施例提供的一种交易信息处理的示意图;
图7为本申请实施例提供的一种交易信息处理的阶段示意图;
图8为本申请实施例提供的一种区块链网络的性能参数的示意图;
图9为本申请实施例提供的一种主共识节点的结构示意图;
图10为本申请实施例提供的另一种主共识节点的结构示意图;
图11为本申请实施例提供的一种从共识节点的结构示意图;
图12为本申请实施例提供的另一种从共识节点的结构示意图;
图13为本申请实施例提供的一种普通节点的结构示意图;
图14为本申请实施例提供的另一种普通节点的结构示意图。
具体实施方式
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b、或c中的至少一项(个),可以表示:a、b、c、a和b、a和c、b和c、或a、b和c,其中a、b、c可以是单个,也可以是多个。另外,本申请实施例 采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。例如,第一阈值和第二阈值仅仅是为了区分不同的阈值,并不对其先后顺序进行限定。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定。
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
下面在介绍本申请实施例之前,首先对本申请所涉及的相关技术背景进行介绍说明。
区块链(blockchain)是一种多节点共同维护的分布式账本,采用一种特殊的数据结构“区块”来记录交易。每个区块可以包括三个组成部分:前一个区块的哈希值、一定数量且有序排列的交易、共识协议附加的元数据。因为每个区块存储前一个区块的哈希值,形成一个链状结构,修改链中间的区块会导致后续区块的哈希值不一致,这种机制保证了区块链上区块很难被篡改。
区块链网络(也可以称为区块链系统)中的节点(也可以称为区块链节点)之间通过分布式共识协议就区块内容和顺序达成一致,确认(commit)唯一的一条区块链。按照节点加入机制,区块链可以分为无需认证型区块链和认证型区块链。下面分别对无需认证型区块链和认证型区块链进行简要说明。
无需认证型区块链,也可以称为“公有区块链”,主要用于加密货币。节点通常采取不记名机制:即节点无需身份认证,可以随时开启客户端加入区块链网络。然而,由于以下三个原因(1)-(3),无需认证型区块链不适合作为通用的信息分享平台。
(1)、无需认证型区块链必须依靠加密货币的实际市场价值来激励或者限制节点行为,从而保证安全性。一方面,加密货币面临严格的监管问题;另一方面,许多企业应用(比如,电子发票)本身并不具备货币金融属性。
(2)、无需认证型区块链通常能耗极高。
(3)、现有大部分无需认证型区块链的性能无法满足数据分享应用的需求。
无需认证型区块链主要可以分为两类,工作量证明(proof-of-work)和股权证明(proof-of-stake)。因为无需认证型区块链中任何节点可以随时随地且不记名的加入区块链网络,所以需要一种方法来让这些节点“自愿”地遵循协议。工作量证明和股权证明都是让一个节点首先进行前期投入,然后用这个投入的成本来激励该节点遵循协议获得回报。
认证型区块链,也可以称为“私有区块链”或者“联盟区块链”。认证型区块链需要节点通过一个身份认证服务加入区块链网络,并维护一个节点列表,即区块链网络中所有节点的身份已知,从而更适合作为数据分享平台。认证型区块链可以使用性能更高、能耗更小的分布式容错协议(distributed fault-tolerant protocol)来对区块内容达成一致。
示例性的,图2为一种认证型区块链的区块链网络的结构示意图,该区块链网络中包括多个共识节点和多个普通节点。其中,该多个共识节点可以运行分布式容错协议,负责就该认证型区块链中包括的区块的内容和顺序协商达成一致;该多个普通节 点可以负责收集来自客户端设备的用户交易、存储确认区块、以及执行用户交易等。具体的,基于图2所示的区块链网络,一种可能的交易确认过程可以包括:S1.普通节点接收来自客户端设备的用户交易;S2.普通节点将接收到的用户交易发送给共识节点;S3.多个共识节点之间就接收到的用户交易进行共识得到区块;S4.共识节点将区块发送给普通节点,以使普通节点执行用户交易;S5.每个节点存储区块。
其中,上述分布式容错协议也可以称为分布式一致性协议(distributed consensus protocol)。分布式一致性协议是指在分布式环境下,多个节点之间通过网络沟通,就一个值X达成一致(也可以称为确认X的值)。在实际使用中,通常通过连续运行分布式容错算法个体,就一个序列的值(比如,X1、X2、…、Xn,n为正整数)达成一致。
分布式一致性协议能够保证,即使在少部分节点故障的情况下,不会有两个节点确认不同的值Xi(i的取值范围为1至n)。分布式一致性算法按照容纳的故障种类可以分为:一)、针对崩溃故障的容错协议;二)、拜占庭容错协议。区块链通常采用拜占庭容错(byzantine fault-tolerant,BFT)协议。
“拜占庭故障”指的是故障节点可以进行任意行为,而不必遵循协议。通常情况下,拜占庭故障节点可能是恶意或者不诚实节点,并尝试扰乱系统正常运行。BFT协议最多容纳约33%的故障节点(也可以称为恶意节点)。示例性的,如果区块链网络中节点的总数是3f+1,则BFT协议最多可以容纳f个故障节点。实用拜占庭容错(practical byzantine fault tolerant,PBFT)协议是最经典的完整BFT协议,但是性能和对于及节点数的扩展性都不佳。
一个典型的BFT协议通常可以包含两个子协议:共识协议和主节点切换协议。图3为一种PBFT协议通过共识协议来确认一个请求的流程,该流程包括五个阶段:请求(request)、预准备(pre-prepare)、准备(prepare)、确认(commit)和回复(reply)。由图3可知,客户端设备C向一个共识节点N0(也可以称为主共识节点)发送交易请求,共识节点N0在预准备阶段将需要达成共识的交易发送给所有共识节点,比如,发送给共识节点N1、N2和N3;共识节点N0至N3通过准备和确认两个阶段的信息交换(比如,交易的哈希值)对交易的内容和顺序达成一致;共识节点N0至N3向客户端设备C发送回复消息。图3以共识节点N3为故障节点为例进行说明。
在区块链网络中,如果主共识节点是恶意节点,该恶意节点可以向不同的共识节点发送不同的交易,或者不向共识节点发送任何交易,从而区块链网络中的节点无法对任何交易达成共识。为解决这一问题,拜占庭容错协议通过运行主节点切换协议来替换掉恶意的主共识节点。某一个共识节点担任主共识节点的这段时间称为一个视图。主共识节点切换又可以被称作视图切换。
在典型的认证型区块链中,每一笔交易会调用智能合约,并将交易的内容作为智能合约的输入。智能合约是保存在区块链上的一段可执行代码。智能合约分为确定型智能合约和非确定型智能合约。确定型智能合约是指:给定同一输入,在同一初始状态下,所有节点执行该智能合约都会得到相同的结果。调用确定型智能合约的交易是确定型交易。非确定型智能合约是指:给定同一输入,在同一初始状态下,不同节点执行该智能合约可能会得到不同的结果。调用非确定型智能合约的交易是非确定型交 易。
大部分区块链网络都仅支持确定型交易,超级账本系统(hyperledger fabric,HLF)和其衍生的区块链网络可以支持非确定型交易(即非确定型交易不会导致节点间的状态不一致)。如果节点执行非确定型交易的过程中得到了不同的执行结果,则节点认为该交易无效,并不将其执行结果写入本地状态数据库。概括来说,HLF将非确定型交易认定为智能合约中的漏洞(bug),并可以有效防止这些漏洞带来的状态不一致问题。
区块链网络中的节点除了在本地保存一份区块链的副本,还会维护一个状态数据库,用于存储区块链中每一笔交易。智能合约执行后,节点会修改状态数据库中某些变量的值。如果两笔交易调用的智能合约读写了同一个变量的值,则认为这两笔交易互相依赖。
目前,为了保证区块链网络中的多个节点能够按照同样的顺序执行同样的交易,通常采用以下两种工作流来工作:第一种、执行-排序工作流;第二种、排序-执行工作流。在第一种工作流中,该多个节点包括背书节点、排序节点和普通节点三种,具体工作流过程包括:1)背书:a.客户端设备向N个背书节点发送交易信息;b.每个背书节点接收到该交易信息后,首先验证该交易信息的客户端签名,之后执行该交易信息对应的智能合约,并将执行结果签名后作为背书回复给客户端设备;c.客户端设备接收到N个背书,如果这N个背书完全一致,则认为该交易背书成功;2)排序:排序节点接收客户端设备发送的背书成功的交易信息,并对接收到的多个交易信息进行共识打包得到区块;3)验证:背书节点和普通节点对该区块中的每个交易信息进行验证;4)提交:背书节点和普通节点将验证成功的区块和背书进行相应的存储,以完成提交。在第二种工作流中,该多个节点包括排序节点和普通节点两种,具体工作流过程包括:1)排序:排序节点对接收到的多个交易信息进行共识打包得到区块,并将该区块发送给普通节点;2)执行:排序节点和普通节点按照该多个交易信息在区块中的顺序执行该多个交易信息;3)提交:所有节点分别对该多个交易信息的交易执行结果和该区块进行相应的存储,以完成提交。
上述两种工作流中,排序阶段和执行阶段是串行执行的,从而导致交易信息的处理时延较长。此外,在上述第一种工作流中,交易信息在背书阶段时还没有被排序,且不同的交易信息之间是独立执行的,这样存在依赖关系的多个交易信息在进入排序阶段后,可能会导致排在后面的交易信息被认为是无效交易,从而降低了交易信息的处理效率。
基于此,本申请实施例提供一种交易信息处理方法,能够将交易信息在处理过程中的排序和执行两个阶段并行化,从而大大降低交易信息的确认延迟,同时也提高交易信息的处理效率。该方法可以应用于数据中心网络中,该数据中心网络可以包括单个数据中心,也可以包括多个数据中心,该多个数据中心由专线连接。在本申请实施例中,该数据中心网络也可以称为区块链网络或者区块链系统。该数据中心网络可以包括多个节点,该多个节点可以包括主共识节点、从共识节点和普通节点三种,该从共识节点和该普通节点的数量可以为多个。该数据中心网络具有组播功能,且该数据中心网络中任意两个节点之间的网络延迟满足三角不等式特性。三角不等式特性可以是指:节点i与节点j之间的通信延迟L ij与节点j与节点k之间的通信延迟L jk之和大 于节点i与节点k之间的通信延迟L ik(即L ij+L jk>L ik),节点i、节点j和节点k为数据中心网络中的任意三个节点。
图4为本申请实施例提供的一种交易信息处理方法的流程示意图,该方法应用于区块链网络中,该区块链网络包括主共识节点、从共识节点和多个普通节点,该方法包括以下几个步骤。
S201:主共识节点接收多个交易信息。
其中,该区块链网络中可以包括多个共识节点,该多个共识节点可以包括一个主共识节点和多个从共识节点,该主共识节点可以是该多个共识节点根据一定规律或原则从该多个共识节点中选择的一个共识节点,该多个从共识节点可以是该多个共识节点中除该主共识节点之外的其他共识节点。可选的,该主共识节点可以是该多个共识节点根据主节点切换协议选择的一个共识节点,且该多个共识节点可以每隔一段时间根据主节点切换协议选择的一个共识节点。比如,该主共识节点可以在不同的时间段中由不同的共识节点来担当。
另外,每个交易信息可以表示一次交易(或者称为交易事务或交易事件),每个交易信息中可以包括该交易相关的一个或者多个信息。在一种实施例中,该交易信息可以为标头(header)形式,比如,该交易信息可以表示为(from,to,value)形式,该from可以表示发起该交易的源客户端信息,该to可以表示接收该交易的目的客户端信息,该value可以表示该交易对应的交易金额。
具体的,该主共识节点可以接收到来自至少一个客户端设备的多个交易信息,该至少一个客户端设备可以直接或间接地向该主共识节点发送该多个交易信息,该多个交易信息可以是该主共识节点在一段时间内接收到的连续的多个交易信息。该至少一个客户端设备可以包括能够通过该区块链网络实现交易的一个或者多个客户端设备。当该至少一个客户端设备包括多个客户端设备时,该多个客户端设备可以是同一客户端(也可以称为同一组织)对应的多个客户端设备,也可以是不同客户端(也可以称为不同组织)对应的多个设备。上述客户端设备可以是指安装有客户端的电子设备,用户能够登录该客户端并通过该客户端进行交易。
S202:对于该多个交易信息中的每个交易信息,该主共识节点分别向从共识节点和普通节点发送交易指示信息,该交易指示信息包括该交易信息和顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序。
其中,该主共识节点可以按照该多个交易信息的接收顺序对该多个交易信息进行排序,一个交易信息在该多个交易信息中的排列顺序可以通过顺序索引来表示。该多个交易信息在后续共识过程中的顺序可以与该多个交易信息对应的接收顺序一致。
具体的,当该主共识节点接收到该多个交易信息中的任意一个交易信息时,该主共识节点可以为该交易信息添加顺序索引以得到一个交易指示信息,该顺序索引可以为序列号,该序列号可以用于指示该交易信息在该多个交易信息中的接收顺序。之后,该主共识节点可以将该交易指示信息分别发送给该区块链网络中的多个从共识节点和多个普通节点,比如,该主共识节点可以通过广播向该多个从共识节点和该多个普通节点发送该交易指示信息。对于该多个交易信息,该主共识节点分别向该多个从共识节点和该多个普通节点发送多个交易指示信息。
示例性的,如图5所示,该至少一个客户端设备可以包括第一客户端设备(比如,安装淘宝、京东和天猫等购物类app的设备)、第二客户端设备(比如,安装支付宝和微信等支付类app的设备)和第三客户端设备(比如,按照各种银行类app)的设备,该多个交易信息可以包括第一客户端设备发起的交易信息A(V.Tom B.Ray$400)、第二客户端设备发起的交易信息B(表示为P.Max B.Amy$1M)、以及第三客户端设备发起的交易信息C(B.Bob P.Sam$100),且该共识节点接收到该多个交易信息的顺序依次为:交易信息C、交易信息A、交易信息B。当该主共识节点接收到交易信息C时,该主共识节点可以为交易信息C添加序列号1以得到交易指示信息C’(1 B.Bob P.Sam$100),并广播交易指示信息C’;当该主共识节点接收到交易信息A时,该主共识节点可以为交易信息A添加序列号2以得到交易指示信息A’(2 V.Tom B.Ray$400),并广播交易指示信息A’;当该主共识节点接收到交易信息B时,该主共识节点可以为交易信息B添加序列号3以得到交易指示信息B’(3 P.Max B.AMY$1M),并广播交易指示信息B’。也即是,该主共识节点分别向该多个从共识节点和该多个普通节点发送的多个交易指示信息的顺序依次为:交易指示信息C’、交易指示信息A’、交易指示信息B’。之后,当该多个从共识节点和该多个普通节点接收到上述多个交易指示信息时,可以根据下文所描述的过程并行执行共识阶段和执行阶段。
可选的,每个交易指示信息中的顺序索引未签名,即该主共识节点不对该顺序索引进行签名。比如,当该顺序索引是序列号时,该主共识节点不对该序列号进行签名。这样其他节点在接收到该交易指示信息时无需对该顺序索引进行签名验证,从而降低了其他节点的性能开销。此外,不对该顺序索引进行签名还可以避免恶意节点耗尽其他节点的计算资源。比如,恶意节点可以通过广播大量的不合法的交易指示信息,每个交易指示信息中携带不合法的签名,这样其他节点只有对这些交易指示信息中的签名进行验证后,才能确定相应的签名不合法,从而会耗尽该其他节点的计算资源。
S203a:当从共识节点接收到该多个交易信息对应的交易指示信息时,主共识节点和从共识节点根据该多个交易信息的顺序索引,共识该多个交易信息以得到第一区块,并向普通节点发送第一区块。
对于该多个从共识节点中的任意一个从共识节点,该从共识节点可以接收到多个交易指示信息,即该从共识节点可以接收到该多个交易信息对应的交易指示信息,并根据该多个交易指示信息能够获取到该多个交易信息、以及该多个交易信息中每个交易信息对应的顺序索引。之后,该主共识节点和该多个从共识节点可以根据该多个交易信息的顺序索引,共识并打包该多个交易信息以得到第一区块。比如,该主共识节点和该多个从共识节点可以分别调用BFT协议对该多个交易信息的内容和顺序达成共识,并将该多个交易信息和共识过程中产生的交易哈希值等信息对应打包在一起得到第一区块。当该从共识节点得到第一区块后,该从共识节点可以将第一区块加入区块链,还可以将第一区块发送给该多个普通节点中的每个普通节点。示例性的,如图5所示,该从共识节点可以包括共识模块,通过该共识模块对该多个交易信息进行共识得到一区块,将第一区块加入区块链,并将第一区块发送给普通节点。
进一步的,第一区块中包括多个交易哈希值,该多个交易哈希值与该多个交易信息一一对应,该多个交易哈希值可以是该主共识节点在该多个交易信息的共识过程中 的产生的。该主共识节点可以向该多个从共识节点中的每个从共识节点发送该多个交易哈希值,该多个交易哈希值可以通过哈希值列表的形式发送给每个从共识节点。相应的,每个从共识节点在接收到该多个交易哈希值时,可以根据该多个交易哈希值确定是否获取到该多个交易哈希值中每个交易哈希值对应的交易信息。比如,每个从共识节点在对多个交易信息进行共识的过程中,会在本地产生该多个交易信息中每个交易信息对应的交易哈希值(下文中称为本地交易哈希值);若该定哈希值列表中的每个交易哈希值都存在一个相同的本地交易哈希值,则该从共识节点确可以确定已获取到该主共识节点发送的多个交易信息;若该定哈希值列表中的至少一个交易哈希值不存在相同的本地交易哈希值,则该从共识节点确可以确定未获取到该至少一个交易哈希值对应的交易信息,即该从共识节点未获取到至少一个交易信息。
可选的,对于任意一个从共识节点,当该从共识节点根据该多个交易哈希值确定未获取到该多个交易信息中的至少一个交易信息时,该从共识节点可以向该主共识节点发送获取请求,该获取请求用于请求获取该至少一个交易信息。当该主共识节点接收到该获取请求时,该主共识节点向该从共识节点发送至少一个交易指示信息,该至少一个交易指示信息包括该至少一个交易信息、以及该至少一个交易信息中的每个交易信息的顺序索引。这样能够确保该从共识节点能够获取到上述多个交易信息。
S203b:当普通节点接收到该多个交易信息对应的交易指示信息时,普通节点根据该多个交易信息的顺序索引执行该多个交易信息。S203a与S203b可以并行执行(或称为同时执行),图4中以S203b位于从共识节点发送第一区块之前为例进行说明。
对于该多个普通节点中的任意一个普通节点,该普通节点可以接收到多个交易指示信息,即该普通节点可以接收到该多个交易信息对应的交易指示信息,并根据该多个交易指示信息能够获取到该多个交易信息、以及该多个交易信息中每个交易信息对应的顺序索引。之后,该普通节点可以根据该多个交易信息的顺序索引执行该多个交易信息。比如,该普通节点可以执行该多个交易信息中与自身相关的交易信息对应的智能合约,以得到对应的交易执行结果,从而执行多个交易信息对应得到多个交易执行结果。每个普通节点相关的交易信息可以是指该普通节点所属或所对应的组织(或客户端)的客户端设备对应的交易信息。例如,对于交易信息T(A向B转账10元),该交易信息需要由A和B所属的组织对应的普通节点来执行。此外,同一个组织内的多个节点互相信任,从而每个组织可以指定一个普通节点来执行该组织对应的交易信息,并对交易执行结果进行签名。
可选的,当该普通节点根据该多个交易信息的顺序索引执行该多个交易信息时,该普通节点可以并行执行不存在依赖关系的交易信息,串行执行存在依赖关系的交易信息。其中,该普通节点可以根据先验知识推断交易信息之间的依赖关系。示例性的,每一个交易信息对应的智能合约中可以标注出该智能合约在运行过程中可能需要读写的变量列表,这样该普通节点可以根据交易信息的输入和调用的智能合约来推断交易信息之间的依赖关系。如果两个交易信息需要修改同一个变量,则可以认为这两个交易信息之间相互依赖,从而需要根据对应的顺序索引串行执行。例如,存在两个交易信息T1(A向B转账10元)和T2(B向C转账5元),T1和T2均调用了转账智能合约,该转账智能合约定义为transfer(from,to,money),并标注了其需要读写的变 量列表为[from,to],即from和to这两个变量(保存了账户余额)会在运行过程中被修改。普通节点在收到这两个交易信息后,可以根据T1和T2的输入与智能合约定义的读写列表,判断T1和T2相互依赖,并串行执行这两笔交易。该智能合约可以是一段完成特定功能逻辑的代码,仅仅定义了控制流,其运行过程中需要读写的全部变量,均可以在交易信息中进行标注或指定。
S204:普通节点接收第一区块,并验证第一区块中的多个交易哈希值与本地执行该多个交易信息得到的多个交易哈希值的一致性。
其中,以该普通节点执行该多个交易信息为例,该普通节点在执行该多个交易信息的过程中会在本地产生该多个交易信息中每个交易信息对应的交易哈希值(下文中称为本地交易哈希值),即该普通节点可以得到多个本地交易哈希值。若第一区块中的多个交易哈希值中的每个交易哈希值都存在一个相同的本地交易哈希值,则该普通节点可以确定第一区块中的多个交易哈希值与多个本地交易哈希值一致。若第一区块中的多个交易哈希值与多个本地交易哈希值不一致,则该普通节点可以重新执行第一区块中的多个交易信息。
进一步的,当该普通节点执行相应的交易信息得到交易执行结果时,该普通节点可以将该交易执行结果发送给多个共识节点(仅包括从共识节点,或者同时包括主共识节点和从共识节点),该多个共识节点可以向该普通节点发送应答信息ACK,该应答信息ACK用于确认该交易执行结果接收成功。示例性的,该区块链网络中包括3f+1个共识节点,该普通节点可以将该交易执行结果发送给2f+1个共识节点,该2f+1个共识节点可以向该普通节点发送应答信息ACK,这样该普通节点可以接收到2f+1个应答信息ACK。
可选地,该普通节点和该多个共识节点可以在本地存储该多个交易信息以及对应的交易执行结果,该普通节点还可以将该多个交易执行结果存储在状态数据库中。示例性的,如图5所示,该普通节点可以包括执行模块和确认模块,通过该执行模块执行该多个交易信息,并在确认模块接收到2f+1个应答信息ACK后,将第一区块加入区块链,并将该多个交易信息的交易执行结果存储在状态数据库中。
为便于理解,下面以图6为例,对本申请实施例提供的交易信息处理方法进行举例说明。如图6所示,该区块链网络可以包括主共识节点C0、从共识节点C1至C4、以及普通节点N1至N4。该方法包括具体包括以下几个步骤:S11.多个客户端设备UE0至UEN分别向该主共识节点C0发送交易信息,比如,发送的交易信息包括Ti、Tj和Tk;S12.该主共识节点C0为每个交易信息添加序列号并分别发送给从共识节点C1至C4以及普通节点N1至N4,上述多个交易信息根据序列号确定的顺序为3Tk、2Ti、1Tj;S13a.从共识节点C1至C4对接收到的交易信息进行共识(比如,验证和共识交易信息的交易哈希值)和打包得到第一区块,并将第一区块发送给普通节点N1至N4;S3b.普通节点N1至N4验证每个交易信息的签名并执行交易信息;S14.普通节点N1至N4接收第一区块,并基于每个交易信息的交易哈希值验证该交易信息,并在验证通过后将对应的交易执行结果存储在本地数据库中。图6中交易信息Ti相关的节点包括N1和N2,交易信息Tj相关的节点包括N1和N3,交易信息Tk相关的节点包括N2和N3为。上述步骤中的S3a和S3b是并行执行的,且S13a可以称为排序阶 段,S13b可以称为执行阶段,S14可以称为提交(commit)(或确认)阶段。示例性的,图7中示出了上述多个阶段之间的关系,即排序阶段和执行阶段并行执行,提交阶段在排序阶段和执行阶段完成后执行。
在本申请实施例中,该主共识节点在接收到多个交易信息时,可以分别向从共识节点和普通节点发送多个交易指示信息,每个交易指示信息包括一个交易信息和一个顺序索引,该顺序索引用于指示该交易信息在共识过程中的排列顺序,从而当从共识节点和普通节点接收到该多个交易指示信息时,主共识节点和从共识节点可以根据该多个交易信息的顺序索引共识该多个交易信息,同时该普通节点可以根据该多个交易信息的顺序索引执行该多个交易信息,从而使得该多个交易信息的共识和执行能够并行执行,从而降低交易信息的处理时延,提高交易信息的执行效率。
进一步的,本申请实施例还能够实现恶意节点(比如,主共识节点为恶意节点)的监控,以避免因为恶意节点的恶意行为而导致区块链网络的整体性能的下降。其中,当主共识节点为恶意节点时,主共识节点的大量恶意行为会导致区块链网络的整体性能严重下降。比如,主共识节点可以向不同从共识节点发给不同的交易信息从而导致共识无法达成,或者主共识节点推迟一段时间后再向一个或者多个节点发送交易信息,或者主共识节点向一个或者多个节点发送错误的交易信息等。本申请实施例中通过从共识节点监控主共识节点的行为,并在检测到主共识节点的恶意行为时切换主共识节点,从而避免恶意节点对于区块链网络性能的影响。下面分别对本申请实施例提供的几种不同的监控方法进行介绍说明。
第一种、对于该多个从共识节点中的任意一个从共识节点,该从共识节点可以获取交易信息处理过程中的性能参数,当该性能参数满足第一预设条件时,该从共识节点触发该主共识节点的切换流程,也可以称为该从共识节点发起主共识节点的切换流程。类似的,主共识节点也可以按照上述类似的方式执行,本申请实施例中以从共识节点为例进行说明。
其中,该性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数。相应的,该共识吞吐量满足第一预设条件包括该共识吞吐量小于预设吞吐量;该交易时延满足第一预设条件包括该交易时延大于预设时延;该交易冲突次数满足第一预设条件包括该交易冲突次数大于第一预设次数。需要说明的是,该预设吞吐量、预设时延和第一预设次数可以是事先设置的,具体可以由本领域技术人员根据实际情况和经验等进行设置,本申请实施例对此不作具体限制。
另外,一个从共识节点发起主共识节点的切换流程可以包括:该从共识节点广播一条主共识节点切换(view change)消息给其它共识节点。如果任意一个从共识节点收到了2f+1条主共识节点切换消息,则意味着有2f+1个从共识节点发起了主共识节点切换,从而该从共识节点可以调用BFT协议的主节点切换协议来更换当前的主共识节点。
在一种实施例中,当从共识节点检测到共识吞吐量小于预设吞吐量时,可以认为共识排序或者交易执行的性能下降了,从而从共识节点可以触发主共识节点的切换流程,以切换该主共识节点。共识排序或者交易执行的性能下降,意味着当前的主共识节点可能向不同的节点发送不同的交易信息,或者推迟了发送给某些节点的交易信息。 比如,为了检测共识排序阶段中的性能下降,每个从共识节点可以监控自身的共识吞吐量,如果当前的共识吞吐量低于之前观测到的最高共识吞吐量的90%,则从共识节点可以发起主共识节点的切换流程。
在另一种实施例中,为了检测交易执行中的性能下降,每个从共识节点可以检测普通节点发送的交易执行结果中的交易哈希值与正在进行共识的交易信息的交易哈希值是否相同,如果两个交易哈希值不同,则表示主共识节点可能向该普通节点发送了错误的交易信息。同时,每个从共识节点还可以检测普通节点发送的交易执行结果的延迟,如果一个从共识节点在完成交易信息的共识后的一段时间内仍没有收到交易执行结果,则表示主共识节点可能推迟了发送给普通节点的交易信息,则从共识节点可以发起主共识节点的切换流程。
第二种、当从共识节点确定某一交易信息在预设时长内未被处理或者该主共识节点在下一次主共识节点切换之前弃权时,该从共识节点触发主共识节点的切换流程。其中,当发起某一交易信息的客户端设备在预设时长内没有接收到回复信息时,该客户端设备可以向多个共识节点发送该交易信息,以使该从共识节点确定该交易信息在未被处理。
在一种实施例中,当从共识节点检测到主共识节点未将某个客户端设备发起的交易信息加入区块链时,该从共识节点可以发起主共识节点的切换流程。一个恶意的主共识节点可能故意不将来自某个客户端的交易信息加入区块(也可以称为加入区块链)。这样,如果该客户端设备确定自己的交易信息无法被加入区块链,则该客户端设备可以将该交易信息发送给多个从共识节点。该多个共识节点再将该交易信息转发给当前的主共识节点。如果该主共识节点依然不将该交易信息加入区块链,则表示该主共识节点为恶意节点,从而从共识节点可以发起主共识节点的切换流程。
在另一种实施例中,若从共识节点检测到当前的主共识节点在下一次主共识节点切换之前主动弃权,比如该主共识节点随机的将主权移交给另一个共识节点,则从共识节点可以发起主共识节点的切换流程。比如,在主共识节点切换过程中,每个主共识节点的切换周期为T,若当前的主共识节点在T/2时放弃主权,则从共识节点可以发起主共识节点的切换流程。
第三种、当从共识节点或者普通节点确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将该客户端设备设置为黑名单。其中,该切换周期可以是指主共识节点的切换周期,该至少一个切换周期中的每个切换周期对应不同的主共识节点。第二预设次数可以是事先设置的。
其中,以交易信息的顺序索引为序列号为例,本申请实施例中的主共识节点不对交易信息的序列号签名,这样恶意节点可以随意伪造主共识节点发送的交易信息。比如,恶意节点可以生成一个或者多个交易信息,并为这些交易信息分配伪造的序列号,之后将伪造的交易信息发送给其他节点。这些伪造的交易信息会在其他节点上造成交易冲突(比如,两个不同的交易信息有着相同的序列号),从而导致该其他节点无法根据序列号进行推断执行(比如,不知道应该以哪个交易信息为准)。上述交易冲突可以理解为:对于某一个序列号,如果一个从共识节点在本地共识该序列号对应的交易信息得到的交易哈希值与主共识节点在共识过程中产生该序列号对应的交易信息的交易 哈希值不一致,则认为这两个交易信息冲突。
经过实际观察可知,恶意节点有以下几个特点:恶意节点只能恶意广播自己的交易信息;恶意的主共识节点可能造成无法检测的冲突。具体分析如下所述。
对于恶意节点只能恶意广播自己的交易信息的具体分析如下:一个恶意节点可能通过两种方式造成交易冲突。第1种:恶意节点通过恶意广播其他节点的交易信息的方式进行恶意攻击,这种方式不可行。在这种攻击中,恶意节点将主共识节点发来的交易信息T修改序列号后生成一个伪造的交易信息T’,并转发给其他节点。由于数据中心网络满足三角不等式特性,其它节点会先接收到交易信息T,后接收到交易信息T’(因为T’是恶意节点在接收到交易信息T之后再转发的),从而其它节点会直接丢弃伪造的交易信息T’(因为这两个交易信息的哈希值相同)。因此,恶意节点只能恶意广播自己的交易信息。第2种:恶意节点通过恶意广播自己的交易信息,这种方式能够被检测。在这种攻击中,由于恶意节点生成的交易信息中带有自己的有效签名,从而其他节点可以根据接收到交易信息的客户端签名来判断恶意节点。
对于恶意的主共识节点可能造成无法检测的冲突的具体分析如下:如果主共识节点是恶意节点,则主共识节点可以造成任意的交易冲突,并且不存在任何可观测的规律。此时,如果区块链网络中共识节点的总数量为3f+1,则可以在f+1个不同的视图(对应不同的主共识节点)中检测交易冲突。
具体的,在同一个视图中,如果主共识节点接收到的来自某一客户端的交易信息和多个共识节点在共识过程的区块内的交易信息发生多次冲突(比如,冲突次数大于第二预设次数),则可以怀疑从共识节点本地接收到的交易信息是恶意的。具体原因如下:1.对于每一个序列号,从共识节点保留接收到的第一个交易信息;2.主共识节点先广播每一个交易信息,后对交易信息的哈希列表达成共识;3.如果有恶意节点也在恶意广播交易信息,就会占据从共识节点的某个序列号,导致从共识节点上该序列号和主共识节点对应序列号的交易信息不一致(比如,交易哈希值不一致)。此时,该冲突可能是恶意的主共识节点造成的,也可能是恶意节点乱发伪造的交易信息造成的。因此,多个共识节点可以先将该客户端设备(比如,客户端账户)加入怀疑列表,并持续监测该客户端设备在多个视图下的恶意行为。如果来自某个客户端设备的交易信息在f+1个视图(其中至少有一个视图的主共识节点是非恶意的)中都和其他客户端设备的交易信息发生了冲突,则可以确定该客户端设备是恶意的。在这种情况下,该多个共识节点可以将恶意的客户端设备加入黑名单,该恶意的客户端设备发起的交易信息也会被所有节点直接忽略。
在上述过程中,由于主共识节点会随机地发起主共识节点切换,并随机选择下一个主共识节点,从而恶意的客户端设备发出的交易信息可能会被随机划分到不同的视图中,即恶意节点无法精确控制自己在哪一个视图(对应不同的主共识节点)中造成冲突。因此上述的恶意节点的检测方法最终总能将恶意的客户端设备加入到黑名单。
本申请实施例将采用上文所提供的方法的区块链网络(下文中称为BIDL),与现有技术中的区块链系统FastFabric(下文中称为FF)和StreamChain(下文中称为SC)进行了比较,具体相关性能参数的变化如图8所示,作为本申请的一个实施例,其不限定于以下具体参数值。图8中的(a)示出了BIDL、FF和SC对应的吞吐量和确认 延迟的关系,其中BIDL的吞吐量最高、FF的吞吐量次之、SC的吞吐量最低,SC的确认延迟最低、BIDL的确认延迟次之、FF的确认延迟最大,从而BIDL相比而言同时兼顾了吞吐量和确认延迟,从而性能最优。图8中的(b)示出了BIDL和FF分别在非确定型交易下的非确定型交易比例与有效吞吐量之间的关系、以及在冲突交易下的冲突交易比例与有效吞吐量之间的关系。其中,随着非确定型交易比例的增加,BIDL的有效吞吐量(即曲线S1)和FF的有效吞吐量(即曲线S2)均会下降,且BIDL的有效吞吐量始终高于FF的有效吞吐量。FF的有效吞吐量下降缓慢,这是因为FF中非确定型交易会被更早发现,并且被提前认定为不合法,客户端设备可以很快提交下一个交易信息。而BIDL在最后一个阶段才能发现非确定型交易,并认定其不合法,客户端设备必须等待交易信息走完整个工作流才能提交下一个交易信息。此时随着交易冲突比例的增加,BIDL的有效吞吐量(即曲线S3)几乎不受影响,而FF的有效吞吐量明显下降(即曲线S4)。这是因为FF中,交易信息在执行阶段还没有顺序,每个节点只能独立执行所有交易信息,这导致了大量交易信息的执行结果最终被认为是无效的。BIDL在推断执行阶段中会根据交易信息的序列号来顺序执行存在冲突的交易信息,因此所有的交易执行结果均有效。
本申请实施例还对BIDL、超级账本架构(hyperledger fabric,HLF)、FF和SC分别在无恶意节点、存在恶意的主共识节点和存在恶意的非主共识节点的三种场景下的有效吞吐量进行了检测,具体结果如下表1所示。根据表1可知,本申请实施例提供的BIDL可以在恶意的主共识节点、以及恶意的非主共识节点存在时,由于能够维持共识阶段和执行阶段的并行,从而有效吞吐量较高,即本申请实施例提供的方法具有高性能的优点。kTxns/s表示每秒执行的以千为计数单位的交易信息的数量。
表1
Figure PCTCN2022106699-appb-000001
在本申请实施例中,通过检测恶意的主共识节点、恶意的非主共识节点,并在检测到恶意的主共识节点时切换主共识节点,在检测到恶意的客户端设备时将该客户端设备添加在黑名单中以忽略该客户端设备的交易信息,可以使得在该区块链网络中存在恶意节点的情况下,仍能够保证共识阶段和执行阶段的并行,从而进一步提高该区块链网络的性能。
上述主要从主共识节点、从共识节点和普通节点交互的角度对本申请实施例提供的方案进行了介绍,可以理解的是,主共识节点、从共识节点和普通节点,为了实现 上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对主共识节点、从共识节点和普通节点进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述功能模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图9示出了上述实施例中所涉及的交易信息处理装置的一种可能的结构示意图,该装置可以作为主共识节点。该装置包括:接收单元301、发送单元302和处理单元303。其中,接收单元301用于支持该装置执行上述方法实施例中的S201;发送单元302用于支持该装置执行上述方法实施例中的S202、向从共识节点发送多个交易哈希值、或者向普通节点发送第一区块中的一个或者多个步骤;处理单元303用于支持该装置执行上述方法实施例中的S203a。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
在采用硬件实现的基础上,本申请实施例中的处理单元303可以为该装置的处理器,发送单元302可以为该装置的发送器,接收单元301可以为该装置的接收器,发送器通常可以和接收器集成在一起用作收发器,具体的收发器还可以称为通信接口或接口电路。
如图10所示,为本申请实施例提供的上述实施例所涉及的交易信息处理装置的另一种可能的结构示意图,该装置可以作为主共识节点。该装置包括:处理器311,还可以包括存储器312、通信接口313和总线314,处理器311、存储器312和通信接口313通过总线314连接。
其中,处理器311用于对该装置的动作进行控制管理。在一种可能的实施例中,处理器311可用于支持该装置执行上述方法实施例中的S203a,以及通过通信接口313发送或接收不同信息的步骤。通信接口313用于支持该装置进行通信,比如支持该装置与从共识节点和普通节点进行通信。
在本申请实施例中,处理器311可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。上述图10中的总线314可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,上述图10中仅用一条粗线表 示,但并不表示仅有一根总线或一种类型的总线。
在采用对应各个功能划分各个功能模块的情况下,图11示出了上述实施例中所涉及的交易信息处理装置的一种可能的结构示意图,该装置可以作为从共识节点。该装置包括:接收单元401、处理单元402和发送单元403。其中,接收单元401用于支持该装置执行上述方法实施例中接收交易指示信息、接收多个交易哈希值、接收交易执行结果等步骤;处理单元402用于支持该装置执行上述方法实施例中的S203a,和/或本文所描述的其他技术过程;发送单元403用于支持该装置执行上述方法实施例中发送第一区块或者发送应答信息等步骤。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
在采用硬件实现的基础上,本申请实施例中的处理单元402可以为该装置的处理器,接收单元401可以为该装置的接收器,发送单元403可以为该装置的发送器,发送器和接收器通常可以集成在一起用作收发器,具体的收发器还可以称为通信接口或接口电路。
如图12所示,为本申请实施例提供的上述实施例所涉及的交易信息处理装置的另一种可能的结构示意图,该装置可以作为从共识节点。该装置包括:处理器411,还可以包括存储器412、通信接口413和总线414,处理器411、存储器412和通信接口413通过总线414连接。
其中,处理器411用于对该装置的动作进行控制管理。在一种可能的实施例中,处理器411可用于支持该装置执行上述方法实施例中的S203a,以及通过通信接口413发送或接收不同信息的步骤。通信接口413用于支持该装置进行通信,比如支持该装置与主共识节点和普通节点进行通信。
在本申请实施例中,处理器411可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。上述图12中的总线414可以是PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,上述图12中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
在采用对应各个功能划分各个功能模块的情况下,图13示出了上述实施例中所涉及的交易信息处理装置的一种可能的结构示意图,该装置可以作为普通节点。该装置包括:接收单元501、处理单元502和发送单元503。其中,接收单元501用于支持该装置执行上述方法实施例中接收交易指示信息、接收第一区块、接收应答信息等步骤;处理单元502用于支持该装置执行上述方法实施例中的S203b,和/或本文所描述的其他技术过程;发送单元503用于支持该装置执行上述方法实施例中发送交易执行结果等步骤。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
在采用硬件实现的基础上,本申请实施例中的处理单元502可以为该装置的处理器,接收单元501可以为该装置的接收器,发送单元503可以为该装置的发送器,发送器和接收器通常可以集成在一起用作收发器,具体的收发器还可以称为通信接口或接口电路。
如图14所示,为本申请实施例提供的上述实施例所涉及的交易信息处理装置的另一种可能的结构示意图,该装置可以作为普通节点。该装置包括:处理器511,还可以包括存储器512、通信接口513和总线514,处理器511、存储器512和通信接口513通过总线514连接。
其中,处理器511用于对该装置的动作进行控制管理。在一种可能的实施例中,处理器511可用于支持该装置执行上述方法实施例中的S203b,以及通过通信接口513发送或接收不同信息的步骤。通信接口513用于支持该装置进行通信,比如支持该装置与主共识节点和普通节点进行通信。
在本申请实施例中,处理器511可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。上述图14中的总线514可以是PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,上述图14中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
本申请实施例还提供一种区块链网络,该区块链网络包括主共识节点、从共识节点和普通节点。该主共识节点、从共识节点和普通节点可以用于实现上述实施例中提供的任意一种交易信息处理方法。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。本申请实施例提供的各个设备(如终端和/或网络设备),用于执行上述实施例中对应设备的功能,因此可以达到与上述通信方法相同的效果。
应理解,在上述实施例中的功能或动作或操作或步骤等,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式来实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包括一个或多个可以用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光 介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
基于此,本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当该计算机指令运行时,执行方法实施例中的主共识节点的步骤。
在本申请的又一方面,提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当该计算机指令运行时,执行上述方法实施例中的从共识节点的步骤。
在本申请的又一方面,提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当该计算机指令运行时,执行上述方法实施例中的普通节点的步骤。
在本申请的又一方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机可以执行上述方法实施例中的主共识节点的步骤。
在本申请的又一方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机可以执行上述方法实施例中的从共识节点的步骤。
在本申请的又一方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机可以执行上述方法实施例中的普通节点的步骤。
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (29)

  1. 一种交易信息处理方法,其特征在于,应用于区块链网络中,所述区块链网络包括主共识节点、从共识节点和普通节点,所述方法包括:
    所述主共识节点接收多个交易信息;
    对于所述多个交易信息中的每个交易信息,所述主共识节点分别向所述从共识节点和所述普通节点发送交易指示信息,所述交易指示信息包括所述交易信息和顺序索引,所述顺序索引用于指示所述交易信息在共识过程中的排列顺序;
    所述主共识节点根据所述多个交易信息的所述顺序索引,共识所述多个交易信息以得到第一区块。
  2. 根据权利要求1所述的方法,其特征在于,所述交易指示信息中的所述顺序索引未签名。
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一区块包括多个交易哈希值,所述多个交易哈希值与所述多个交易信息一一对应,所述方法还包括:
    所述主共识节点向所述从共识节点发送所述多个交易哈希值,所述多个交易哈希值中的每个交易哈希值用于所述从共识节点确定是否获取到所述交易哈希值对应的交易信息。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    所述主共识节点接收来自所述从共识节点的获取请求,所述获取请求用于请求获取所述多个交易信息中的至少一个交易信息,所述获取请求是所述从共识节点根据所述多个交易哈希值确定未获取到所述至少一个交易信息时发送的;
    所述主共识节点向所述从共识节点发送至少一个交易指示信息,所述至少一个交易指示信息包括所述至少一个交易信息、以及所述至少一个交易信息中的每个交易信息对应的顺序索引。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述第一区块包括多个交易哈希值,所述多个交易哈希值与所述多个交易信息一一对应,所述方法还包括:
    所述主共识节点向所述普通节点发送所述第一区块,以使所述普通节点验证所述第一区块中的所述多个交易哈希值与本地执行所述多个交易信息得到的多个交易哈希值的一致性。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述方法还包括:
    所述主共识节点获取交易信息处理过程中的性能参数,当所述性能参数满足第一预设条件时,所述主共识节点触发主共识节点的切换流程。
  7. 根据权利要求6所述的方法,其特征在于,所述性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;
    所述共识吞吐量满足第一预设条件包括所述共识吞吐量小于预设吞吐量;
    所述交易时延满足第一预设条件包括所述交易时延大于预设时延;
    所述交易冲突次数满足第一预设条件包括所述交易冲突次数大于第一预设次数。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述方法还包括:
    当所述主共识节点确定某一交易信息在预设时长内未被处理时,所述主共识节点 触发主共识节点的切换流程。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述方法还包括:
    当所述主共识节点确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将所述客户端设备设置为黑名单;
    其中,所述至少一个切换周期中的每个切换周期对应不同的主共识节点。
  10. 一种交易信息处理方法,其特征在于,应用于区块链网络中,所述区块链网络包括主共识节点、从共识节点和普通节点,所述方法包括:
    所述从共识节点接收来自所述主共识节点的多个交易指示信息,所述多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,所述顺序索引用于指示所述交易信息在共识过程中的排列顺序;
    所述从共识节点根据所述多个交易信息的所述顺序索引,共识所述多个交易信息以得到第一区块。
  11. 根据权利要求10所述的方法,其特征在于,所述交易指示信息中的所述顺序索引未签名。
  12. 根据权利要求10或11所述的方法,其特征在于,所述第一区块包括多个交易哈希值,所述多个交易哈希值与所述多个交易信息一一对应,所述方法还包括:
    所述从共识节点接收来自所述主共识节点的所述多个交易哈希值,所述多个交易哈希值中的每个交易哈希值用于所述从共识节点确定是否获取到所述交易哈希值对应的交易信息。
  13. 根据权利要求12所述的方法,其特征在于,当所述从共识节点根据所述多个交易哈希值确定未获取到所述多个交易信息中的至少一个交易信息时,所述方法还包括:
    所述从共识节点向所述主共识节点发送获取请求,所述获取请求用于请求获取所述至少一个交易信息;
    所述从共识节点接收来自所述主共识节点的至少一个交易指示信息,所述至少一个交易指示信息包括所述至少一个交易信息、以及所述至少一个交易信息中的每个交易信息对应的顺序索引。
  14. 根据权利要求10-13任一项所述的方法,其特征在于,对于所述多个交易信息中的每个交易信息,所述方法还包括:
    所述从共识节点接收来自所述普通节点对于所述交易信息的交易执行结果;
    所述从共识节点向所述普通节点发送应答信息,所述应答信息用于确认所述交易执行结果接收成功。
  15. 根据权利要求10-14任一项所述的方法,其特征在于,所述方法还包括:
    所述从共识节点获取交易信息处理过程中的性能参数,当所述性能参数满足第一预设条件时,所述从共识节点触发主共识节点的切换流程。
  16. 根据权利要求15所述的方法,其特征在于,所述性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;
    所述共识吞吐量满足第一预设条件包括所述共识吞吐量小于预设吞吐量;
    所述交易时延满足第一预设条件包括所述交易时延大于预设时延;
    所述交易冲突次数满足第一预设条件包括所述交易冲突次数大于第一预设次数。
  17. 根据权利要求10-16任一项所述的方法,其特征在于,所述方法还包括:
    当所述从共识节点确定某一交易信息在预设时长内未被处理或者所述主共识节点在下一次主共识节点切换之前弃权时,所述从共识节点触发主共识节点的切换流程。
  18. 根据权利要求10-17任一项所述的方法,其特征在于,所述方法还包括:
    当所述从共识节点确定某一客户端设备在连续的至少一个切换周期内的交易信息的交易冲突次数大于第二预设次数时,将所述客户端设备设置为黑名单;
    其中,所述至少一个切换周期中的每个切换周期对应不同的主共识节点。
  19. 一种交易信息处理装置,其特征在于,所述装置作为主共识节点,应用于区块链网络中,所述区块链网络还包括从共识节点和普通节点,所述装置包括:
    接收单元,用于接收多个交易信息;
    发送单元,用于对于所述多个交易信息中的每个交易信息,分别向所述从共识节点和所述普通节点发送交易指示信息,所述交易指示信息包括所述交易信息和顺序索引,所述顺序索引用于指示所述交易信息在共识过程中的排列顺序;
    处理单元,用于根据所述多个交易信息的所述顺序索引,共识所述多个交易信息以得到第一区块。
  20. 根据权利要求19所述的装置,其特征在于,所述交易指示信息中的所述顺序索引未签名。
  21. 根据权利要求19或20所述的装置,其特征在于,所述第一区块包括多个交易哈希值,所述多个交易哈希值与所述多个交易信息一一对应,所述发送单元还用于:
    向所述从共识节点发送所述多个交易哈希值,所述多个交易哈希值中的每个交易哈希值用于所述从共识节点确定是否获取到所述交易哈希值对应的交易信息。
  22. 一种交易信息处理装置,其特征在于,所述装置作为从共识节点,应用于区块链网络中,所述区块链网络还包括主共识节点和普通节点,所述装置包括:
    接收单元,用于接收来自所述主共识节点的多个交易指示信息,所述多个交易指示信息中的每个交易指示信息包括交易信息和顺序索引,所述顺序索引用于指示所述交易信息在共识过程中的排列顺序;
    处理单元,用于根据所述多个交易信息的所述顺序索引,共识所述多个交易信息以得到第一区块。
  23. 根据权利要求22所述的装置,其特征在于,所述交易指示信息中的所述顺序索引未签名。
  24. 根据权利要求22或23所述的装置,其特征在于,所述第一区块包括多个交易哈希值,所述多个交易哈希值与所述多个交易信息一一对应,所述接收单元还用于:
    接收来自所述主共识节点的所述多个交易哈希值,所述多个交易哈希值中的每个交易哈希值用于所述从共识节点确定是否获取到所述交易哈希值对应的交易信息。
  25. 根据权利要求24所述的装置,其特征在于,当所述从共识节点未获取到所述多个交易信息中的至少一个交易信息时,所述装置还包括发送单元;
    所述发送单元,用于向所述主共识节点发送获取请求,所述获取请求用于请求获取所述至少一个交易信息;
    所述接收单元,还用于接收来自所述主共识节点的至少一个交易指示信息,所述至少一个交易指示信息包括所述至少一个交易信息、以及所述至少一个交易信息中的每个交易信息对应的顺序索引。
  26. 根据权利要求22-25任一项所述的装置,其特征在于,所述处理单元还用于:
    获取交易信息处理过程中的性能参数,当所述性能参数满足第一预设条件时,所述从共识节点触发主共识节点的切换流程。
  27. 根据权利要求26所述的装置,其特征在于,所述性能参数包括以下至少一种:共识吞吐量、交易时延、交易冲突次数;
    所述共识吞吐量满足第一预设条件包括所述共识吞吐量小于预设吞吐量;
    所述交易时延满足第一预设条件包括所述交易时延大于预设时延;
    所述交易冲突次数满足第一预设条件包括所述交易冲突次数大于第一预设次数。
  28. 一种交易信息处理装置,其特征在于,所述装置包括处理器、存储器、通信接口和总线,所述处理器、所述存储器和所述通信接口通过总线连接;所述存储器用于存储程序代码,当所述程序代码被所述处理器执行时,使得所述装置执行权利要求1-9任一项所述的交易信息处理方法,或者执行权利要求10-18任一项所述的交易信息处理方法。
  29. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被运行时,实现1-9任一项所述的交易信息处理方法,或者实现权利要求10-18任一项所述的交易信息处理方法。
PCT/CN2022/106699 2021-09-15 2022-07-20 一种交易信息处理方法及装置 WO2023040453A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111080651.2A CN115829731A (zh) 2021-09-15 2021-09-15 一种交易信息处理方法及装置
CN202111080651.2 2021-09-15

Publications (1)

Publication Number Publication Date
WO2023040453A1 true WO2023040453A1 (zh) 2023-03-23

Family

ID=85514927

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/106699 WO2023040453A1 (zh) 2021-09-15 2022-07-20 一种交易信息处理方法及装置

Country Status (2)

Country Link
CN (1) CN115829731A (zh)
WO (1) WO2023040453A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (zh) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 一种区块链的交易排序方法、装置、电子设备和存储介质
CN117808466A (zh) * 2024-02-28 2024-04-02 中国信息通信研究院 基于区块链的交易预执行方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111611321A (zh) * 2020-06-29 2020-09-01 上海优扬新媒信息技术有限公司 一种数据存储方法、装置及区块链系统
CN112507019A (zh) * 2020-11-20 2021-03-16 南京航空航天大学 一种基于智能合约的pbft共识系统及方法
WO2021082315A1 (zh) * 2019-10-30 2021-05-06 北京海益同展信息科技有限公司 区块链的共识方法、共识节点、电子设备、存储介质
CN112887437A (zh) * 2021-04-28 2021-06-01 支付宝(杭州)信息技术有限公司 区块链交易处理方法、区块链节点和区块链
CN113342838A (zh) * 2021-08-06 2021-09-03 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021082315A1 (zh) * 2019-10-30 2021-05-06 北京海益同展信息科技有限公司 区块链的共识方法、共识节点、电子设备、存储介质
CN111611321A (zh) * 2020-06-29 2020-09-01 上海优扬新媒信息技术有限公司 一种数据存储方法、装置及区块链系统
CN112507019A (zh) * 2020-11-20 2021-03-16 南京航空航天大学 一种基于智能合约的pbft共识系统及方法
CN112887437A (zh) * 2021-04-28 2021-06-01 支付宝(杭州)信息技术有限公司 区块链交易处理方法、区块链节点和区块链
CN113342838A (zh) * 2021-08-06 2021-09-03 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及可读存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
GUO BINGYONG, LI XIN-YU: "Multi-valued Byzantine Consensus Scheme with High Transmission Efficiency", JOURNAL OF CRYPTOLOGIC RESEARCH, vol. 5, no. 5, 31 October 2018 (2018-10-31), pages 516 - 528, XP093048129, DOI: 10.13868/j.cnki.jcr.000261 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (zh) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 一种区块链的交易排序方法、装置、电子设备和存储介质
CN117808466A (zh) * 2024-02-28 2024-04-02 中国信息通信研究院 基于区块链的交易预执行方法和装置

Also Published As

Publication number Publication date
CN115829731A (zh) 2023-03-21

Similar Documents

Publication Publication Date Title
US11830001B2 (en) Blockchain consensus method, accounting node and node
WO2023040453A1 (zh) 一种交易信息处理方法及装置
KR102566892B1 (ko) 블록체인 합의 방법, 디바이스 및 시스템
CN109815373B (zh) 数据存储的控制方法、装置、服务器及可读存储介质
CN111741114A (zh) 基于区块链的可监管跨链交互系统、方法及设备
WO2023045620A1 (zh) 一种交易数据处理方法、装置、计算机设备以及存储介质
CN112887160B (zh) 区块链一体机及其多节点部署方法、装置、存储介质
CN113347164B (zh) 基于区块链的分布式共识系统及方法、设备、存储介质
EP3869434B1 (en) Blockchain-based data processing method and apparatus, device, and medium
WO2021098139A1 (zh) 跨链交易的状态数据的存储方法、装置及存储介质
US20200394162A1 (en) Operation management method for distributed ledger system, operation management system for distributed ledger system, and operation management program for distributed ledger system
WO2021208762A1 (zh) 数据存储、查询
WO2023045617A1 (zh) 一种交易数据处理方法、装置、设备以及介质
CN111899019A (zh) 一种黑名单多方交叉验证和共享的方法及系统
CN112184436B (zh) 数据同步方法、电子设备及可读存储介质
EP4030314A1 (en) Blockchain-based data processing method, apparatus and device, and readable storage medium
CN112202564B (zh) 交易传递方法、装置、电子设备及可读存储介质
JP2022525551A (ja) データレコードのコピーの分散型台帳システムへの誤伝送の防止
Vizier et al. ComChain: A blockchain with Byzantine fault‐tolerant reconfiguration
CN113890739B (zh) 跨区块链的认证方法、装置、电子设备及介质
CN113409047B (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
CN112037055B (zh) 交易处理方法、装置、电子设备及可读存储介质
US10326833B1 (en) Systems and method for processing request for network resources
CN112037062B (zh) 交易共识方法、装置、电子设备及可读存储介质
WO2024103854A1 (zh) 跨链交易方法、系统、电子设备及存储介质

Legal Events

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

Ref document number: 22868830

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE