CN112232958A - Transaction consensus method and device and electronic equipment - Google Patents

Transaction consensus method and device and electronic equipment Download PDF

Info

Publication number
CN112232958A
CN112232958A CN202011114906.8A CN202011114906A CN112232958A CN 112232958 A CN112232958 A CN 112232958A CN 202011114906 A CN202011114906 A CN 202011114906A CN 112232958 A CN112232958 A CN 112232958A
Authority
CN
China
Prior art keywords
transaction
block
target
node
hash value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011114906.8A
Other languages
Chinese (zh)
Inventor
赖奕宇
曹崇瑞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202011114906.8A priority Critical patent/CN112232958A/en
Publication of CN112232958A publication Critical patent/CN112232958A/en
Pending legal-status Critical Current

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

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention provides a transaction consensus method, a device and electronic equipment; wherein, the method comprises the following steps: determining a target transaction from the transactions to be identified; generating a transaction block based on a transaction hash value of the target transaction; and broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block. The invention can greatly reduce the data volume of the transaction block, and the transaction block can be quickly and stably broadcast to each node in the block chain even under the condition of large transaction volume, thereby improving the transaction consensus efficiency.

Description

Transaction consensus method and device and electronic equipment
Technical Field
The invention relates to the technical field of block chains, in particular to a transaction consensus method, a transaction consensus device and electronic equipment.
Background
In the consensus transaction process of the blockchain such as the alliance chain, when the transaction enters the transaction pool, the transaction is verified, the main node in the blockchain acquires the transaction from the transaction pool, the acquired transaction is packaged in full to obtain a block, then block broadcasting is carried out, so that other nodes in the blockchain receive the block, and then the subsequent consensus transaction process is executed. In the above process, the master node needs to pack the whole transaction, which results in a large data volume of the block, and under the condition that the whole transaction volume of the block chain is large, the block with a large data volume is easy to cause network congestion, reduce the block broadcasting speed, and cause consensus timeout.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a transaction consensus method, apparatus and electronic device, which can greatly reduce the data volume of a transaction block, and even under the condition of large transaction volume, the transaction block can be quickly and stably broadcast to each node in a block chain, thereby improving the transaction consensus efficiency.
In a first aspect, an embodiment of the present invention provides a transaction consensus method, where the method is applied to a master node in a block chain; the main node stores the transaction to be identified; the method comprises the following steps: determining a target transaction from the transactions to be identified; generating a transaction block based on a transaction hash value of the target transaction; and broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block.
The transaction block comprises: a transaction hash value for the target transaction.
After the step of broadcasting the transaction block to the nodes in the blockchain except the master node, the method further includes: if a transaction acquisition request sent by a first node except the main node is received, extracting a transaction hash value of a transaction to be acquired from the transaction acquisition request; acquiring transaction content of the transaction to be acquired from the transaction to be identified based on the transaction hash value of the transaction to be acquired; and sending the transaction content of the transaction to be acquired to the first node.
In a second aspect, an embodiment of the present invention provides a transaction consensus method, where the method is applied to a first node in a block chain, except for a master node; the first node stores the transaction to be identified; the method comprises the following steps: if a transaction block sent by the main node is received, acquiring a transaction hash value of a target transaction contained in the transaction block; acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
The step of obtaining the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified includes: inquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; if the target transaction hash value of which the transaction content cannot be inquired exists in the transaction hash values, generating a transaction acquisition request based on the target transaction hash value; and sending the transaction acquisition request to the main node so as to acquire the transaction content of the transaction corresponding to the target transaction hash value from the main node.
After the step of sending the transaction obtaining request to the master node, the method further comprises: receiving transaction content of a transaction corresponding to the target transaction hash value returned by the main node; and carrying out signature verification processing on the transaction content of the transaction corresponding to the target transaction hash value.
In a third aspect, an embodiment of the present invention provides a transaction consensus apparatus, where the apparatus is disposed in a master node in a block chain; the main node stores the transaction to be identified; the device comprises: the transaction determining module is used for determining a target transaction from the transactions to be identified; the block generation module is used for generating a transaction block based on the transaction hash value of the target transaction; and the block broadcasting module is used for broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block.
In a fourth aspect, an embodiment of the present invention provides a transaction consensus apparatus, where the apparatus is disposed at a first node in a blockchain, except for a master node; the first node stores the transaction to be identified; the device comprises: the hash value acquisition module is used for acquiring a transaction hash value of a target transaction contained in a transaction block if the transaction block sent by the main node is received; the transaction content acquisition module is used for acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
In a fifth aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the transaction consensus method.
In a sixth aspect, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the transaction consensus method described above.
The embodiment of the invention has the following beneficial effects:
in the transaction consensus method, the transaction consensus device and the electronic equipment, after a target transaction is determined from the transactions to be agreed, a transaction block is generated based on a transaction hash value of the target transaction; and then broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block. In the mode, the transaction block is generated based on the transaction hash value of the target transaction, the data volume of the transaction block can be greatly reduced, even under the condition of large transaction volume, the transaction block can be quickly and stably broadcast to each node in the block chain, and the transaction consensus efficiency is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a transaction consensus method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another transaction consensus method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a transaction consensus apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another transaction consensus apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For ease of understanding, two technical concepts, BFT (Byzantine factory Tolerance) and federation chains are first introduced. The Byzantine fault-tolerant technology BFT is a fault-tolerant technology in the field of distributed computing, the Byzantine assumption in the technology is real-world modeling, and unexpected behaviors of a computer and a network can occur due to hardware errors, network congestion or interruption, malicious attack and the like. Byzantine fault tolerance techniques are designed to handle these abnormal behaviors and meet the specification requirements of the problem to be solved.
A federation chain is essentially a private chain, except that a federation chain is larger than a private chain developed by a single small organization, but not as large as a public chain, it being understood that it is a block chain between a private chain and a public chain. At present, in the consensus transaction process of the alliance chain, a host node packages the whole transaction and issues a consensus proposal. This approach generally causes two problems: firstly, if the transaction amount in the chain is too large, for example, the transaction amount in a unit time period reaches one hundred thousand, the network bandwidth can be easily filled and the message broadcasting speed can be rapidly reduced, and as long as the network shakes, the consensus timeout can be easily caused; second, transaction verification is performed by the consensus master node, and when other consensus nodes receive a block (also called a block) proposal, in order to save time, the transactions in the block are usually not checked repeatedly, so that if the master node does bad, a security problem occurs. In this embodiment, the master node may also be referred to as a leader node or a master node.
Based on the above, embodiments of the present invention provide a transaction consensus method, an apparatus, and an electronic device, where the technology may be applied to a transaction consensus process of various block chains, such as a federation chain, a private chain, and a public chain. To facilitate understanding of the embodiment, a detailed description will be given of a transaction consensus method disclosed in the embodiment of the present invention.
The method is applied to the main nodes in the block chain, the main nodes in the block chain can be selected from all the nodes in the block chain, and all the nodes in the block chain can be alternately used as the main nodes under the control of a certain selection algorithm; the main node stores the transaction to be identified; the main node can be provided with a transaction pool, and the transaction pool stores transactions received by the main node from the client and also includes transactions broadcasted by other nodes; specifically, each node in the block chain is provided with a transaction pool, and the transaction pool of each node stores transactions received by the node from the client and also includes transactions broadcasted by other nodes; for example, for node a, after receiving transaction B from the client, the node checks and stores the transaction B in the transaction pool of node a, then broadcasts the transaction B in the blockchain, so that other nodes also receive transaction B, and after checking and storing the transaction B in their respective transaction pools by other nodes. Thus, in an ideal situation, the transactions held in the transaction pool of each node in the blockchain are identical; the transaction pool of each node transaction holds the transactions to be identified.
As shown in fig. 1, the transaction consensus method includes the following steps:
step S102, determining a target transaction from the transactions to be identified;
the main node is used for triggering a transaction consensus process, the transactions to be consensus can be stored in a transaction pool of the main node, and the transactions to be consensus can be stored in the transaction pool in a queue form. The main node selects a certain number of transactions from the transactions to be identified as the target transactions; in most cases, the number of target transactions selected at one time by the master node is plural, but may be one.
Step S104, generating a transaction block based on the transaction hash value of the target transaction;
in the related technology, after a certain number of target transactions are determined from the transactions to be identified, the complete transaction content of the target transactions is packaged to generate transaction blocks; typically, the transaction content of a transaction includes a variety of data, particularly an input data portion, which is created by, or invoked by, the smart contract code. In most cases, the data size of one transaction can reach 500 bytes, if a transaction block needs to pack 10 ten thousand transactions, the data size of the transaction block can reach 50M, and the bandwidth requirement is very high when a transaction area with such a large data size is broadcast in a block chain. Thus, in the case of a relatively large transaction amount, the consensus process can easily time out at the network level.
In this embodiment, the complete transaction content is not packaged any more, but a transaction block is generated based on the transaction hash value of the target transaction; the transaction block does not comprise the complete transaction content of the target transaction and only comprises the content related to the transaction hash value of the target transaction; in a specific implementation manner, the transaction block includes a transaction hash value of the target transaction; in other ways, other identifying information related to the transaction hash value of the target transaction, such as the encrypted transaction hash value, may also be included in the transaction block. Therefore, the embodiment can greatly reduce the data volume of the transaction block and reduce the problem of consensus timeout.
Step S106, the transaction block is broadcasted to the nodes except the main node in the block chain, so as to perform consensus processing on the transaction in the transaction block.
After the data volume of the transaction block is reduced, even if the network is crowded or network jitter occurs, the transaction block can be stably broadcast to other nodes except the main node in the block chain; taking a node A in other nodes as an example, the transaction block received by the node A only includes the content related to the transaction hash value of the target transaction; because the transaction pool of the node a contains the same to-be-consensus transaction as that in the transaction pool of the master node, the node a can obtain the complete transaction content of the target transaction from the transaction pool of the node a based on the content related to the transaction hash value of the target transaction in the transaction block, and then perform subsequent consensus processing, such as a commit stage, an execute stage, and the like.
In the transaction consensus method, after a target transaction is determined from the transactions to be agreed, a transaction block is generated based on a transaction hash value of the target transaction; and then broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block. In the mode, the transaction block is generated based on the transaction hash value of the target transaction, the data volume of the transaction block can be greatly reduced, even under the condition of large transaction volume, the transaction block can be quickly and stably broadcast to each node in the block chain, and the transaction consensus efficiency is improved.
As described in the previous embodiments, each node broadcasts a transaction to other nodes in the blockchain after receiving the transaction from the client, and thus, in most cases, the transactions held in the transaction pool of each node in the blockchain are the same. Therefore, after receiving the transaction block, the node may obtain the transaction content of the target transaction from the local transaction pool of the node based on the transaction hash value of the target transaction in the transaction block. However, in actual implementation, the transaction broadcast is not timely or missed, so that the node does not store all transactions to be identified, and at this time, the node cannot acquire the transaction content of the target transaction from the local transaction pool.
To obtain the transaction content of the target transaction, the other node may send a request to the master node. Specifically, if the transaction content of the target transaction K is not obtained from the local transaction pool, a transaction obtaining request is generated based on the transaction hash value of the target transaction K in the transaction block, where the transaction obtaining request includes the transaction hash value of the target transaction K. For the main node, if a transaction acquisition request sent by a first node except the main node is received, extracting a transaction hash value of a transaction to be acquired from the transaction acquisition request; the transaction to be acquired here belongs to one or more transactions in the target transactions; acquiring transaction content of the transaction to be acquired from the transaction to be identified based on the transaction hash value of the transaction to be acquired; and sending the transaction content of the transaction to be acquired to the first node. Generally, after receiving the transaction content of the transaction to be acquired, the first node performs signature verification on the transaction content of the transaction to be acquired. After the signature is checked, the first node can obtain the transaction content of each transaction in the transaction block, and at this time, a commit stage, an execute stage and the like in the transaction consensus process can be executed.
To further understand the transaction consensus method of the present embodiment, the transaction consensus method is described below from the perspective of the first node except the master node; the method is applied to a first node except a main node in a block chain; the first node stores the transaction to be identified; as shown in fig. 2, the method comprises the steps of:
step S202, if a transaction block sent by the master node is received, a transaction hash value of a target transaction contained in the transaction block is obtained;
the transaction block typically contains transaction hash values of a plurality of target transactions, and the transaction hash values of the plurality of target transactions are stored in the transaction block in a list form, where the list form may be [ hash1, hash2, …, hash ]. Because the transaction block only comprises the transaction hash value, even if the transaction block comprises 10 thousands of transactions, the data volume of one transaction block is usually less than 1M, the data volume of the transaction block is greatly reduced, the transmission of a network layer is facilitated, and the consensus speed can be increased.
Step S204, acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
The local transaction pool of the first node stores the transactions to be identified in the current block link network, so that the first node can acquire the transaction content of the target transaction corresponding to each transaction hash value included in the transaction block from the local transaction pool, and perform identification processing on the target transaction based on the transaction content of the target transaction acquired from the local transaction pool.
It should be noted that, if the master node makes a malicious result and tampers with the transaction content of the target transaction, the first node may detect the hash value of the target transaction in the transaction block; in addition, because the first node is the transaction content of the target transaction acquired from the local transaction pool, even if the master node tampers the transaction content of the target transaction, the first node does not perform subsequent consensus processing, such as commit processing, on the tampered transaction content of the target transaction; the first node uses the transaction content of the target transaction which is not tampered in the local transaction pool to perform subsequent consensus processing, so that the safety of the block chain data is improved.
In the transaction consensus method, if a transaction block sent by a main node is received, a transaction hash value of a target transaction contained in the transaction block is obtained; acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction. In the mode, the main node generates the transaction block based on the transaction hash value of the target transaction, the data volume of the transaction block can be greatly reduced, even under the condition of large transaction volume, the transaction block can be quickly and stably broadcast to each node in the block chain, each node obtains transaction content from a local transaction pool based on the transaction hash value in the transaction area, the transaction content does not need to be transmitted through a network, and the transaction consensus efficiency is improved.
In addition, the method can also prevent the master node from tampering the transaction content, the first node except the master node uses a local transaction pool, the transaction content of the target transaction which is not tampered is subjected to subsequent consensus processing, even if the master node tampers the transaction content, the subsequent consensus processing based on the tampered transaction content cannot be performed, and the safety of the block chain data is improved.
When the transaction block comprises transaction hash values of a plurality of target transactions, acquiring transaction contents of each target transaction from a transaction pool of the first node aiming at the transaction hash value of each target transaction; in most cases, the first node stores all transactions to be identified, but there may be a few situations where the broadcast is not timely or missed, and at this time, the first node may not store the transaction content of the target transaction.
Based on the above, when the transaction content of the target transaction corresponding to the transaction hash value is obtained, the transaction content of the target transaction corresponding to the transaction hash value is inquired from the transactions to be identified; if the target transaction hash value of which the transaction content cannot be inquired exists in the transaction hash values, generating a transaction acquisition request based on the target transaction hash value; and sending the transaction acquisition request to the main node so as to acquire the transaction content of the transaction corresponding to the target transaction hash value from the main node.
The transaction acquisition request comprises transaction hash values of one or more target transactions which are not inquired from the transaction pool of the first node; after the transaction acquisition request is sent to the main node, the main node acquires the transaction contents of the target transactions from the local transaction pool of the main node and then sends the transaction contents to the first node, so that the first node can obtain the transaction contents of each target transaction in the transaction block, and the subsequent consensus process can be executed after the transaction contents of each transaction in the transaction block are complete.
After the first node sends the request to be acquired to the main node, transaction content of the transaction corresponding to the target transaction hash value returned by the main node can be received; and carrying out signature verification processing on the transaction content of the transaction corresponding to the target transaction hash value. In the block chain, each node needs to check the received transaction, and after the check passes, the transaction can be stored in a local transaction pool; for the transaction contents of the target transactions which are not inquired in the first node, after the transaction contents of the target transactions are obtained from the main node, signature verification processing is required to be carried out, and then the transaction contents can enter a transaction pool of the first node; therefore, for the first node, after the first node acquires the transaction content of the target transaction from the transaction block, if the transaction content of the target transaction is already stored in the transaction pool of the first node, it indicates that the first node has already performed one-time signature verification on the transaction content of the target transaction, and at this time, the transaction content of the target transaction in the transaction block is subjected to one-time signature verification again, which is equivalent to that the first node needs to perform two-time signature verification on the transaction content of the target transaction, so that the time consumption of the consensus process is increased undoubtedly.
Corresponding to the above method embodiment, refer to a flowchart of a transaction consensus device shown in fig. 3, the device is disposed in a master node in a blockchain; the main node stores the transaction to be identified; the device includes:
a transaction determination module 30 for determining a target transaction from the transactions to be agreed upon;
a block generation module 32, configured to generate a transaction block based on the transaction hash value of the target transaction;
the block broadcasting module 34 is configured to broadcast the transaction block to nodes in the block chain except the master node, so as to perform consensus processing on the transaction in the transaction block.
In the transaction consensus device, after a target transaction is determined from the transactions to be consensus, a transaction block is generated based on a transaction hash value of the target transaction; and then broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block. In the mode, the transaction block is generated based on the transaction hash value of the target transaction, the data volume of the transaction block can be greatly reduced, even under the condition of large transaction volume, the transaction block can be quickly and stably broadcast to each node in the block chain, and the transaction consensus efficiency is improved.
The transaction block comprises: a transaction hash value for the target transaction.
The apparatus further comprises a request processing module configured to: if a transaction acquisition request sent by a first node except the main node is received, extracting a transaction hash value of a transaction to be acquired from the transaction acquisition request; acquiring transaction content of the transaction to be acquired from the transaction to be identified based on the transaction hash value of the transaction to be acquired; and sending the transaction content of the transaction to be acquired to the first node.
Referring to fig. 4, a flow chart of another transaction consensus device is shown, which is disposed at a first node of a blockchain except for a master node; the first node stores therein transactions to be identified; the device includes:
a hash value obtaining module 40, configured to, if a transaction block sent by the host node is received, obtain a transaction hash value of a target transaction included in the transaction block;
the transaction content obtaining module 42 is configured to obtain transaction content of a target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
The transaction content obtaining module is further configured to: inquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; if the target transaction hash value of which the transaction content cannot be inquired exists in the transaction hash values, generating a transaction acquisition request based on the target transaction hash value; and sending the transaction acquisition request to the main node so as to acquire the transaction content of the transaction corresponding to the target transaction hash value from the main node.
The device also comprises a label checking module used for: receiving transaction content of a transaction corresponding to the target transaction hash value returned by the main node; and carrying out signature verification processing on the transaction content of the transaction corresponding to the target transaction hash value.
The embodiment also provides an electronic device, which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to realize the transaction consensus method.
Referring to fig. 5, the electronic device includes a processor 100 and a memory 101, the memory 101 stores machine executable instructions capable of being executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the transaction consensus method in the game.
Further, the electronic device shown in fig. 5 further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
The Memory 101 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 5, but this does not indicate only one bus or one type of bus.
Processor 100 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 100. The Processor 100 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The present embodiments also provide a machine-readable storage medium having stored thereon machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the above-described method of transaction consensus in a game.
The method, the apparatus, and the computer program product for transaction consensus in games provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood in specific cases for those skilled in the art.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that the following embodiments are merely illustrative of the present invention, and not restrictive, and the scope of the present invention is not limited thereto: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A transaction consensus method is characterized in that the method is applied to a main node in a block chain; the main node stores the transaction to be identified; the method comprises the following steps:
determining a target transaction from the transactions to be identified;
generating a transaction block based on the transaction hash value of the target transaction;
and broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block.
2. The method of claim 1, wherein the transaction block comprises: a transaction hash value for the target transaction.
3. The method of claim 1, wherein after the step of broadcasting the transaction block to nodes in the blockchain other than the master node, the method further comprises:
if a transaction acquisition request sent by a first node except the main node is received, extracting a transaction hash value of a transaction to be acquired from the transaction acquisition request;
acquiring the transaction content of the transaction to be acquired from the transaction to be identified based on the transaction hash value of the transaction to be acquired;
and sending the transaction content of the transaction to be acquired to the first node.
4. A transaction consensus method, characterized in that the method is applied to a first node in a blockchain, except a master node; the first node stores the transaction to be identified; the method comprises the following steps:
if a transaction block sent by a main node is received, acquiring a transaction hash value of a target transaction contained in the transaction block;
acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
5. The method according to claim 4, wherein the step of obtaining the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be agreed upon comprises:
inquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified;
if a target transaction hash value of which the transaction content cannot be inquired exists in the transaction hash values, generating a transaction acquisition request based on the target transaction hash value;
and sending the transaction acquisition request to the main node so as to acquire the transaction content of the transaction corresponding to the target transaction hash value from the main node.
6. The method of claim 5, wherein after the step of sending the transaction acquisition request to the master node, the method further comprises:
receiving transaction content of the transaction corresponding to the target transaction hash value returned by the main node;
and carrying out signature verification processing on the transaction content of the transaction corresponding to the target transaction hash value.
7. The transaction consensus device is characterized in that the device is arranged on a main node in a block chain; the main node stores the transaction to be identified; the device comprises:
the transaction determining module is used for determining a target transaction from the transactions to be identified;
the block generation module is used for generating a transaction block based on the transaction hash value of the target transaction;
and the block broadcasting module is used for broadcasting the transaction block to nodes except the main node in the block chain so as to perform consensus processing on the transaction in the transaction block.
8. A transaction consensus device is characterized in that the device is arranged at a first node except a main node in a block chain; the first node stores the transaction to be identified; the device comprises:
the hash value acquisition module is used for acquiring a transaction hash value of a target transaction contained in a transaction block if the transaction block sent by the main node is received;
the transaction content acquisition module is used for acquiring the transaction content of the target transaction corresponding to the transaction hash value from the transaction to be identified; and performing consensus processing on the target transaction based on the transaction content of the target transaction.
9. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the transaction consensus method of any one of claims 1-6.
10. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement the transaction consensus method of any one of claims 1-6.
CN202011114906.8A 2020-10-16 2020-10-16 Transaction consensus method and device and electronic equipment Pending CN112232958A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011114906.8A CN112232958A (en) 2020-10-16 2020-10-16 Transaction consensus method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011114906.8A CN112232958A (en) 2020-10-16 2020-10-16 Transaction consensus method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112232958A true CN112232958A (en) 2021-01-15

