Data interaction method and device under block chain, equipment, medium and product
By preparing transactions and executing them in the blockchain and constructing confirmation messages, the problem of low blockchain interaction efficiency in the existing technology is solved, and more efficient transaction response is achieved.
Patent Information
- Application Number
- CN202410114865.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-26
- Publication Date
- 2025-07-29
AI Technical Summary
The existing blockchain interaction technology adopts a sequential serial workflow, resulting in poor transaction consensus, execution and on-chain performance and inefficient data interaction.
By entering the preparation stage in response to the received preparatory message, the sorted transaction is carried out to perform preparation processing and transaction execution, and broadcast the prepared processing generated preparation message within the blockchain, and the confirmation message is constructed based on the result of transaction execution.
It improves the response efficiency of blockchain transactions and reduces transaction time. It is suitable for a variety of consensus algorithms, including PBFT and BFT consensus of various alliance chains, with low transformation cost and strong maintenance.
Smart Images

Figure CN120389844A_ABST
Abstract
Description
Background Art
[0002] Currently, the technical research on consortium blockchains mainly focuses on improving the performance of consortium blockchains.
[0003] In related technologies, the widely used blockchain interaction process is consensus (i.e., sorting) - execution. In the multi - stage consensus process, each node executes the transactions in the block at a certain stage, and then adds the transaction results to the consensus information to ensure the consistency of the final transaction execution results.
[0004] However, the existing blockchain interaction technology adopts a sequential and serial workflow, which is not conducive to the performance of transaction consensus, execution, and on - chain, and the data interaction efficiency is low.
[0005] It should be noted that the information disclosed in the above background art section is only used to strengthen the understanding of the background of the present disclosure. Therefore, it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0006] The purpose of the present disclosure is to provide a data interaction method, device, equipment, medium, and product under a blockchain, which is used to at least overcome to some extent the problem of low blockchain interaction efficiency caused by the limitations and defects of related technologies.
[0007] According to the first aspect of the embodiments of the present disclosure, a data interaction method under a blockchain is provided, including: upon receiving a pre - preparation message, determining to enter the preparation stage; in the preparation stage, performing preparation processing and transaction execution on the sorted transactions, and broadcasting the preparation message generated by the preparation processing in the blockchain; upon receiving the preparation message, constructing an acknowledgment message based on the result of the transaction execution.
[0008] In an exemplary embodiment of the present disclosure, before responding to the received pre - preparation message, it further includes:
[0009] Upon receiving a transaction sent by a client, sorting the transaction and forming a block;
[0010] Determining the pre - preparation message according to the block;
[0011] Broadcasting the pre - preparation message in the blockchain.
[0012] In an exemplary embodiment of the present disclosure, upon receiving a transaction sent by a client, sorting the transaction and forming a block includes:
[0013] Determining that the main node of the blockchain receives the transaction sent by the client;
[0014] In response to the transaction sent by the client to the master node, trigger the master node to sort the transaction and form the block.
[0015] In an exemplary embodiment of the present disclosure, determining to enter the preparation phase in response to the received pre-preparation message includes:
[0016] In response to the received pre-preparation message, verify the pre-preparation message; if the pre-preparation message passes the verification, determine to enter the preparation phase.
[0017] In an exemplary embodiment of the present disclosure, constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain includes:
[0018] After receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed;
[0019] If it is determined that the transaction corresponding to the preparation message has been executed, construct the confirmation message according to the result of the transaction execution.
[0020] In an exemplary embodiment of the present disclosure, constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain further includes:
[0021] After receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed;
[0022] If it is determined that the transaction corresponding to the preparation message has not been executed, wait for the transaction to be executed;
[0023] In response to the executed transaction, construct the confirmation message according to the result of the transaction execution.
[0024] In an exemplary embodiment of the present disclosure, it further includes:
[0025] Broadcast the confirmation message within the blockchain to reach a consensus on the transaction within the blockchain.
[0026] According to the second aspect of the embodiments of the present disclosure, a data interaction device under a blockchain is provided, including:
[0027] A determination module, configured to determine to enter the preparation phase in response to the received pre-preparation message;
[0028] A transaction module, configured to perform preparation processing and transaction execution on the sorted transaction during the preparation phase, and broadcast the preparation message generated by the preparation processing within the blockchain;
[0029] A consensus module, configured to construct a confirmation message based on the result of the transaction execution in response to the received preparation message.
[0030] According to a third aspect of the present disclosure, there is provided an electronic device, including: a memory; and a processor coupled to the memory, the processor being configured to execute the method according to any one of the above based on instructions stored in the memory.
[0031] According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, it implements the data interaction method under the blockchain according to any one of the above.
[0032] According to a fifth aspect of the present disclosure, there is provided a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the data interaction method under the blockchain according to any one of the above.
[0033] In the embodiments of the present disclosure, by responding to the received pre-preparation message, it is determined to enter the preparation stage, and in the preparation stage, the sorted transactions are subjected to preparation processing and transaction execution, and then the preparation message generated by the preparation processing is broadcast within the blockchain, and finally, an acknowledgment message is constructed based on the result of the transaction execution, thereby improving the response efficiency of blockchain transactions.
[0034] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0036] Figure 1 A schematic diagram showing an exemplary system architecture to which the data interaction solution under the blockchain according to the embodiments of the present invention can be applied;
[0037] Figure 2 is a flowchart of a data interaction method under a blockchain in an exemplary embodiment of the present disclosure;
[0038] Figure 3 is a flowchart of another data interaction method under a blockchain in an exemplary embodiment of the present disclosure;
[0039] Figure 4 is a flowchart of another data interaction method under a blockchain in an exemplary embodiment of the present disclosure;
[0040] Figure 5It is a flowchart of another data interaction method under the blockchain in an exemplary embodiment of the present disclosure;
[0041] Figure 6 It is a flowchart of another data interaction method under the blockchain in an exemplary embodiment of the present disclosure;
[0042] Figure 7 It is a flowchart of another data interaction method under the blockchain in an exemplary embodiment of the present disclosure;
[0043] Figure 8 It is a flowchart of another data interaction method under the blockchain in an exemplary embodiment of the present disclosure;
[0044] Figure 9 It is a timing diagram of a data interaction solution under the blockchain in the prior art;
[0045] Figure 10 It is a timing diagram of another data interaction solution under the blockchain in the prior art;
[0046] Figure 11 It is a timing diagram of a data interaction solution under the blockchain in an exemplary embodiment of the present disclosure;
[0047] Figure 12 It is a block diagram of a data interaction device under the blockchain in an exemplary embodiment of the present disclosure;
[0048] Figure 13 It is a block diagram of an electronic device in an exemplary embodiment of the present disclosure. Detailed implementation manners
[0049] Now, the exemplary embodiments will be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring the various aspects of the present disclosure.
[0050] In addition, the accompanying drawings are only schematic illustrations of the present disclosure, and the same reference numerals in the drawings denote the same or similar parts, so that repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0051] Figure 1 A schematic diagram of an exemplary system architecture of a data interaction scheme under a blockchain to which embodiments of the present invention can be applied is shown.
[0052] As Figure 1 shown, the system architecture 100 may include one or more of the terminal devices 101, 102, 103, the network 104, and the server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0053] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in
[0054] are merely illustrative. According to the implementation requirements, there may be any number of terminal devices, networks, and servers. For example, the server 105 may be a server cluster composed of multiple servers, etc.
[0055] In some embodiments, the data interaction method provided by the embodiments of the present invention is generally executed by the server 105. Correspondingly, the data interaction device under the blockchain is generally disposed in the terminal device 103 (it may also be the terminal device 101 or 102). In other embodiments, some terminals may have functions similar to those of server devices and thus execute this method.
[0056] The following will describe the exemplary embodiments of the present disclosure in detail with reference to the accompanying drawings. Nodes in a blockchain include computer devices such as terminals, mining machines, and servers. A master node is a special type of node in a blockchain network that performs additional functions beyond the standard responsibilities of ordinary nodes. Master nodes are typically used in proof-of-stake (PoS) or hybrid PoS / proof-of-work (PoW) blockchain networks. They play a crucial role in maintaining the stability, security, and efficiency of the network by performing specific tasks, which may vary depending on the specific blockchain implementation.
[0057] The processing procedures of each node during the blockchain transaction process include the following key stages:
[0058] (1) Pre-preparation stage: After receiving a request from a client, the master node will actively broadcast a pre-preparation message <Pre-prepare, v, n, D(m)> to other nodes, where v is the current view, n is the request sequence number assigned by the master node, D(m) is the message digest, and m is the message itself.
[0059] After receiving the pre-preparation message, the slave node will verify the legality of the message. If the verification passes, then the slave node will enter the pre-preparation state, indicating that the request has passed the legality verification at the slave node. Otherwise, the slave node will reject the request and trigger the view switching process.
[0060] (2) Preparation stage: After receiving the notification to enter the pre-preparation state, the node will broadcast a preparation message <Prepare, v, n, D(m), i> to other nodes, where i is the current node identification sequence number. After other nodes receive the message, if the request has entered the pre-preparation state at the current node, and 2f preparation messages from different nodes (including the pre-preparation message sent by itself and the master node) are received, then the request will enter the preparation state.
[0061] (3) Confirmation stage: After the request enters the preparation state at the current node, the node will broadcast a confirmation message <Confirm, v, n, i> to other nodes. If the request has reached the preparation state at the current node, and 2f + 1 confirmation messages from different nodes (including itself) are received, then the request will enter the confirmed state and can be executed. After the execution is completed, the node will feedback the execution result to the client for subsequent judgment.
[0062] Figure 2 It is a flowchart of the data interaction method under the blockchain in the exemplary embodiment of the present disclosure.
[0063] Refer to Figure 2 and the data interaction method under the blockchain may include:
[0064] Step S202: In response to the received pre - preparation message, determine to enter the preparation phase.
[0065] Step S204: In the preparation phase, perform preparation processing and transaction execution on the sorted transactions, and broadcast the preparation message generated by the preparation processing within the blockchain.
[0066] Step S206: In response to the received preparation message, construct a confirmation message based on the result of the transaction execution.
[0067] In the embodiment of the present disclosure, by responding to the received pre - preparation message, determining to enter the preparation phase, performing preparation processing and transaction execution on the sorted transactions in the preparation phase, then broadcasting the preparation message generated by the preparation processing within the blockchain, and finally constructing a confirmation message based on the result of the transaction execution, the response efficiency of blockchain transactions is improved.
[0068] Next, each step of the data interaction method under the blockchain will be described in detail.
[0069] In an exemplary embodiment of the present disclosure, as Figure 3 shown, before responding to the received pre - preparation message, it further includes:
[0070] Step S302: In response to the transaction sent by the client, sort the transaction and form a block.
[0071] Step S304: Determine the pre - preparation message according to the block.
[0072] Step S306: Broadcast the pre - preparation message within the blockchain.
[0073] In an exemplary embodiment of the present disclosure, as Figure 4 shown, in response to the transaction sent by the client, sorting the transaction and forming a block includes:
[0074] Step S402: Determine that the main node of the blockchain receives the transaction from the client.
[0075] Step S404: In response to the transaction sent by the client to the main node, trigger the main node to sort the transaction and form the block.
[0076] In an exemplary embodiment of the present disclosure, as Figure 5 shown, in response to the received pre - preparation message, determining to enter the preparation phase includes:
[0077] Step S502: In response to the received pre - preparation message, verify the pre - preparation message. If the pre - preparation message passes the verification, determine to enter the preparation phase.
[0078] In an exemplary embodiment of the present disclosure, as Figure 6 shown, constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain includes:
[0079] Step S602, after receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed.
[0080] Step S604, if it is determined that the transaction corresponding to the preparation message has been executed, construct the confirmation message according to the result of the transaction execution.
[0081] In an exemplary embodiment of the present disclosure, as Figure 7 shown, constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain further includes:
[0082] Step S702, after receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed.
[0083] Step S704, if it is determined that the transaction corresponding to the preparation message has not been executed, wait for the transaction to be executed.
[0084] Step S706, in response to the executed transaction, construct the confirmation message according to the result of the transaction execution.
[0085] In an exemplary embodiment of the present disclosure, as Figure 8 shown, the data interaction method under the blockchain further includes:
[0086] Step S802, broadcast the confirmation message within the blockchain to reach a consensus on the transaction within the blockchain.
[0087] Combined with the timing diagram of the prior art as Figure 9 and Figure 10 shown and the timing diagram of the embodiment of the present disclosure as Figure 11 shown, the data interaction solution under the blockchain of the present disclosure is specifically described.
[0088] As Figures 9 to 11 shown, the core consensus process of the blockchain includes three stages: the pre-prepare stage, the prepare stage, and the commit stage, Figure 9 and Figure 10 shown, the stage of the Tx process is the transaction execution stage.
[0089] Among them, Client represents the client, and Node0, Node 1, Node 2, and Node 3 represent the numbers of nodes 0, 1, 2, and 3 in the blockchain respectively. In the request phase, the client initiates the request. After the master node receives the client's request, it will trigger the core consensus process.
[0090] like Figure 9 In the blockchain system 900 of the prior art shown, each node executes a transaction after the pre-preparation phase and waits for the completion of the execution to begin the preparation phase consensus.
[0091] like Figure 10 In the blockchain system 1000 of the prior art shown, each node executes a transaction after the preparation phase and waits for the confirmation phase consensus to begin after the execution is completed.
[0092] like Figure 11 As shown, in the blockchain system 1100 provided by the embodiment of the present disclosure, the transaction execution process and the second stage (preparation) of the consensus are carried out in parallel, specifically as follows: in each consensus process, the client sends the transaction to each node (or only to the master node).
[0093] The core consensus process of the transaction algorithm in this application is divided into three phases: pre-preparation phase, preparation phase, and confirmation phase. Nodes conduct a round of voting in each of the preparation phase and confirmation phase, respectively, to confirm the legitimacy and pending execution of the message.
[0094] In the first consensus phase, Figure 11 The nodes shown in the figure sort the transactions into blocks and broadcast the blocks. The message broadcast in the first phase is recorded as pre-prepare, and the time taken in the first phase is recorded as t1.
[0095] After receiving the Prepare message, the node enters the second phase. Each node processes and executes the sorted transactions in the second phase, broadcasting the Prepare message to other nodes. The Prepare message contains only each node's confirmation of the Prepare message; since it does not need to wait for the transaction to complete, it does not contain the transaction execution result. The time required to process the Prepare message (including receiving and verifying the message, but not executing the transaction) and propagate the Prepare message is denoted as t2.
[0096] After receiving the prepare message, the node enters the third phase. At this point, the node can be in one of two states: completed transaction or in progress. If the transaction has been completed, the node constructs a confirmation message based on the transaction results. If the transaction has not yet been completed, the node waits until the transaction is complete and then constructs the transaction results into a confirmation message. The time it takes to construct and broadcast the confirmation message is t3.
[0097] Combined with Figure 9 andFigure 10 The timing diagram of the prior art shown and as Figure 11 shown in the embodiments of the present disclosure, the embodiments of the present disclosure have at least the following technical effects:
[0098] Denote the transaction time of the embodiments of the present disclosure as t p , the time required for consensus and transaction execution of this solution can be expressed as t1 + max(t2, t p ), the response time of the present disclosure is less than the time required for consensus and transaction execution of the existing solution. In addition, the embodiments of the present disclosure can be easily implemented by changing the existing solution without modifying the core part of the consensus algorithm, with low transformation cost and strong maintainability.
[0099] In addition, the present invention is applicable not only to the PBFT (Pratical Byzantine Fault Tolerance) consensus algorithm, but also to various consortium chain BFT (Byzantine Fault Tolerance) - type consensuses.
[0100] Corresponding to the above method embodiments, the present disclosure also provides a data interaction device under the blockchain, which can be used to execute the above method embodiments.
[0101] Figure 12 is a block diagram of a data interaction device under the blockchain in an exemplary embodiment of the present disclosure.
[0102] Referring to Figure 12 , the data interaction device 1200 under the blockchain may include:
[0103] A determination module 1202, configured to determine to enter the preparation phase in response to a received pre - preparation message.
[0104] A transaction module 1204, configured to perform preparation processing and transaction execution on the sorted transactions during the preparation phase, and broadcast the preparation message generated by the preparation processing within the blockchain.
[0105] A consensus module 1206, configured to construct an acknowledgment message based on the result of the transaction execution in response to the received preparation message.
[0106] In an exemplary embodiment of the present disclosure, the transaction module 1204 is further configured to:
[0107] Before responding to the received pre - preparation message, in response to a transaction sent by a client, sort the transaction and form a block;
[0108] Determine the pre - preparation message according to the block;
[0109] Broadcast the pre-prepared message within the blockchain.
[0110] In an exemplary embodiment of the present disclosure, the transaction module 1204 is further configured to:
[0111] Determine that the main node of the blockchain receives the transaction from the client;
[0112] In response to the transaction sent by the client to the main node, trigger the main node to sort the transaction and form the block.
[0113] In an exemplary embodiment of the present disclosure, the transaction module 1204 is further configured to:
[0114] In response to the received pre-prepared message, verify the pre-prepared message; if the pre-prepared message passes the verification, determine to enter the preparation stage.
[0115] In an exemplary embodiment of the present disclosure, the consensus module 1206 is further configured to:
[0116] After receiving the prepared message, determine whether the transaction corresponding to the prepared message has been executed;
[0117] If it is determined that the transaction corresponding to the prepared message has been executed, construct the confirmation message according to the result of the transaction execution.
[0118] In an exemplary embodiment of the present disclosure, the consensus module 1206 is further configured to:
[0119] After receiving the prepared message, determine whether the transaction corresponding to the prepared message has been executed;
[0120] If it is determined that the transaction corresponding to the prepared message has not been executed, wait for the transaction to be executed;
[0121] In response to the executed transaction, construct the confirmation message according to the result of the transaction execution.
[0122] In an exemplary embodiment of the present disclosure, the consensus module 1206 is further configured to:
[0123] Broadcast the confirmation message within the blockchain to reach a consensus on the transaction within the blockchain.
[0124] Since the functions of the device 1200 have been described in detail in their corresponding method embodiments, the present disclosure will not be elaborated herein.
[0125] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0126] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0127] Those skilled in the art can understand that various aspects of the present invention can be implemented as a system, a method, or a program product. Therefore, various aspects of the present invention can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuit", "module", or "system" here.
[0128] Next, refer to Figure 13 to describe the electronic device 1300 according to this embodiment of the present invention. Figure 13 The displayed electronic device 1300 is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0129] As Figure 13 shown, the electronic device 1300 is presented in the form of a general-purpose computing device. The components of the electronic device 1300 may include, but are not limited to: the above at least one processing unit 1310, the above at least one storage unit 1320, and a bus 1330 connecting different system components (including the storage unit 1320 and the processing unit 1310).
[0130] Among them, the storage unit stores program code, and the program code can be executed by the processing unit 1310, so that the processing unit 1310 executes the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit 1310 can execute the method as shown in the embodiments of the present disclosure.
[0131] The storage unit 1320 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 13201 and / or a cache storage unit 13202, and may further include a read-only storage unit (ROM) 13203.
[0132] The storage unit 1320 may also include a program / utility 13204 having a set (at least one) of program modules 13205. Such program modules 13205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.
[0133] The bus 1330 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus structures.
[0134] The electronic device 1300 may also communicate with one or more external devices 1340 (such as a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1300, and / or may communicate with any device that enables the electronic device 1300 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication may be through the input / output (I / O) interface 1350. Also, the electronic device 1300 may communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 1360. As shown in the figure, the network adapter 1360 communicates with other modules of the electronic device 1300 through the bus 1330. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0135] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or can be implemented by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0136] In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having a program product stored thereon that can implement the above-described method of this specification. In some possible implementation manners, various aspects of the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0137] The program product for implementing the above method according to an embodiment of the present invention may be a portable compact disc read-only memory (CD-ROM) and includes program code, and can run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0138] The program product may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0139] The computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries the readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0140] The program code contained on the readable medium can be transmitted by any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0141] In an exemplary embodiment of the present disclosure, there is also provided a computer program product. The computer program product can be loaded or stored by any combination of one or more readable media, and the program code for performing the operations of the present invention can be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, executed as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., by using an Internet service provider to connect through the Internet).
[0142] In addition, the above-mentioned drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present invention, rather than for limiting purposes. It is easy to understand that the processes shown in the above-mentioned drawings do not indicate or limit the chronological order of these processes. Additionally, it is also easy to understand that these processes can be executed synchronously or asynchronously in, for example, multiple modules.
[0143] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include well-known knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and concept of the present disclosure are pointed out by the claims.
Claims
1. A data interaction method under blockchain, characterized in that, including: Upon receiving a pre-preparation message, determine to enter the preparation phase; During the preparation phase, perform preparation processing and transaction execution on the sorted transactions, and broadcast the preparation message generated by the preparation processing within the blockchain; Upon receiving the said preparation message, construct a confirmation message based on the result of the transaction execution.
2. The data interaction method under the blockchain according to claim 1, characterized in that, Before responding to the received pre-preparation message, it further includes: Upon receiving a transaction sent by a client, sort the transaction and form a block; Determine the pre-preparation message according to the block; Broadcast the pre-preparation message within the blockchain.
3. The data interaction method under the blockchain according to claim 2, characterized in that, Upon receiving a transaction sent by a client, sorting the transaction and forming a block includes: Determine that the main node of the blockchain receives the transaction sent by the client; In response to the transaction sent by the client to the main node, trigger the main node to sort the transaction and form the block.
4. The data interaction method under the blockchain according to any one of claims 1-3, characterized in that Upon receiving a pre-preparation message, determining to enter the preparation phase includes: Upon receiving a pre-preparation message, verify the pre-preparation message; If the pre-preparation message passes the verification, determine to enter the preparation phase.
5. The data interaction method under the blockchain according to any one of claims 1-3, characterized in that Constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain includes: After receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed; If it is determined that the transaction corresponding to the preparation message has been executed, construct the confirmation message according to the result of the transaction execution.
6. The data interaction method under the blockchain according to any one of claims 1-3, characterized in that, Constructing a confirmation message based on the result of the transaction execution and broadcasting it within the blockchain further includes: After receiving the preparation message, determine whether the transaction corresponding to the preparation message has been executed; If it is determined that the transaction corresponding to the preparation message has not been executed, wait for the transaction to be executed; In response to the executed transaction, construct the confirmation message according to the result of the transaction execution.
7. The data interaction method under the blockchain according to any one of claims 1-3, characterized in that It further includes: Broadcast the confirmation message within the blockchain to reach a consensus on the transaction within the blockchain.
8. A data interaction device under a blockchain, characterized in that, including: A determination module, configured to determine to enter the preparation phase upon receiving a pre-preparation message; A transaction module, configured to perform preparation processing and transaction execution on the sorted transactions during the preparation phase, and broadcast the preparation message generated by the preparation processing within the blockchain; A consensus module, configured to construct a confirmation message based on the result of the transaction execution upon receiving the said preparation message.
9. An electronic device, characterized in that, including: A memory; and A processor coupled to the memory, the processor being configured to execute the data interaction method under the blockchain as described in any one of claims 1 - 7 based on instructions stored in the memory.
10. A computer-readable storage medium, having a program stored thereon, which when executed by a processor implements the data interaction method under the blockchain as described in any one of claims 1 - 7.
11. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the data interaction method under the blockchain as described in any one of claims 1 - 7.