WO2021135745A1 - Method and apparatus for carrying out transaction data processing at blockchain node - Google Patents
Method and apparatus for carrying out transaction data processing at blockchain node Download PDFInfo
- Publication number
- WO2021135745A1 WO2021135745A1 PCT/CN2020/131838 CN2020131838W WO2021135745A1 WO 2021135745 A1 WO2021135745 A1 WO 2021135745A1 CN 2020131838 W CN2020131838 W CN 2020131838W WO 2021135745 A1 WO2021135745 A1 WO 2021135745A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction data
- blockchain
- processing
- transaction
- unit
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
Definitions
- the present disclosure relates to the field of blockchain technology, and in particular, to a method and device for processing transaction data at a blockchain node.
- Blockchain technology also known as distributed ledger technology, is an emerging technology in which several computing devices participate in "bookkeeping" and jointly maintain a complete distributed database. Because the blockchain technology has the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and the rapid data synchronization between computing devices, the blockchain technology has been widely used in many fields. To apply.
- the transaction initiated by the client is sent to the blockchain node to request the blockchain node to perform the blockchain processing operation on the transaction.
- the client After the client sends the transaction data to the blockchain node, it needs to query the blockchain node for the processing status of the transaction after a period of time.
- Blockchain nodes not only need to perform blockchain processing on transaction data, but also respond to client status query requests, which leads to excessive load on blockchain nodes.
- the present disclosure provides a method and device for processing transaction data at a blockchain node.
- the processing status of each transaction is stored independently of the blockchain processing unit, so that the transaction related parties can obtain the processing status of the transaction without accessing the blockchain processing unit of the blockchain node. Reduce the load of the block chain link processing unit.
- a method for processing transaction data at a blockchain node including a blockchain processing unit, and the method includes: upon receiving at least one transaction After data, the received at least one transaction data is sent to the blockchain processing unit for corresponding blockchain processing.
- the transaction data has a state description field; the transaction data is obtained from the blockchain processing unit for each The corresponding blockchain processing status information of the transaction data; and for each transaction data in the at least one transaction data, use the received blockchain processing status information to update the status description field of the transaction data for the at least A related party of transaction data to perform status query.
- the method may further include: periodically sending the updated blockchain processing status information of the at least one transaction data to the related party of the at least one transaction data.
- the method may further include: in response to a status query request of an associated party of the at least one transaction data, sending blockchain processing status information of the at least one transaction data to the associated party .
- the method may further include: when the pending transaction data sent to the blockchain processing unit exceeds the current limit threshold, stopping sending the pending transaction to the blockchain processing unit Transaction data.
- the current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state.
- the method may further include: buffering at least one piece of received transaction data.
- the method may further include: when the amount of the cached transaction data exceeds the storage threshold, storing part or all of the cached transaction data in the non-volatile memory.
- the method may further include: for each transaction data stored, deleting the transaction when the state description field of the transaction data is updated to a predetermined time period after completing the block chaining data.
- the method may further include: for each transaction data cached, the status description field of the transaction data is updated to be not updated to complete consensus after a second predetermined time has passed after the verification is completed At the time, broadcast the transaction data to other blockchain nodes.
- a device for processing transaction data at a blockchain node includes a blockchain processing unit, and the device includes a transaction data sending unit, It is configured to, after receiving at least one transaction data, send the received at least one transaction data to the blockchain processing unit for corresponding blockchain processing, and the transaction data has a state description field; processing state An information acquisition unit configured to acquire corresponding blockchain processing status information for each transaction data from the blockchain processing unit; and a processing status update unit configured to target each transaction data in the at least one transaction data , Using the received block chain processing state information to update the state description field of the transaction data, so that the related party of the at least one transaction data can perform state query.
- the device may further include: a processing status information sending unit configured to periodically send the updated blockchain processing status information of the at least one transaction data to the at least one transaction data Related party.
- a processing status information sending unit configured to periodically send the updated blockchain processing status information of the at least one transaction data to the at least one transaction data Related party.
- the apparatus may further include: a processing status information sending unit configured to send the at least one related party to the at least one related party in response to a status query message of the at least one related party of transaction data.
- the blockchain of transaction data processes status information.
- the device may further include: a data current limiting unit configured to determine whether the transaction data to be processed sent to the blockchain processing unit exceeds a current limiting threshold.
- the transaction data sending unit is configured to stop sending the transaction data to be processed to the blockchain processing unit when it is determined that the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold.
- the device may further include: a storage unit configured to store the received at least one transaction data in a cache.
- the storage unit may be further configured to store part or all of the cached transaction data in the non-volatile memory when the amount of the cached transaction data exceeds the storage threshold.
- the device may further include: a transaction data deletion unit configured to deal with each transaction data cached, after the state description field of the transaction data is updated to complete the block chaining. When a predetermined period of time, delete the transaction data.
- a transaction data deletion unit configured to deal with each transaction data cached, after the state description field of the transaction data is updated to complete the block chaining. When a predetermined period of time, delete the transaction data.
- the device may further include: a broadcasting unit configured to target each transaction data that is cached, after the state description field of the transaction data is updated to complete verification after a second predetermined time has elapsed When it has not been updated to complete the consensus, the transaction data is broadcast to other blockchain nodes.
- a broadcasting unit configured to target each transaction data that is cached, after the state description field of the transaction data is updated to complete verification after a second predetermined time has elapsed When it has not been updated to complete the consensus, the transaction data is broadcast to other blockchain nodes.
- a computing device including: at least one processor; and a memory, the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one The processor executes the method as described above.
- a non-transitory machine-readable storage medium which stores executable instructions that, when executed, cause the machine to perform the method as described above.
- the related parties of the transaction data can obtain the transaction information without accessing the blockchain processing unit of the blockchain node.
- Blockchain processing status Therefore, the blockchain processing unit of the blockchain only needs to update the processing status of the transaction data on the blockchain node, and does not need to respond to the status query request of the related party. Therefore, the method and device can reduce the load of the blockchain processing unit, thereby improving the processing efficiency of transaction data.
- the transaction data can be obtained from the local cache , So there is no need for the client to send transaction data again.
- the method and device of the present disclosure by storing part or all of the cached transaction data in the non-volatile memory when the amount of cached transaction data exceeds the storage threshold, it is possible to avoid difficulty when the cache space becomes vacant.
- the transaction data is read in the lossy memory, so as to avoid the problem that the client has to send the transaction data again due to the loss of the transaction data caused by insufficient buffer space.
- Fig. 1 is a schematic diagram for explaining an example of a blockchain system
- Figure 2 is a schematic diagram for explaining the structure of a blockchain node
- FIG. 3 is a schematic diagram for explaining the message sending process when a blockchain node performs transaction data processing
- Fig. 4 is a schematic structural diagram of a blockchain node according to an embodiment of the present disclosure.
- FIG. 5 is a structural block diagram of a device for processing transaction data at a blockchain node suitable for the blockchain node shown in FIG. 4;
- FIG. 6 is a schematic diagram for explaining the message sending process when using the blockchain node of the present disclosure to process transaction data
- Fig. 7 is a flowchart of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure
- Fig. 8 is a flowchart of an application scenario of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
- Fig. 9 is a structural block diagram of a computing device for implementing a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
- the term “including” and its variations mean open terms, meaning “including but not limited to”.
- the term “based on” means “based at least in part on.”
- the terms “one embodiment” and “an embodiment” mean “at least one embodiment.”
- the term “another embodiment” means “at least one other embodiment.”
- connection refers to direct mechanical connection, communication or electrical connection between two components, or indirect mechanical connection, communication or electrical connection through intermediate components.
- electrically connected refers to the possibility of electrical communication between two components for data/information exchange.
- the electrical connection may refer to a direct electrical connection between two components, or an indirect electrical connection through an intermediate component.
- the electrical connection can be implemented in a wired manner or a wireless manner.
- FIG. 1 is a schematic diagram for explaining an example of the blockchain system 100.
- the blockchain system 100 there are blockchain nodes 102, 103, 104, 105, and 106.
- the client 101 is connected to the blockchain node 102.
- the transaction data is sent to the blockchain node 102 communicating with it.
- the blockchain node 102 After receiving the transaction data, the blockchain node 102 first verifies the transaction data. When the verification is legal, the blockchain node 102 broadcasts the received transaction data to other blockchain nodes 103-106 in the blockchain system 100 to perform consensus processing on the transaction data.
- Figure 1 is just an example of a blockchain system.
- the blockchain system may include a transaction pool, which is used to store transactions initiated by the client 101 (or other clients in the blockchain system) data.
- Each node can read transaction data from the transaction pool, and perform verification, consensus and other processing.
- the client 101 can also be connected to multiple blockchain nodes, so that transaction data can be sent to multiple blockchain nodes connected to it.
- the blockchain node that receives the transaction data can fight for the processing right (for example, the accounting right) of the transaction data through a predetermined mechanism.
- the client 101 may be a lightweight node (or called an SPV node) in a blockchain system, and the blockchain nodes 102, 103, 104, 105, 106 are full nodes (or called an accounting node).
- the lightweight node can further connect to one or more second clients (not shown in the figure), and the second client can perform operations such as initiating transactions or querying transaction status via the lightweight nodes.
- FIG. 2 is a schematic diagram for explaining the structure of a blockchain node 200 in the prior art.
- a blockchain node includes a verification module 201, a consensus module 202, an execution module 203, and a block module 204.
- the verification module 201 verifies the received transaction data.
- the verification module 201 may also have a buffer function, and multiple received transaction data may be queued in the verification module 201 for verification.
- the verification module 201 is used to verify whether the transaction data is legal.
- the verification operation performed by the verification module may be, for example, verifying whether the data structure of the transaction data meets the requirements of the corresponding blockchain system; whether the corresponding client has the ability to pay for the transaction procedures Fees (such as verifying the client’s account balance); whether the corresponding transaction is a repeated transaction (ie "double spend"); verifying whether the signature in the transaction data is legal; whether the size of the transaction data exceeds the maximum capacity of the block in the blockchain, etc. Wait.
- the verification module 201 can perform one or more of the verification operations. In different blockchain systems (such as the Bitcoin system, the Ethereum system, etc.), the verification operations performed by the verification module 201 may be different. The verification operation performed by the verification module 201 is not limited to the content listed here.
- the consensus module 202 executes the consensus operation on the blockchain node, and can broadcast transaction data to other blockchain nodes in the blockchain system to complete the consensus processing on the transaction data. Consensus processing can implement consensus based on consensus mechanisms such as Proof of Work (PoW) and Practical Byzantine Algorithm (PBFT). If other blockchain nodes do not recognize the transaction data after performing a consensus operation on the transaction data, they may not make any response. When each blockchain node recognizes that the transaction data is legal, it can return the consensus result of each blockchain node to the consensus module 202 of the blockchain node. The consensus module 202 can determine whether the transaction data reaches a consensus based on the consensus result of each blockchain node.
- PoW Proof of Work
- PBFT Practical Byzantine Algorithm
- the execution module 203 will execute the transaction data.
- the execution module may be a virtual machine module, such as the EVM in the Ethereum system.
- the execution operation can be the execution of a smart contract.
- the execution operation of the transaction data may be, for example, deducting the cost of executing the corresponding transaction from the balance of the client that initiated the transaction, and increasing the nonce in the sender’s account by 1 for the current transaction; in order to gain access to the corresponding transaction area Block chain nodes issue rewards, etc.
- the corresponding transaction may be a transfer transaction.
- the corresponding money for example, a predetermined amount of Bitcoin, Ether, etc.
- the execution content of the execution module 203 for transactions may be different.
- the block module 204 packages the transaction data of the transaction into a block, and sends it to the blockchain to perform the block chaining operation.
- Fig. 3 is a schematic diagram for explaining a message sending process when a block chain node in the prior art is used to process transaction data.
- the client 301 initiates a transaction
- the client sends the transaction data to the blockchain node 302.
- the blockchain node verifies the legality of the transaction data, if the verification result is legal, at 320, the transaction data is broadcast to other blockchain nodes 303, 304, 305, and 306.
- the consensus result is fed back to the blockchain node 302. Then, if the transaction data reaches a consensus among various blockchain nodes, the blockchain node 302 will perform transaction execution and block chaining operations.
- the client 301 After the client 301 sends the transaction data to the blockchain node 302, it may visit the blockchain node 302 at 350 after a predetermined time interval to obtain the blockchain processing status of the transaction initiated by it. If the client 301 frequently queries the blockchain processing status or multiple clients perform status queries at the same time, it may cause the blockchain node 302 to visit too much and become overloaded, which may cause the efficiency of blockchain processing for transaction data. Decline, or the blockchain node may fail due to overload.
- FIG. 4 is a structural block diagram of a blockchain node 400 according to an embodiment of the present disclosure.
- the blockchain node 400 includes a blockchain processing unit 410, a transaction data processing device 420, and a non-volatile memory 430.
- the non-volatile memory 430 is not an essential component.
- the blockchain node may not include the non-volatile memory.
- the blockchain processing unit 410 is configured to perform blockchain processing on transaction data.
- the blockchain processing unit 410 may include various modules of the blockchain node in the prior art as shown in FIG. 2. As shown in FIG. 4, the blockchain node includes a verification module 411, a consensus module 412, an execution module 413, and a block module 414. The operations performed by each module are the same as each functional module of the blockchain node in the prior art.
- FIG. 5 is a structural block diagram of a transaction data processing device 420 suitable for the blockchain node 400 shown in FIG. 4.
- the transaction data processing device 420 includes a transaction data sending unit 421, a processing status information acquiring unit 422, a processing status update unit 423, a processing status information sending unit 424, a data current limiting unit 425, a storage unit 426, and transaction data.
- Delete unit 427 and broadcasting unit 428 are not necessary constituent elements. In other examples of the present disclosure, these unnecessary constituent elements may not be included, and one or more of them may also be included.
- the transaction data processing device 420 waits for the blockchain processing unit 410 to perform blockchain processing on it.
- the transaction data sending unit 421 is configured to send the received at least one transaction data to the blockchain processing unit 410 for corresponding blockchain processing after receiving at least one transaction data, and the transaction data has a state description field.
- the status description field is used to describe the blockchain processing status of the transaction data.
- the blockchain processing status can include: pending verification (waiting for verification by the verification module 411), completed verification (verification processing by the verification module 411), pending consensus (Verified lawful and waiting for consensus processing), Consensus completed (Consensus processing has been passed), Pending execution (Consensus reached a consensus and waiting to be executed), Execution completed (Execution of the execution module has been performed), Waiting for the block to be chained and completed Block chain and so on.
- the transaction processing status indicated by the status description field may include pending verification, pending consensus, pending execution, pending block uploading, completing block uploading, and so on.
- Pending transaction data refers to the transaction data whose status description field has not been updated to complete the blockchain.
- the blockchain processing for the transaction data has ended, so there is no need to process it again.
- the transaction data Before the status of the transaction data is updated to complete the block chaining, the transaction data still needs to be processed.
- Transaction data can also include transaction content, the node where the transaction arrives, transaction serial number and business ID, etc.
- Transaction content is used to describe the specific content of the transaction, such as the initiator of the transaction (such as a transfer transaction), the recipient of the transaction, the transaction amount, and the transaction summary.
- the transaction serial number indicates the corresponding serial number of the exchange initiated by the client that initiated the transaction.
- the business ID represents the serial number of the transaction in the corresponding blockchain system.
- the state description field of the transaction data is stored in the transaction data processing device 420.
- each module of the blockchain processing unit performs corresponding processing on the transaction data, it can The processing state information of the transaction data is sent to the transaction data processing device 420 for updating the state description field of the corresponding transaction data.
- the processing state information acquiring unit 422 is configured to acquire corresponding blockchain processing state information for each transaction data from the blockchain processing unit 410.
- each module in the blockchain processing unit 410 can be connected to the processing state information acquisition unit 422 of the transaction data processing device 420 through a state machine interface, so that the transaction processing device can be updated based on the state machine mechanism through the state machine interface The state description field of each transaction data in.
- the processing status update unit 423 uses the received blockchain processing status information to update the status description of the transaction data Field for at least one related party of transaction data to perform status query.
- the related party of the transaction data can be, for example, the client that initiates the corresponding transaction, or can be various functional modules of the blockchain processing unit.
- FIG. 6 is a schematic diagram for explaining the message sending process when using the blockchain node of the present disclosure to process transaction data.
- the client 601 sends transaction data to the transaction processing device 602a of the blockchain node 602.
- the transaction processing device may be the transaction processing device described above with reference to FIG. 45 and FIG. 5.
- the transaction processing device 602a in the blockchain node 602 sends the data to be processed to the blockchain processing unit 602b in the blockchain node 602.
- the blockchain processing unit 602b broadcasts the verified transaction data to other blockchain nodes 603, 604, 605, and 606 at 630 to perform consensus processing on the transaction data . Then at 640, each blockchain node feeds back the consensus result to the blockchain node 602.
- the blockchain processing unit 602b sends the blockchain processing status information of each transaction data to the transaction processing device 602a.
- the transaction processing device 602a can send the blockchain state information of the transaction data to the client at 660.
- the client can access the transaction processing device 602a to obtain the blockchain processing status information of the transaction data.
- the related party of the transaction data (for example, the client that initiates the corresponding transaction) can query the status of the transaction data without accessing the blockchain processing unit 410, and thus will not send the blockchain processing unit 410 to the blockchain processing unit 410 due to the query operation of the client. Bring extra load.
- the related party only needs to access the transaction data processing device 420 to obtain the status of the transaction data, and does not need to query the various functional modules of the blockchain processing unit 410 one by one, the path of the status query can be shortened and improved.
- the client obtains the efficiency of the blockchain processing state information.
- the related party is a non-local related party such as a client that initiates a transaction
- the cost of establishing a communication connection between the non-local related party and the blockchain node is higher and consumes more resources, which will further increase the access load and Access cost.
- the communication between the transaction data processing device 420 and the blockchain processing unit 410 is local communication, so the communication cost and the access load caused by it are low. Therefore, this example can also save communication resources and reduce the overall load of blockchain nodes.
- each transaction related party can access the transaction processing device to query the blockchain processing status as described above, or the processing status information sending unit 424 can periodically update at least the updated at least
- the blockchain processing status information of one transaction data is sent to the related party of the at least one transaction data.
- the load of the transaction processing device can be distributed to various time periods. As a result, it is possible to avoid the occurrence of multiple related parties simultaneously querying the processing status of the blockchain, which may cause excessive transient load.
- the "regular" is not limited to the "fixed period”.
- the transmission time of the blockchain processing status information can also be selected according to the load status of the transaction data processing device 420.
- the blockchain processing status information may be sent when the load (for example, resource occupancy rate) of the transaction data processing device 420 does not exceed a predetermined load.
- the related party of the transaction data may also send a status query request to the transaction data processing device 420.
- the processing status information sending unit 424 may also be configured to send the blockchain processing status information of the corresponding transaction data to the associated party in response to the status query request of the associated party.
- the consensus module 412 After the transaction data to be processed sent to the blockchain processing unit 420 is verified by the verification module 411, the consensus module 412 will perform a consensus operation on it. If there is more than one transaction data waiting for consensus, the transaction data to be processed will enter the consensus queue and wait for consensus. If the consensus queue is full, the pending transaction data may be lost due to the inability to perform the consensus queue.
- a data current limiting unit 425 is configured.
- the data current limiting unit 425 is configured to determine whether the transaction data to be processed sent to the blockchain processing unit 410 exceeds the current limiting threshold.
- the transaction data sending unit 421 is configured to stop sending the transaction data to be processed to the blockchain processing unit 410.
- the current limit threshold can be determined based on the amount of transaction data, or it can be determined based on the data capacity occupied by the transaction data.
- the current limit threshold may be the upper limit of the amount of transaction data to be processed sent to the blockchain processing unit 410 within a predetermined time period, or it may be the total amount of transaction data to be processed sent to the blockchain processing unit 410 within a predetermined time period. Maximum data capacity.
- the current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state.
- the current limit threshold can be set to be adjustable in real time.
- the processing queue may be, for example, the size of the consensus queue of the consensus module.
- the consensus state refers to the state between each block chain node in the block chain system.
- the consensus state includes an initial state (init), a normal state (normal case), a view change state (viewchange), and a recovery state (recovery).
- Non-BFT consensus algorithms include initial state (init), normal state (normal case), and recovery state (recovery). Only when the consensus state is a normal case can the consensus processing be performed normally.
- PBFT includes three stages in the normal state: Pre-Prepare, Prepare, and Commit.
- the Normal Case state the amount of transaction data that can currently be processed can be determined according to the size of the consensus queue. However, whether the blockchain processing unit can receive transaction data is determined according to the consensus state.
- the blockchain processing unit cannot accept the transaction data.
- the transaction data will also be lost.
- the client is required to resend the transaction data, which is very unfriendly to the client.
- the re-sent transaction data needs to go through the blockchain processing operation again from the verification process, which further leads to the waste of blockchain node resources.
- the storage unit 426 is configured in the example in the present disclosure.
- the storage unit 426 is configured to buffer at least one transaction data received. By buffering the received transaction data locally, when the transaction data is lost due to the consensus queue being full, the blockchain processing unit 410 malfunctions, etc., the blockchain processing unit 410 can obtain the transaction data from the transaction data processing device 420 , Without the need for the client to send transaction data again.
- the transaction data stored in the transaction data processing unit has a state description field, when the blockchain processing unit 410 obtains the transaction data from the storage module of the transaction data processing device 420 again, it can also know which transaction data has been processed. , So there is no need to re-experience all the blockchain processing from the verification process. Therefore, the resources of the blockchain processing unit 420 can also be saved.
- aching refers to storing data in volatile memory, for example, in the memory of a computing device.
- the storage unit 426 may also store part or all of the cached transaction data in the non-volatile memory 430 (as shown in FIG. 4) when the amount of the cached transaction data exceeds the storage threshold. .
- the storage unit may also store the newly received transaction data in the non-volatile memory 430.
- the transaction data deletion unit 427 may be used to perform deletion processing.
- the transaction data deletion unit 427 is configured to delete the transaction data when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has passed for each stored transaction data.
- the transaction data is completed on the blockchain, it means that the transaction data has been processed on the blockchain. At this time, it is no longer necessary for the blockchain node to continue to retain the transaction data. However, it is necessary to reserve a predetermined period of time for the related party (for example, the client) of the transaction data to obtain the blockchain processing status of the corresponding transaction data.
- the related party can actively query the blockchain processing status or the transaction data processing device 420 can send the blockchain processing status to the related party.
- the predetermined time period it can be assumed that the related party has obtained the blockchain processing status, so the corresponding transaction data can be deleted to avoid the transaction data that has completed the blockchain processing from continuously occupying storage space.
- the transaction data is broadcast by the consensus module to other blockchain nodes for consensus processing after being verified by the verification module. If the blockchain node fails, the consensus module may not be able to broadcast transaction data to other nodes smoothly. Therefore, the broadcasting unit 428 can be used for each transaction data stored, when the state description field of the transaction data is updated to complete the verification and is not updated to complete the consensus after the second predetermined time, the transaction data Broadcast to other blockchain nodes. If the state description field of the transaction data is updated to complete the verification and has not been updated to complete the consensus for a long time, it can be inferred that the blockchain processing unit has failed or the transaction data in the blockchain processing unit has been lost.
- the transaction data processing device 420 has a broadcasting unit 428 to broadcast the corresponding transaction data.
- Fig. 7 is a flowchart of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
- the received at least one transaction data is sent to the blockchain processing unit for corresponding blockchain processing, and the transaction data has a status Description field.
- the blockchain processing unit can send the blockchain processing status information of the transaction data in the process of blockchain processing the transaction data. Therefore, the method may obtain corresponding blockchain processing state information for each transaction data from the blockchain processing unit at block 740.
- block 760 for each transaction data in at least one transaction data, use the received blockchain processing status information to update the status description field of the transaction data for at least A related party of transaction data to perform status query.
- Fig. 8 is a flowchart for explaining an application scenario of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure. As shown in FIG. 8, the method for processing transaction data at a blockchain node in this example can be executed by a transaction data processing device.
- the client that initiated the transaction sends the transaction data to the transaction data processing device of the blockchain node.
- the transaction data processing device receives the transaction data, in 804, the received transaction data is buffered. And at 806, it is determined whether the buffered transaction data exceeds the storage threshold. When the buffered transaction data exceeds the storage threshold, at 808, the transaction data processing device stores the buffered transaction data in the non-volatile memory.
- the method of the present disclosure may store part or all of the buffered transaction data in a non-volatile memory.
- the transaction data may be deleted when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has passed.
- the transaction data to be processed sent to the blockchain processing unit it may be determined at 810 whether the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold.
- the amount of transaction data to be processed to be sent to the blockchain processing unit may be determined based on the first predetermined time period, and it may be determined whether the amount exceeds the current limit threshold.
- stop sending the transaction data to be processed to the blockchain processing unit stop sending the transaction data to be processed to the blockchain processing unit.
- the transaction data to be processed is sent to the blockchain processing unit.
- the current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state. For example, the maximum or minimum of the processing queue size, the maximum business volume per unit time, and the number of transactions in the pending consensus state can be selected as the current limit threshold.
- the blockchain processing unit After receiving the transaction data to be processed, the blockchain processing unit performs blockchain processing operations such as verification and consensus on the transaction data to be processed, and during the processing, at 814, the blockchain processing status information of the transaction data is sent to the transaction Data processing device.
- the transaction data processing device may receive blockchain processing status information. Then, at 818, when the blockchain processing status information for the transaction data is received, the received blockchain processing status information is used to update the status description field of the corresponding transaction data.
- the updated blockchain processing status information can be queried by the related parties of the transaction data (for example, the client that initiates the corresponding transaction), or it can be periodically sent by the transaction processing device to the related parties of the transaction data. As shown in FIG. 8, at 820, it is determined whether the status transmission period has expired. When the status sending period expires, at 822, the blockchain processing status information of the transaction data is sent to the client that initiated the corresponding transaction. It should be noted that the “periodical” or “status transmission period” is not necessarily a fixed period, and it may also be a variable time period.
- the client can also send a status query request to the transaction processing device at 824. Therefore, in 826, the transaction processing device may send the blockchain state information of the corresponding transaction data to the client in response to the client's state query request.
- block 828 for each of the cached transaction data, it is also possible to determine whether the predetermined time has passed after the block chain status information of the transaction data is updated to complete the verification. If the predetermined time has passed, then at 830, it is determined whether the blockchain status information updated to complete the consensus is received. If the state description field of the transaction data is updated to complete the verification and is not updated to complete the consensus after the second predetermined time has elapsed, then at 832, the transaction data is broadcast to other blockchain nodes.
- FIGS. 1 to 8 the embodiments of the method and device for processing transaction data at a blockchain node according to the present disclosure have been described.
- the details mentioned in the above description of the method embodiment are also applicable to the embodiment of the device of the present disclosure.
- the device for processing transaction data at a blockchain node of the present disclosure can be implemented by hardware, or by software or a combination of hardware and software.
- the details mentioned in the above description of the method embodiment are also applicable to the embodiment of the device of the present disclosure.
- the various embodiments in this specification are described in a progressive manner, and the same or similar parts among the various embodiments are referred to each other.
- the device for processing transaction data at a blockchain node of the present disclosure can be implemented by hardware, or by software or a combination of hardware and software. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the memory into the memory through the processor of the device where it is located. In the present disclosure, the device for processing transaction data at a blockchain node can be implemented by using a computing device, for example.
- Fig. 9 is a structural block diagram of a computing device for implementing a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
- the computing device 900 includes a processor 910, a memory 920, a memory 930, a communication interface 940, and an internal bus 950.
- the computing device 900 may include at least one processor 910 that executes at least one computer-readable instruction (ie, the aforementioned Elements implemented in software).
- computer-executable instructions are stored in the memory 920, which when executed, cause at least one processor 910 to: after receiving at least one transaction data, send the received at least one transaction data to the area
- the block chain processing unit performs the corresponding block chain processing, and the transaction data has a state description field; obtains the corresponding block chain processing state information for each transaction data from the block chain processing unit; and for each transaction in at least one transaction data Data, using the received blockchain processing status information to update the status description field of the transaction data, so that at least one related party of the transaction data can perform status query.
- a program product such as a non-transitory machine-readable medium.
- the non-transitory machine-readable medium may have instructions (ie, the above-mentioned elements implemented in the form of software), which when executed by a machine, cause the machine to execute the various embodiments described above in conjunction with FIGS. 1-8 in the various embodiments of the present disclosure. Operation and function.
- a system or device equipped with a readable storage medium may be provided, and the software program code for realizing the function of any one of the above-mentioned embodiments is stored on the readable storage medium, and the computer or device of the system or device The processor reads and executes the instructions stored in the readable storage medium.
- the program code itself read from the readable medium can realize the function of any one of the above embodiments, so the machine readable code and the readable storage medium storing the machine readable code constitute the present invention a part of.
- Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, Volatile memory card and ROM.
- the program code can be downloaded from a server computer or cloud via a communication network.
- the device structure described in the foregoing embodiments may be a physical structure or a logical structure, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or may be implemented by multiple physical entities. Some components in independent devices are implemented together.
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Finance (AREA)
- Accounting & Taxation (AREA)
- Software Systems (AREA)
- Fuzzy Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Probability & Statistics with Applications (AREA)
- Mathematical Physics (AREA)
- Databases & Information Systems (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
A method and apparatus for carrying out transaction data processing at a blockchain node. The method comprises: after at least one piece of transaction data is received, sending the received at least one piece of transaction data to a blockchain processing unit to carry out corresponding blockchain processing, wherein the transaction data has a state description field; acquiring, from the blockchain processing unit, corresponding blockchain processing state information for each piece of transaction data; and for each piece of transaction data of the at least one piece of transaction data, updating the state description field of the transaction data by using the received blockchain processing state information, so that an associated party of the at least one piece of transaction data carries out state querying.
Description
本公开涉及区块链技术领域,具体地,涉及用于在区块链节点处进行交易数据处理的方法及装置。The present disclosure relates to the field of blockchain technology, and in particular, to a method and device for processing transaction data at a blockchain node.
区块链技术,也被称之为分布式账本技术,是一种由若干台计算设备共同参与“记账”,共同维护一份完整的分布式数据库的新兴技术。由于区块链技术具有去中心化、公开透明、每台计算设备可以参与数据库记录、并且各计算设备之间可以快速的进行数据同步的特性,使得区块链技术已在众多的领域中广泛的进行应用。Blockchain technology, also known as distributed ledger technology, is an emerging technology in which several computing devices participate in "bookkeeping" and jointly maintain a complete distributed database. Because the blockchain technology has the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and the rapid data synchronization between computing devices, the blockchain technology has been widely used in many fields. To apply.
在区块链系统中,客户端发起的交易被发送到区块链节点,以请求区块链节点对该笔交易进行区块链处理操作。客户端将交易数据发送给区块链节点后,需要隔一段时间后向区块链节点查询交易的处理状态。区块链节点不仅要对交易数据执行区块链处理,还要响应客户端的状态查询请求,因而导致区块链节点负荷过大。In the blockchain system, the transaction initiated by the client is sent to the blockchain node to request the blockchain node to perform the blockchain processing operation on the transaction. After the client sends the transaction data to the blockchain node, it needs to query the blockchain node for the processing status of the transaction after a period of time. Blockchain nodes not only need to perform blockchain processing on transaction data, but also respond to client status query requests, which leads to excessive load on blockchain nodes.
发明内容Summary of the invention
鉴于上述,本公开提供了一种用于在区块链节点处进行交易数据处理的方法及装置。利用该方法及装置,将每笔交易的处理状态独立于区块链处理单元来存储,从而交易关联方不需要访问区块链节点的区块链处理单元即可获取交易的处理状态,从而能够降低块块链节处理单元的负荷。In view of the above, the present disclosure provides a method and device for processing transaction data at a blockchain node. Using the method and device, the processing status of each transaction is stored independently of the blockchain processing unit, so that the transaction related parties can obtain the processing status of the transaction without accessing the blockchain processing unit of the blockchain node. Reduce the load of the block chain link processing unit.
根据本公开的一个方面,提供了一种用于在区块链节点处进行交易数据处理的方法,所述区块链节点包括区块链处理单元,所述方法包括:在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,所述交易数据具有状态描述字段;从所述区块链处理单元获取针对各个交易数据的对应区块链处理状态信息;以及针对所述至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供所述至少一个交易数据的关联方来进行状态查询。According to one aspect of the present disclosure, there is provided a method for processing transaction data at a blockchain node, the blockchain node including a blockchain processing unit, and the method includes: upon receiving at least one transaction After data, the received at least one transaction data is sent to the blockchain processing unit for corresponding blockchain processing. The transaction data has a state description field; the transaction data is obtained from the blockchain processing unit for each The corresponding blockchain processing status information of the transaction data; and for each transaction data in the at least one transaction data, use the received blockchain processing status information to update the status description field of the transaction data for the at least A related party of transaction data to perform status query.
可选地,在一个示例中,所述方法还可以包括:定期地将更新后的至少一个交易 数据的区块链处理状态信息发送给该至少一个交易数据的关联方。Optionally, in an example, the method may further include: periodically sending the updated blockchain processing status information of the at least one transaction data to the related party of the at least one transaction data.
可选地,在一个示例中,所述方法还可以包括:响应于所述至少一个交易数据的关联方的状态查询请求,向该关联方发送所述至少一个交易数据的区块链处理状态信息。Optionally, in an example, the method may further include: in response to a status query request of an associated party of the at least one transaction data, sending blockchain processing status information of the at least one transaction data to the associated party .
可选地,在一个示例中,所述方法还可以包括:在向所述区块链处理单元所发送的待处理交易数据超过限流阈值时,停止向所述区块链处理单元发送待处理交易数据。Optionally, in an example, the method may further include: when the pending transaction data sent to the blockchain processing unit exceeds the current limit threshold, stopping sending the pending transaction to the blockchain processing unit Transaction data.
可选地,在一个示例中,所述限流阈值可以是基于所述区块链处理单元的处理队列大小、最大单位时间业务量和共识状态确定的。Optionally, in an example, the current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state.
可选地,在一个示例中,所述方法还可以包括:缓存所接收的至少一个交易数据。Optionally, in an example, the method may further include: buffering at least one piece of received transaction data.
可选地,在一个示例中,所述方法还可以包括:在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器中。Optionally, in an example, the method may further include: when the amount of the cached transaction data exceeds the storage threshold, storing part or all of the cached transaction data in the non-volatile memory.
可选地,在一个示例中,所述方法还可以包括:针对所存储的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该交易数据。Optionally, in an example, the method may further include: for each transaction data stored, deleting the transaction when the state description field of the transaction data is updated to a predetermined time period after completing the block chaining data.
可选地,在一个示例中,所述方法还可以包括:针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其他区块链节点。Optionally, in an example, the method may further include: for each transaction data cached, the status description field of the transaction data is updated to be not updated to complete consensus after a second predetermined time has passed after the verification is completed At the time, broadcast the transaction data to other blockchain nodes.
根据本公开的另一方面,还提供一种用于在区块链节点处进行交易数据处理的装置,所述区块链节点包括区块链处理单元,所述装置包括:交易数据发送单元,被配置为在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,所述交易数据具有状态描述字段;处理状态信息获取单元,被配置为从所述区块链处理单元获取针对各个交易数据的对应区块链处理状态信息;以及处理状态更新单元,被配置为针对所述至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供所述至少一个交易数据的关联方来进行状态查询。According to another aspect of the present disclosure, there is also provided a device for processing transaction data at a blockchain node, the blockchain node includes a blockchain processing unit, and the device includes a transaction data sending unit, It is configured to, after receiving at least one transaction data, send the received at least one transaction data to the blockchain processing unit for corresponding blockchain processing, and the transaction data has a state description field; processing state An information acquisition unit configured to acquire corresponding blockchain processing status information for each transaction data from the blockchain processing unit; and a processing status update unit configured to target each transaction data in the at least one transaction data , Using the received block chain processing state information to update the state description field of the transaction data, so that the related party of the at least one transaction data can perform state query.
可选地,在一个示例中,所述装置还可以包括:处理状态信息发送单元,被配置为定期地将更新后的至少一个交易数据的区块链处理状态信息发送给该至少一个交易数据的关联方。Optionally, in an example, the device may further include: a processing status information sending unit configured to periodically send the updated blockchain processing status information of the at least one transaction data to the at least one transaction data Related party.
可选地,在一个示例中,所述装置还可以包括:处理状态信息发送单元,被配置 为响应于所述至少一个交易数据的关联方的状态查询消息,向该关联方发送所述至少一个交易数据的区块链处理状态信息。Optionally, in an example, the apparatus may further include: a processing status information sending unit configured to send the at least one related party to the at least one related party in response to a status query message of the at least one related party of transaction data. The blockchain of transaction data processes status information.
可选地,在一个示例中,所述装置还可以包括:数据限流单元,被配置为判断向所述区块链处理单元所发送的待处理交易数据是否超过限流阈值。所述交易数据发送单元被配置为:在被判断为向所述区块链处理单元所发送的待处理交易数据超过限流阈值时,停止向所述区块链处理单元发送待处理交易数据。Optionally, in an example, the device may further include: a data current limiting unit configured to determine whether the transaction data to be processed sent to the blockchain processing unit exceeds a current limiting threshold. The transaction data sending unit is configured to stop sending the transaction data to be processed to the blockchain processing unit when it is determined that the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold.
可选地,在一个示例中,所述装置还可以包括:存储单元,被配置为将所接收的至少一个交易数据存储在缓存中。Optionally, in an example, the device may further include: a storage unit configured to store the received at least one transaction data in a cache.
可选地,在一个示例中,所述存储单元还可以被配置为在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器中。Optionally, in an example, the storage unit may be further configured to store part or all of the cached transaction data in the non-volatile memory when the amount of the cached transaction data exceeds the storage threshold.
可选地,在一个示例中,所述装置还可以包括:交易数据删除单元,被配置为针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该交易数据。Optionally, in an example, the device may further include: a transaction data deletion unit configured to deal with each transaction data cached, after the state description field of the transaction data is updated to complete the block chaining. When a predetermined period of time, delete the transaction data.
可选地,在一个示例中,所述装置还可以包括:广播单元,被配置为针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其他区块链节点。Optionally, in an example, the device may further include: a broadcasting unit configured to target each transaction data that is cached, after the state description field of the transaction data is updated to complete verification after a second predetermined time has elapsed When it has not been updated to complete the consensus, the transaction data is broadcast to other blockchain nodes.
根据本公开的另一方面,还提供一种计算设备,包括:至少一个处理器;以及存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如上所述的方法。According to another aspect of the present disclosure, there is also provided a computing device, including: at least one processor; and a memory, the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one The processor executes the method as described above.
根据本公开的另一方面,还提供一种非暂时性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如上所述的方法。According to another aspect of the present disclosure, there is also provided a non-transitory machine-readable storage medium, which stores executable instructions that, when executed, cause the machine to perform the method as described above.
利用本公开的方法和装置,通过将每笔交易的处理状态独立于区块链处理单元来存储,从而交易数据的关联方不需要访问区块链节点的区块链处理单元即可获取交易的区块链处理状态。由此,区块链的区块链处理单元仅需要将交易数据的处理状态在区块链节点上进行更新,而不需要对关联方的状态查询请求进行响应。因而,该方法和装置能够降低区块链处理单元的负荷,从而提高对交易数据的处理效率。Using the method and device of the present disclosure, by storing the processing state of each transaction independently of the blockchain processing unit, the related parties of the transaction data can obtain the transaction information without accessing the blockchain processing unit of the blockchain node. Blockchain processing status. Therefore, the blockchain processing unit of the blockchain only needs to update the processing status of the transaction data on the blockchain node, and does not need to respond to the status query request of the related party. Therefore, the method and device can reduce the load of the blockchain processing unit, thereby improving the processing efficiency of transaction data.
利用本公开的方法和装置,通过定期向交易数据的关联方发送交易数据的区块链处理状态信息,能够避免因关联方访问区块链节点而导致访问负荷过大或出现瞬时访问峰值。Using the method and device of the present disclosure, by periodically sending transaction data blockchain processing status information to transaction data related parties, it is possible to avoid excessive access load or instantaneous access peaks caused by related parties' access to blockchain nodes.
利用本公开的方法和装置,通过利用限流阈值对向区块链处理单元发送的待处理交易数据进行限流,能够避免因区块链处理单元的处理队列超过阈值而导致交易数据丢失。Using the method and device of the present disclosure, by using the current limit threshold to limit the current to be processed transaction data sent to the blockchain processing unit, it is possible to avoid the loss of transaction data due to the processing queue of the blockchain processing unit exceeding the threshold.
利用本公开的方法和装置,通过将所接收到的交易数据缓存在本地,当区块链节点发生故障而导致在区块链处理单元发生交易数据丢失时,能够从本地的缓存中获取交易数据,从而不需要客户端再次发送交易数据。By using the method and device of the present disclosure, by caching the received transaction data locally, when the block chain node fails and the transaction data is lost in the block chain processing unit, the transaction data can be obtained from the local cache , So there is no need for the client to send transaction data again.
利用本公开的方法和装置,通过在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器中,能够在缓存空间出现空余时从非易失性存储器中读取交易数据,从而避免因缓存空间不足引起的交易数据丢失而导致客户端必须再次发送交易数据的问题。By using the method and device of the present disclosure, by storing part or all of the cached transaction data in the non-volatile memory when the amount of cached transaction data exceeds the storage threshold, it is possible to avoid difficulty when the cache space becomes vacant. The transaction data is read in the lossy memory, so as to avoid the problem that the client has to send the transaction data again due to the loss of the transaction data caused by insufficient buffer space.
利用本公开的方法和装置,通过在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其他区块链节点,能够在区块链节点发生故障时,及时将交易数据广播给其它区块链节点。Using the method and device of the present disclosure, by broadcasting the transaction data to other blockchain nodes when the state description field of the transaction data is updated to complete the verification and is not updated to complete the consensus after the second predetermined time has passed after the verification is completed. When a block chain node fails, the transaction data is broadcast to other block chain nodes in time.
通过参照下面的附图,可以实现对于本公开内容的本质和优点的进一步理解。在附图中,类似组件或特征可以具有相同的附图标记。附图是用来提供对本发明实施例的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本公开的实施例,但并不构成对本公开的实施例的限制。在附图中:By referring to the following drawings, a further understanding of the nature and advantages of the present disclosure can be achieved. In the drawings, similar components or features may have the same reference signs. The drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present disclosure, but do not constitute a limitation to the embodiments of the present disclosure. In the attached picture:
图1是用于说明区块链系统的一种示例的示意图;Fig. 1 is a schematic diagram for explaining an example of a blockchain system;
图2是用于说明区块链节点的结构示意图;Figure 2 is a schematic diagram for explaining the structure of a blockchain node;
图3是用于说明区块链节点进行交易数据处理时的消息发送过程的示意图;FIG. 3 is a schematic diagram for explaining the message sending process when a blockchain node performs transaction data processing;
图4是根据本公开的一个实施例的区块链节点的结构示意图;Fig. 4 is a schematic structural diagram of a blockchain node according to an embodiment of the present disclosure;
图5是适用于图4所示的区块链节点的用于在区块链节点处进行交易数据处理的装置的结构框图;FIG. 5 is a structural block diagram of a device for processing transaction data at a blockchain node suitable for the blockchain node shown in FIG. 4;
图6是用于说明利用本公开的区块链节点进行交易数据处理时的消息发送过程的示意图;6 is a schematic diagram for explaining the message sending process when using the blockchain node of the present disclosure to process transaction data;
图7是根据本公开的一个实施例的用于在区块链节点处进行交易数据处理的方法 的流程图;Fig. 7 is a flowchart of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure;
图8是根据本公开的一个实施例的用于在区块链节点处进行交易数据处理的方法的一种应用场景的流程图;以及Fig. 8 is a flowchart of an application scenario of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure; and
图9是根据本公开的一个实施例的用于实现用于在区块链节点处进行交易数据处理的方法的计算设备的结构框图。Fig. 9 is a structural block diagram of a computing device for implementing a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
以下将参考示例实施方式讨论本文描述的主题。应该理解,讨论这些实施方式只是为了使得本领域技术人员能够更好地理解从而实现本文描述的主题,并非是对权利要求书中所阐述的保护范围、适用性或者示例的限制。可以在不脱离本公开内容的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个示例可以根据需要,省略、替代或者添加各种过程或组件。另外,相对一些示例所描述的特征在其它例子中也可以进行组合。The subject described herein will be discussed below with reference to example embodiments. It should be understood that the discussion of these embodiments is only to enable those skilled in the art to better understand and realize the subject described herein, and is not to limit the scope of protection, applicability, or examples set forth in the claims. The function and arrangement of the discussed elements can be changed without departing from the scope of protection of the present disclosure. Various examples can omit, substitute, or add various procedures or components as needed. In addition, features described with respect to some examples can also be combined in other examples.
如本文中使用的,术语“包括”及其变型表示开放的术语,含义是“包括但不限于”。术语“基于”表示“至少部分地基于”。术语“一个实施例”和“一实施例”表示“至少一个实施例”。术语“另一个实施例”表示“至少一个其他实施例”。As used herein, the term "including" and its variations mean open terms, meaning "including but not limited to". The term "based on" means "based at least in part on." The terms "one embodiment" and "an embodiment" mean "at least one embodiment." The term "another embodiment" means "at least one other embodiment."
在本文中,术语“相连”是指两个组件之间直接机械连接、连通或电连接,或者通过中间组件来间接机械连接、连通或电连接。术语“电连接”是指两个组件之间可以进行电通信以进行数据/信息交换。同样,所述电连接可以指两个组件之间直接电连接,或者通过中间组件来间接电连接。所述电连接可以采用有线方式或无线方式来实现。In this document, the term "connected" refers to direct mechanical connection, communication or electrical connection between two components, or indirect mechanical connection, communication or electrical connection through intermediate components. The term "electrically connected" refers to the possibility of electrical communication between two components for data/information exchange. Similarly, the electrical connection may refer to a direct electrical connection between two components, or an indirect electrical connection through an intermediate component. The electrical connection can be implemented in a wired manner or a wireless manner.
现在结合附图来描述本公开的用于在区块链节点处进行交易数据处理的方法及装置。The method and device for processing transaction data at a blockchain node of the present disclosure will now be described with reference to the accompanying drawings.
图1是用于说明区块链系统100的一种示例的示意图。FIG. 1 is a schematic diagram for explaining an example of the blockchain system 100.
如图1所示,在区块链系统100中,存在区块链节点102、103、104、105和106。客户端101与区块链节点102相连。客户端101发起交易时将交易数据发送给与其通信连接的区块链节点102。区块链节点102接收到交易数据后,首先对该交易数据进行验证。验证合法时,区块链节点102将所接收的交易数据广播给区块链系统100中的其它区块链节点103-106,以对该交易数据进行共识处理。图1仅仅是区块链系统一种示例,在其它示例中,区块链系统可以包括交易池,交易池用于存放客户端101(或区块链系 统中的其它客户端)所发起的交易数据。各个节点可以从交易池中读取交易数据,并进行验证、共识等处理。此外,在另一示例中,客户端101也可以与多个区块链节点相连,从而可以将交易数据发送给多个与其相连的区块链节点。接收到交易数据的区块链节点可以通过预定机制争取对该交易数据的处理权(例如记账权)。客户端101可以是区块链系统中的轻量节点(或称为SPV节点),区块链节点102、103、104、105、106是全量节点(或称为记账节点)。在区块链系统中,轻量节点还可以进一步连接一个或多个第二客户端(图中未示出),第二客户端可以经由轻量节点来执行发起交易或查询交易状态等操作。As shown in FIG. 1, in the blockchain system 100, there are blockchain nodes 102, 103, 104, 105, and 106. The client 101 is connected to the blockchain node 102. When the client 101 initiates a transaction, the transaction data is sent to the blockchain node 102 communicating with it. After receiving the transaction data, the blockchain node 102 first verifies the transaction data. When the verification is legal, the blockchain node 102 broadcasts the received transaction data to other blockchain nodes 103-106 in the blockchain system 100 to perform consensus processing on the transaction data. Figure 1 is just an example of a blockchain system. In other examples, the blockchain system may include a transaction pool, which is used to store transactions initiated by the client 101 (or other clients in the blockchain system) data. Each node can read transaction data from the transaction pool, and perform verification, consensus and other processing. In addition, in another example, the client 101 can also be connected to multiple blockchain nodes, so that transaction data can be sent to multiple blockchain nodes connected to it. The blockchain node that receives the transaction data can fight for the processing right (for example, the accounting right) of the transaction data through a predetermined mechanism. The client 101 may be a lightweight node (or called an SPV node) in a blockchain system, and the blockchain nodes 102, 103, 104, 105, 106 are full nodes (or called an accounting node). In the blockchain system, the lightweight node can further connect to one or more second clients (not shown in the figure), and the second client can perform operations such as initiating transactions or querying transaction status via the lightweight nodes.
图2是用于说明现有技术中的区块链节点200的结构示意图。如图2所示,在现有技术中,区块链节点包括验证模块201、共识模块202、执行模块203和区块模块204。FIG. 2 is a schematic diagram for explaining the structure of a blockchain node 200 in the prior art. As shown in FIG. 2, in the prior art, a blockchain node includes a verification module 201, a consensus module 202, an execution module 203, and a block module 204.
在接收到交易数据时,验证模块201对所接收到的交易数据进行验证。验证模块201还可以具有缓冲功能,所接收到的多个交易数据可以在验证模块201排队等待验证。验证模块201用于验证交易数据是否合法,验证模块所执行的验证操作例如可以是:验证交易数据的数据结构是否符合相应区块链系统的要求;相应客户端是否有能力支付该笔交易的手续费(例如验证客户端的账户余额);相应交易是否为重复交易(即“双花”);验证交易数据中的签名是否合法;交易数据的大小是否超过了区块链中区块的最大容量等等。验证模块201可以执行验证操作中的一种或多种。在不同的区块链系统中(例如比特币系统、以太坊系统等),验证模块201所执行的验证操作可能有所不同。验证模块201所执行的验证操作不限于此处所列举的内容。When the transaction data is received, the verification module 201 verifies the received transaction data. The verification module 201 may also have a buffer function, and multiple received transaction data may be queued in the verification module 201 for verification. The verification module 201 is used to verify whether the transaction data is legal. The verification operation performed by the verification module may be, for example, verifying whether the data structure of the transaction data meets the requirements of the corresponding blockchain system; whether the corresponding client has the ability to pay for the transaction procedures Fees (such as verifying the client’s account balance); whether the corresponding transaction is a repeated transaction (ie "double spend"); verifying whether the signature in the transaction data is legal; whether the size of the transaction data exceeds the maximum capacity of the block in the blockchain, etc. Wait. The verification module 201 can perform one or more of the verification operations. In different blockchain systems (such as the Bitcoin system, the Ethereum system, etc.), the verification operations performed by the verification module 201 may be different. The verification operation performed by the verification module 201 is not limited to the content listed here.
如果验证模块201对交易数据的验证结果为不合法,则可以不对该交易数据进行进一步处理。如果验证结果为合法,则相应交易数据进入共识模块的共识队列中以进行共识。共识模块202执行在该区块链节点上的共识操作,并可以将交易数据广播给区块链系统中的其它区块链节点,以完成对该交易数据的共识处理。共识处理可以基于工作量证明(PoW)、实用拜占庭算法(PBFT)等共识机制执行共识。如果其它区块链结点对该交易数据进行共识操作后不承认该交易数据,则可以不做出任何响应。当各个区块链节点承认该交易数据为合法时,则可以向该区块链节点的共识模块202返回各个区块链节点的共识结果。共识模块202可以根据各个区块链节点的共识结果确定该交易数据是否达成一致性共识。If the verification result of the verification module 201 on the transaction data is illegal, the transaction data may not be processed further. If the verification result is legal, the corresponding transaction data enters the consensus queue of the consensus module for consensus. The consensus module 202 executes the consensus operation on the blockchain node, and can broadcast transaction data to other blockchain nodes in the blockchain system to complete the consensus processing on the transaction data. Consensus processing can implement consensus based on consensus mechanisms such as Proof of Work (PoW) and Practical Byzantine Algorithm (PBFT). If other blockchain nodes do not recognize the transaction data after performing a consensus operation on the transaction data, they may not make any response. When each blockchain node recognizes that the transaction data is legal, it can return the consensus result of each blockchain node to the consensus module 202 of the blockchain node. The consensus module 202 can determine whether the transaction data reaches a consensus based on the consensus result of each blockchain node.
当该交易数据在各个区块链节点间达成一致性共识时,执行模块203将执行交易数据。执行模块可以是虚拟机模块,例如以太坊系统中的EVM。执行操作可以是对智 能合约的执行。对交易数据的执行操作例如可以是:从发起交易的客户端的余额中扣除执行相应交易的费用,并为当前交易将发送者账户中的随机数(nonce)增加1;为争取到相应交易的区块链节点发放奖励等。作为示例,相应的交易可以是转账交易,此时,在执该笔交易时,将从发起方的账户中扣除相应款项(例如预定金额的比特币、以太币等),并在接收方的账户增加相应款项。在不同的区块链系统中,执行模块203针对交易的执行内容可以有所不同。When the transaction data reaches a consensus among various blockchain nodes, the execution module 203 will execute the transaction data. The execution module may be a virtual machine module, such as the EVM in the Ethereum system. The execution operation can be the execution of a smart contract. The execution operation of the transaction data may be, for example, deducting the cost of executing the corresponding transaction from the balance of the client that initiated the transaction, and increasing the nonce in the sender’s account by 1 for the current transaction; in order to gain access to the corresponding transaction area Block chain nodes issue rewards, etc. As an example, the corresponding transaction may be a transfer transaction. At this time, when the transaction is executed, the corresponding money (for example, a predetermined amount of Bitcoin, Ether, etc.) will be deducted from the account of the initiator, and the transaction will be transferred to the account of the recipient Increase the corresponding amount. In different blockchain systems, the execution content of the execution module 203 for transactions may be different.
当执行模块203完成执行操作时,区块模块204将该笔交易的交易数据打包成区块,并发送到区块链上以执行区块上链操作。When the execution module 203 completes the execution operation, the block module 204 packages the transaction data of the transaction into a block, and sends it to the blockchain to perform the block chaining operation.
图3是用于说明利用现有技术的区块链节点进行交易数据处理时的消息发送过程的示意图。如图3所示,当客户端301发起交易时,在320,客户端将交易数据发送给区块链节点302。区块链节点对交易数据进行合法性验证后,如果验证结果为合法,则在320,将交易数据发广播给其它区块链节点303、304、305和306。其它区块链节点对该交易数据进行共识后在340,将共识结果反馈给区块链节点302。然后如果该交易数据在各个区块链节点之间达成一致性共识,则由区块链节点302进行交易执行和区块上链操作。Fig. 3 is a schematic diagram for explaining a message sending process when a block chain node in the prior art is used to process transaction data. As shown in FIG. 3, when the client 301 initiates a transaction, at 320, the client sends the transaction data to the blockchain node 302. After the blockchain node verifies the legality of the transaction data, if the verification result is legal, at 320, the transaction data is broadcast to other blockchain nodes 303, 304, 305, and 306. After other blockchain nodes have reached a consensus on the transaction data, at 340, the consensus result is fed back to the blockchain node 302. Then, if the transaction data reaches a consensus among various blockchain nodes, the blockchain node 302 will perform transaction execution and block chaining operations.
客户端301将交易数据发送给区块链节点302后,可以在间隔预定时间后,在350,访问区块链节点302以获取其发起的交易的区块链处理状态。如果客户端301频繁地查询区块链处理状态或多个客户端同时进行状态查询,可能导致区块链节点302访问量过大而出现过负荷,进而可能引起针对交易数据的区块链处理效率下降,或区块链节点可能因过负荷出现故障。After the client 301 sends the transaction data to the blockchain node 302, it may visit the blockchain node 302 at 350 after a predetermined time interval to obtain the blockchain processing status of the transaction initiated by it. If the client 301 frequently queries the blockchain processing status or multiple clients perform status queries at the same time, it may cause the blockchain node 302 to visit too much and become overloaded, which may cause the efficiency of blockchain processing for transaction data. Decline, or the blockchain node may fail due to overload.
图4是根据本公开的一个实施例的区块链节点400的结构框图。如图4所示,区块链节点400包括区块链处理单元410、交易数据处理装置420和非易失性存储器430。其中,非易失性存储器430并不是必要组成元素,在另一示例中,区块链节点也可以不包括非易失性存储器。FIG. 4 is a structural block diagram of a blockchain node 400 according to an embodiment of the present disclosure. As shown in FIG. 4, the blockchain node 400 includes a blockchain processing unit 410, a transaction data processing device 420, and a non-volatile memory 430. Among them, the non-volatile memory 430 is not an essential component. In another example, the blockchain node may not include the non-volatile memory.
区块链处理单元410被配置为对交易数据执行区块链处理。区块链处理单元410可以包括如图2所示的现有技术中的区块链节点的各个模块。如图4所示,区块链节点包括验证模块411、共识模块412、执行模块413和区块模块414。各个模块所执行的操作与现有技术中的区块链节点的各个功能模块相同。The blockchain processing unit 410 is configured to perform blockchain processing on transaction data. The blockchain processing unit 410 may include various modules of the blockchain node in the prior art as shown in FIG. 2. As shown in FIG. 4, the blockchain node includes a verification module 411, a consensus module 412, an execution module 413, and a block module 414. The operations performed by each module are the same as each functional module of the blockchain node in the prior art.
图5是适用于图4所示的区块链节点400的交易数据处理装置420的结构框图。 如图4所示,交易数据处理装置420包括交易数据发送单元421、处理状态信息获取单元422、处理状态更新单元423、处理状态信息发送单元424、数据限流单元425、存储单元426、交易数据删除单元427和广播单元428。需要说明的是,图5所示出的各个单元中,处理状态信息发送单元、数据限流单元、存储单元、交易数据删除单元和广播单元不是必要的组成元素。在本公开的其它示例中,可以不包括这些非必要组成元素,也可以包括其中的一者或多者。FIG. 5 is a structural block diagram of a transaction data processing device 420 suitable for the blockchain node 400 shown in FIG. 4. As shown in FIG. 4, the transaction data processing device 420 includes a transaction data sending unit 421, a processing status information acquiring unit 422, a processing status update unit 423, a processing status information sending unit 424, a data current limiting unit 425, a storage unit 426, and transaction data. Delete unit 427 and broadcasting unit 428. It should be noted that, among the units shown in FIG. 5, the processing status information sending unit, the data current limiting unit, the storage unit, the transaction data deletion unit, and the broadcasting unit are not necessary constituent elements. In other examples of the present disclosure, these unnecessary constituent elements may not be included, and one or more of them may also be included.
交易数据发送到区块链节点400后,在交易数据处理装置420处等待区块链处理单元410对其进行区块链处理。交易数据发送单元421被配置为在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给区块链处理单元410来进行对应的区块链处理,交易数据具有状态描述字段。状态描述字段用于描述交易数据的区块链处理状态,区块链处理状态可以包括:待验证(等待验证模块411进行验证处理)、完成验证(已经过验证模块411的验证处理)、待共识(已验证合法等待进行共识处理)、完成共识(已经过共识处理)、待执行(已达成一致性共识等待执行)、完成执行(已经过执行模块的执行操作)、待区块上链、完成区块上链等。在另一示例中,状态描述字段表示的交易处理状态可以包括待验证、待共识、待执行、待区块上链和完成区块上链等。After the transaction data is sent to the blockchain node 400, the transaction data processing device 420 waits for the blockchain processing unit 410 to perform blockchain processing on it. The transaction data sending unit 421 is configured to send the received at least one transaction data to the blockchain processing unit 410 for corresponding blockchain processing after receiving at least one transaction data, and the transaction data has a state description field. The status description field is used to describe the blockchain processing status of the transaction data. The blockchain processing status can include: pending verification (waiting for verification by the verification module 411), completed verification (verification processing by the verification module 411), pending consensus (Verified lawful and waiting for consensus processing), Consensus completed (Consensus processing has been passed), Pending execution (Consensus reached a consensus and waiting to be executed), Execution completed (Execution of the execution module has been performed), Waiting for the block to be chained and completed Block chain and so on. In another example, the transaction processing status indicated by the status description field may include pending verification, pending consensus, pending execution, pending block uploading, completing block uploading, and so on.
待处理交易数据是指状态描述字段还未更新为完成区块上链的交易数据。当交易数据已完成区块上链时,针对该交易数据的区块链处理已结束,因而不需要再对其进行处理。而在交易数据的状态被更新为完成区块上链之前,该交易数据仍然需要处理。Pending transaction data refers to the transaction data whose status description field has not been updated to complete the blockchain. When the transaction data has been completed on the blockchain, the blockchain processing for the transaction data has ended, so there is no need to process it again. Before the status of the transaction data is updated to complete the block chaining, the transaction data still needs to be processed.
交易数据还可以包括交易内容、交易到达的节点、交易序列号和业务ID等。交易内容用于描述交易的具体内容,例如交易(例如转账交易)发起方、交易接收方、交易金额、交易摘要等。交易序列号表示发起该交易的客户端所发起的交易所对应序号。业务ID代表该交易在相应区块链系统中的序号。Transaction data can also include transaction content, the node where the transaction arrives, transaction serial number and business ID, etc. Transaction content is used to describe the specific content of the transaction, such as the initiator of the transaction (such as a transfer transaction), the recipient of the transaction, the transaction amount, and the transaction summary. The transaction serial number indicates the corresponding serial number of the exchange initiated by the client that initiated the transaction. The business ID represents the serial number of the transaction in the corresponding blockchain system.
待处理交易数据被发送给区块链处理单元后,该交易数据的状态描述字段存储在交易数据处理装置420中,区块链处理单元的各个模块在对交易数据进行相应的处理之后,可以将该交易数据的处理状态信息发送给交易数据处理装置420,以用于更新相应交易数据的状态描述字段。After the transaction data to be processed is sent to the blockchain processing unit, the state description field of the transaction data is stored in the transaction data processing device 420. After each module of the blockchain processing unit performs corresponding processing on the transaction data, it can The processing state information of the transaction data is sent to the transaction data processing device 420 for updating the state description field of the corresponding transaction data.
此时,处理状态信息获取单元422被配置为从区块链处理单元410获取针对各个交易数据的对应区块链处理状态信息。在一个示例中,区块链处理单元410中的各个模块可以通过状态机接口与交易数据处理装置420的处理状态信息获取单元422连接,从而可以通过状态机接口基于状态机机制来更新交易处理装置中的各个交易数据的状态 描述字段。At this time, the processing state information acquiring unit 422 is configured to acquire corresponding blockchain processing state information for each transaction data from the blockchain processing unit 410. In an example, each module in the blockchain processing unit 410 can be connected to the processing state information acquisition unit 422 of the transaction data processing device 420 through a state machine interface, so that the transaction processing device can be updated based on the state machine mechanism through the state machine interface The state description field of each transaction data in.
针对至少一个交易数据中的各个交易数据,在接收到相应交易处理数据的区块链处理状态信息时,处理状态更新单元423使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供至少一个交易数据的关联方来进行状态查询。交易数据的关联方例如可以是发起相应交易的客户端,也可以是区块链处理单元的各个功能模块。For each transaction data in at least one transaction data, when receiving the blockchain processing status information of the corresponding transaction processing data, the processing status update unit 423 uses the received blockchain processing status information to update the status description of the transaction data Field for at least one related party of transaction data to perform status query. The related party of the transaction data can be, for example, the client that initiates the corresponding transaction, or can be various functional modules of the blockchain processing unit.
图6是用于说明利用本公开的区块链节点进行交易数据处理时的消息发送过程的示意图。如图6所示,在610,客户端601将交易数据发送给区块链节点602的交易处理装置602a。交易处理装置可以是如上参考图45图5所描述的交易处理装置。然后在620,区块链节点602中的交易处理装置602a将待处理数据发送给区块链节点602中的区块链处理单元602b。FIG. 6 is a schematic diagram for explaining the message sending process when using the blockchain node of the present disclosure to process transaction data. As shown in FIG. 6, at 610, the client 601 sends transaction data to the transaction processing device 602a of the blockchain node 602. The transaction processing device may be the transaction processing device described above with reference to FIG. 45 and FIG. 5. Then at 620, the transaction processing device 602a in the blockchain node 602 sends the data to be processed to the blockchain processing unit 602b in the blockchain node 602.
区块链处理单元602b在所接收的待处理交易数据验证合法后,在630,将验证合法的交易数据广播给其它区块链节点603、604、605和606,以对该交易数据进行共识处理。然后在640,各个区块链节点将共识结果反馈给区块链节点602。After the received transaction data to be processed is verified to be legal, the blockchain processing unit 602b broadcasts the verified transaction data to other blockchain nodes 603, 604, 605, and 606 at 630 to perform consensus processing on the transaction data . Then at 640, each blockchain node feeds back the consensus result to the blockchain node 602.
在对交易数据进行区块链处理的过程中,在650,区块链处理单元602b将各个交易数据的区块链处理状态信息发送给交易处理装置602a。由此,交易处理装置602a可以在660,向客户端发送交易数据的区块链状态信息。或者,也可以在670,由客户端访问交易处理装置602a,以获取交易数据的区块链处理状态信息。In the process of performing blockchain processing on transaction data, at 650, the blockchain processing unit 602b sends the blockchain processing status information of each transaction data to the transaction processing device 602a. Thus, the transaction processing device 602a can send the blockchain state information of the transaction data to the client at 660. Alternatively, at 670, the client can access the transaction processing device 602a to obtain the blockchain processing status information of the transaction data.
由此,交易数据的关联方(例如发起相应交易的客户端)不需要访问区块链处理单元410即可查询到交易数据的状态,因而不会因客户端的查询操作给区块链处理单元410带来额外的负荷。此外,由于关联方只需要访问交易数据处理装置420即可获取交易数据的状态,而不需要一一查询区块链处理单元410的各个功能模块,从而还能缩短的状态查询的路径,提高了客户端获取区块链处理状态信息时的效率。Therefore, the related party of the transaction data (for example, the client that initiates the corresponding transaction) can query the status of the transaction data without accessing the blockchain processing unit 410, and thus will not send the blockchain processing unit 410 to the blockchain processing unit 410 due to the query operation of the client. Bring extra load. In addition, because the related party only needs to access the transaction data processing device 420 to obtain the status of the transaction data, and does not need to query the various functional modules of the blockchain processing unit 410 one by one, the path of the status query can be shortened and improved. The client obtains the efficiency of the blockchain processing state information.
此外,当关联方为发起交易的客户端等非本地关联方时,由于非本地关联方与区块链节点之间建立通信连接的成本较高且消耗资源更多,因而会进一步增加访问负荷和访问成本。而交易数据处理装置420与区块链处理单元410之间的通信为本地通信,因而通信成本以及由此带来的访问负荷较低。因此,该示例还能够节约通信资源并降低区块链节点的整体负荷。In addition, when the related party is a non-local related party such as a client that initiates a transaction, the cost of establishing a communication connection between the non-local related party and the blockchain node is higher and consumes more resources, which will further increase the access load and Access cost. The communication between the transaction data processing device 420 and the blockchain processing unit 410 is local communication, so the communication cost and the access load caused by it are low. Therefore, this example can also save communication resources and reduce the overall load of blockchain nodes.
在更新各个交易数据的区块链处理状态之后,可以如上所述由各个交易关联方访问交易处理装置从而查询区块链处理状态,也可以由处理状态信息发送单元424定期地 将更新后的至少一个交易数据的区块链处理状态信息发送给该至少一个交易数据的关联方。定期向交易数据的关联方发送区块链处理状态信息时,能够将交易处理装置的负荷分散到各个时段。由此,能够避免出现多个关联方同时查询区块链处理状态而造成瞬时负荷过大。需要说明的是,“定期”并不限于“固定周期”,在一个示例中,也可以根据交易数据处理装置420的负荷状态选择发送区块链处理状态信息的发送时间。可以在交易数据处理装置420的负荷(例如资源占用率)不超过预定负荷时发送区块链处理状态信息。After the blockchain processing status of each transaction data is updated, each transaction related party can access the transaction processing device to query the blockchain processing status as described above, or the processing status information sending unit 424 can periodically update at least the updated at least The blockchain processing status information of one transaction data is sent to the related party of the at least one transaction data. When regularly sending blockchain processing status information to related parties of transaction data, the load of the transaction processing device can be distributed to various time periods. As a result, it is possible to avoid the occurrence of multiple related parties simultaneously querying the processing status of the blockchain, which may cause excessive transient load. It should be noted that the "regular" is not limited to the "fixed period". In an example, the transmission time of the blockchain processing status information can also be selected according to the load status of the transaction data processing device 420. The blockchain processing status information may be sent when the load (for example, resource occupancy rate) of the transaction data processing device 420 does not exceed a predetermined load.
在一个示例中,交易数据的关联方也可以向交易数据处理装置420发送状态查询请求。在该示例中,处理状态信息发送单元424还可以被配置为响应于关联方的状态查询请求,将相应交易数据的区块链处理状态信息发送给关联方。In an example, the related party of the transaction data may also send a status query request to the transaction data processing device 420. In this example, the processing status information sending unit 424 may also be configured to send the blockchain processing status information of the corresponding transaction data to the associated party in response to the status query request of the associated party.
发送给区块链处理单元420的待处理交易数据经过验证模块411的验证处理后将由共识模块412对其执行共识操作。如果等待共识的交易数据不止一个,则待处理交易数据将进入共识队列等待共识。如果共识队列已满,该待处理交易数据可能会因不能进行共识队列而丢失。After the transaction data to be processed sent to the blockchain processing unit 420 is verified by the verification module 411, the consensus module 412 will perform a consensus operation on it. If there is more than one transaction data waiting for consensus, the transaction data to be processed will enter the consensus queue and wait for consensus. If the consensus queue is full, the pending transaction data may be lost due to the inability to perform the consensus queue.
为了防止因共识队列满而导致数据丢失,在图5所示的示例中,配置了数据限流单元425。数据限流单元425被配置为判断向区块链处理单元410所发送的待处理交易数据是否超过限流阈值。在被判断为向区块链处理单元所发送的待处理交易数据超过限流阈值时,交易数据发送单元421被配置为停止向区块链处理单元410发送待处理交易数据。In order to prevent data loss due to the full consensus queue, in the example shown in FIG. 5, a data current limiting unit 425 is configured. The data current limiting unit 425 is configured to determine whether the transaction data to be processed sent to the blockchain processing unit 410 exceeds the current limiting threshold. When it is determined that the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold, the transaction data sending unit 421 is configured to stop sending the transaction data to be processed to the blockchain processing unit 410.
限流阈值可以基于交易数据的数量确定,也可以基于交易数据所占用的数据容量来确定。例如,限流阈值可以是在预定时间段内向区块链处理单元410发送的待处理交易数据的数量上限,也可以是在预定时间段内向区块链处理单元410发送的待处理交易数据的总数据容量上限。The current limit threshold can be determined based on the amount of transaction data, or it can be determined based on the data capacity occupied by the transaction data. For example, the current limit threshold may be the upper limit of the amount of transaction data to be processed sent to the blockchain processing unit 410 within a predetermined time period, or it may be the total amount of transaction data to be processed sent to the blockchain processing unit 410 within a predetermined time period. Maximum data capacity.
限流阈值可以是基于区块链处理单元的处理队列大小、最大单位时间业务量和共识状态确定的。限流阈值可以设置为可以实时调整的。处理队列例如可以是共识模块的共识队列大小。共识状态是指区块链系统中各个区块链节点之间的状态。The current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state. The current limit threshold can be set to be adjustable in real time. The processing queue may be, for example, the size of the consensus queue of the consensus module. The consensus state refers to the state between each block chain node in the block chain system.
不同的共识算法具有不同的共识状态。例如对于BFT类共识算法,共识状态包括初始状态(init)、正常状态(normal case)、视图更换状态(viewchange)、恢复状态(recovery)。而非BFT类共识算法包括初始状态(init)、正常状态(normal case)、 恢复状态(recovery)。只有当共识状态为正常状态(normal case)时,才可以正常地进行共识处理。以PBFT算法为例,PBFT在正常状态包括三阶段预准备阶段(Pre-Prepare)、准备阶段(Prepare)、确认阶段(Commit)。在Normal Case状态下,可以根据共识队列大小确定当前能够处理的交易数据量。但是区块链处理单元能否接收交易数据是根据共识状态来决定的。例如,区块链节点的共识状态为viewchange状态时,无法进行共识。假如共识队列中的交易数据量已达到共识队列中的2/3并且当前共识状态为viewchange状态,区块链处理单元不能接受交易数据。Different consensus algorithms have different consensus states. For example, for BFT consensus algorithms, the consensus state includes an initial state (init), a normal state (normal case), a view change state (viewchange), and a recovery state (recovery). Non-BFT consensus algorithms include initial state (init), normal state (normal case), and recovery state (recovery). Only when the consensus state is a normal case can the consensus processing be performed normally. Taking the PBFT algorithm as an example, PBFT includes three stages in the normal state: Pre-Prepare, Prepare, and Commit. In the Normal Case state, the amount of transaction data that can currently be processed can be determined according to the size of the consensus queue. However, whether the blockchain processing unit can receive transaction data is determined according to the consensus state. For example, when the consensus state of a blockchain node is the viewchange state, consensus cannot be carried out. If the amount of transaction data in the consensus queue has reached 2/3 of the consensus queue and the current consensus state is the viewchange state, the blockchain processing unit cannot accept the transaction data.
此外,如果区块链处理单元410发生故障,也会导致交易数据丢失。在现有技术中,当交易数据丢失时,需要客户端重新发送交易数据,这对于客户端来说很不友好。并且重新发送的交易数据需要再次从验证处理开始重新经历区块链处理操作,这也进一步导致区块链节点资源的浪费。In addition, if the blockchain processing unit 410 fails, the transaction data will also be lost. In the prior art, when the transaction data is lost, the client is required to resend the transaction data, which is very unfriendly to the client. And the re-sent transaction data needs to go through the blockchain processing operation again from the verification process, which further leads to the waste of blockchain node resources.
因而,在本公开中的示例中配置了存储单元426。存储单元426被配置为缓存所接收的至少一个交易数据。通过将所接收到的交易数据缓冲在本地,当因共识队列满、区块链处理单元410故障等原因导致交易数据丢失时,区块链处理单元410可以从交易数据处理装置420处获取交易数据,而不需要客户端再次发送交易数据。此外,由于存储在交易数据处理单元的交易数据具有状态描述字段,当区块链处理单元410重新从交易数据处理装置420的存储模块获得交易数据时,还能获知相应交易数据已经过了哪些处理,从而不需要从验证处理开始重新经历所有的区块链处理过程。因而还能够节省区块链处理单元420的资源。Thus, the storage unit 426 is configured in the example in the present disclosure. The storage unit 426 is configured to buffer at least one transaction data received. By buffering the received transaction data locally, when the transaction data is lost due to the consensus queue being full, the blockchain processing unit 410 malfunctions, etc., the blockchain processing unit 410 can obtain the transaction data from the transaction data processing device 420 , Without the need for the client to send transaction data again. In addition, since the transaction data stored in the transaction data processing unit has a state description field, when the blockchain processing unit 410 obtains the transaction data from the storage module of the transaction data processing device 420 again, it can also know which transaction data has been processed. , So there is no need to re-experience all the blockchain processing from the verification process. Therefore, the resources of the blockchain processing unit 420 can also be saved.
在本公开中,“缓存”是指将数据存储在易失性存储器中,例如存储在计算设备的内存中。In the present disclosure, "caching" refers to storing data in volatile memory, for example, in the memory of a computing device.
此外,在一个示例中,存储单元426还可以在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器430(如图4所示)中。当缓冲的交易数据的数量超过存储阈值时,存储单元也可以将新接收的交易数据存储在非易失性存储器430中。由此,可以在交易数据处理装置420的存储空间有空余时,从非易失性存储器中读取交易数据以进行处理,从而避免因存储空间超过存储阈值出现数据丢失而导致客户端重复发送交易数据。In addition, in an example, the storage unit 426 may also store part or all of the cached transaction data in the non-volatile memory 430 (as shown in FIG. 4) when the amount of the cached transaction data exceeds the storage threshold. . When the number of buffered transaction data exceeds the storage threshold, the storage unit may also store the newly received transaction data in the non-volatile memory 430. As a result, when the storage space of the transaction data processing device 420 is free, transaction data can be read from the non-volatile memory for processing, thereby avoiding data loss due to the storage space exceeding the storage threshold and causing the client to repeatedly send transactions. data.
为了及时清空存储在交易数据处理装置420中的交易数据,可以利用交易数据删除单元427来进行删除处理。交易数据删除单元427被配置为针对所存储的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该 交易数据。当交易数据完成区块上链上后,表示该交易数据已完成了区块链处理。此时对于区块链节点来说已没有必要继续保留该交易数据。但是需要为交易数据的关联方(例如客户端)预留预定时间段,以使其获取相应交易数据的区块链处理状态。在预留的预定时间段内,关联方可以主动查询区块链处理状态或交易数据处理装置420向关联方发送区块链处理状态。在预定时间段经过后,可以默认为关联方已获取到了区块链处理状态,因而可以删除相应交易数据,以避免完成区块链处理的交易数据持续占用存储空间。In order to clear the transaction data stored in the transaction data processing device 420 in time, the transaction data deletion unit 427 may be used to perform deletion processing. The transaction data deletion unit 427 is configured to delete the transaction data when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has passed for each stored transaction data. When the transaction data is completed on the blockchain, it means that the transaction data has been processed on the blockchain. At this time, it is no longer necessary for the blockchain node to continue to retain the transaction data. However, it is necessary to reserve a predetermined period of time for the related party (for example, the client) of the transaction data to obtain the blockchain processing status of the corresponding transaction data. Within the reserved predetermined time period, the related party can actively query the blockchain processing status or the transaction data processing device 420 can send the blockchain processing status to the related party. After the predetermined time period has elapsed, it can be assumed that the related party has obtained the blockchain processing status, so the corresponding transaction data can be deleted to avoid the transaction data that has completed the blockchain processing from continuously occupying storage space.
如上所述,交易数据在经过验证模块验证后由共识模块广播给其他区块链节点以进行共识处理。如果区块链节点故障,共识模块可能不能顺利地将交易数据广播给其它节点。因而,可以利用广播单元428来针对所存储的各个交易数据,在该交易数据的状态描述字段被更新为完成验证后且在经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其他区块链节点。如果交易数据的状态描述字段被更新为完成验证后长时间没有被更新为完成共识,则可以推测区块链处理单元发生了故障或区块链处理单元中的交易数据发生了丢失,此时可由交易数据处理装置420具有的广播单元428来将相应交易数据广播出去。As mentioned above, the transaction data is broadcast by the consensus module to other blockchain nodes for consensus processing after being verified by the verification module. If the blockchain node fails, the consensus module may not be able to broadcast transaction data to other nodes smoothly. Therefore, the broadcasting unit 428 can be used for each transaction data stored, when the state description field of the transaction data is updated to complete the verification and is not updated to complete the consensus after the second predetermined time, the transaction data Broadcast to other blockchain nodes. If the state description field of the transaction data is updated to complete the verification and has not been updated to complete the consensus for a long time, it can be inferred that the blockchain processing unit has failed or the transaction data in the blockchain processing unit has been lost. The transaction data processing device 420 has a broadcasting unit 428 to broadcast the corresponding transaction data.
图7是根据本公开的一个实施例的用于在区块链节点处进行交易数据处理的方法的流程图。Fig. 7 is a flowchart of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure.
如图7所示,在块720,在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,交易数据具有状态描述字段。As shown in FIG. 7, in block 720, after receiving at least one transaction data, the received at least one transaction data is sent to the blockchain processing unit for corresponding blockchain processing, and the transaction data has a status Description field.
区块链处理单元在对交易数据进行区块链处理的过程中,可以发送交易数据的区块链处理状态信息。因而该方法可以在块740,从区块链处理单元获取针对各个交易数据的对应区块链处理状态信息。The blockchain processing unit can send the blockchain processing status information of the transaction data in the process of blockchain processing the transaction data. Therefore, the method may obtain corresponding blockchain processing state information for each transaction data from the blockchain processing unit at block 740.
在获取到相应区块链处理状态信息后,在块760,针对至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供至少一个交易数据的关联方来进行状态查询。After obtaining the corresponding blockchain processing status information, in block 760, for each transaction data in at least one transaction data, use the received blockchain processing status information to update the status description field of the transaction data for at least A related party of transaction data to perform status query.
图8是用于说明根据本公开的一个实施例的用于在区块链节点处进行交易数据处理的方法的一种应用场景的流程图。如图8所示,该示例中的用于在区块链节点处进行交易数据处理的方法可以由交易数据处理装置来执行。Fig. 8 is a flowchart for explaining an application scenario of a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure. As shown in FIG. 8, the method for processing transaction data at a blockchain node in this example can be executed by a transaction data processing device.
如图8所示,在802,发起交易的客户端将交易数据发送给区块链节点的交易数据处理装置。交易数据处理装置在接收到交易数据时,在804,缓存所接收到的交易数据。并在806,判断所缓冲的交易数据是否超过了存储阈值。当缓冲的交易数据超过存储阈值时,在808,交易数据处理装置将缓存的交易数据存储在非易失性存储器中。As shown in Figure 8, at 802, the client that initiated the transaction sends the transaction data to the transaction data processing device of the blockchain node. When the transaction data processing device receives the transaction data, in 804, the received transaction data is buffered. And at 806, it is determined whether the buffered transaction data exceeds the storage threshold. When the buffered transaction data exceeds the storage threshold, at 808, the transaction data processing device stores the buffered transaction data in the non-volatile memory.
此外,虽然图8中未示出,当所缓存的交易数据超过存储阈值时,本公开的方法可以将所缓冲的交易数据的部分或全部存储在非易失性存储器中。在另一示例中,还可以针对所存储的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该交易数据。In addition, although not shown in FIG. 8, when the buffered transaction data exceeds the storage threshold, the method of the present disclosure may store part or all of the buffered transaction data in a non-volatile memory. In another example, for each transaction data stored, the transaction data may be deleted when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has passed.
在将待处理交易数据发送给区块链处理单元的过程中,可以在810,判断向区块链处理单元发送的待处理交易数据是否超过限流阈值。可以基于第一预定时间段来确定向区块链处理单元发送的待处理交易数据的数量,并确定该数量是否超过限流阈值。当向区块链处理单元发送的待处理交易数据超过限流阈值时,停止向区块链处理单元发送待处理交易数据。然后可以在经过第二预定时间段后再次确定所发送的待处理交易数据是否超过限流阈值,如果仍然超过限流阈值则继续等待。在确定向区块链处理单元发送的待处理交易数据未超过限流阈值时,在812,将待处理交易数据发送给区块链处理单元。限流阈值可以是基于区块链处理单元的处理队列大小、最大单位时间业务量和共识状态确定的。例如,可以选择处理队列大小、最大单位时间业务量和处于待共识状态的交易数量中的最大值或最小值作为限流阈值。In the process of sending the transaction data to be processed to the blockchain processing unit, it may be determined at 810 whether the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold. The amount of transaction data to be processed to be sent to the blockchain processing unit may be determined based on the first predetermined time period, and it may be determined whether the amount exceeds the current limit threshold. When the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold, stop sending the transaction data to be processed to the blockchain processing unit. Then, after the second predetermined period of time has passed, it can be determined again whether the sent transaction data to be processed exceeds the current limit threshold, and if it still exceeds the current limit threshold, continue to wait. When it is determined that the transaction data to be processed sent to the blockchain processing unit does not exceed the current limit threshold, at 812, the transaction data to be processed is sent to the blockchain processing unit. The current limit threshold may be determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state. For example, the maximum or minimum of the processing queue size, the maximum business volume per unit time, and the number of transactions in the pending consensus state can be selected as the current limit threshold.
区块链处理单元接收到待处理交易数据之后,对待处理交易数据进行验证、共识等区块链处理操作,并在处理过程中,在814,将交易数据的区块链处理状态信息发送给交易数据处理装置。在816,交易数据处理装置可接收区块链处理状态信息。然后在818,当接收到针对交易数据的区块链处理状态信息时,使用所接收的区块链处理状态信息来更新相应交易数据的状态描述字段。After receiving the transaction data to be processed, the blockchain processing unit performs blockchain processing operations such as verification and consensus on the transaction data to be processed, and during the processing, at 814, the blockchain processing status information of the transaction data is sent to the transaction Data processing device. At 816, the transaction data processing device may receive blockchain processing status information. Then, at 818, when the blockchain processing status information for the transaction data is received, the received blockchain processing status information is used to update the status description field of the corresponding transaction data.
更新后的区块链处理状态信息可供交易数据的关联方(例如发起相应交易的客户端)查询,也可以由交易处理装置定期发送给交易数据的关联方。如图8所示,在820,判断状态发送周期是否期满。当状态发送周期期满时,在822,将交易数据的区块链处理状态信息发送给发起相应交易的客户端。需要说明的是,“定期”或“状态发送周期”并不一定是固定周期,其也可以是可变的时间期间。客户端也可以在824,向交易处理装置发送状态查询请求。从而在826,交易处理装置可以响应于客户端的状态查询请求,将相应交易数据的区块链状态信息发送给客户端。The updated blockchain processing status information can be queried by the related parties of the transaction data (for example, the client that initiates the corresponding transaction), or it can be periodically sent by the transaction processing device to the related parties of the transaction data. As shown in FIG. 8, at 820, it is determined whether the status transmission period has expired. When the status sending period expires, at 822, the blockchain processing status information of the transaction data is sent to the client that initiated the corresponding transaction. It should be noted that the “periodical” or “status transmission period” is not necessarily a fixed period, and it may also be a variable time period. The client can also send a status query request to the transaction processing device at 824. Therefore, in 826, the transaction processing device may send the blockchain state information of the corresponding transaction data to the client in response to the client's state query request.
此外,还可以在块828,针对各所缓存的各个交易数据,判断交易数据被的区块链状态信息在更新为完成验证后是否已经过预定时间。如果已经过预定时间,则在830,判断是否接收到更新为完成共识的区块链状态信息。如果在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识,则在832,将该交易数据广播给其他区块链节点。In addition, in block 828, for each of the cached transaction data, it is also possible to determine whether the predetermined time has passed after the block chain status information of the transaction data is updated to complete the verification. If the predetermined time has passed, then at 830, it is determined whether the blockchain status information updated to complete the consensus is received. If the state description field of the transaction data is updated to complete the verification and is not updated to complete the consensus after the second predetermined time has elapsed, then at 832, the transaction data is broadcast to other blockchain nodes.
需要说明的是,图8中示出的用于在区块链节点处进行交易数据处理的方法的流程中,某些操作并不是必须执行的操作。例如,在其它示例中,可以不执行804至808的操作,在某些示例中,可以不执行810的操作。在实践中,可以要根据实践需要进行省去某些操作。It should be noted that in the flow of the method for processing transaction data at a blockchain node shown in FIG. 8, some operations are not mandatory operations. For example, in other examples, operations 804 to 808 may not be performed, and in some examples, operations 810 may not be performed. In practice, certain operations can be omitted according to practical needs.
以上参照图1到图8,对根据本公开的用于在区块链节点处进行交易数据处理的方法及装置的实施例进行了描述。在以上对方法实施例的描述中所提及的细节,同样适用于本公开的装置的实施例。Above, referring to FIGS. 1 to 8, the embodiments of the method and device for processing transaction data at a blockchain node according to the present disclosure have been described. The details mentioned in the above description of the method embodiment are also applicable to the embodiment of the device of the present disclosure.
本公开的用于在区块链节点处进行交易数据处理的装置可以采用硬件实现,也可以采用软件或者硬件和软件的组合来实现。在以上对方法实施例的描述中所提及的细节,同样适用于本公开的装置的实施例。本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见。The device for processing transaction data at a blockchain node of the present disclosure can be implemented by hardware, or by software or a combination of hardware and software. The details mentioned in the above description of the method embodiment are also applicable to the embodiment of the device of the present disclosure. The various embodiments in this specification are described in a progressive manner, and the same or similar parts among the various embodiments are referred to each other.
本公开的用于在区块链节点处进行交易数据处理的装置可以采用硬件实现,也可以采用软件或者硬件和软件的组合来实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将存储器中对应的计算机程序指令读取到内存中运行形成的。在本公开中,用于在区块链节点处进行交易数据处理的装置例如可以利用计算设备实现。The device for processing transaction data at a blockchain node of the present disclosure can be implemented by hardware, or by software or a combination of hardware and software. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the memory into the memory through the processor of the device where it is located. In the present disclosure, the device for processing transaction data at a blockchain node can be implemented by using a computing device, for example.
图9是根据本公开的一个实施例的用于实现用于在区块链节点处进行交易数据处理的方法的计算设备的结构框图。如图9所示,计算设备900包括处理器910、存储器920、内存930、通信接口940和内部总线950。根据一个实施例,计算设备900可以包括至少一个处理器910,该至少一个处理器910执行在计算机可读存储介质(即,存储器920)中存储或编码的至少一个计算机可读指令(即,上述以软件形式实现的元素)。Fig. 9 is a structural block diagram of a computing device for implementing a method for processing transaction data at a blockchain node according to an embodiment of the present disclosure. As shown in FIG. 9, the computing device 900 includes a processor 910, a memory 920, a memory 930, a communication interface 940, and an internal bus 950. According to an embodiment, the computing device 900 may include at least one processor 910 that executes at least one computer-readable instruction (ie, the aforementioned Elements implemented in software).
在一个实施例中,在存储器920中存储计算机可执行指令,其当执行时使得至少一个处理器910:在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,交易数据具有状态描述字段;从区块 链处理单元获取针对各个交易数据的对应区块链处理状态信息;以及针对至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供至少一个交易数据的关联方来进行状态查询。In one embodiment, computer-executable instructions are stored in the memory 920, which when executed, cause at least one processor 910 to: after receiving at least one transaction data, send the received at least one transaction data to the area The block chain processing unit performs the corresponding block chain processing, and the transaction data has a state description field; obtains the corresponding block chain processing state information for each transaction data from the block chain processing unit; and for each transaction in at least one transaction data Data, using the received blockchain processing status information to update the status description field of the transaction data, so that at least one related party of the transaction data can perform status query.
应该理解,在存储器920中存储的计算机可执行指令当执行时使得至少一个处理器610进行本公开的各个实施例中以上结合图1-8描述的各种操作和功能。It should be understood that the computer-executable instructions stored in the memory 920, when executed, cause at least one processor 610 to perform various operations and functions described above in conjunction with FIGS. 1-8 in the various embodiments of the present disclosure.
根据一个实施例,提供了一种例如非暂时性机器可读介质的程序产品。非暂时性机器可读介质可以具有指令(即,上述以软件形式实现的元素),该指令当被机器执行时,使得机器执行本公开的各个实施例中以上结合图1-8描述的各种操作和功能。According to one embodiment, a program product such as a non-transitory machine-readable medium is provided. The non-transitory machine-readable medium may have instructions (ie, the above-mentioned elements implemented in the form of software), which when executed by a machine, cause the machine to execute the various embodiments described above in conjunction with FIGS. 1-8 in the various embodiments of the present disclosure. Operation and function.
具体地,可以提供配有可读存储介质的系统或者装置,在该可读存储介质上存储着实现上述实施例中任一实施例的功能的软件程序代码,且使该系统或者装置的计算机或处理器读出并执行存储在该可读存储介质中的指令。Specifically, a system or device equipped with a readable storage medium may be provided, and the software program code for realizing the function of any one of the above-mentioned embodiments is stored on the readable storage medium, and the computer or device of the system or device The processor reads and executes the instructions stored in the readable storage medium.
在这种情况下,从可读介质读取的程序代码本身可实现上述实施例中任何一项实施例的功能,因此机器可读代码和存储机器可读代码的可读存储介质构成了本发明的一部分。In this case, the program code itself read from the readable medium can realize the function of any one of the above embodiments, so the machine readable code and the readable storage medium storing the machine readable code constitute the present invention a part of.
可读存储介质的实施例包括软盘、硬盘、磁光盘、光盘(如CD-ROM、CD-R、CD-RW、DVD-ROM、DVD-RAM、DVD-RW、DVD-RW)、磁带、非易失性存储卡和ROM。可选择地,可以由通信网络从服务器计算机上或云上下载程序代码。Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, Volatile memory card and ROM. Alternatively, the program code can be downloaded from a server computer or cloud via a communication network.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than in the embodiments and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
上述各流程和各系统结构图中不是所有的步骤和单元都是必须的,可以根据实际的需要忽略某些步骤或单元。各步骤的执行顺序不是固定的,可以根据需要进行确定。上述各实施例中描述的装置结构可以是物理结构,也可以是逻辑结构,即,有些单元可能由同一物理实体实现,或者,有些单元可能分由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。Not all steps and units in the above processes and system structure diagrams are necessary, and some steps or units can be omitted according to actual needs. The order of execution of each step is not fixed and can be determined as needed. The device structure described in the foregoing embodiments may be a physical structure or a logical structure, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or may be implemented by multiple physical entities. Some components in independent devices are implemented together.
在整个本说明书中使用的术语“示例性”意味着“用作示例、实例或例示”,并不意味着比其它实施例“优选”或“具有优势”。出于提供对所描述技术的理解的目的, 具体实施方式包括具体细节。然而,可以在没有这些具体细节的情况下实施这些技术。在一些实例中,为了避免对所描述的实施例的概念造成难以理解,公知的结构和装置以框图形式示出。The term "exemplary" used throughout this specification means "serving as an example, instance, or illustration", and does not mean "preferred" or "advantageous" over other embodiments. For the purpose of providing an understanding of the described technology, the detailed description includes specific details. However, these techniques can be implemented without these specific details. In some instances, in order to avoid incomprehensibility to the concepts of the described embodiments, well-known structures and devices are shown in the form of block diagrams.
以上结合附图详细描述了本公开的实施例的可选实施方式,但是,本公开的实施例并不限于上述实施方式中的具体细节,在本公开的实施例的技术构思范围内,可以对本公开的实施例的技术方案进行多种简单变型,这些简单变型均属于本公开的实施例的保护范围。The optional implementations of the embodiments of the present disclosure are described in detail above with reference to the accompanying drawings. However, the embodiments of the present disclosure are not limited to the specific details in the above-mentioned implementation manners. Within the scope of the technical concept of the embodiments of the present disclosure, the present disclosure can be modified. The technical solutions of the disclosed embodiments are subjected to a variety of simple modifications, and these simple modifications all fall within the protection scope of the embodiments of the present disclosure.
本公开内容的上述描述被提供来使得本领域任何普通技术人员能够实现或者使用本公开内容。对于本领域普通技术人员来说,对本公开内容进行的各种修改是显而易见的,并且,也可以在不脱离本公开内容的保护范围的情况下,将本文所定义的一般性原理应用于其它变型。因此,本公开内容并不限于本文所描述的示例和设计,而是与符合本文公开的原理和新颖性特征的最广范围相一致。The foregoing description of the present disclosure is provided to enable any person of ordinary skill in the art to implement or use the present disclosure. For those of ordinary skill in the art, various modifications to the present disclosure are obvious, and the general principles defined herein can also be applied to other modifications without departing from the scope of protection of the present disclosure. . Therefore, the present disclosure is not limited to the examples and designs described herein, but is consistent with the widest scope that conforms to the principles and novel features disclosed herein.
Claims (19)
- 一种用于在区块链节点处进行交易数据处理的方法,所述区块链节点包括区块链处理单元,所述方法包括:A method for processing transaction data at a block chain node, the block chain node includes a block chain processing unit, and the method includes:在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,所述交易数据具有状态描述字段;After receiving at least one transaction data, sending the received at least one transaction data to the blockchain processing unit for corresponding blockchain processing, where the transaction data has a state description field;从所述区块链处理单元获取针对各个交易数据的对应区块链处理状态信息;以及Obtain corresponding blockchain processing state information for each transaction data from the blockchain processing unit; and针对所述至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供所述至少一个交易数据的关联方来进行状态查询。For each transaction data in the at least one transaction data, the received block chain processing status information is used to update the status description field of the transaction data, so that the associated parties of the at least one transaction data can perform status query.
- 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:定期地将更新后的至少一个交易数据的区块链处理状态信息发送给该至少一个交易数据的关联方。The updated blockchain processing status information of the at least one transaction data is sent to the related party of the at least one transaction data on a regular basis.
- 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:响应于所述至少一个交易数据的关联方的状态查询请求,向该关联方发送所述至少一个交易数据的区块链处理状态信息。In response to the status query request of the at least one related party of transaction data, the blockchain processing status information of the at least one transaction data is sent to the related party.
- 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:在向所述区块链处理单元所发送的待处理交易数据超过限流阈值时,停止向所述区块链处理单元发送待处理交易数据。When the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold, stop sending the transaction data to be processed to the blockchain processing unit.
- 如权利要求4所述的方法,其中,所述限流阈值是基于所述区块链处理单元的处理队列大小、最大单位时间业务量和共识状态确定的。The method of claim 4, wherein the current limit threshold is determined based on the processing queue size of the blockchain processing unit, the maximum business volume per unit time, and the consensus state.
- 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:缓存所接收的至少一个交易数据。At least one transaction data received is cached.
- 如权利要求6所述的方法,还包括:The method of claim 6, further comprising:在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器中。When the number of cached transaction data exceeds the storage threshold, some or all of the cached transaction data is stored in the non-volatile memory.
- 如权利要求6或7所述的方法,还包括:The method of claim 6 or 7, further comprising:针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该交易数据。For each transaction data that is cached, the transaction data is deleted when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has passed.
- 如权利要求6或7所述的方法,还包括:The method of claim 6 or 7, further comprising:针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其他区块链节点。For each transaction data cached, when the state description field of the transaction data is updated to be not updated to complete the consensus after the second predetermined time has passed after the verification is completed, the transaction data is broadcast to other blockchain nodes.
- 一种用于在区块链节点处进行交易数据处理的装置,所述区块链节点包括区块链处理单元,所述装置包括:A device for processing transaction data at a block chain node, the block chain node includes a block chain processing unit, and the device includes:交易数据发送单元,被配置为在接收到至少一个交易数据后,将所接收到的至少一个交易数据发送给所述区块链处理单元来进行对应的区块链处理,所述交易数据具有状态描述字段;The transaction data sending unit is configured to, after receiving at least one transaction data, send the received at least one transaction data to the blockchain processing unit for corresponding blockchain processing, and the transaction data has a status Description field处理状态信息获取单元,被配置为从所述区块链处理单元获取针对各个交易数据的对应区块链处理状态信息;以及A processing state information acquiring unit configured to acquire corresponding blockchain processing state information for each transaction data from the blockchain processing unit; and处理状态更新单元,被配置为针对所述至少一个交易数据中的各个交易数据,使用所接收的区块链处理状态信息来更新该交易数据的状态描述字段,以供所述至少一个交易数据的关联方来进行状态查询。The processing status update unit is configured to use the received block chain processing status information to update the status description field of the transaction data for each transaction data in the at least one transaction data, so as to provide for the at least one transaction data Related parties to perform status inquiries.
- 如权利要求10所述的装置,还包括:The device of claim 10, further comprising:处理状态信息发送单元,被配置为定期地将更新后的至少一个交易数据的区块链处理状态信息发送给该至少一个交易数据的关联方。The processing status information sending unit is configured to periodically send the updated blockchain processing status information of the at least one transaction data to the associated party of the at least one transaction data.
- 如权利要求10所述的装置,还包括:The device of claim 10, further comprising:处理状态信息发送单元,被配置为响应于所述至少一个交易数据的关联方的状态查询消息,向该关联方发送所述至少一个交易数据的区块链处理状态信息。The processing status information sending unit is configured to respond to the status query message of the at least one transaction data related party to send the blockchain processing status information of the at least one transaction data to the related party.
- 如权利要求10所述的装置,还包括:The device of claim 10, further comprising:数据限流单元,被配置为判断向所述区块链处理单元所发送的待处理交易数据是否超过限流阈值,The data current limiting unit is configured to determine whether the transaction data to be processed sent to the blockchain processing unit exceeds the current limiting threshold,所述交易数据发送单元被配置为:在被判断为向所述区块链处理单元所发送的待处理交易数据超过限流阈值时,停止向所述区块链处理单元发送待处理交易数据。The transaction data sending unit is configured to stop sending the transaction data to be processed to the blockchain processing unit when it is determined that the transaction data to be processed sent to the blockchain processing unit exceeds the current limit threshold.
- 如权利要求10所述的装置,还包括:The device of claim 10, further comprising:存储单元,被配置为将所接收的至少一个交易数据存储在缓存中。The storage unit is configured to store the received at least one transaction data in a cache.
- 如权利要求14所述的装置,其中,所述存储单元还被配置为在所缓存的交易数据的数量超过存储阈值时,将所缓存的部分或全部交易数据存储在非易失性存储器中。The apparatus of claim 14, wherein the storage unit is further configured to store part or all of the cached transaction data in the non-volatile memory when the amount of the cached transaction data exceeds a storage threshold.
- 如权利要求14或15所述的装置,还包括:The device according to claim 14 or 15, further comprising:交易数据删除单元,被配置为针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成区块上链后经过预定时间段时,删除该交易数据。The transaction data deletion unit is configured to delete the transaction data when the state description field of the transaction data is updated to complete the block chaining after a predetermined period of time has elapsed for each cached transaction data.
- 如权利要求14或15所述的装置,还包括:The device according to claim 14 or 15, further comprising:广播单元,被配置为针对所缓存的各个交易数据,在该交易数据的状态描述字段被更新为完成验证后经过第二预定时间后未被更新为完成共识时,将该交易数据广播给其 他区块链节点。The broadcasting unit is configured to broadcast the transaction data to other areas when the state description field of the transaction data is updated to complete the verification after the second predetermined time has passed after the verification is completed. Block chain node.
- 一种计算设备,包括:A computing device including:至少一个处理器;以及At least one processor; and存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如权利要求1到9中任一所述的方法。A memory, where the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the method according to any one of claims 1 to 9.
- 一种非暂时性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如权利要求1到9中任一所述的方法。A non-transitory machine-readable storage medium that stores executable instructions that, when executed, cause the machine to execute the method according to any one of claims 1 to 9.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010000752.3 | 2020-01-02 | ||
CN202010000752.3A CN111199485A (en) | 2020-01-02 | 2020-01-02 | Method and device for processing transaction data at block chain nodes |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021135745A1 true WO2021135745A1 (en) | 2021-07-08 |
Family
ID=70746718
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/131838 WO2021135745A1 (en) | 2020-01-02 | 2020-11-26 | Method and apparatus for carrying out transaction data processing at blockchain node |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111199485A (en) |
WO (1) | WO2021135745A1 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111199485A (en) * | 2020-01-02 | 2020-05-26 | 支付宝(杭州)信息技术有限公司 | Method and device for processing transaction data at block chain nodes |
CN111917859B (en) * | 2020-07-28 | 2022-08-12 | 腾讯科技(深圳)有限公司 | Data transmission method and device, computer equipment and storage medium |
CN112804351B (en) * | 2021-03-05 | 2022-12-23 | 中国工商银行股份有限公司 | Flow control method, device, node, medium and product of block chain system |
CN112685796B (en) * | 2021-03-12 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Block chain-based block consensus method and related equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109493223A (en) * | 2018-11-07 | 2019-03-19 | 联动优势科技有限公司 | A kind of bookkeeping methods and device |
CN109684408A (en) * | 2018-12-07 | 2019-04-26 | 深圳市智税链科技有限公司 | Data managing method, device, medium and the electronic equipment of block catenary system |
CN110046896A (en) * | 2019-04-26 | 2019-07-23 | 腾讯科技(深圳)有限公司 | A kind of block processes method and node and system |
US10476847B1 (en) * | 2017-12-08 | 2019-11-12 | Symbiont.Io, Inc. | Systems, methods, and devices for implementing a smart contract on a distributed ledger technology platform |
CN111199485A (en) * | 2020-01-02 | 2020-05-26 | 支付宝(杭州)信息技术有限公司 | Method and device for processing transaction data at block chain nodes |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106372868B (en) * | 2016-09-06 | 2020-02-18 | 联动优势科技有限公司 | Verification method and device for transaction data written into block chain |
CN106453377B (en) * | 2016-10-28 | 2021-03-02 | 中金云金融(北京)大数据科技股份有限公司 | Block chain based distributed network intelligent monitoring system and method |
CN106598490A (en) * | 2016-11-25 | 2017-04-26 | 深圳前海微众银行股份有限公司 | Access method for block chain data and block chain management system |
US10796329B2 (en) * | 2016-11-29 | 2020-10-06 | Mastercard International Incorporated | Method and system for authentication of coupons via blockchain |
CN108876608B (en) * | 2018-05-30 | 2021-05-04 | 深圳乐信软件技术有限公司 | Block chain application method and system |
-
2020
- 2020-01-02 CN CN202010000752.3A patent/CN111199485A/en active Pending
- 2020-11-26 WO PCT/CN2020/131838 patent/WO2021135745A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10476847B1 (en) * | 2017-12-08 | 2019-11-12 | Symbiont.Io, Inc. | Systems, methods, and devices for implementing a smart contract on a distributed ledger technology platform |
CN109493223A (en) * | 2018-11-07 | 2019-03-19 | 联动优势科技有限公司 | A kind of bookkeeping methods and device |
CN109684408A (en) * | 2018-12-07 | 2019-04-26 | 深圳市智税链科技有限公司 | Data managing method, device, medium and the electronic equipment of block catenary system |
CN110046896A (en) * | 2019-04-26 | 2019-07-23 | 腾讯科技(深圳)有限公司 | A kind of block processes method and node and system |
CN111199485A (en) * | 2020-01-02 | 2020-05-26 | 支付宝(杭州)信息技术有限公司 | Method and device for processing transaction data at block chain nodes |
Also Published As
Publication number | Publication date |
---|---|
CN111199485A (en) | 2020-05-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021135745A1 (en) | Method and apparatus for carrying out transaction data processing at blockchain node | |
US20220393954A1 (en) | Systems and methods for providing notifications of changes in a cloud-based file system | |
US20160057201A1 (en) | File Uploading Method, Client, and Application Server in Cloud Storage, and Cloud Storage System | |
WO2016177285A1 (en) | Data pushing method and device | |
US10455264B2 (en) | Bulk data extraction system | |
CN109087116A (en) | Accumulated point exchanging method, integral transaction system and computer readable storage medium | |
WO2020019943A1 (en) | Method and device for transmitting data, and method and apparatus for receiving data | |
US11741075B2 (en) | Methods and system of tracking transactions for distributed ledger | |
WO2021120995A1 (en) | Data synchronization method and device for databases, and storage medium | |
US10853155B2 (en) | Forwarding metadata proxy server for asynchronous metadata operations | |
WO2018223789A1 (en) | Method and system for performing operation with respect to transaction id, and computer readable storage medium | |
JP4205323B2 (en) | Distribution system, distribution server and distribution method, distribution program | |
CN111641563B (en) | Flow self-adaption method and system based on distributed scene | |
US11494403B2 (en) | Method and apparatus for storing off-chain data | |
US11537336B2 (en) | Resource service system, control method, and storage medium | |
CN113301390B (en) | Data processing method, device and server for calling virtual resources | |
CN112751847A (en) | Interface call request processing method and device, electronic equipment and storage medium | |
JP2021039585A (en) | Method for controlling connection with client or server | |
CN109583980A (en) | Method, system, electronic equipment and the storage medium of order processing | |
CN114547214A (en) | Long-link data processing method, device and equipment | |
US10848449B2 (en) | Token-based message exchange system | |
WO2020088311A1 (en) | Data processing method and apparatus | |
CN111242621A (en) | Transaction data storage method, device, equipment and storage medium | |
CN113760519A (en) | Distributed transaction processing method, device and system and electronic equipment | |
CN118502842A (en) | Block chain intelligent contract executing method, device, server and storage medium |
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: 20910819 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20910819 Country of ref document: EP Kind code of ref document: A1 |