WO2024244342A1 - Transaction processing method in blockchain, and blockchain node - Google Patents
Transaction processing method in blockchain, and blockchain node Download PDFInfo
- Publication number
- WO2024244342A1 WO2024244342A1 PCT/CN2023/135057 CN2023135057W WO2024244342A1 WO 2024244342 A1 WO2024244342 A1 WO 2024244342A1 CN 2023135057 W CN2023135057 W CN 2023135057W WO 2024244342 A1 WO2024244342 A1 WO 2024244342A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- node
- information
- execution
- blockchain
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/50—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/16—Implementing security features at a particular protocol layer
- H04L63/168—Implementing security features at a particular protocol layer above the transport layer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/20—Network architectures or network communication protocols for network security for managing network security; network security policies in general
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
Definitions
- the embodiments of this specification belong to the field of blockchain technology, and more particularly to a transaction processing method and blockchain node in a blockchain.
- Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc.
- data blocks are combined into a chain data structure in a sequential manner according to time sequence, and a distributed ledger that cannot be tampered with or forged is guaranteed by cryptography. Due to the characteristics of blockchain such as decentralization, information cannot be tampered with, and autonomy, blockchain has also received more and more attention and application.
- the purpose of the present invention is to provide a transaction processing method in a blockchain to improve the transaction processing efficiency in the blockchain.
- the present specification provides a transaction processing method in a blockchain, which is executed by a first node, where the first node is currently a slave node, and the method includes:
- the first transaction is stored.
- a second aspect of the present specification provides a blockchain node, wherein the blockchain node is currently a slave node, including:
- an acquisition unit configured to acquire a first transaction and first information stored locally, wherein the first information is used to indicate that a pre-execution function is turned off;
- a verification unit configured to verify the first transaction according to the first information
- the storage unit is used to store the first transaction when the verification is passed.
- a third aspect of the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method described in the first aspect.
- a fourth aspect of the present specification provides a blockchain node, including a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, the method described in the first aspect is implemented.
- the slave node stores the transaction in the transaction queue after the transaction is verified according to the instruction information stored in the slave node, so that when the slave node is converted from a slave node to a master node, it can obtain the verified transaction from the verified transaction queue for pre-execution without the loss of the transaction, avoiding the need for the client to resend the transaction, and improving the transaction processing efficiency in the blockchain.
- FIG1 is a diagram of a blockchain architecture in one embodiment
- FIG2 is a flow chart of a transaction processing method in a blockchain according to an embodiment of the present specification
- FIG3 is a flow chart of a transaction processing method in a blockchain according to an embodiment of this specification.
- FIG4 is a flow chart of a transaction processing method in a blockchain in another embodiment of the present specification.
- FIG5 is a flow chart of a transaction processing method in a blockchain in another embodiment of this specification.
- FIG6 is an architecture diagram of a blockchain node in an embodiment of this specification.
- FIG. 1 shows a diagram of a blockchain architecture in one embodiment.
- the blockchain includes N nodes, and FIG. 1 schematically shows nodes 1 to 8.
- the lines between the nodes schematically represent P2P (Peer to Peer) connections, and the connection may be, for example, a TCP connection, etc., for transmitting data between nodes.
- P2P Peer to Peer
- These nodes can store a full amount of ledgers, that is, store the status of all blocks and all accounts.
- each node in the blockchain can generate the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database.
- Transactions in the blockchain field can refer to task units executed and recorded in the blockchain.
- Transactions usually include a send field (From), a receive field (To), and a data field (Data).
- the From field indicates the account address that initiates the transaction (i.e., initiates a transfer task to another account)
- the To field indicates the account address that receives the transaction (i.e., receives the transfer)
- the Data field includes the transfer amount.
- the blockchain can provide the function of smart contracts.
- Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system.
- Smart contracts can be defined in the form of code. Calling a smart contract in the blockchain is to initiate a transaction pointing to the smart contract address, so that each node in the blockchain can run the smart contract code in a distributed manner.
- Bob sends a transaction containing information about creating a smart contract (i.e., deploying a contract) to the blockchain shown in Figure 1.
- the data field of the transaction includes the code of the contract to be created (such as bytecode or machine code), and the to field of the transaction is empty to indicate that the transaction is used to deploy a contract.
- the contract address "0x6f8ae93" of the contract is determined.
- Each node adds a contract account corresponding to the contract address of the smart contract to the state database, allocates the state storage corresponding to the contract account, and stores the contract code.
- the hash value of the contract code is saved in the state storage of the contract, so that the contract is successfully created.
- each node in the blockchain can execute the transaction separately, thereby executing the contract separately, and updating the status database based on the execution of the contract.
- One of the decentralized features that distinguishes blockchain technology from traditional technologies is that it records accounts on each node, or distributed accounting, rather than traditional centralized accounting.
- a blockchain system In order for a blockchain system to become a decentralized, honest and trustworthy system that is difficult to break, public, and cannot be tampered with, it is necessary to make distributed data records secure, clear, and irreversible in the shortest possible time.
- a consensus algorithm In different types of blockchain networks, in order to maintain the consistency of the ledgers in each node that records the ledger, a consensus algorithm is usually used to ensure that it is the consensus mechanism mentioned above. For example, a consensus mechanism of block granularity can be implemented between blockchain nodes.
- a consensus mechanism of transaction granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) obtains a blockchain transaction, if the blockchain transaction is recognized by other nodes, each node that recognizes the blockchain transaction can add the blockchain transaction to the latest block maintained by itself, and ultimately ensure that each node generates the same latest block.
- the consensus mechanism is a mechanism for blockchain nodes to reach a consensus on block information (or block data) across the entire network, which can ensure that the latest block is accurately added to the blockchain.
- the current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, etc.
- PW Proof of Work
- POS Proof of Stake
- DPOS Delegated Proof of Stake
- PBFT Practical Byzantine Fault Tolerance
- 3(f+1)+1>N ⁇ 3f+1 consensus nodes f malicious nodes can be tolerated, that is, when at least 2f+1 nodes among N consensus nodes reach an agreement, the consensus can be determined to be successful.
- the blockchain shown in FIG1 may include a master node and a slave node.
- the master node may pre-execute multiple transactions and obtain pre-execution read-write sets of multiple transactions, so that a consensus proposal including the multiple transactions and their pre-execution read-write sets may be sent to each slave node.
- each slave node may group the multiple transactions according to the pre-execution read-write sets of the multiple transactions, and execute the multiple transactions in parallel according to the grouping results.
- the slave node forwards the received transaction to the master node so that the master node performs pre-execution of the transaction.
- the slave node does not store a batch of transactions that have been received from the client, resulting in the loss of the batch of transactions, and the client needs to resend the batch of transactions to the blockchain, affecting business efficiency.
- the embodiments of the present specification provide a method for processing transactions in a blockchain, wherein after receiving a transaction, a slave node verifies the received transaction based on its role-related information without pre-executing the transaction, and stores the transaction after the verification is passed, so that when a master node fails, the slave node can directly obtain the verified transaction locally for consensus on the transaction, thereby improving the transaction processing efficiency in the blockchain.
- Figure 2 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification. The method can be executed by, for example, node 1 in the blockchain, where node 1 is currently a slave node.
- step S210 node 1 obtains information m1 and transaction Tx1, wherein information m1 is stored after node 1 is set as a slave node, and is used to indicate turning off the pre-execution function, that is, instructing node 1 to verify the transaction after receiving it and not perform pre-execution.
- the information m1 can be stored in a local preset location to instruct node 1 to verify the transaction after receiving it without pre-execution.
- Node 1 may receive transaction Tx1 from the client. Different nodes in the blockchain may receive different transactions from multiple clients. After receiving transaction Tx1, node 1 may read information related to transaction preprocessing from the local computer. If information m1 is stored locally, the information m1 may be read locally.
- step S220 after reading the information m1, node 1 verifies the transaction Tx1 according to the instructions of the information m1.
- the verification of the transaction includes, for example, verification of the transaction signature, verification of the GAS balance of the transaction sending account, verification of the legality of the transaction, etc. According to the information m1, node 1 only verifies the transaction Tx1 without pre-execution.
- step S230 node 1 stores transaction Tx1 if verification is successful.
- node 1 can store the transaction Tx1 in, for example, a verified transaction queue. While storing the transaction Tx1, node 1 also sends the transaction Tx1 to the current master node so that the master node can pre-execute the transaction Tx1.
- node 1 In the case where node 1 is converted from a master node to a slave node, node 1 also includes a pre-execution transaction queue stored when it is a master node.
- the pre-execution transaction queue stores verified and pre-executed transactions.
- Node 1 can send the transactions in the pre-execution transaction queue to the current master node so that the master node can re-pre-execute these transactions and reach consensus on these transactions.
- FIG3 is a flow chart of a transaction processing method in a blockchain in an embodiment of the present specification, which corresponds to the method shown in FIG2 , and the method may be, for example, a consensus service, a cache service, and a pre-execution service in node 1.
- Each service includes multiple executable bodies (such as processes) for implementing the preset functions of the service, and the multiple processes included in each service may be executed in parallel.
- step S301 the consensus service determines that node 1 is a slave node.
- node 1 After being enabled, node 1 can negotiate with other consensus nodes to determine that it is a slave node. Alternatively, if node 1 fails as a master node and is determined by other consensus nodes to be converted to a slave node, node 1 can obtain information about its conversion to a slave node from other consensus nodes after the failure is recovered. After determining that it is a slave node, node 1 can provide this information to the consensus service.
- step S303 the cache service caches the transaction received from the user device.
- Node 1 may be connected to a user device to receive a transaction (such as the transaction Tx1 described above) from a client of the user device, and the cache service may cache the transaction Tx1. Specifically, the cache service may store the transaction Tx1 in an unverified transaction queue.
- a transaction such as the transaction Tx1 described above
- the cache service may store the transaction Tx1 in an unverified transaction queue.
- step S305 the consensus service calls the disable interface provided by the cache service.
- the disable interface is used to set indication information, and the indication information is used to indicate to turn off the pre-execution function, that is, only verify the received transaction without pre-execution.
- step S307 in response to the call to the disable interface, the cache service sets the value of the variable flag to a preset value for indicating that the pre-execution function is disabled.
- the cache service executes the disable interface and sets the variable flag in the cache service to a preset value (e.g., 1) for indicating that the pre-execution function is turned off, where the value of the variable flag before the setting is, for example, the default value, or when node 1 is transformed from a master node to a slave node, the value of the variable flag before the setting is a preset value (e.g., 0) for indicating that the pre-execution function is turned on.
- a preset value e.g., 1
- a preset value e.g., 0
- step S309 the pre-execution service requests a transaction from the cache service.
- the pre-execution service may request the cache service for the newly received transaction to pre-process the transaction.
- step S311 the cache service sends a transaction Tx1 and a preset value of the variable flag for indicating closing the pre-execution operation to the pre-execution service.
- the several transactions include, for example, transaction Tx1.
- the following steps are described by taking transaction Tx1 as an example.
- step S315 when the pre-execution service verifies the transaction Tx1 successfully, it may send the verification result to the cache service.
- step S317 if the cache service determines that the verification is successful based on the received verification result, the transaction Tx1 is placed in the verified transaction queue.
- slave node 1 determines that it has been converted from a master node to a slave node, since the pre-execution service in the slave node turns off the pre-execution function and only retains the verification function, the number of pre-execution service instances (such as the number of processes) can be reduced, thereby achieving a dynamic scaling effect.
- the slave node pre-processes the received transaction as shown in FIG2 or 3, and stores the transaction in the transaction queue according to the flag value after the transaction is verified, so that when the slave node is converted from a slave node to a master node, it can obtain the verified transaction from the verified transaction queue for pre-execution without transaction loss, avoiding the need for the client to resend the transaction, and improving the transaction processing efficiency in the blockchain.
- Figure 4 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification. The method can be executed by, for example, node 2 in the blockchain, where node 2 is currently the master node.
- step S410 node 2 obtains information m2 and transaction Tx2, wherein information m2 is stored after node 2 is set as the master node, and is used to indicate to turn on the pre-execution function, that is, to verify the transaction after receiving it, and pre-execute the transaction after the verification is passed.
- node 2 After node 2 determines that its identity has been converted from a slave node to a master node, or when node 2 determines that its identity is a master node during initial startup, it can store information m2 in a local preset location to instruct node 2 to enable the pre-execution function, that is, to verify and pre-execute the transaction after receiving the transaction.
- Node 2 may receive transaction Tx2 from a client or other consensus node. Different nodes in the blockchain may receive different transactions from multiple clients. After receiving transaction Tx2, node 2 may read information related to transaction preprocessing from the local computer. If information m2 is stored locally, information m2 may be read locally.
- step S420 after reading the information m2, node 2 verifies the transaction Tx2 according to the instructions of the information m2, and pre-executes the transaction Tx2 if the verification passes.
- the verification of the transaction includes, for example: verification of the transaction signature, verification of the GAS balance of the transaction sending account, verification of the legality of the transaction, etc.
- node 2 After node 2 verifies transaction Tx2, it pre-executes transaction Tx2. Specifically, node 2 can execute transaction Tx2 based on the state value read from the state database to obtain a pre-execution read-write set of transaction Tx2.
- the pre-execution read-write set includes a pre-execution read set and a pre-execution write set.
- the pre-execution read set includes the variable key or key-value pair read by node 2 during the pre-execution of transaction Tx2, and the pre-execution write set includes the variable key or key-value pair updated by node 2 during the pre-execution of transaction Tx2.
- step S430 node 2 stores transaction Tx2 and its pre-execution read-write set.
- node 2 After completing the pre-execution of transaction Tx2, node 2 can store transaction Tx2 and its pre-execution read-write set in the pre-execution transaction queue. Subsequently, node 2 can obtain a batch of transactions and their read-write sets from the pre-execution transaction queue and generate a consensus proposal, which can include the batch of transactions and their read-write sets. Node 2 can send the consensus proposal to each slave node to reach a consensus on the consensus proposal.
- node 2 In the case where node 2 is converted from a slave node to a master node, node 2 also includes a verified transaction queue stored when it was a slave node, in which verified but non-pre-executed transactions are stored. Node 2 can re-pre-execute transactions in the verified transaction queue and store these transactions and their pre-executed read-write sets in the pre-executed transaction queue.
- FIG5 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification, which corresponds to the method shown in FIG4 and can be implemented by, for example, a consensus service, a cache service, and a pre-execution service in node 2.
- Each service includes multiple executable bodies (such as processes) for implementing the preset functions of the service, and the multiple processes included in each service can be executed in parallel.
- step S501 the consensus service determines node 2 as the master node.
- Node 2 After being enabled, Node 2 can negotiate with other consensus nodes to determine itself as the master node. Alternatively, Node 2 is determined by multiple consensus nodes to be the new master node after the previous master node fails. After Node 2 determines itself as the master node, it can provide this information to the consensus service.
- step S503 the cache service caches the received transaction.
- Node 2 can be connected to a user device to receive a transaction (such as the above transaction Tx2) from a client of the user device, and the cache service can cache the transaction Tx2.
- Node 2 as a master node, can also receive transactions received by each slave node from the client and cache the transaction.
- step S505 the consensus service calls the start interface (reset interface) provided by the cache service.
- the reset interface is used to set indication information, and the indication information is used to instruct node 2 to enable the pre-execution function, that is, to verify the received transaction and pre-execute it after the verification passes.
- step S507 in response to the call to the reset interface, the cache service sets the value of the variable flag to a preset value for indicating that the pre-execution function is enabled.
- the cache service executes the reset interface and sets the variable flag in the cache service to a preset value (e.g., 0) for indicating that the pre-execution function is turned on, where the value of the variable flag before the setting is, for example, the default value, or in the case where node 2 is transformed from a slave node to a master node, the value of the variable flag before the setting is a preset value (e.g., 1) for indicating that the pre-execution function is turned off.
- a preset value e.g., 0
- step S509 the pre-execution service requests a transaction from the cache service.
- the pre-execution service may request the cache service for the newly received transaction to pre-process the transaction.
- step S511 the cache service sends the transaction Tx2 and a preset value of the variable flag to the pre-execution service for indicating the start of the pre-execution operation.
- the several transactions include, for example, transaction Tx2.
- the following steps are described by taking transaction Tx2 as an example.
- step S515 the pre-execution service sends the pre-execution read-write set of transaction Tx2 to the cache service.
- step S517 the cache service puts the transaction Tx2 and its pre-execution read-write set into the pre-execution transaction queue.
- node 2 When node 2 is converted from a slave node to a master node, node 2 also includes a verified transaction queue stored when it is a slave node, in which verified but not pre-executed transactions are stored.
- slave node 2 determines that it is converted from a slave node to a master node, since the pre-execution function is enabled in the pre-execution service in the slave node, the computing task is increased, and therefore the number of pre-execution service instances (e.g., the number of processes) can be increased, thereby achieving the effect of dynamic capacity.
- the number of pre-execution service instances e.g., the number of processes
- the master node pre-processes the received transaction as shown in FIG4 or FIG5.
- the verified transaction can be obtained from the verified transaction queue for pre-execution according to the value of the variable flag without losing the transaction, thus avoiding the need for the client to resend the transaction and improving the transaction processing efficiency in the blockchain.
- FIG6 is an architecture diagram of a blockchain node in an embodiment of this specification, wherein the blockchain node is currently a slave node, and is used to execute the method shown in FIG2, FIG3, FIG4 or FIG5, including:
- An acquisition unit 61 is used to acquire a first transaction and first information stored locally, where the first information is used to indicate to close the pre-execution function;
- a verification unit 62 configured to verify the first transaction according to the first information
- the storage unit 63 is used to store the first transaction when the verification is successful.
- the embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored.
- the computer program When the computer program is executed in a computer, the computer is caused to execute the method shown in FIG. 2 , FIG. 3 , FIG. 4 , or FIG. 5 .
- the embodiments of this specification also provide a blockchain node, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method shown in FIG. 2, FIG. 3, FIG. 4 or FIG. 5 is implemented.
- a programmable logic device such as a field programmable gate array (FPGA)
- FPGA field programmable gate array
- HDL Hardware Description Language
- HDL High-Speed Integrated Circuit Hardware Description Language
- ABEL Advanced Boolean Expression Language
- AHDL Altera Hardware Description Language
- HDCal Joint CHDL
- JHDL Java Hardware Description Language
- Lava Lava
- Lola MyHDL
- PALASM RHDL
- VHDL Very-High-Speed Integrated Circuit Hardware Description Language
- Verilog Verilog
- the controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer readable medium storing a computer readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory.
- a computer readable program code e.g., software or firmware
- the controller may be implemented in the form of a logic gate, a switch, an application specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the means for implementing various functions included therein may also be considered as a structure within the hardware component. Or even, the means for implementing various functions may be considered as both a software module for implementing the method and a structure within the hardware component.
- the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
- a typical implementation device is a server system.
- the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
- one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means.
- the order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order.
- the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment).
- each module can be implemented in the same or more software and/or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc.
- the device embodiments described above are only schematic.
- the division of the units is only a logical function division. There may be other division methods in actual implementation.
- multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
- Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
- the present invention is a flowchart of a method, apparatus (system), and computer program product according to an embodiment of the present invention.
- the flowchart and/or block diagram are described in detail. It should be understood that each process and/or block in the flowchart and/or block diagram, as well as the combination of the processes and/or blocks in the flowchart and/or block diagram, can be implemented by computer program instructions.
- These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one or more processes in the flowchart and/or one or more blocks in the block diagram.
- These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
- a computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
- processors CPU
- input/output interfaces network interfaces
- memory volatile and non-volatile memory
- Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
- RAM random access memory
- ROM read-only memory
- flash RAM flash memory
- Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information.
- Information can be computer readable instructions, data structures, program modules or other data.
- Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
- computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
- one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
- computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules.
- program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
- One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network.
- program modules may be located in local and remote computer storage media, including storage devices.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Medical Informatics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Debugging And Monitoring (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
本申请要求于2023年05月31日提交中国国家知识产权局、申请号为202310640782.4、申请名称为“区块链中的交易处理方法和区块链节点”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on May 31, 2023, with application number 202310640782.4 and application name “Transaction Processing Method and Blockchain Node in Blockchain”, the entire contents of which are incorporated by reference in this application.
本说明书实施例属于区块链技术领域,尤其涉及一种区块链中的交易处理方法和区块链节点。The embodiments of this specification belong to the field of blockchain technology, and more particularly to a transaction processing method and blockchain node in a blockchain.
区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链系统中按照时间顺序将数据区块以顺序相连的方式组合成链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本。由于区块链具有去中心化、信息不可篡改、自治性等特性,区块链也受到人们越来越多的重视和应用。Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. In the blockchain system, data blocks are combined into a chain data structure in a sequential manner according to time sequence, and a distributed ledger that cannot be tampered with or forged is guaranteed by cryptography. Due to the characteristics of blockchain such as decentralization, information cannot be tampered with, and autonomy, blockchain has also received more and more attention and application.
发明内容Summary of the invention
本发明的目的在于提供一种区块链中的交易处理方法,以提高区块链中的交易处理效率。The purpose of the present invention is to provide a transaction processing method in a blockchain to improve the transaction processing efficiency in the blockchain.
本说明书第一方面提供一种区块链中的交易处理方法,由第一节点执行,所述第一节点当前为从节点,所述方法包括:In a first aspect, the present specification provides a transaction processing method in a blockchain, which is executed by a first node, where the first node is currently a slave node, and the method includes:
获取第一交易和本地存储的第一信息,所述第一信息用于指示关闭预执行功能;Acquire a first transaction and first information stored locally, where the first information is used to indicate that a pre-execution function is disabled;
根据所述第一信息,对所述第一交易进行验证;verifying the first transaction according to the first information;
在验证通过的情况下,存储所述第一交易。If the verification is successful, the first transaction is stored.
本说明书第二方面提供一种区块链节点,所述区块链节点当前为从节点,包括:A second aspect of the present specification provides a blockchain node, wherein the blockchain node is currently a slave node, including:
获取单元,用于获取第一交易和本地存储的第一信息,所述第一信息用于指示关闭预执行功能;an acquisition unit, configured to acquire a first transaction and first information stored locally, wherein the first information is used to indicate that a pre-execution function is turned off;
验证单元,用于根据所述第一信息,对所述第一交易进行验证;a verification unit, configured to verify the first transaction according to the first information;
存储单元,用于在验证通过的情况下,存储所述第一交易。The storage unit is used to store the first transaction when the verification is passed.
本说明书第三方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行第一方面所述的方法。A third aspect of the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method described in the first aspect.
本说明书第四方面提供一种区块链节点,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现第一方面所述的方法。A fourth aspect of the present specification provides a blockchain node, including a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, the method described in the first aspect is implemented.
在本说明书实施例提供的方案中,从节点中通过根据从节点中存储的指示信息,在对交易验证通过之后在交易队列中存储该交易,使得该从节点在由从节点转换为主节点的情况下,可从已验证交易队列中获取已验证的交易进行预执行,而不会出现交易丢失的情况,避免了需要客户端重发交易的情况,提高了区块链中的交易处理效率。 In the solution provided in the embodiments of the present specification, the slave node stores the transaction in the transaction queue after the transaction is verified according to the instruction information stored in the slave node, so that when the slave node is converted from a slave node to a master node, it can obtain the verified transaction from the verified transaction queue for pre-execution without the loss of the transaction, avoiding the need for the client to resend the transaction, and improving the transaction processing efficiency in the blockchain.
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
图1为一实施例中的区块链架构图;FIG1 is a diagram of a blockchain architecture in one embodiment;
图2为本说明书实施例中的一种区块链中的交易处理方法流程图;FIG2 is a flow chart of a transaction processing method in a blockchain according to an embodiment of the present specification;
图3为本说明书实施例中一种区块链中的交易处理方法流程图;FIG3 is a flow chart of a transaction processing method in a blockchain according to an embodiment of this specification;
图4为本说明书另一实施例中的一种区块链中的交易处理方法流程图;FIG4 is a flow chart of a transaction processing method in a blockchain in another embodiment of the present specification;
图5为本说明书另一实施例中一种区块链中的交易处理方法流程图;FIG5 is a flow chart of a transaction processing method in a blockchain in another embodiment of this specification;
图6为本说明书实施例中的一种区块链节点的架构图。FIG6 is an architecture diagram of a blockchain node in an embodiment of this specification.
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
图1示出了一实施例中的区块链架构图。在图1所示的区块链架构图中,区块链中包括N个节点,图1中示意示出节点1-节点8。节点之间的连线示意性的表示P2P(Peer to Peer,点对点)连接,所述连接例如可以为TCP连接等,用于在节点之间传输数据。这些节点上可存储全量的账本,即存储全部区块和全部账户的状态。其中,区块链中的每个节点可通过执行相同的交易而产生区块链中的相同的状态,区块链中的每个节点可存储相同的状态数据库。FIG. 1 shows a diagram of a blockchain architecture in one embodiment. In the diagram of the blockchain architecture shown in FIG. 1 , the blockchain includes N nodes, and FIG. 1 schematically shows nodes 1 to 8. The lines between the nodes schematically represent P2P (Peer to Peer) connections, and the connection may be, for example, a TCP connection, etc., for transmitting data between nodes. These nodes can store a full amount of ledgers, that is, store the status of all blocks and all accounts. Among them, each node in the blockchain can generate the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database.
区块链领域中的交易可以指在区块链中执行并记录在区块链中的任务单元。交易中通常包括发送字段(From)、接收字段(To)和数据字段(Data)。其中,在交易为转账交易的情况中,From字段表示发起该交易(即发起对另一个账户的转账任务)的账户地址,To字段表示接收该交易(即接收转账)的账户地址,Data字段中包括转账金额。Transactions in the blockchain field can refer to task units executed and recorded in the blockchain. Transactions usually include a send field (From), a receive field (To), and a data field (Data). Among them, in the case of a transfer transaction, the From field indicates the account address that initiates the transaction (i.e., initiates a transfer task to another account), the To field indicates the account address that receives the transaction (i.e., receives the transfer), and the Data field includes the transfer amount.
区块链中可提供智能合约的功能。区块链上的智能合约是在区块链系统上可以被交易触发执行的合约。智能合约可以通过代码的形式定义。在区块链中调用智能合约,是发起一笔指向智能合约地址的交易,使得区块链中每个节点分布式地运行智能合约代码。The blockchain can provide the function of smart contracts. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract in the blockchain is to initiate a transaction pointing to the smart contract address, so that each node in the blockchain can run the smart contract code in a distributed manner.
在部署合约的场景中,例如,Bob将一个包含创建智能合约信息(即部署合约)的交易发送到如图1所示的区块链中,该交易的data字段包括待创建的合约的代码(如字节码或者机器码),交易的to字段为空,以表示该交易用于部署合约。节点间通过共识机制达成一致后,确定合约的合约地址“0x6f8ae93…”,各个节点在状态数据库中添加与该智能合约的合约地址对应的合约账户,分配与该合约账户对应的状态存储,并存储合约代码,将合约代码的哈希值保存在该合约的状态存储中,从而合约创建成功。In the scenario of deploying a contract, for example, Bob sends a transaction containing information about creating a smart contract (i.e., deploying a contract) to the blockchain shown in Figure 1. The data field of the transaction includes the code of the contract to be created (such as bytecode or machine code), and the to field of the transaction is empty to indicate that the transaction is used to deploy a contract. After the nodes reach an agreement through the consensus mechanism, the contract address "0x6f8ae93..." of the contract is determined. Each node adds a contract account corresponding to the contract address of the smart contract to the state database, allocates the state storage corresponding to the contract account, and stores the contract code. The hash value of the contract code is saved in the state storage of the contract, so that the contract is successfully created.
在调用合约的场景中,例如,Bob将一个用于调用智能合约的交易发送到如图1所示的区块链中,该交易的from字段是交易发起方(即Bob)的账户的地址,to字段为上述 “0x6f8ae93…”,即被调用的智能合约的地址,交易的data字段包括调用智能合约的方法和参数。在区块链中对该交易进行共识之后,区块链中的各个节点可分别执行该交易,从而分别执行该合约,基于该合约的执行更新状态数据库。In the scenario of calling a contract, for example, Bob sends a transaction for calling a smart contract to the blockchain shown in Figure 1. The from field of the transaction is the address of the account of the transaction initiator (i.e. Bob), and the to field is the above "0x6f8ae93..." is the address of the smart contract being called, and the data field of the transaction includes the method and parameters for calling the smart contract. After the transaction is agreed upon in the blockchain, each node in the blockchain can execute the transaction separately, thereby executing the contract separately, and updating the status database based on the execution of the contract.
区块链技术区别于传统技术的去中心化特点之一,就是在各个节点上进行记账,或者称为分布式记账,而不是传统的集中式记账。区块链系统要成为一个难以攻破的、公开的、不可篡改数据记录的去中心化诚实可信系统,需要在尽可能短的时间内做到分布式数据记录的安全、明确及不可逆。不同类型的区块链网络中,为了在各个记录账本的节点中保持账本的一致,通常采用共识算法来保证,即前述提到的共识机制。例如,区块链节点之间可以实现区块粒度的共识机制,比如在节点(例如某个独特的节点)产生一个区块后,如果产生的这个区块得到其它节点的认可,其它节点记录相同的区块。再例如,区块链节点之间可以实现交易粒度的共识机制,比如在节点(例如某个独特的节点)获取一笔区块链交易后,如果这笔区块链交易得到其他节点的认可,认可该区块链交易的各个节点可以分别将该区块链交易添加至自身维护的最新区块中,并且最终能够确保各个节点产生相同的最新区块。共识机制是区块链节点就区块信息(或称区块数据)达成全网一致共识的机制,可以保证最新区块被准确添加至区块链。当前主流的共识机制包括:工作量证明(Proof of Work,POW)、股权证明(Proof of Stake,POS)、委任权益证明(Delegated Proof of Stake,DPOS)、实用拜占庭容错(Practical Byzantine Fault Tolerance,PBFT)算法等。其中,在各种共识算法中,通常在预设数目的节点对待共识的数据(即共识提议)达成一致之后,从而确定对该共识提议的共识成功。具体是,在PBFT算法中,对于3(f+1)+1>N≥3f+1个共识节点,可容忍f个恶意节点,也就是说,当N个共识节点中至少2f+1个节点达成一致时,可确定共识成功。One of the decentralized features that distinguishes blockchain technology from traditional technologies is that it records accounts on each node, or distributed accounting, rather than traditional centralized accounting. In order for a blockchain system to become a decentralized, honest and trustworthy system that is difficult to break, public, and cannot be tampered with, it is necessary to make distributed data records secure, clear, and irreversible in the shortest possible time. In different types of blockchain networks, in order to maintain the consistency of the ledgers in each node that records the ledger, a consensus algorithm is usually used to ensure that it is the consensus mechanism mentioned above. For example, a consensus mechanism of block granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) generates a block, if the generated block is recognized by other nodes, other nodes record the same block. For another example, a consensus mechanism of transaction granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) obtains a blockchain transaction, if the blockchain transaction is recognized by other nodes, each node that recognizes the blockchain transaction can add the blockchain transaction to the latest block maintained by itself, and ultimately ensure that each node generates the same latest block. The consensus mechanism is a mechanism for blockchain nodes to reach a consensus on block information (or block data) across the entire network, which can ensure that the latest block is accurately added to the blockchain. The current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, etc. Among them, in various consensus algorithms, usually after a preset number of nodes reach an agreement on the consensus data (i.e., consensus proposal), the consensus on the consensus proposal is determined to be successful. Specifically, in the PBFT algorithm, for 3(f+1)+1>N≥3f+1 consensus nodes, f malicious nodes can be tolerated, that is, when at least 2f+1 nodes among N consensus nodes reach an agreement, the consensus can be determined to be successful.
图1所示的区块链中可包括主节点和从节点,在并行执行交易的场景下,主节点可预执行多个交易,得到多个交易的预执行读写集,从而可将包括该多个交易及其预执行读写集的共识提议发送给各个从节点。各个从节点可在对共识提议共识通过之后,根据该多个交易的预执行读写集对该多个交易进行分组,并根据分组结果并行执行该多个交易。在该场景中,通常,从节点在从客户端接收到交易之后,将接收的交易转发给主节点,以使得主节点进行对交易的预执行。然而,在主节点出现故障需要更换主节点时,从节点中并未存储已经从客户端接收的一批交易,从而导致该批交易的丢失,需要客户端重新向区块链发送该批交易,影响了业务效率。The blockchain shown in FIG1 may include a master node and a slave node. In the scenario of executing transactions in parallel, the master node may pre-execute multiple transactions and obtain pre-execution read-write sets of multiple transactions, so that a consensus proposal including the multiple transactions and their pre-execution read-write sets may be sent to each slave node. After the consensus proposal is passed, each slave node may group the multiple transactions according to the pre-execution read-write sets of the multiple transactions, and execute the multiple transactions in parallel according to the grouping results. In this scenario, usually, after receiving the transaction from the client, the slave node forwards the received transaction to the master node so that the master node performs pre-execution of the transaction. However, when the master node fails and needs to be replaced, the slave node does not store a batch of transactions that have been received from the client, resulting in the loss of the batch of transactions, and the client needs to resend the batch of transactions to the blockchain, affecting business efficiency.
本说明书实施例提供一种在区块链中处理交易的方法,其中,从节点在接收到交易之后,根据其角色相关信息,对接收到的交易进行验证,而不对交易进行预执行,并在验证通过之后存储交易,从而使得从节点在主节点出现故障的情况下,可直接从本地获取经验证的交易以用于对该交易进行共识,提高了区块链中的交易处理效率。The embodiments of the present specification provide a method for processing transactions in a blockchain, wherein after receiving a transaction, a slave node verifies the received transaction based on its role-related information without pre-executing the transaction, and stores the transaction after the verification is passed, so that when a master node fails, the slave node can directly obtain the verified transaction locally for consensus on the transaction, thereby improving the transaction processing efficiency in the blockchain.
图2为本说明书实施例中的一种区块链中的交易处理方法流程图。该方法可由区块链中的例如节点1执行,其中,节点1当前为从节点。Figure 2 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification. The method can be executed by, for example, node 1 in the blockchain, where node 1 is currently a slave node.
如图2所示,首先,在步骤S210,节点1获取信息m1和交易Tx1,其中,信息m1在节点1被设置为从节点之后存储,用于指示关闭预执行功能,即指示节点1在接收到交易之后对交易进行验证、不进行预执行。As shown in Figure 2, first, in step S210, node 1 obtains information m1 and transaction Tx1, wherein information m1 is stored after node 1 is set as a slave node, and is used to indicate turning off the pre-execution function, that is, instructing node 1 to verify the transaction after receiving it and not perform pre-execution.
节点1在确定自身的身份从主节点转换为从节点之后,或者节点1在初始启动时确定 自身的身份为从节点时,可在本地预设位置存储信息m1,以用于指示节点1在接收到交易之后对交易进行验证,而不进行预执行。After node 1 determines that it has switched from a master node to a slave node, or when node 1 determines that When its own identity is a slave node, the information m1 can be stored in a local preset location to instruct node 1 to verify the transaction after receiving it without pre-execution.
节点1可从客户端接收到交易Tx1。其中,区块链中的不同节点可从多个客户端接收到不同的交易。节点1可在接收到交易Tx1之后,从本地读取与交易预处理相关的信息,在本地存储有信息m1的情况下,可从本地读取信息m1。Node 1 may receive transaction Tx1 from the client. Different nodes in the blockchain may receive different transactions from multiple clients. After receiving transaction Tx1, node 1 may read information related to transaction preprocessing from the local computer. If information m1 is stored locally, the information m1 may be read locally.
在步骤S220,节点1在读取信息m1之后,根据信息m1的指示,对交易Tx1进行验证。In step S220, after reading the information m1, node 1 verifies the transaction Tx1 according to the instructions of the information m1.
所述对交易的验证例如包括:对交易签名的验证、对交易发送账户的GAS余额的验证、对交易合法性的验证等。根据信息m1,节点1仅对交易Tx1进行验证,而不进行预执行。The verification of the transaction includes, for example, verification of the transaction signature, verification of the GAS balance of the transaction sending account, verification of the legality of the transaction, etc. According to the information m1, node 1 only verifies the transaction Tx1 without pre-execution.
在步骤S230,节点1在验证通过的情况下,存储交易Tx1。In step S230, node 1 stores transaction Tx1 if verification is successful.
节点1在对交易Tx1验证通过的情况下,可将交易Tx1存储到例如已验证交易队列中。节点1在存储交易Tx1的同时,还将交易Tx1发送给当前的主节点,以使得主节点可预执行该交易Tx1。When the transaction Tx1 is verified, node 1 can store the transaction Tx1 in, for example, a verified transaction queue. While storing the transaction Tx1, node 1 also sends the transaction Tx1 to the current master node so that the master node can pre-execute the transaction Tx1.
在节点1是从主节点转换为从节点的情况下,节点1中还包括在作为主节点时存储的预执行交易队列,该预执行交易队列中存储了经验证、且经预执行的交易,节点1可将该预执行交易队列中的交易发送给当前的主节点,以使得主节点可重新预执行这些交易,并对这些交易进行共识。In the case where node 1 is converted from a master node to a slave node, node 1 also includes a pre-execution transaction queue stored when it is a master node. The pre-execution transaction queue stores verified and pre-executed transactions. Node 1 can send the transactions in the pre-execution transaction queue to the current master node so that the master node can re-pre-execute these transactions and reach consensus on these transactions.
图3为本说明书实施例中一种区块链中的交易处理方法流程图,该方法与图2所示方法对应,该方法可由例如节点1中的共识服务、缓存服务和预执行服务。其中,每个服务都包括用于实现该服务的预设功能的多个执行体(例如进程),且每个服务包括的多个进程可并行执行。FIG3 is a flow chart of a transaction processing method in a blockchain in an embodiment of the present specification, which corresponds to the method shown in FIG2 , and the method may be, for example, a consensus service, a cache service, and a pre-execution service in node 1. Each service includes multiple executable bodies (such as processes) for implementing the preset functions of the service, and the multiple processes included in each service may be executed in parallel.
如图3所示,在步骤S301,共识服务确定节点1为从节点。As shown in FIG. 3 , in step S301 , the consensus service determines that node 1 is a slave node.
节点1在启用之后可以与其他共识节点进行协商,从而确定自己为从节点。或者,节点1在作为主节点时出现故障,被其他共识节点确定为转换为从节点,节点1可在故障恢复之后从其他共识节点获取到自身转换为从节点的信息。节点1在确定自身为从节点之后,可将该信息提供给共识服务。After being enabled, node 1 can negotiate with other consensus nodes to determine that it is a slave node. Alternatively, if node 1 fails as a master node and is determined by other consensus nodes to be converted to a slave node, node 1 can obtain information about its conversion to a slave node from other consensus nodes after the failure is recovered. After determining that it is a slave node, node 1 can provide this information to the consensus service.
在步骤S303,缓存服务缓存从用户设备接收的交易。In step S303, the cache service caches the transaction received from the user device.
节点1可与用户设备连接,以从用户设备的客户端接收到交易(例如上述交易Tx1),缓存服务可缓存该交易Tx1。具体是,缓存服务可将交易Tx1存储到未验证交易队列中。Node 1 may be connected to a user device to receive a transaction (such as the transaction Tx1 described above) from a client of the user device, and the cache service may cache the transaction Tx1. Specifically, the cache service may store the transaction Tx1 in an unverified transaction queue.
在步骤S305,共识服务调用缓存服务提供的关闭接口(disable接口)。In step S305, the consensus service calls the disable interface provided by the cache service.
该disable接口用于设置指示信息,该指示信息用于指示关闭预执行功能,即对接收的交易仅进行验证,而不进行预执行。The disable interface is used to set indication information, and the indication information is used to indicate to turn off the pre-execution function, that is, only verify the received transaction without pre-execution.
在步骤S307,缓存服务响应于对disable接口的调用,将变量flag的值设置为用于指示关闭预执行功能的预设值。In step S307, in response to the call to the disable interface, the cache service sets the value of the variable flag to a preset value for indicating that the pre-execution function is disabled.
缓存服务响应于共识服务对disable接口的调用,执行disable接口,将缓存服务中的变量flag设置为用于指示关闭预执行功能的预设值(例如1),其中变量flag在该设置之前的值例如为默认值,或者在节点1由主节点转变为从节点的情况下,变量flag在该设置之前的值为用于指示开启预执行功能的预设值(例如0)。 In response to the consensus service's call to the disable interface, the cache service executes the disable interface and sets the variable flag in the cache service to a preset value (e.g., 1) for indicating that the pre-execution function is turned off, where the value of the variable flag before the setting is, for example, the default value, or when node 1 is transformed from a master node to a slave node, the value of the variable flag before the setting is a preset value (e.g., 0) for indicating that the pre-execution function is turned on.
在步骤S309,预执行服务向缓存服务请求交易。In step S309, the pre-execution service requests a transaction from the cache service.
预执行服务可向缓存服务请求新接收的交易,以对该交易进行预处理。The pre-execution service may request the cache service for the newly received transaction to pre-process the transaction.
在步骤S311,缓存服务向预执行服务发送交易Tx1和变量flag的用于指示关闭预执行操作的预设值。In step S311, the cache service sends a transaction Tx1 and a preset value of the variable flag for indicating closing the pre-execution operation to the pre-execution service.
缓存服务响应于预执行服务的请求,从缓存的交易中获取若干交易,将该若干交易和“flag=1”发送给预执行服务,该若干交易中例如包括交易Tx1。下面的步骤中以交易Tx1为例进行描述。In response to the request of the pre-execution service, the cache service obtains several transactions from the cached transactions and sends the several transactions and "flag=1" to the pre-execution service. The several transactions include, for example, transaction Tx1. The following steps are described by taking transaction Tx1 as an example.
在步骤S313,预执行服务在接收到交易Tx1和“flag=1”之后,根据“flag=1”,对接收的交易Tx1进行验证,而不进行预执行。In step S313, after receiving the transaction Tx1 and "flag=1", the pre-execution service verifies the received transaction Tx1 according to "flag=1" without performing pre-execution.
在步骤S315,预执行服务在对交易Tx1验证通过的情况下,可将验证通过的验证结果发送给缓存服务。In step S315, when the pre-execution service verifies the transaction Tx1 successfully, it may send the verification result to the cache service.
在步骤S317,缓存服务根据接收的验证结果确定验证通过的情况下,将交易Tx1放入已验证交易队列中。In step S317, if the cache service determines that the verification is successful based on the received verification result, the transaction Tx1 is placed in the verified transaction queue.
在一种实施方式中,从节点1在确定自身由主节点转换为从节点的情况中,由于从节点中预执行服务关闭了预执行功能,仅保留验证功能,因此可减少预执行服务实例数(例如进程数),从而达到动态缩容的效果。In one embodiment, when slave node 1 determines that it has been converted from a master node to a slave node, since the pre-execution service in the slave node turns off the pre-execution function and only retains the verification function, the number of pre-execution service instances (such as the number of processes) can be reduced, thereby achieving a dynamic scaling effect.
从节点中通过如图2或图3所示对接收的交易进行预处理,根据flag值在对交易验证通过之后在交易队列中存储该交易,使得该从节点在由从节点转换为主节点的情况下,可从已验证交易队列中获取已验证的交易进行预执行,而不会出现交易丢失的情况,避免了需要客户端重发交易的情况,提高了区块链中的交易处理效率。The slave node pre-processes the received transaction as shown in FIG2 or 3, and stores the transaction in the transaction queue according to the flag value after the transaction is verified, so that when the slave node is converted from a slave node to a master node, it can obtain the verified transaction from the verified transaction queue for pre-execution without transaction loss, avoiding the need for the client to resend the transaction, and improving the transaction processing efficiency in the blockchain.
图4为本说明书实施例中的一种区块链中的交易处理方法流程图。该方法可由区块链中的例如节点2执行,其中,节点2当前为主节点。Figure 4 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification. The method can be executed by, for example, node 2 in the blockchain, where node 2 is currently the master node.
如图4所示,首先,在步骤S410,节点2获取信息m2和交易Tx2,其中,信息m2在节点2被设置为主节点之后存储,用于指示开启预执行功能,即在接收到交易之后对交易进行验证,并在验证通过之后预执行交易。As shown in Figure 4, first, in step S410, node 2 obtains information m2 and transaction Tx2, wherein information m2 is stored after node 2 is set as the master node, and is used to indicate to turn on the pre-execution function, that is, to verify the transaction after receiving it, and pre-execute the transaction after the verification is passed.
节点2在确定自身的身份从从节点转换为主节点之后,或者节点2在初始启动时确定自身的身份为主节点时,可在本地预设位置存储信息m2,以用于指示节点2开启预执行功能,即在接收到交易之后对交易进行验证和预执行。After node 2 determines that its identity has been converted from a slave node to a master node, or when node 2 determines that its identity is a master node during initial startup, it can store information m2 in a local preset location to instruct node 2 to enable the pre-execution function, that is, to verify and pre-execute the transaction after receiving the transaction.
节点2可从客户端或者其他共识节点接收到交易Tx2。其中,区块链中的不同节点可从多个客户端接收到不同的交易。节点2可在接收到交易Tx2之后,从本地读取与交易预处理相关的信息,其中,在本地存储有信息m2的情况下,可从本地读取信息m2。Node 2 may receive transaction Tx2 from a client or other consensus node. Different nodes in the blockchain may receive different transactions from multiple clients. After receiving transaction Tx2, node 2 may read information related to transaction preprocessing from the local computer. If information m2 is stored locally, information m2 may be read locally.
在步骤S420,节点2在读取信息m2之后,根据信息m2的指示,对交易Tx2进行验证,在验证通过的情况下,预执行交易Tx2。In step S420, after reading the information m2, node 2 verifies the transaction Tx2 according to the instructions of the information m2, and pre-executes the transaction Tx2 if the verification passes.
如上文所述,所述对交易的验证例如包括:对交易签名的验证、对交易发送账户的GAS余额的验证、对交易合法性的验证等。节点2在对交易Tx2验证通过之后,预执行交易Tx2。具体是,节点2可基于从状态数据库读取的状态值执行交易Tx2,得到交易Tx2的预执行读写集。该预执行读写集包括预执行读集和预执行写集,所述预执行读集包括节点2在预执行交易Tx2的过程中读取的变量key或key-value对,所述预执行写集包括节点2在预执行交易Tx2的过程中更新的变量key或key-value对。 As described above, the verification of the transaction includes, for example: verification of the transaction signature, verification of the GAS balance of the transaction sending account, verification of the legality of the transaction, etc. After node 2 verifies transaction Tx2, it pre-executes transaction Tx2. Specifically, node 2 can execute transaction Tx2 based on the state value read from the state database to obtain a pre-execution read-write set of transaction Tx2. The pre-execution read-write set includes a pre-execution read set and a pre-execution write set. The pre-execution read set includes the variable key or key-value pair read by node 2 during the pre-execution of transaction Tx2, and the pre-execution write set includes the variable key or key-value pair updated by node 2 during the pre-execution of transaction Tx2.
在步骤S430,节点2存储交易Tx2及其预执行读写集。In step S430, node 2 stores transaction Tx2 and its pre-execution read-write set.
节点2在对交易Tx2预执行完成之后,可将交易Tx2及其预执行读写集存储到预执行交易队列中。后续,节点2可从该预执行交易队列中获取一批交易及其读写集,生成共识提议,该共识提议中可包括该批交易及其读写集,节点2可将该共识提议发送给各个从节点以进行对该共识提议的共识。After completing the pre-execution of transaction Tx2, node 2 can store transaction Tx2 and its pre-execution read-write set in the pre-execution transaction queue. Subsequently, node 2 can obtain a batch of transactions and their read-write sets from the pre-execution transaction queue and generate a consensus proposal, which can include the batch of transactions and their read-write sets. Node 2 can send the consensus proposal to each slave node to reach a consensus on the consensus proposal.
在节点2是从从节点转换为主节点的情况下,节点2中还包括在作为从节点时存储的已验证交易队列,该交易队列中存储了经验证、且未预执行的交易,节点2可将该已验证交易队列中的交易重新预执行,并将这些交易及其预执行读写集存储到预执行交易队列中。In the case where node 2 is converted from a slave node to a master node, node 2 also includes a verified transaction queue stored when it was a slave node, in which verified but non-pre-executed transactions are stored. Node 2 can re-pre-execute transactions in the verified transaction queue and store these transactions and their pre-executed read-write sets in the pre-executed transaction queue.
图5为本说明书实施例中一种区块链中的交易处理方法流程图,该方法与图4所示方法对应,可由例如节点2中的共识服务、缓存服务和预执行服务。其中,每个服务都包括用于实现该服务的预设功能的多个执行体(例如进程),且每个服务包括的多个进程可并行执行。FIG5 is a flow chart of a transaction processing method in a blockchain in an embodiment of this specification, which corresponds to the method shown in FIG4 and can be implemented by, for example, a consensus service, a cache service, and a pre-execution service in node 2. Each service includes multiple executable bodies (such as processes) for implementing the preset functions of the service, and the multiple processes included in each service can be executed in parallel.
如图5所示,在步骤S501,共识服务确定节点2为主节点。As shown in FIG. 5 , in step S501 , the consensus service determines node 2 as the master node.
节点2在启用之后可以与其他共识节点进行协商,从而确定自己为主节点。或者,节点2在之前的主节点出现故障之后被多个共识节点确定为新的主节点。节点2在确定自身为主节点之后,可将该信息提供给共识服务。After being enabled, Node 2 can negotiate with other consensus nodes to determine itself as the master node. Alternatively, Node 2 is determined by multiple consensus nodes to be the new master node after the previous master node fails. After Node 2 determines itself as the master node, it can provide this information to the consensus service.
在步骤S503,缓存服务缓存接收的交易。In step S503, the cache service caches the received transaction.
节点2可与用户设备连接,以从用户设备的客户端接收到交易(例如上述交易Tx2),缓存服务可缓存该交易Tx2。节点2作为主节点还可以从各个从节点接收到该从节点从客户端接收到的交易,并缓存该交易。Node 2 can be connected to a user device to receive a transaction (such as the above transaction Tx2) from a client of the user device, and the cache service can cache the transaction Tx2. Node 2, as a master node, can also receive transactions received by each slave node from the client and cache the transaction.
在步骤S505,共识服务调用缓存服务提供的开启接口(reset接口)。In step S505, the consensus service calls the start interface (reset interface) provided by the cache service.
该reset接口用于设置指示信息,该指示信息用于指示节点2开启预执行功能,即对接收的交易进行验证,并在验证通过后预执行。The reset interface is used to set indication information, and the indication information is used to instruct node 2 to enable the pre-execution function, that is, to verify the received transaction and pre-execute it after the verification passes.
在步骤S507,缓存服务响应于对reset接口的调用,将变量flag的值设置为用于指示开启预执行功能的预设值。In step S507, in response to the call to the reset interface, the cache service sets the value of the variable flag to a preset value for indicating that the pre-execution function is enabled.
缓存服务响应于共识服务对reset接口的调用,执行reset接口,将缓存服务中的变量flag设置为用于指示开启预执行功能的预设值(例如0),其中变量flag在该设置之前的值例如为默认值,或者在节点2由从节点转变为主节点的情况下,变量flag在该设置之前的值为用于指示关闭预执行功能的预设值(例如1)。In response to the consensus service's call to the reset interface, the cache service executes the reset interface and sets the variable flag in the cache service to a preset value (e.g., 0) for indicating that the pre-execution function is turned on, where the value of the variable flag before the setting is, for example, the default value, or in the case where node 2 is transformed from a slave node to a master node, the value of the variable flag before the setting is a preset value (e.g., 1) for indicating that the pre-execution function is turned off.
在步骤S509,预执行服务向缓存服务请求交易。In step S509, the pre-execution service requests a transaction from the cache service.
预执行服务可向缓存服务请求新接收的交易,以对该交易进行预处理。The pre-execution service may request the cache service for the newly received transaction to pre-process the transaction.
在步骤S511,缓存服务向预执行服务发送交易Tx2和变量flag的用于指示开启预执行操作的预设值。In step S511, the cache service sends the transaction Tx2 and a preset value of the variable flag to the pre-execution service for indicating the start of the pre-execution operation.
缓存服务响应于预执行服务的请求,从缓存的交易中获取若干交易,将该若干交易和“flag=0”发送给预执行服务,该若干交易中例如包括交易Tx2。下面的步骤中以交易Tx2为例进行描述。In response to the request of the pre-execution service, the cache service obtains several transactions from the cached transactions and sends the several transactions and "flag=0" to the pre-execution service. The several transactions include, for example, transaction Tx2. The following steps are described by taking transaction Tx2 as an example.
在步骤S513,预执行服务在接收到交易Tx2和“flag=0”之后,根据“flag=0”,对接收的交易Tx2进行验证,在验证通过之后预执行交易Tx2,得到交易Tx2的预执行读写集。In step S513, after receiving transaction Tx2 and "flag=0", the pre-execution service verifies the received transaction Tx2 according to "flag=0", and pre-executes transaction Tx2 after the verification passes, to obtain the pre-execution read-write set of transaction Tx2.
在步骤S515,预执行服务将交易Tx2的预执行读写集发送给缓存服务。 In step S515, the pre-execution service sends the pre-execution read-write set of transaction Tx2 to the cache service.
在步骤S517,缓存服务将交易Tx2及其预执行读写集放入预执行交易队列中。In step S517, the cache service puts the transaction Tx2 and its pre-execution read-write set into the pre-execution transaction queue.
在节点2是从从节点转换为主节点的情况下,节点2中还包括作为从节点时存储的已验证交易队列,该交易队列中存储了经验证、且未预执行的交易,节点2中的缓存服务可将该已验证交易队列中的交易与“flag=0”一起发送给预执行服务,从而预执行服务可对这些交易进行预执行,并将这些交易的预执行读写集发送给缓存服务,从而缓存服务可将这些交易及其预执行读写集存储到预执行交易队列中。When node 2 is converted from a slave node to a master node, node 2 also includes a verified transaction queue stored when it is a slave node, in which verified but not pre-executed transactions are stored. The cache service in node 2 can send the transactions in the verified transaction queue together with "flag=0" to the pre-execution service, so that the pre-execution service can pre-execute these transactions, and send the pre-execution read-write sets of these transactions to the cache service, so that the cache service can store these transactions and their pre-execution read-write sets in the pre-execution transaction queue.
在一种实施方式中,从节点2在确定自身由从节点转换为主节点的情况中,由于从节点中预执行服务开启了预执行功能,计算任务加重,因此可增加预执行服务实例数(例如进程数),从而达到动态括容的效果。In one embodiment, when slave node 2 determines that it is converted from a slave node to a master node, since the pre-execution function is enabled in the pre-execution service in the slave node, the computing task is increased, and therefore the number of pre-execution service instances (e.g., the number of processes) can be increased, thereby achieving the effect of dynamic capacity.
主节点中通过如图4或图5所示对接收的交易进行预处理,对于在该主节点由从节点转换为主节点的情况下,可根据变量flag的值,从已验证交易队列中获取已验证的交易进行预执行,而不会出现交易丢失的情况,避免了需要客户端重发交易的情况,提高了区块链中的交易处理效率。The master node pre-processes the received transaction as shown in FIG4 or FIG5. When the master node is converted from a slave node to a master node, the verified transaction can be obtained from the verified transaction queue for pre-execution according to the value of the variable flag without losing the transaction, thus avoiding the need for the client to resend the transaction and improving the transaction processing efficiency in the blockchain.
图6为本说明书实施例中的一种区块链节点的架构图,所述区块链节点当前为从节点,用于执行如图2、图3、图4或图5所示的方法,包括:FIG6 is an architecture diagram of a blockchain node in an embodiment of this specification, wherein the blockchain node is currently a slave node, and is used to execute the method shown in FIG2, FIG3, FIG4 or FIG5, including:
获取单元61,用于获取第一交易和本地存储的第一信息,所述第一信息用于指示关闭预执行功能;An acquisition unit 61 is used to acquire a first transaction and first information stored locally, where the first information is used to indicate to close the pre-execution function;
验证单元62,用于根据所述第一信息,对所述第一交易进行验证;a verification unit 62, configured to verify the first transaction according to the first information;
存储单元63,用于在验证通过的情况下,存储所述第一交易。The storage unit 63 is used to store the first transaction when the verification is successful.
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行如图2、图3、图4或图5所示的方法。The embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method shown in FIG. 2 , FIG. 3 , FIG. 4 , or FIG. 5 .
本说明书实施例还提供一种区块链节点,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现如图2、图3、图4或图5所示的方法。The embodiments of this specification also provide a blockchain node, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method shown in FIG. 2, FIG. 3, FIG. 4 or FIG. 5 is implemented.
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs. The original code before compilation must also be written in a specific programming language, which is called Hardware Description Language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby) The most commonly used languages are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. It should be clear to those skilled in the art that the method flow can be easily obtained by programming the method flow in the above-mentioned hardware description languages and programming it into the integrated circuit.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer readable medium storing a computer readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that in addition to implementing the controller in a purely computer readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the means for implementing various functions included therein may also be considered as a structure within the hardware component. Or even, the means for implementing various functions may be considered as both a software module for implementing the method and a structure within the hardware component.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为服务器系统。当然,本申请不排除随着未来计算机技术的发展,实现上述实施例功能的计算机例如可以为个人计算机、膝上型计算机、车载人机交互设备、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本说明书一个或多个时可以把各模块的功能在同一个或多个软件和/或硬件中实现,也可以将实现同一功能的模块由多个子模块或子单元的组合实现等。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and/or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图 和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is a flowchart of a method, apparatus (system), and computer program product according to an embodiment of the present invention. The flowchart and/or block diagram are described in detail. It should be understood that each process and/or block in the flowchart and/or block diagram, as well as the combination of the processes and/or blocks in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one or more processes in the flowchart and/or one or more blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互 相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments are mutually exclusive. Just refer to each other, each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples.
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在权利要求范围之内。 The above description is only an example of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the scope of the claims.
Claims (14)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310640782.4 | 2023-05-31 | ||
CN202310640782.4A CN116668001A (en) | 2023-05-31 | 2023-05-31 | Transaction processing method in block chain and block chain link point |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024244342A1 true WO2024244342A1 (en) | 2024-12-05 |
Family
ID=87711332
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/135057 WO2024244342A1 (en) | 2023-05-31 | 2023-11-29 | Transaction processing method in blockchain, and blockchain node |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116668001A (en) |
WO (1) | WO2024244342A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116668001A (en) * | 2023-05-31 | 2023-08-29 | 蚂蚁区块链科技(上海)有限公司 | Transaction processing method in block chain and block chain link point |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111078696A (en) * | 2019-12-04 | 2020-04-28 | 杭州复杂美科技有限公司 | Block generation method, device and storage medium |
US20200153605A1 (en) * | 2018-11-13 | 2020-05-14 | Accelor Ltd. | Systems and methods for pre-executing transaction validation for blockchain applications |
CN113743949A (en) * | 2021-11-04 | 2021-12-03 | 支付宝(杭州)信息技术有限公司 | Method for executing transaction in block chain, main node and slave node |
CN114827165A (en) * | 2022-05-30 | 2022-07-29 | 蚂蚁区块链科技(上海)有限公司 | Method and block link point for grouping multiple transactions |
CN116668001A (en) * | 2023-05-31 | 2023-08-29 | 蚂蚁区块链科技(上海)有限公司 | Transaction processing method in block chain and block chain link point |
-
2023
- 2023-05-31 CN CN202310640782.4A patent/CN116668001A/en active Pending
- 2023-11-29 WO PCT/CN2023/135057 patent/WO2024244342A1/en unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20200153605A1 (en) * | 2018-11-13 | 2020-05-14 | Accelor Ltd. | Systems and methods for pre-executing transaction validation for blockchain applications |
CN111078696A (en) * | 2019-12-04 | 2020-04-28 | 杭州复杂美科技有限公司 | Block generation method, device and storage medium |
CN113743949A (en) * | 2021-11-04 | 2021-12-03 | 支付宝(杭州)信息技术有限公司 | Method for executing transaction in block chain, main node and slave node |
CN114827165A (en) * | 2022-05-30 | 2022-07-29 | 蚂蚁区块链科技(上海)有限公司 | Method and block link point for grouping multiple transactions |
CN116668001A (en) * | 2023-05-31 | 2023-08-29 | 蚂蚁区块链科技(上海)有限公司 | Transaction processing method in block chain and block chain link point |
Also Published As
Publication number | Publication date |
---|---|
CN116668001A (en) | 2023-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6675518B1 (en) | Method and device for processing a service request | |
US20220094698A1 (en) | Cross-blockchain interaction systems | |
EP3547170B1 (en) | Blockchain-based consensus method and device | |
CN114827165B (en) | Method and block link point for grouping multiple transactions | |
WO2024092932A1 (en) | Transaction execution method and blockchain node | |
CN114942847B (en) | Methods and blockchain nodes for executing transactions | |
TW202040386A (en) | Storage and execution method and device of intelligent contract in block chain and electronic device | |
WO2023231337A1 (en) | Method for executing transaction in blockchain, and master node and slave node of blockchain | |
CN115150409B (en) | Method for executing transaction in blockchain system, node and computer readable storage medium | |
WO2023185059A1 (en) | Consensus method and blockchain node | |
CN114936256A (en) | Method for executing transaction in block chain and block chain link point | |
CN114820187A (en) | Data processing method and device, electronic equipment and storage medium | |
EP3779692A1 (en) | Data processing method and device, client, and server | |
WO2024244342A1 (en) | Transaction processing method in blockchain, and blockchain node | |
WO2023231335A1 (en) | Method for executing transaction in blockchain, and master node of blockchain | |
CN114741736A (en) | Data processing method and device, electronic equipment and storage medium | |
WO2024221910A1 (en) | Transaction execution method and blockchain node in blockchain system | |
WO2025025436A1 (en) | Data management method based on blockchain system, and blockchain node | |
WO2024092930A1 (en) | Transaction execution method in blockchain system, and node | |
WO2024066005A1 (en) | Method and apparatus for replaying blockchain transaction | |
CN115018499B (en) | A digital certificate issuance method, device and system based on blockchain | |
WO2023185041A1 (en) | Data processing method and apparatus, electronic device, and storage medium | |
WO2024001025A1 (en) | Pre-execution cache data cleaning method and blockchain node | |
EP3779691B1 (en) | Data processing method and apparatus | |
CN116032756A (en) | Method and blockchain node for updating configuration information of application program based on blockchain |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23939311 Country of ref document: EP Kind code of ref document: A1 |