Family

ID=74117848

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011114906.8A Pending CN112232958A (en) 2020-10-16 2020-10-16 Transaction consensus method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112232958A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180240114A1 (en) * 2017-02-22 2018-08-23 Alibaba Group Holding Limited Transaction verification in a consensus network
CN109474682A (en) * 2018-11-12 2019-03-15 杭州秘猿科技有限公司 A kind of block chain network transmission method, device and electronic equipment
CN111130801A (en) * 2019-12-26 2020-05-08 腾讯科技(深圳)有限公司 Data processing method and device, node equipment and computer storage medium
CN111522822A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Block chain consensus method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180240114A1 (en) * 2017-02-22 2018-08-23 Alibaba Group Holding Limited Transaction verification in a consensus network
CN109474682A (en) * 2018-11-12 2019-03-15 杭州秘猿科技有限公司 A kind of block chain network transmission method, device and electronic equipment
CN111130801A (en) * 2019-12-26 2020-05-08 腾讯科技(深圳)有限公司 Data processing method and device, node equipment and computer storage medium
CN111522822A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Block chain consensus method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
KR102469267B1 (en) Blockchain consensus method, accounting node and node
CN111901327B (en) Cloud network vulnerability mining method and device, electronic equipment and medium
CN112232957A (en) Transaction consensus method and device and electronic equipment
KR102578019B1 (en) Blockchain-based data detection method and device, and computer-readable storage medium
CN112907369B (en) Block chain-based data consensus method and device, electronic equipment and storage medium
CN111885050B (en) Data storage method and device based on block chain network, related equipment and medium
CN111010284B (en) Processing method of block to be identified, related device and block chain system
CN109684878B (en) Privacy information tamper-proofing method and system based on block chain technology
CN110784521A (en) Block chain consensus method, electronic device and storage medium
CN111224782B (en) Data verification method based on digital signature, intelligent device and storage medium
CN111367923A (en) Data processing method, data processing device, node equipment and storage medium
CN109560893B (en) Data verification method and device and server
CN114788199A (en) Data verification method and device
CN111176567B (en) Storage supply verification method and device for distributed cloud storage
CN116455974A (en) Transaction caching and ordering method, device, electronic equipment and storage medium
CN112232958A (en) Transaction consensus method and device and electronic equipment
CN110730063B (en) Security verification method and system, internet of things platform, terminal and readable storage medium
CN114979109B (en) Behavior track detection method, behavior track detection device, computer equipment and storage medium
CN111814204B (en) Block chain-based data consensus method, related equipment and storage medium
CN116305322A (en) Program signature verification method and device, storage medium and electronic equipment
CN114614996B (en) Terminal request processing method, device and system
CN113591137B (en) Block chain-based management method and device
CN114465866B (en) DPoS method based on trust degree and PBFT
CN112367326B (en) Method and device for identifying traffic of Internet of vehicles

Legal Events

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