WO2019100598A1 - Transaction processing method and device, computer equipment, and storage medium - Google Patents

Transaction processing method and device, computer equipment, and storage medium Download PDF

Info

Publication number
WO2019100598A1
WO2019100598A1 PCT/CN2018/075501 CN2018075501W WO2019100598A1 WO 2019100598 A1 WO2019100598 A1 WO 2019100598A1 CN 2018075501 W CN2018075501 W CN 2018075501W WO 2019100598 A1 WO2019100598 A1 WO 2019100598A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
node
current
transaction node
preliminary
Prior art date
Application number
PCT/CN2018/075501
Other languages
French (fr)
Chinese (zh)
Inventor
刘雄文
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019100598A1 publication Critical patent/WO2019100598A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/388Payment protocols; Details thereof using mutual authentication without cards, e.g. challenge-response

Definitions

  • the present application relates to a transaction processing method, apparatus, computer device, and storage medium.
  • a blockchain or a distributed trading system based on the PaxOS algorithm multiple trading nodes are required to participate in the transaction, and a consensus is reached based on a certain processing strategy.
  • the system needs to know which trading nodes. Available, the currently solution is to initiate a transaction between the trading nodes to monitor and synchronize data and to elect a leader of the trading node from the trading node during the transaction.
  • a transaction processing method, apparatus, computer device, and storage medium are provided.
  • a transaction processing method including:
  • a blockchain transaction processing device comprising:
  • a transaction request communication module configured to receive a transaction request, and acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request;
  • a node parameter communication module configured to receive, when the current transaction node fails, a parameter of the switched transaction node that is switched after the current transaction node is in the same cluster
  • a replacement module configured to replace parameters of the current trading node with parameters of the switched trading node
  • a processing module configured to receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
  • a computer device comprising a memory and one or more processors having stored therein computer readable instructions, the computer readable instructions being executable by the processor to cause the one or more processors to execute The following steps: receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving a failure at the current transaction node And a parameter of the switched transaction node that is switched in the same cluster as the current transaction node;
  • One or more non-transitory computer readable instruction storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of:
  • FIG. 1 is an application environment diagram of a transaction processing method in accordance with one or more embodiments.
  • FIG. 2 is a flow diagram of a transaction processing method in accordance with one or more embodiments.
  • FIG. 3 is a block diagram of a blockchain transaction device in accordance with one or more embodiments.
  • FIG. 4 is a block diagram of a computer system in accordance with one or more embodiments.
  • FIG. 1 is an application environment diagram of a transaction processing method in an embodiment.
  • FIG. 1 shows a transaction server, a transaction node, and a sorting server, wherein the transaction nodes may exist in a cluster manner.
  • the transaction processing method can be applied to a blockchain or a distributed transaction system implemented based on a PaxOS algorithm.
  • the transaction server may store a configuration file or a database corresponding to the transaction server, where the configuration file or the database stores the IP address and port of the transaction node, the event address and port of the transaction node.
  • a nominal channel can be established based on the configuration file or database.
  • the channel contains all available trading nodes.
  • the trading server can accept the registration of new trading nodes in the channel, the logout of the original trading node, and the change of the attributes of the original trading node.
  • the change of the attribute of the original transaction node includes two ways: one is that the current transaction node in the transaction node cluster is faulty, and the transaction is continued by the replacement transaction node.
  • the trading node continues to work, only the address and port of the event change. The other is that the current trading node itself is down or the trading process of the current trading node is aborted or the storage process of the current trading node is aborted. In this case, the current trading node is no longer involved in subsequent transactions.
  • the transaction server may also register a transaction processing event with each available transaction node, receive an event notification after completion of each transaction node transaction, that is, receive the preliminary transaction processing result returned by each transaction node, and summarize the preliminary transaction processing result.
  • the target processing result is obtained, and the target processing result is stored to the sorting server.
  • the transaction server can achieve load balancing on a cluster basis, improving availability and efficiency.
  • the trading node is a data result function with calculation function and storage calculation, and each transaction node joins the trust verification of the transaction server.
  • Each transaction node exists as a master-slave node or a cluster of nodes.
  • the parameters may include the starting position of the data and the length of the data, and then the sorting server submits the data to the current node of the trading node. After the submission is completed, the trading node will sort the target transaction returned by the server. The results are stored in their own data storage device.
  • the trading node Before the trading process of the trading node is aborted, the trading node can send an event message to the trading server, and the trading server can update the configuration file or the database.
  • trading nodes can achieve load balancing on the basis of clusters, improving availability and efficiency.
  • the sorting server can receive the target transaction result of the transaction server, and sort and store the target transaction result in chronological order, so that when receiving the data acquisition request of the transaction node, the sorting server can return the correct target transaction result to the corresponding Trading node.
  • the sorting server can provide services out of data synchronization between the cluster and the cluster, providing data persistence and high throughput performance.
  • a transaction processing method is provided. This embodiment is exemplified by applying the method to the transaction server in FIG. 1 described above. The method specifically includes the following steps:
  • S202 Receive a transaction request, and acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request.
  • the transaction server can verify the transaction request after receiving the external transaction request, for example, the transaction server pre-arranges the encryption and decryption method and algorithm, the signing and verification method and the algorithm, and the like, and receives the transaction request at the transaction server.
  • the verification is first performed according to the pre-agreed verification method, and then the decryption is performed according to a predetermined decryption method to obtain transaction data and the like.
  • the transaction server obtains the current transaction node, which may be a transaction server query configuration file or a database, etc., wherein the transaction server may establish a channel in the configuration file or the database, and the channel may be associated with the transaction type, so that the transaction server may be based on the configuration file or the database.
  • the attribute of the transaction node stored in the middle is acquired to the current transaction node, and the transaction request is sent to the current transaction node.
  • the transaction server may encrypt the decrypted transaction data, generate a corresponding transaction identifier, and then send the transaction identifier and the transaction data to the corresponding current transaction node, wherein the transaction identifier is an identifier that can uniquely determine the transaction. .
  • the transaction server may also prioritize changes to the configuration file or the database. For example, the configuration file or the database change caused by the change of the transaction node attribute has the highest priority, and the change of the configuration file or the database caused by the transaction node logout is prioritized. Secondly, the configuration file caused by the registration of the transaction node has the lowest priority, the same priority is queued in the manner of queue, and the update of the configuration file or database can only be performed by the transaction server. And the transaction server can establish the concept of the channel, the channel contains the available transaction nodes, and the channel can be associated with the transaction type.
  • the attributes of each transaction node include the identifier of the transaction node, which can be the number of the transaction node, and the execution of the transaction node.
  • the IP address and port of the transaction, the event address and port of the event registration for each trading node may be the same, and the ports may be different.
  • the properties of the trading node are recorded in the configuration file or database.
  • the transaction request is processed to generate a preliminary transaction processing result.
  • the current transaction node may, after obtaining the transaction request, perform verification and decryption on the transaction request to obtain the transaction identifier and the transaction data, and process the transaction data to obtain a preliminary transaction processing result, and the preliminary transaction is obtained.
  • the processing result is returned to the trading server.
  • S204 Receive parameters of the switched transaction node that is in the same cluster as the current transaction node when the current transaction node fails.
  • the transaction node cluster can replace the current transaction node with another non-failed transaction node in the cluster, so that the transaction can continue, and since all transaction nodes in the transaction node cluster share storage Space, so that the switched trading node can continue to process the current transaction request from the location where the current trading node fails, without reprocessing, which can save a lot of processing time.
  • the transaction node cluster sends the parameters of the switched transaction node to the transaction server, so that the transaction server can change the content in the configuration file or the database, so that the transaction service can be understood in real time. To the case where the properties of the trading node change.
  • the transaction server may first perform event registration to each currently available transaction node and perform RPC (remote procedure call) of the event; when the attribute of the transaction node changes, the transaction server may receive the event message and receive the message.
  • the mode can be asynchronous non-blocking, that is, the transaction server can still continue other event processing.
  • the return of the initial transaction processing result of the transaction node is also returned to the transaction server by means of the event message. Therefore, when the transaction server receives the event message, it may first determine that the event message is a normal transaction node to complete the transaction execution according to the type of the event message.
  • the event notification is also a failure of the transaction node itself, that is, an event message in which the transaction node itself changes.
  • the event message is a message that the transaction node itself is faulty
  • S206 The transaction server replaces the parameter of the current transaction node with the parameter of the switched transaction node.
  • the signature of the message of the event message is first validated. If it is valid, it is determined whether the IP address or port of the transaction node, or the event address or port is changed. , the configuration file or database will be updated. If not, that is, the message event is the status and execution result of the transaction node, the configuration file or database will not be updated, and the preliminary transaction processing result returned by the transaction node is saved.
  • S208 Receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
  • the transaction server stores according to the transaction identifier, and after all the transaction nodes or a preset number of transaction nodes return the preliminary transaction processing result, the target can be obtained according to the preset processing strategy.
  • Transaction processing results The transaction server controls the execution of the transaction, and ensures the consistency of the transaction result based on the processing strategy.
  • the transaction node is mainly used to complete the execution of the transaction and store the consistency processing result of the transaction, and the transaction node is related to the transaction before executing the transaction.
  • the parameters are initialized, and the sorting server sorts and stores the consistent results after the transaction, and provides the consistent result data of the transaction according to the request of the transaction node.
  • the transaction processing method if the current transaction node fails, directly switches to another transaction node in the same cluster as the current transaction node to continue processing the transaction request, and sends the parameter of the switched transaction node to the transaction server, so that the transaction server The transaction node after the switch is clearly understood, so that the transaction server can normally receive the initial transaction processing result returned by the transaction node, and does not need to monitor each transaction node in real time, thereby saving system resources and improving system performance.
  • the transaction processing method further includes: if the transaction node in the cluster corresponding to the current transaction node fails, receiving the transaction node failure information returned by the current transaction node; and the current transaction according to the information of the transaction node failure The node marks; if the current transaction node is processing the transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
  • the change of the transaction node includes three types, one is the registration of the transaction node, that is, the new transaction node is added to the system, and the other is the cancellation of the transaction node, that is, the existing transaction node exits the system, and one The change of the attributes of the transaction node, wherein the registration of the transaction node and the cancellation of the transaction node are performed by the transaction node actively sending a message to the transaction server, and the transaction server listens for and receives the message, and the transaction node attribute changes by the transaction.
  • the server first registers the event with the available trading node, and then when the transaction node property changes, the transaction server receives the event message of the change, and the message is signed by the transaction node and checked by the transaction server, and the signature verification is passed. Processing, and the processing results need to be confirmed by the transaction server to take effect.
  • the change of the attributes of the transaction node includes the change of the address and port of the transaction node, the event address and the port, and the change of the transaction process, the suspension of the storage process or the change of the transaction node itself. These three changes will lead to the connection. Errors, and these three errors indicate that the trading nodes in the cluster corresponding to the current trading node have failed. When the transaction server receives these three types of errors, the current trading node is directly marked, that is, marked as unavailable. So that the trading node will no longer be used later.
  • the transaction node when the transaction nodes in the cluster corresponding to the current transaction node all fail, the transaction node is marked, so that the transaction node is no longer used, and if the current transaction node is processing the transaction request, the token is directly marked.
  • the preliminary transaction processing result of this transaction corresponding to the current trading node is the transaction failure, which lays a foundation for the subsequent calculation of the target transaction result.
  • the transaction processing method may further include: if receiving the information of the current transaction node cancellation, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction request, the asynchronous non-blocking After the mode continues to wait for the preliminary transaction processing result returned by the current trading node, the parameters of the current trading node are deleted.
  • the transaction processing method may further include: if the registration information of the new transaction node is received, verifying the registration information; and when the verification is passed, adding the parameters of the new transaction node.
  • the transaction server when the transaction server receives the information of the transaction node cancellation, it first determines whether the current transaction node is processing the transaction request, and if so, the transaction server continues to wait for the current transaction node to return the preliminary transaction processing result through the asynchronous non-blocking mode, and then The parameters of the current trading node are deleted, so that the cancellation of the current trading node can be completed without affecting the transaction request being processed by the current trading node.
  • the transaction server When the transaction server receives the registration information of the transaction node, it will perform verification to prevent the criminals from obtaining the transaction information by registering the transaction node.
  • the CA server can be introduced, and the CA server delivers the transaction server to the secure transaction node.
  • the key or the certificate, the transaction node encrypts the registration information by the key, and when the transaction server receives the registration information of the transaction node, the transaction server first decrypts, and only after the decryption is passed, the transaction server completes the registration of the new transaction node according to the registration information.
  • the transaction server when the transaction server processes the transaction, it performs different processing according to the dynamic change of the transaction node and the processing strategy.
  • the dynamic change of the transaction node occurs before the execution of the transaction, and the latest update is obtained because the configuration file or the database is updated.
  • the node information is traded so that the transaction request is sent to the available trading nodes for execution and the preliminary transaction processing results are obtained.
  • the dynamic change of the trading node occurs in the execution of the transaction, there are two cases. One is that the transaction server has sent the transaction request to all available trading nodes, and the other is that the transaction server is sending the transaction request. The end of the transaction has not been completely sent, and it is possible to decide whether to terminate the processing of the transaction request according to the processing strategy.
  • the dynamic change of the trading node occurs after the execution of the transaction, and will not affect and change the current transaction processing result.
  • the step of calculating the target transaction processing result according to the preliminary transaction processing result may include: determining whether the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; If the number of successful preliminary transaction processing results is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
  • the transaction server After receiving the preliminary transaction processing result fed back by the transaction node, the transaction server queries the number of successful transaction results and obtains the target transaction result according to the transaction strategy.
  • the target transaction result is the transaction success. If there is a transaction node whose initial transaction processing result indicates that the transaction is unsuccessful, the target transaction result is obtained. It is a transaction failure. Under this trading strategy, the trading server queries the preliminary transaction processing result returned by the trading node, and when all the preliminary transaction processing results indicate that the transaction is successful, the target transaction result indicating that the transaction is successful is output, when there is a preliminary transaction processing result When the transaction is failed, the result of the target transaction indicating that the transaction failed is output.
  • the target trading result is the transaction success, if there is no preliminary transaction processing of n/2+1 trading nodes The result indicates success, then the target transaction result is a transaction failure, where n is the number of trading nodes.
  • the transaction server queries the preliminary transaction processing result returned by the trading node, and when at least n/2+1 preliminary transaction processing results indicate that the transaction is successful, the target transaction result indicating that the transaction is successful is output, when not When there are at least n/2+1 preliminary transaction processing results indicating that the transaction is successful, a target transaction result indicating that the transaction failed is output.
  • the transaction server obtains the target transaction result according to the preliminary transaction processing result returned by the transaction node, instead of relying on only one transaction node for processing, or the transaction nodes communicate with each other to obtain the target transaction result, and the processing procedure is simple and the result is reliable.
  • the transaction processing method may further include: the transaction server sends the target transaction result to the sorting server to cause the sorting server to sort the target transaction result in a preset order, and receive the data acquisition request of the current transaction node. And returning the target transaction result corresponding to the transaction request to the current transaction node according to the data acquisition request.
  • the transaction server sends the target transaction result to the sorting server for saving.
  • the sorting server sorts the target transaction results according to preset criteria, for example, it can be sorted and saved in chronological order.
  • the sorting server receives a data acquisition request of the current transaction node, where the data acquisition request includes a starting position of the data and a length of the data, and then the sorting server acquires the corresponding data according to the data obtaining request, and returns the data to the transaction node. Storage is fine.
  • the transaction node, the transaction server and the sorting server are designed and implemented based on secure communication, including encryption of sensitive data before sending, signing of general messages and event messages, and checking and decrypting when receiving messages. To obtain the message, it is also possible to secure the transport layer based on the secure transport protocol. And the flotation server design and implementation support a large number of trading nodes, can communicate with a large number of trading nodes and data transmission, data is stored persistently, using kafka cluster to achieve.
  • the large load amount of mutual monitoring and data synchronization between the transaction nodes is avoided, the transaction availability is reduced and the system performance is greatly reduced, the transaction server controls the execution of the transaction, and the transaction is guaranteed based on the processing strategy.
  • the consistency of the results; the trading node is mainly used to complete the execution of the transaction and store the consistent result of the transaction, the transaction node initializes the transaction-related data before executing the transaction; the sorting server sorts the consistency result after the transaction and Store and provide consistent result data for the transaction as required by the trading node.
  • steps in the flowchart of FIG. 2 are sequentially displayed as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these steps is not strictly limited, and the steps may be performed in other orders. Moreover, at least some of the steps in FIG. 2 may include a plurality of sub-steps or stages, which are not necessarily performed at the same time, but may be executed at different times, the execution of these sub-steps or stages The order is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of the other steps.
  • FIG. 3 is a schematic diagram of a blockchain transaction processing apparatus in accordance with one or more embodiments, the apparatus comprising:
  • the transaction request communication module 100 is configured to receive a transaction request, acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request.
  • the transaction parameter communication module 200 is configured to receive a parameter of the switched transaction node that is in the same cluster as the current transaction node when the current transaction node fails.
  • the replacement module 300 is configured to replace the parameter of the current transaction node with the parameter of the switched transaction node.
  • the processing module 400 is configured to receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
  • the apparatus may further include a fault receiving module, configured to receive the transaction node fault information returned by the current transaction node when the transaction node in the cluster corresponding to the current transaction node fails.
  • a marking module configured to mark the current trading node according to the information of the trading node failure; and if the current trading node is processing the transaction request, mark the preliminary transaction processing result corresponding to the current trading node as a transaction failure.
  • the apparatus may further include a logout module, configured to determine, when receiving the information of the current transaction node logout, whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction request, The non-blocking mode continues to wait for the preliminary transaction processing result returned by the current trading node, and then deletes the parameters of the current trading node.
  • a logout module configured to determine, when receiving the information of the current transaction node logout, whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction request, The non-blocking mode continues to wait for the preliminary transaction processing result returned by the current trading node, and then deletes the parameters of the current trading node.
  • the apparatus may further include a registration module for verifying the registration information upon receiving the registration information of the new transaction node; and adding the parameters of the new transaction node when the verification is passed.
  • the processing module is further configured to determine whether the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; and the number of preliminary transaction processing results indicating that the transaction is successful When the value is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
  • the apparatus further includes a sorting module, configured to send the target transaction result to the sorting server, so that the sorting server sorts the target transaction result in a preset order, and receives the data acquisition request of the current transaction node. Thereafter, the target transaction result corresponding to the transaction request is returned to the current trading node according to the data acquisition request.
  • a sorting module configured to send the target transaction result to the sorting server, so that the sorting server sorts the target transaction result in a preset order, and receives the data acquisition request of the current transaction node. Thereafter, the target transaction result corresponding to the transaction request is returned to the current trading node according to the data acquisition request.
  • Each of the above blockchain transaction processing devices may be implemented in whole or in part by software, hardware, and combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
  • a computer device which may be a server or a terminal.
  • the computer device is a server, such as a transaction server, its internal structure diagram can be as shown in FIG.
  • the computer device includes a processor, memory, and network interface coupled by a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-transitory computer readable instruction storage medium, an internal memory.
  • the non-transitory computer readable instruction storage medium stores an operating system and computer readable instructions.
  • the internal memory provides an environment for the operation of an operating system and computer readable instructions in a non-transitory computer readable instruction storage medium.
  • the network interface of the computer device is used to communicate with an external terminal via a network connection.
  • the computer readable instructions are executed by a processor to implement a transaction processing method.
  • FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • a computer device comprising a memory and one or more processors, the memory storing computer readable instructions, the computer readable instructions being executed by the processor, causing the one or more processors to perform the steps of: receiving a transaction request, And acquiring the current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving the switched transaction after the current transaction node fails, and the switched transaction is in the same cluster as the current transaction node.
  • the parameter of the node; the parameter of the current transaction node is replaced with the parameter of the switched transaction node; the preliminary transaction processing result returned by the switched transaction node is received, and the target transaction processing result is calculated according to the preliminary transaction processing result.
  • the processor may also implement the following steps when executing the computer readable instructions:
  • the information transaction server that returns the transaction node failure to the transaction server receives the transaction node failure information returned by the current transaction node; the transaction server according to the transaction node failure information The current transaction node is marked; if the current transaction node is processing the transaction request, the transaction server marks the preliminary transaction processing result corresponding to the current transaction node as a transaction failure.
  • the processor may further implement the following steps: when receiving the information of the current transaction node logout, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction The request deletes the parameters of the current transaction node after waiting for the preliminary transaction processing result returned by the current transaction node through the asynchronous non-blocking mode.
  • the processor may further implement the following steps when executing the computer readable instructions: verifying the registration information when the registration information of the new transaction node is received; adding a new transaction when the verification is passed The parameters of the node.
  • the processor may further implement the following steps when determining that the current transaction processing feedback of the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; If the number of successful preliminary transaction processing results is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
  • the processor may further implement the steps of: sending the target transaction result to the sorting server to cause the sorting server to sort the target transaction result in a preset order and receiving the current trading node when executing the computer readable instructions After the data acquisition request, the target transaction result corresponding to the transaction request is returned to the current transaction node according to the data acquisition request.
  • One or more non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of: receiving a transaction request, and obtaining The current trading node sends the transaction request to the current trading node to cause the current trading node to process the transaction request; and receives the parameter of the switched trading node that is switched in the same cluster as the current trading node when the current trading node fails.
  • the parameter of the current transaction node is replaced with the parameter of the switched transaction node; the preliminary transaction processing result returned by the switched transaction node is received, and the target transaction processing result is calculated according to the preliminary transaction processing result.
  • the following steps may be further implemented: if the transaction nodes in the cluster corresponding to the current transaction node both fail, receiving the transaction node failure returned by the current transaction node Information; the current transaction node is marked according to the information of the transaction node failure; if the current transaction node is processing the transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
  • the following steps may be further implemented: if receiving the information of the current transaction node cancellation, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction The request deletes the parameters of the current transaction node after waiting for the preliminary transaction processing result returned by the current transaction node through the asynchronous non-blocking mode.
  • the following steps may be further implemented: if the registration information of the new transaction node is received, the registration information is verified; when the verification is passed, a new one is added. The parameters of the trading node.
  • the step of calculating the target transaction processing result according to the preliminary transaction processing result implemented by the processor when the computer readable instruction is executed by the processor may include: determining that the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates the transaction Whether the number of success is greater than or equal to the preset value; when the number of preliminary transaction processing results indicating that the transaction is successful is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset When the value is, the target transaction result indicates that the transaction failed.
  • the computer readable instructions when executed by the processor may further implement the steps of: transmitting the target transaction result to the sorting server to cause the sorting server to sort the target transaction results in a preset order, and receiving the current transaction After the data acquisition request of the node, the target transaction result corresponding to the transaction request is returned to the current transaction node according to the data acquisition request.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM is available in a variety of formats, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronization chain.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • Synchlink DRAM SLDRAM
  • Memory Bus Radbus
  • RDRAM Direct RAM
  • DRAM Direct Memory Bus Dynamic RAM
  • RDRAM Memory Bus Dynamic RAM

Abstract

A transaction processing method comprises: receiving a transaction request, acquiring a current transaction node, and transmitting the transaction request to the current transaction node for processing; upon switchover to an alternative transaction node in the same cluster as the current transaction node due to occurrence of a failure in the current transaction node, receiving a parameter of the alternative transaction node; replacing a parameter of the current transaction node with the parameter of the alternative transaction node; and a transaction server receiving a preliminary transaction processing result returned by the alternative transaction node, and performing, according to the preliminary transaction processing result, calculation to obtain a target transaction processing result.

Description

交易处理方法、装置、计算机设备及存储介质Transaction processing method, device, computer device and storage medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年11月23日提交中国专利局,申请号为2017111807520,申请名称为“交易处理方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application entitled "Transaction Processing Method, Apparatus, Computer Equipment and Storage Media", filed on November 23, 2017, with the application number of 2017111807520, the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请涉及一种交易处理方法、装置、计算机设备及存储介质。The present application relates to a transaction processing method, apparatus, computer device, and storage medium.
背景技术Background technique
在区块链或基于PaxOS算法实现的分布式的交易系统中,需要多个交易节点参与交易,基于一定的处理策略达成共识。参与交易的交易节点存在动态变化的可能性,如交易节点宕机不能参与交易的计算或者不能存储交易的计算结果,但是交易不能因为部分交易节点的不可用而失去可用性,系统需要知道哪些交易节点可用,目前解决的方案是在交易节点之间互相监控及进行数据同步并在交易时从交易节点中选举出一个交易节点的领导者发起交易。如果有交易节点宕机并且宕机的交易节点落后正进行的交易进程太多,要么大幅牺牲整个系统的性能来允许宕机的交易节点参与计算,要么让宕机的交易节点不再参与选举和交易。在实践应用中考虑节点的最低数量要求,往往是让整个系统进行重启。In a blockchain or a distributed trading system based on the PaxOS algorithm, multiple trading nodes are required to participate in the transaction, and a consensus is reached based on a certain processing strategy. There is a possibility of dynamic changes in the trading nodes participating in the transaction. For example, the trading node may not participate in the calculation of the transaction or the calculation result of the transaction, but the transaction cannot lose the availability due to the unavailability of some trading nodes. The system needs to know which trading nodes. Available, the currently solution is to initiate a transaction between the trading nodes to monitor and synchronize data and to elect a leader of the trading node from the trading node during the transaction. If there is a trading node down and the trading node of the downtime is too far behind the ongoing trading process, either the performance of the entire system is sacrificed to allow the trading node of the downtime to participate in the calculation, or the trading node of the downtime is no longer involved in the election and transaction. Considering the minimum number of nodes in a practical application is often to restart the entire system.
这些方式和方法降低了系统的灵活性,采用传统的监控方式和交易节点之间的数据同步、选举模式等机制则让整个系统的负载过重过大,对宕机的交易节点的处理也大幅降低了系统功能上的可用性,整个系统的交易性能也大幅下降。These methods and methods reduce the flexibility of the system. The traditional monitoring method and the data synchronization between the transaction nodes and the election mode make the load of the whole system too heavy, and the processing of the transaction nodes of the downtime is also greatly increased. The usability of the system is reduced, and the transaction performance of the entire system is also greatly reduced.
发明内容Summary of the invention
根据本申请公开的各种实施例,提供一种交易处理方法、装置、计算机设备及存储介质。According to various embodiments disclosed herein, a transaction processing method, apparatus, computer device, and storage medium are provided.
一种交易处理方法,包括:A transaction processing method, including:
接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;Receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving when the current transaction node fails Switching parameters of the switched transaction node in the same cluster as the current transaction node;
将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
一种区块链交易处理装置,包括;A blockchain transaction processing device, comprising:
交易请求通信模块,用于接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;a transaction request communication module, configured to receive a transaction request, and acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request;
节点参数通信模块,用于接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;a node parameter communication module, configured to receive, when the current transaction node fails, a parameter of the switched transaction node that is switched after the current transaction node is in the same cluster;
替换模块,用于将当前交易节点的参数替换为切换后的交易节点的参数;及a replacement module, configured to replace parameters of the current trading node with parameters of the switched trading node; and
处理模块,用于接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。And a processing module, configured to receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;A computer device comprising a memory and one or more processors having stored therein computer readable instructions, the computer readable instructions being executable by the processor to cause the one or more processors to execute The following steps: receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving a failure at the current transaction node And a parameter of the switched transaction node that is switched in the same cluster as the current transaction node;
将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
一个或多个存储有计算机可读指令的非易失性计算机可读指令存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:One or more non-transitory computer readable instruction storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of:
接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;Receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving when the current transaction node fails Switching parameters of the switched transaction node in the same cluster as the current transaction node;
将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。Details of one or more embodiments of the present application are set forth in the accompanying drawings and description below. Other features and advantages of the present invention will be apparent from the description, drawings and claims.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some embodiments of the present application, Those skilled in the art can also obtain other drawings based on these drawings without any creative work.
图1为根据一个或多个实施例中的交易处理方法的应用环境图。1 is an application environment diagram of a transaction processing method in accordance with one or more embodiments.
图2为根据一个或多个实施例中的交易处理方法的流程图。2 is a flow diagram of a transaction processing method in accordance with one or more embodiments.
图3为根据一个或多个实施例中的区块链交易装置的框图。3 is a block diagram of a blockchain transaction device in accordance with one or more embodiments.
图4为根据一个或多个实施例中的计算机系统的框图。4 is a block diagram of a computer system in accordance with one or more embodiments.
具体实施方式Detailed ways
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用于解释本申请,并不用于限定本申请。In order to make the technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
请参阅图1,图1为一实施例中的交易处理方法的应用环境图,图1示出了交易服务器、交易节点以及排序服务器,其中交易节点可以是以集群的方式存在。该交易处理方法可以应用于区块链或基于PaxOS算法实现的分布式的交易系统。Please refer to FIG. 1. FIG. 1 is an application environment diagram of a transaction processing method in an embodiment. FIG. 1 shows a transaction server, a transaction node, and a sorting server, wherein the transaction nodes may exist in a cluster manner. The transaction processing method can be applied to a blockchain or a distributed transaction system implemented based on a PaxOS algorithm.
具体地,交易服务器中可以存储有配置文件或者设置有与交易服务器相对应的数据库,该配置文件或该数据库中存储有交易节点的IP地址和端口、交易节点的事件地址和端口。可以基于该配置文件或者数据库建立名义上的通道,通道中包含了所有可用的交易节点,交易服务器可以接受通道中新的交易节点的注册、原交易节点的注销以及原交易节点的属性的改变。其中由于交易节点是以集群的方式存在的,因此原交易节点的属性的改变包括两种方式:一种是交易节点集群中当前交易节点故障,由替代交易节点继续处理交易,这种情况下,交易节点继续工作,仅是事件的地址和端口发生改变。另外一种是当前交易节点本身宕机或当前交易节点的交易进程中止或当前交易节点的存储进程中止,该种情况下当前交易节点不再参与后续的交易。交易服务器还可以向每个可用的交易节点注册交易处理事件,接收每个交易节点交易完成后的事件通知,即接收每个交易节点返回的初步交易处理结果,并把初步交易处理结果进行汇总后得到目标处理结果,将目标处理结果存储至排序服务器。交易服务器可以在集群的基础上实现负载平衡,提高可用性和高效性。Specifically, the transaction server may store a configuration file or a database corresponding to the transaction server, where the configuration file or the database stores the IP address and port of the transaction node, the event address and port of the transaction node. A nominal channel can be established based on the configuration file or database. The channel contains all available trading nodes. The trading server can accept the registration of new trading nodes in the channel, the logout of the original trading node, and the change of the attributes of the original trading node. In this case, since the transaction node exists in a cluster manner, the change of the attribute of the original transaction node includes two ways: one is that the current transaction node in the transaction node cluster is faulty, and the transaction is continued by the replacement transaction node. The trading node continues to work, only the address and port of the event change. The other is that the current trading node itself is down or the trading process of the current trading node is aborted or the storage process of the current trading node is aborted. In this case, the current trading node is no longer involved in subsequent transactions. The transaction server may also register a transaction processing event with each available transaction node, receive an event notification after completion of each transaction node transaction, that is, receive the preliminary transaction processing result returned by each transaction node, and summarize the preliminary transaction processing result. The target processing result is obtained, and the target processing result is stored to the sorting server. The transaction server can achieve load balancing on a cluster basis, improving availability and efficiency.
交易节点是具有计算功能和存储计算的数据结果功能的,且每个交易节点的加入都经过了交易服务器的信任验证。每个交易节点均是以主备节点或 节点集群的方式存在的,在执行交易的计算功能时,只有一个节点执行计算功能,其余节点作为备份使用,交易节点中的所有节点共享同一个数据存储设备。交易节点在向排序服务器拉取数据时,参数可以包括数据的起始位置和数据的长度,然后排序服务器把数据提交给交易节点的当前节点,提交完成后,交易节点将排序服务器返回的目标交易结果存储在自己的数据存储设备中。在交易节点的计算进程中止前,交易节点可以通过事件消息发送给交易服务器,交易服务器可以更新配置文件或数据库。另外交易节点可以在集群的基础上实现负载平衡,提高可用性和高效性。The trading node is a data result function with calculation function and storage calculation, and each transaction node joins the trust verification of the transaction server. Each transaction node exists as a master-slave node or a cluster of nodes. When performing the transaction calculation function, only one node performs the calculation function, and the other nodes are used as backups. All nodes in the transaction node share the same data storage. device. When the transaction node pulls data to the sorting server, the parameters may include the starting position of the data and the length of the data, and then the sorting server submits the data to the current node of the trading node. After the submission is completed, the trading node will sort the target transaction returned by the server. The results are stored in their own data storage device. Before the trading process of the trading node is aborted, the trading node can send an event message to the trading server, and the trading server can update the configuration file or the database. In addition, trading nodes can achieve load balancing on the basis of clusters, improving availability and efficiency.
排序服务器可以接收交易服务器的目标交易结果,并对目标交易结果按照时间先后顺序进行排序和存储,从而在接收到交易节点的数据获取请求时,排序服务器可以将正确的目标交易结果返回给对应的交易节点。其中排序服务器可以以集群和集群之间数据同步的方式向外提供服务,从而提供数据持久化和高吞吐的性能。The sorting server can receive the target transaction result of the transaction server, and sort and store the target transaction result in chronological order, so that when receiving the data acquisition request of the transaction node, the sorting server can return the correct target transaction result to the corresponding Trading node. The sorting server can provide services out of data synchronization between the cluster and the cluster, providing data persistence and high throughput performance.
在其中一个实施例中,请参阅图2,提供一种交易处理方法,本实施例以该方法应用到上述图1中的交易服务器来举例说明。该方法具体包括如下步骤:In one embodiment, referring to FIG. 2, a transaction processing method is provided. This embodiment is exemplified by applying the method to the transaction server in FIG. 1 described above. The method specifically includes the following steps:
S202:接收交易请求,并获取当前交易节点,将交易请求发送至当前交易节点,以使当前交易节点对交易请求进行处理。S202: Receive a transaction request, and acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request.
具体地,交易服务器接收外部的交易请求后可以对该交易请求进行验证,例如交易服务器预先与外部约定好加解密方式及算法、加签和验签方式及算法等,在交易服务器接收到交易请求时,首先根据预先约定的验签方式进行验签,然后根据预定的解密方式进行解密从而可以获取交易数据等。Specifically, the transaction server can verify the transaction request after receiving the external transaction request, for example, the transaction server pre-arranges the encryption and decryption method and algorithm, the signing and verification method and the algorithm, and the like, and receives the transaction request at the transaction server. At the same time, the verification is first performed according to the pre-agreed verification method, and then the decryption is performed according to a predetermined decryption method to obtain transaction data and the like.
交易服务器获取当前交易节点可以是交易服务器查询配置文件或数据库等获取交易节点,其中交易服务器可以在配置文件或数据库中建立通道,通道可以与交易类型相关联,从而交易服务器可以根据配置文件或数据库中存储的交易节点的属性等获取到当前交易节点,并将交易请求发送到该当前交易节点。进一步地,交易服务器可以对解密后的交易数据进行加密,并生成对应的交易标识,然后将该交易标识和交易数据发送给对应的当前交易节点,其中交易标识为可以唯一确定本次交易的标识。The transaction server obtains the current transaction node, which may be a transaction server query configuration file or a database, etc., wherein the transaction server may establish a channel in the configuration file or the database, and the channel may be associated with the transaction type, so that the transaction server may be based on the configuration file or the database. The attribute of the transaction node stored in the middle is acquired to the current transaction node, and the transaction request is sent to the current transaction node. Further, the transaction server may encrypt the decrypted transaction data, generate a corresponding transaction identifier, and then send the transaction identifier and the transaction data to the corresponding current transaction node, wherein the transaction identifier is an identifier that can uniquely determine the transaction. .
其中,交易服务器还可以对配置文件或数据库的变更设计优先级,例如交易节点的属性发生变化引起的配置文件或数据库的变更的优先级最高,交易节点注销引起的配置文件或数据库的变更的优先级其次,交易节点的注册引起的配置文件的优先级最低,相同优先级以队列的方式进行排队处理,且配置文件或数据库的更新只能由交易服务器进行。且交易服务器可以建立通道的概念,通道中包含了可用的交易节点,且通道可以与交易类型相关联, 每个交易节点的属性包括交易节点的标识,可以为交易节点的编号,交易节点的执行交易的IP地址和端口、每个交易节点的事件注册的事件地址和端口。其中每个交易节点执行交易的IP地址和交易节点事件注册的地址可以是相同,端口可以是不同的。交易节点的属性均记录在配置文件或数据库中。The transaction server may also prioritize changes to the configuration file or the database. For example, the configuration file or the database change caused by the change of the transaction node attribute has the highest priority, and the change of the configuration file or the database caused by the transaction node logout is prioritized. Secondly, the configuration file caused by the registration of the transaction node has the lowest priority, the same priority is queued in the manner of queue, and the update of the configuration file or database can only be performed by the transaction server. And the transaction server can establish the concept of the channel, the channel contains the available transaction nodes, and the channel can be associated with the transaction type. The attributes of each transaction node include the identifier of the transaction node, which can be the number of the transaction node, and the execution of the transaction node. The IP address and port of the transaction, the event address and port of the event registration for each trading node. The IP address where each transaction node executes the transaction and the address registered by the transaction node event may be the same, and the ports may be different. The properties of the trading node are recorded in the configuration file or database.
具体地,当前交易节点在获取到交易请求后,对该交易请求进行处理以生成初步交易处理结果。进一步地,当前交易节点可以在获取到交易请求后,对该交易请求进行验签和解密以获取到交易标识和交易数据,并对交易数据进行处理后得到初步交易处理结果,并将该初步交易处理结果返回至交易服务器。Specifically, after the current transaction node acquires the transaction request, the transaction request is processed to generate a preliminary transaction processing result. Further, the current transaction node may, after obtaining the transaction request, perform verification and decryption on the transaction request to obtain the transaction identifier and the transaction data, and process the transaction data to obtain a preliminary transaction processing result, and the preliminary transaction is obtained. The processing result is returned to the trading server.
S204:接收在当前交易节点发生故障时、所切换的与当前交易节点处于同一集群的切换后的交易节点的参数。S204: Receive parameters of the switched transaction node that is in the same cluster as the current transaction node when the current transaction node fails.
具体地,若当前交易节点发生故障,则交易节点集群可以用集群中另一未发生故障的交易节点替换该当前交易节点,从而交易可以继续进行,且由于交易节点集群中的所有交易节点共享存储空间,从而切换后的交易节点可以从当前交易节点出现故障的位置处继续处理当前交易请求,而无需重新处理,这样可以节省大量的处理时间。且为了实现与服务器的沟通,在当前交易节点被切换后,交易节点集群将切换后的交易节点的参数发送至交易服务器,从而交易服务器可以更改配置文件或数据库中的内容,使得交易服务实时了解到交易节点属性变化的情况。Specifically, if the current transaction node fails, the transaction node cluster can replace the current transaction node with another non-failed transaction node in the cluster, so that the transaction can continue, and since all transaction nodes in the transaction node cluster share storage Space, so that the switched trading node can continue to process the current transaction request from the location where the current trading node fails, without reprocessing, which can save a lot of processing time. And in order to realize communication with the server, after the current transaction node is switched, the transaction node cluster sends the parameters of the switched transaction node to the transaction server, so that the transaction server can change the content in the configuration file or the database, so that the transaction service can be understood in real time. To the case where the properties of the trading node change.
其中,交易服务器可以首先向当前每个可用的交易节点进行事件注册,并进行事件的RPC(远程过程调用);当交易节点的属性发生变化时,交易服务器则可以接收到事件消息,接收消息的方式可以是异步非阻塞,即交易服务器仍可以继续其他的事件处理。此外,交易节点的初步交易处理结果的返回也是通过事件消息的方式返回给交易服务器,因此当交易服务器接收到事件消息时,可以首先根据事件消息的类型,确定事件消息是正常交易节点完成交易执行的事件通知还是交易节点本身故障,即交易节点本身发生变化的事件消息。然后若事件消息是交易节点本身故障的消息,则首先判断该消息表示的是否为交易节点的IP地址或端口、或事件地址或端口发生变换,若是则会根据对应的处理策略进行处理。The transaction server may first perform event registration to each currently available transaction node and perform RPC (remote procedure call) of the event; when the attribute of the transaction node changes, the transaction server may receive the event message and receive the message. The mode can be asynchronous non-blocking, that is, the transaction server can still continue other event processing. In addition, the return of the initial transaction processing result of the transaction node is also returned to the transaction server by means of the event message. Therefore, when the transaction server receives the event message, it may first determine that the event message is a normal transaction node to complete the transaction execution according to the type of the event message. The event notification is also a failure of the transaction node itself, that is, an event message in which the transaction node itself changes. Then, if the event message is a message that the transaction node itself is faulty, it is first determined whether the message indicates that the transaction node's IP address or port, or the event address or port is transformed, and if so, processing is performed according to the corresponding processing policy.
S206:交易服务器将当前交易节点的参数替换为切换后的交易节点的参数。S206: The transaction server replaces the parameter of the current transaction node with the parameter of the switched transaction node.
具体地,当交易服务器接收到的事件消息后,首先会验证事件消息的报文的签名是否有效,若有效,则确定是否为交易节点的IP地址或端口、或事件地址或端口发生变换,若是,则会更新配置文件或数据库,若不是,即消息事件是交易节点执行的状态和执行结果,则不会更新配置文件或数据库, 则是将交易节点所返回的初步交易处理结果进行保存。Specifically, after the event message received by the transaction server, the signature of the message of the event message is first validated. If it is valid, it is determined whether the IP address or port of the transaction node, or the event address or port is changed. , the configuration file or database will be updated. If not, that is, the message event is the status and execution result of the transaction node, the configuration file or database will not be updated, and the preliminary transaction processing result returned by the transaction node is saved.
S208:接收切换后的交易节点返回的初步交易处理结果,并根据初步交易处理结果计算目标交易处理结果。S208: Receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
具体地,交易服务器在接收到初步交易处理结果后,根据交易标识进行存储,且在所有的交易节点或者预设数量的交易节点返回了初步交易处理结果后,根据预设的处理策略可以得到目标交易处理结果。其中交易服务器对于交易的执行进行控制,并基于处理策略保证交易结果的一致性,交易节点主要用于完成交易的执行以及对交易的一致性处理结果进行存储,交易节点在执行交易前对交易相关的参数进行初始化,排序服务器则对交易后的一致性结果进行排序和存储,并根据交易节点的请求提供交易的一致性结果数据。Specifically, after receiving the preliminary transaction processing result, the transaction server stores according to the transaction identifier, and after all the transaction nodes or a preset number of transaction nodes return the preliminary transaction processing result, the target can be obtained according to the preset processing strategy. Transaction processing results. The transaction server controls the execution of the transaction, and ensures the consistency of the transaction result based on the processing strategy. The transaction node is mainly used to complete the execution of the transaction and store the consistency processing result of the transaction, and the transaction node is related to the transaction before executing the transaction. The parameters are initialized, and the sorting server sorts and stores the consistent results after the transaction, and provides the consistent result data of the transaction according to the request of the transaction node.
上述交易处理方法,若当前交易节点发生故障,则直接切换到与当前交易节点处于同一集群的另一交易节点继续处理交易请求,并将切换后的交易节点的参数发送至交易服务器,使得交易服务器明确了解到切换后的交易节点,从而交易服务器可以正常接收交易节点返回的初步交易处理结果,不需要实时监控每个交易节点,节约了系统资源,提高了系统的性能。The transaction processing method, if the current transaction node fails, directly switches to another transaction node in the same cluster as the current transaction node to continue processing the transaction request, and sends the parameter of the switched transaction node to the transaction server, so that the transaction server The transaction node after the switch is clearly understood, so that the transaction server can normally receive the initial transaction processing result returned by the transaction node, and does not need to monitor each transaction node in real time, thereby saving system resources and improving system performance.
在其中一个实施例中,该交易处理方法还包括:若与当前交易节点对应的集群中的交易节点均发生故障,接收当前交易节点返回的交易节点故障信息;根据交易节点故障的信息对当前交易节点进行标记;若当前交易节点正在处理交易请求,则将与当前交易节点对应的初步交易处理结果标记为交易失败。In one embodiment, the transaction processing method further includes: if the transaction node in the cluster corresponding to the current transaction node fails, receiving the transaction node failure information returned by the current transaction node; and the current transaction according to the information of the transaction node failure The node marks; if the current transaction node is processing the transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
具体地,交易节点的变化包括三种类型,一种是交易节点的注册,即存在新的交易节点加入到系统中,一种是交易节点的注销,即已有的交易节点退出系统,还有一种是交易节点的属性的变化,其中交易节点的注册和交易节点的注销均是由交易节点主动向交易服务器发送消息,而交易服务器则监听并接收消息,而交易节点属性的变化则是由交易服务器先向可用的交易节点进行事件注册,然后当交易节点属性变化时,交易服务器会接收到该变化的事件消息,消息会由交易节点签名并由交易服务器验签,签名验证通过后才会进行处理,并且处理结果需要得到交易服务器的确认后才会生效。Specifically, the change of the transaction node includes three types, one is the registration of the transaction node, that is, the new transaction node is added to the system, and the other is the cancellation of the transaction node, that is, the existing transaction node exits the system, and one The change of the attributes of the transaction node, wherein the registration of the transaction node and the cancellation of the transaction node are performed by the transaction node actively sending a message to the transaction server, and the transaction server listens for and receives the message, and the transaction node attribute changes by the transaction. The server first registers the event with the available trading node, and then when the transaction node property changes, the transaction server receives the event message of the change, and the message is signed by the transaction node and checked by the transaction server, and the signature verification is passed. Processing, and the processing results need to be confirmed by the transaction server to take effect.
其中交易节点的属性的变化包括上述交易节点的地址和端口、事件地址和端口的变化,还有一种是交易进程中止、存储进程中止或交易节点本身宕机的变化,这三种变化都会导致连接错误,且会导致这三种错误则表示当前交易节点对应的集群中的交易节点均发生故障,交易服务器接收到这三种错误时,则直接对该当前交易节点进行标记,即标记为不可用,从而后续不会再使用该交易节点。The change of the attributes of the transaction node includes the change of the address and port of the transaction node, the event address and the port, and the change of the transaction process, the suspension of the storage process or the change of the transaction node itself. These three changes will lead to the connection. Errors, and these three errors indicate that the trading nodes in the cluster corresponding to the current trading node have failed. When the transaction server receives these three types of errors, the current trading node is directly marked, that is, marked as unavailable. So that the trading node will no longer be used later.
上述实施例中,当当前交易节点对应的集群中的交易节点均发生故障时, 则对交易节点进行标记,从而后续不再使用该交易节点,且若当前交易节点正在处理交易请求,则直接标记当前交易节点对应的本次交易的初步交易处理结果为交易失败,从后续计算目标交易结果奠定了基础。In the above embodiment, when the transaction nodes in the cluster corresponding to the current transaction node all fail, the transaction node is marked, so that the transaction node is no longer used, and if the current transaction node is processing the transaction request, the token is directly marked. The preliminary transaction processing result of this transaction corresponding to the current trading node is the transaction failure, which lays a foundation for the subsequent calculation of the target transaction result.
在其中一个实施例中,该交易处理方法还可以包括:若接收到当前交易节点注销的信息,则判断当前交易节点是否正在处理交易请求;若当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待当前交易节点返回的初步交易处理结果后,将当前交易节点的参数删除。In one embodiment, the transaction processing method may further include: if receiving the information of the current transaction node cancellation, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction request, the asynchronous non-blocking After the mode continues to wait for the preliminary transaction processing result returned by the current trading node, the parameters of the current trading node are deleted.
在其中一个实施例中,该交易处理方法还可以包括:若接收新的交易节点的注册信息,则对注册信息进行验证;当验证通过后,则添加新的交易节点的参数。In one embodiment, the transaction processing method may further include: if the registration information of the new transaction node is received, verifying the registration information; and when the verification is passed, adding the parameters of the new transaction node.
具体地,当交易服务器接收到交易节点注销的信息时,则首先判断当前交易节点是否正在处理交易请求,若是,则交易服务器通过异步非阻塞方式继续等待当前交易节点返回初步交易处理结果,然后再将当前交易节点的参数删除,这样才能完成当前交易节点的注销,且不影响当前交易节点正在处理的交易请求。Specifically, when the transaction server receives the information of the transaction node cancellation, it first determines whether the current transaction node is processing the transaction request, and if so, the transaction server continues to wait for the current transaction node to return the preliminary transaction processing result through the asynchronous non-blocking mode, and then The parameters of the current trading node are deleted, so that the cancellation of the current trading node can be completed without affecting the transaction request being processed by the current trading node.
当交易服务器接收到交易节点的注册的信息时,则会进行验证,防止不法分子通过注册交易节点的方式获取到交易信息,例如可以引入CA服务器,CA服务器向安全的交易节点下发交易服务器的密钥或证书,交易节点通过密钥加密注册信息,交易服务器接收到交易节点的注册信息时,首先进行解密,只有解密通过后,交易服务器才会根据注册信息完成新的交易节点的注册。When the transaction server receives the registration information of the transaction node, it will perform verification to prevent the criminals from obtaining the transaction information by registering the transaction node. For example, the CA server can be introduced, and the CA server delivers the transaction server to the secure transaction node. The key or the certificate, the transaction node encrypts the registration information by the key, and when the transaction server receives the registration information of the transaction node, the transaction server first decrypts, and only after the decryption is passed, the transaction server completes the registration of the new transaction node according to the registration information.
上述实施例中,交易服务器处理交易时会根据交易节点的动态变化结合处理策略进行不同的处理,交易节点的动态变化发生在交易执行前,则会因为配置文件或数据库进行了更新而获得最新的交易节点信息,这样交易请求会发送给可用的交易节点进行执行并获取初步交易处理结果。若交易节点的动态变化发生在交易执行中,则包括两种情况,一种是交易服务器已经把交易请求发送给了所有可用的交易节点,另外一种是交易服务器正在发送交易请求的过程中,尚未完全发送结束,这时可以根据处理策略决定是否终止交易请求的处理。交易节点的动态变化发生在交易执行完毕后,则不会影响和改变当前交易处理结果。In the above embodiment, when the transaction server processes the transaction, it performs different processing according to the dynamic change of the transaction node and the processing strategy. The dynamic change of the transaction node occurs before the execution of the transaction, and the latest update is obtained because the configuration file or the database is updated. The node information is traded so that the transaction request is sent to the available trading nodes for execution and the preliminary transaction processing results are obtained. If the dynamic change of the trading node occurs in the execution of the transaction, there are two cases. One is that the transaction server has sent the transaction request to all available trading nodes, and the other is that the transaction server is sending the transaction request. The end of the transaction has not been completely sent, and it is possible to decide whether to terminate the processing of the transaction request according to the processing strategy. The dynamic change of the trading node occurs after the execution of the transaction, and will not affect and change the current transaction processing result.
在其中一个实施例中,根据初步交易处理结果计算目标交易处理结果的步骤可以包括:判断参与交易的当前交易节点反馈的初步交易处理结果表示交易成功的数量是否大于等于预设值;当表示交易成功的初步交易处理结果的数量大于等于预设值时,则目标交易结果表示交易成功;当表示交易成功的初步交易处理结果的数量小于预设值时,则目标交易结果表示交易失败。In one embodiment, the step of calculating the target transaction processing result according to the preliminary transaction processing result may include: determining whether the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; If the number of successful preliminary transaction processing results is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
具体地,交易服务器在接收到交易节点反馈的初步交易处理结果后,查 询表示成功的交易结果的数量,并根据交易策略得到目标交易结果。Specifically, after receiving the preliminary transaction processing result fed back by the transaction node, the transaction server queries the number of successful transaction results and obtains the target transaction result according to the transaction strategy.
例如,交易策略是交易服务器中所有的交易节点的初步交易处理结果均需表示交易成功,则目标交易结果才是交易成功,若存在一个交易节点的初步交易处理结果表示未成功,则目标交易结果是交易失败。在这种交易策略下,交易服务器查询交易节点所返回的初步交易处理结果,当所有的初步交易处理结果均表示交易成功时,则输出表示交易成功的目标交易结果,当存在一个初步交易处理结果表示交易失败时,则输出表示交易失败的目标交易结果。For example, if the trading strategy is that the initial transaction processing result of all the trading nodes in the transaction server needs to indicate that the transaction is successful, then the target transaction result is the transaction success. If there is a transaction node whose initial transaction processing result indicates that the transaction is unsuccessful, the target transaction result is obtained. It is a transaction failure. Under this trading strategy, the trading server queries the preliminary transaction processing result returned by the trading node, and when all the preliminary transaction processing results indicate that the transaction is successful, the target transaction result indicating that the transaction is successful is output, when there is a preliminary transaction processing result When the transaction is failed, the result of the target transaction indicating that the transaction failed is output.
当交易策略是通道中至少n/2+1个交易节点的初步交易处理结果均需表示交易成功,则目标交易结果才是交易成功,若不存在n/2+1个交易节点的初步交易处理结果表示成功,则目标交易结果是交易失败,其中n为交易节点的个数。在这种交易策略下,交易服务器查询交易节点所返回的初步交易处理结果,当至少n/2+1个初步交易处理结果均表示交易成功时,则输出表示交易成功的目标交易结果,当不存在至少n/2+1个初步交易处理结果表示交易成功时,则输出表示交易失败的目标交易结果。When the trading strategy is that at least n/2+1 trading nodes in the channel have a preliminary transaction processing result indicating that the transaction is successful, the target trading result is the transaction success, if there is no preliminary transaction processing of n/2+1 trading nodes The result indicates success, then the target transaction result is a transaction failure, where n is the number of trading nodes. Under this trading strategy, the transaction server queries the preliminary transaction processing result returned by the trading node, and when at least n/2+1 preliminary transaction processing results indicate that the transaction is successful, the target transaction result indicating that the transaction is successful is output, when not When there are at least n/2+1 preliminary transaction processing results indicating that the transaction is successful, a target transaction result indicating that the transaction failed is output.
上述实施例中,交易服务器根据交易节点返回的初步交易处理结果得到目标交易结果,而不是仅仅依靠一个交易节点进行处理,或者交易节点之间互相通信得到目标交易结果,处理过程简单、结果可靠。In the above embodiment, the transaction server obtains the target transaction result according to the preliminary transaction processing result returned by the transaction node, instead of relying on only one transaction node for processing, or the transaction nodes communicate with each other to obtain the target transaction result, and the processing procedure is simple and the result is reliable.
在其中一个实施例中,该交易处理方法还可以包括:交易服务器将目标交易结果发送至排序服务器以使排序服务器按照预设顺序对目标交易结果进行排序,并接收当前交易节点的数据获取请求后,根据数据获取请求向当前交易节点返回与交易请求对应的目标交易结果。In one embodiment, the transaction processing method may further include: the transaction server sends the target transaction result to the sorting server to cause the sorting server to sort the target transaction result in a preset order, and receive the data acquisition request of the current transaction node. And returning the target transaction result corresponding to the transaction request to the current transaction node according to the data acquisition request.
具体地,交易服务器每次计算出目标交易结果后,都将目标交易结果发送至排序服务器进行保存。排序服务器在接收到目标交易结果后,按照预设标准对目标交易结果进行排序,例如可以按照时间顺序进行排序并保存。排序服务器接收当前交易节点的数据获取请求,该数据获取请求中包括数据的起始位置和数据的长度,然后排序服务器根据该数据获取请求获取到相应的数据,并将该数据返回给交易节点进行存储即可以。Specifically, each time the transaction server calculates the target transaction result, the transaction server sends the target transaction result to the sorting server for saving. After receiving the target transaction result, the sorting server sorts the target transaction results according to preset criteria, for example, it can be sorted and saved in chronological order. The sorting server receives a data acquisition request of the current transaction node, where the data acquisition request includes a starting position of the data and a length of the data, and then the sorting server acquires the corresponding data according to the data obtaining request, and returns the data to the transaction node. Storage is fine.
其中交易节点、交易服务器以及排序服务器之间是基于安全通信进行设计和实现的,包括发送前对敏感数据的加密,对通用消息和事件消息进行加签,接收消息时以验签和解密的方式来获取消息,同时还可以基于安全传输协议进行传输层的安全保障。且飘絮服务器设计和实现支持了大批量的交易节点,能同时与大量的交易节点进行通信和数据的传输,数据进行了持久化存储,采用了kafka集群来实现。The transaction node, the transaction server and the sorting server are designed and implemented based on secure communication, including encryption of sensitive data before sending, signing of general messages and event messages, and checking and decrypting when receiving messages. To obtain the message, it is also possible to secure the transport layer based on the secure transport protocol. And the flotation server design and implementation support a large number of trading nodes, can communicate with a large number of trading nodes and data transmission, data is stored persistently, using kafka cluster to achieve.
上述实施例中,避免了交易节点之间的彼此监控和数据同步的大的负载 量,避免交易的可用性下降和系统性能的大幅下降,交易服务器对交易的执行进行控制,并基于处理策略保证交易结果的一致性;交易节点主要用于完成交易的执行及对交易的一致性结果进行存储,交易节点在执行交易前对交易相关的数据进行初始化;排序服务器对交易后的一致性结果进行排序和存储并根据交易节点的要求提供交易的一致性结果数据。In the above embodiment, the large load amount of mutual monitoring and data synchronization between the transaction nodes is avoided, the transaction availability is reduced and the system performance is greatly reduced, the transaction server controls the execution of the transaction, and the transaction is guaranteed based on the processing strategy. The consistency of the results; the trading node is mainly used to complete the execution of the transaction and store the consistent result of the transaction, the transaction node initializes the transaction-related data before executing the transaction; the sorting server sorts the consistency result after the transaction and Store and provide consistent result data for the transaction as required by the trading node.
应该理解的是,虽然图2的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of FIG. 2 are sequentially displayed as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these steps is not strictly limited, and the steps may be performed in other orders. Moreover, at least some of the steps in FIG. 2 may include a plurality of sub-steps or stages, which are not necessarily performed at the same time, but may be executed at different times, the execution of these sub-steps or stages The order is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of the other steps.
继续参阅图3,图3为根据一个或多个实施例中的区块链交易处理装置的示意图,该装置包括:With continued reference to FIG. 3, FIG. 3 is a schematic diagram of a blockchain transaction processing apparatus in accordance with one or more embodiments, the apparatus comprising:
交易请求通信模块100,用于接收交易请求,并获取当前交易节点,将交易请求发送至当前交易节点,以使当前交易节点对交易请求进行处理。The transaction request communication module 100 is configured to receive a transaction request, acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request.
交易参数通信模块200,用于接收在当前交易节点发生故障时、所切换的与当前交易节点处于同一集群的切换后的交易节点的参数。The transaction parameter communication module 200 is configured to receive a parameter of the switched transaction node that is in the same cluster as the current transaction node when the current transaction node fails.
替换模块300,用于将当前交易节点的参数替换为切换后的交易节点的参数。The replacement module 300 is configured to replace the parameter of the current transaction node with the parameter of the switched transaction node.
处理模块400,用于接收切换后的交易节点返回的初步交易处理结果,并根据初步交易处理结果计算目标交易处理结果。The processing module 400 is configured to receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
在其中一个实施例中,该装置还可以包括故障接收模块,用于在与当前交易节点对应的集群中的交易节点均发生故障,则接收当前交易节点返回的交易节点故障信息。In one embodiment, the apparatus may further include a fault receiving module, configured to receive the transaction node fault information returned by the current transaction node when the transaction node in the cluster corresponding to the current transaction node fails.
标记模块,用于根据交易节点故障的信息对当前交易节点进行标记;且若当前交易节点正在处理交易请求,则将与当前交易节点对应的初步交易处理结果标记为交易失败。a marking module, configured to mark the current trading node according to the information of the trading node failure; and if the current trading node is processing the transaction request, mark the preliminary transaction processing result corresponding to the current trading node as a transaction failure.
在其中一个实施例中,该装置还可以包括注销模块,用于在接收到当前交易节点注销的信息时,判断当前交易节点是否正在处理交易请求;若当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待当前交易节点返回的初步交易处理结果后,将当前交易节点的参数删除。In one embodiment, the apparatus may further include a logout module, configured to determine, when receiving the information of the current transaction node logout, whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction request, The non-blocking mode continues to wait for the preliminary transaction processing result returned by the current trading node, and then deletes the parameters of the current trading node.
在其中一个实施例中,该装置还可以包括注册模块,用于在接收到新的交易节点的注册信息时,对注册信息进行验证;当验证通过后,则添加新的 交易节点的参数。In one of the embodiments, the apparatus may further include a registration module for verifying the registration information upon receiving the registration information of the new transaction node; and adding the parameters of the new transaction node when the verification is passed.
在其中一个实施例中,所述处理模块还用于判断参与交易的当前交易节点反馈的初步交易处理结果表示交易成功的数量是否大于等于预设值;当表示交易成功的初步交易处理结果的数量大于等于预设值时,则目标交易结果表示交易成功;当表示交易成功的初步交易处理结果的数量小于预设值时,则目标交易结果表示交易失败。In one embodiment, the processing module is further configured to determine whether the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; and the number of preliminary transaction processing results indicating that the transaction is successful When the value is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
在其中一个实施例中,所述装置还包括排序模块,用于将目标交易结果发送至排序服务器,以使排序服务器按照预设顺序对目标交易结果进行排序,并接收当前交易节点的数据获取请求后,根据数据获取请求向当前交易节点返回与交易请求对应的目标交易结果。In one embodiment, the apparatus further includes a sorting module, configured to send the target transaction result to the sorting server, so that the sorting server sorts the target transaction result in a preset order, and receives the data acquisition request of the current transaction node. Thereafter, the target transaction result corresponding to the transaction request is returned to the current trading node according to the data acquisition request.
关于区块链交易处理装置的具体限定可以参见上文中对于交易处理方法的限定,在此不再赘述。上述区块链交易处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For specific definitions of the blockchain transaction processing device, reference may be made to the above description of the transaction processing method, and details are not described herein again. Each of the above blockchain transaction processing devices may be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,也可以是终端。当该计算机设备为服务器时,例如为交易服务器时,其内部结构图可以如图4所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性计算机可读指令存储介质、内存储器。该非易失性计算机可读指令存储介质存储有操作系统和计算机可读指令。该内存储器为非易失性计算机可读指令存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种交易处理方法。In one embodiment, a computer device is provided, which may be a server or a terminal. When the computer device is a server, such as a transaction server, its internal structure diagram can be as shown in FIG. The computer device includes a processor, memory, and network interface coupled by a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-transitory computer readable instruction storage medium, an internal memory. The non-transitory computer readable instruction storage medium stores an operating system and computer readable instructions. The internal memory provides an environment for the operation of an operating system and computer readable instructions in a non-transitory computer readable instruction storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. The computer readable instructions are executed by a processor to implement a transaction processing method.
本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。It will be understood by those skilled in the art that the structure shown in FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied. The specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
一种计算机设备,包括存储器和一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行以下步骤::接收交易请求,并获取当前交易节点,将交易请求发送至当前交易节点,以使当前交易节点对交易请求进行处理;接收在当前交易节点发生故障时、所切换的与当前交易节点处于同一集群的切换后的交易节点的参数;将当前交易节点的参数替换为切换后的交易节点的参数;接收切换后的交易节点返回的初步交易处理结果,并根据初步交易处理结果计算目标交易 处理结果。A computer device comprising a memory and one or more processors, the memory storing computer readable instructions, the computer readable instructions being executed by the processor, causing the one or more processors to perform the steps of: receiving a transaction request, And acquiring the current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving the switched transaction after the current transaction node fails, and the switched transaction is in the same cluster as the current transaction node. The parameter of the node; the parameter of the current transaction node is replaced with the parameter of the switched transaction node; the preliminary transaction processing result returned by the switched transaction node is received, and the target transaction processing result is calculated according to the preliminary transaction processing result.
在其中一个实施例中,处理器执行计算机可读指令时还可以实现以下步骤:In one of the embodiments, the processor may also implement the following steps when executing the computer readable instructions:
若与当前交易节点对应的集群中的交易节点均发生故障,则当前交易节点向交易服务器返回交易节点故障的信息交易服务器接收当前交易节点返回的交易节点故障信息;交易服务器根据交易节点故障的信息对当前交易节点进行标记;若当前交易节点正在处理交易请求,则交易服务器将与当前交易节点对应的初步交易处理结果标记为交易失败。If the transaction node in the cluster corresponding to the current transaction node fails, the information transaction server that returns the transaction node failure to the transaction server receives the transaction node failure information returned by the current transaction node; the transaction server according to the transaction node failure information The current transaction node is marked; if the current transaction node is processing the transaction request, the transaction server marks the preliminary transaction processing result corresponding to the current transaction node as a transaction failure.
在其中一个实施例中,处理器在执行计算机可读指令时还可以实现以下步骤:在接收到当前交易节点注销的信息时,判断当前交易节点是否正在处理交易请求;若当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待当前交易节点返回的初步交易处理结果后,将当前交易节点的参数删除。In one embodiment, the processor may further implement the following steps: when receiving the information of the current transaction node logout, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction The request deletes the parameters of the current transaction node after waiting for the preliminary transaction processing result returned by the current transaction node through the asynchronous non-blocking mode.
在其中一个实施例中,处理器在执行计算机可读指令时还可以实现以下步骤:在接收到新的交易节点的注册信息时,对注册信息进行验证;当验证通过后,则添加新的交易节点的参数。In one embodiment, the processor may further implement the following steps when executing the computer readable instructions: verifying the registration information when the registration information of the new transaction node is received; adding a new transaction when the verification is passed The parameters of the node.
在其中一个实施例中,处理器在执行计算机可读指令时还可以实现以下步骤:判断参与交易的当前交易节点反馈的初步交易处理结果表示交易成功的数量是否大于等于预设值;当表示交易成功的初步交易处理结果的数量大于等于预设值时,则目标交易结果表示交易成功;当表示交易成功的初步交易处理结果的数量小于预设值时,则目标交易结果表示交易失败。In one embodiment, the processor may further implement the following steps when determining that the current transaction processing feedback of the current transaction node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value; If the number of successful preliminary transaction processing results is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset value, the target transaction result indicates that the transaction has failed.
在其中一个实施例中,处理器在执行计算机可读指令时还可以实现以下步骤:将目标交易结果发送至排序服务器以使排序服务器按照预设顺序对目标交易结果进行排序,并接收当前交易节点的数据获取请求后,根据数据获取请求向当前交易节点返回与交易请求对应的目标交易结果。In one embodiment, the processor may further implement the steps of: sending the target transaction result to the sorting server to cause the sorting server to sort the target transaction result in a preset order and receiving the current trading node when executing the computer readable instructions After the data acquisition request, the target transaction result corresponding to the transaction request is returned to the current transaction node according to the data acquisition request.
一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤::接收交易请求,并获取当前交易节点,将交易请求发送至当前交易节点以使当前交易节点对交易请求进行处理;接收在当前交易节点发生故障时、所切换的与当前交易节点处于同一集群的切换后的交易节点的参数;将当前交易节点的参数替换为切换后的交易节点的参数;接收切换后的交易节点返回的初步交易处理结果,并根据初步交易处理结果计算目标交易处理结果。One or more non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of: receiving a transaction request, and obtaining The current trading node sends the transaction request to the current trading node to cause the current trading node to process the transaction request; and receives the parameter of the switched trading node that is switched in the same cluster as the current trading node when the current trading node fails. The parameter of the current transaction node is replaced with the parameter of the switched transaction node; the preliminary transaction processing result returned by the switched transaction node is received, and the target transaction processing result is calculated according to the preliminary transaction processing result.
在其中一个实施例中,该计算机可读指令被处理器执行时还可以实现以下步骤:若与当前交易节点对应的集群中的交易节点均发生故障,则接收当前交易节点返回的交易节点故障的信息;根据交易节点故障的信息对当前交 易节点进行标记;若当前交易节点正在处理交易请求,则将与当前交易节点对应的初步交易处理结果标记为交易失败。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may be further implemented: if the transaction nodes in the cluster corresponding to the current transaction node both fail, receiving the transaction node failure returned by the current transaction node Information; the current transaction node is marked according to the information of the transaction node failure; if the current transaction node is processing the transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
在其中一个实施例中,该计算机可读指令被处理器执行时还可以实现以下步骤:若接收当前交易节点注销的信息,则判断当前交易节点是否正在处理交易请求;若当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待当前交易节点返回的初步交易处理结果后,将当前交易节点的参数删除。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may be further implemented: if receiving the information of the current transaction node cancellation, determining whether the current transaction node is processing the transaction request; if the current transaction node is processing the transaction The request deletes the parameters of the current transaction node after waiting for the preliminary transaction processing result returned by the current transaction node through the asynchronous non-blocking mode.
在其中一个实施例中,该计算机可读指令被处理器执行时还可以实现以下步骤:若接收到新的交易节点的注册信息,则对注册信息进行验证;当验证通过后,则添加新的交易节点的参数。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may be further implemented: if the registration information of the new transaction node is received, the registration information is verified; when the verification is passed, a new one is added. The parameters of the trading node.
在其中一个实施例中,该计算机可读指令被处理器执行时所实现的根据初步交易处理结果计算目标交易处理结果的步骤可以包括:判断参与交易的当前交易节点反馈的初步交易处理结果表示交易成功的数量是否大于等于预设值;当表示交易成功的初步交易处理结果的数量大于等于预设值时,则目标交易结果表示交易成功;当表示交易成功的初步交易处理结果的数量小于预设值时,则目标交易结果表示交易失败。In one embodiment, the step of calculating the target transaction processing result according to the preliminary transaction processing result implemented by the processor when the computer readable instruction is executed by the processor may include: determining that the preliminary transaction processing result fed back by the current transaction node participating in the transaction indicates the transaction Whether the number of success is greater than or equal to the preset value; when the number of preliminary transaction processing results indicating that the transaction is successful is greater than or equal to the preset value, the target transaction result indicates that the transaction is successful; when the number of preliminary transaction processing results indicating that the transaction is successful is less than the preset When the value is, the target transaction result indicates that the transaction failed.
在其中一个实施例中,该计算机可读指令被处理器执行时还可以实现以下步骤:将目标交易结果发送至排序服务器以使排序服务器按照预设顺序对目标交易结果进行排序,并接收当前交易节点的数据获取请求后,根据数据获取请求向当前交易节点返回与交易请求对应的目标交易结果。In one of the embodiments, the computer readable instructions when executed by the processor may further implement the steps of: transmitting the target transaction result to the sorting server to cause the sorting server to sort the target transaction results in a preset order, and receiving the current transaction After the data acquisition request of the node, the target transaction result corresponding to the transaction request is returned to the current transaction node according to the data acquisition request.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the above embodiments can be completed by computer readable instructions, which can be stored in a non-volatile computer. The readable storage medium, which when executed, may include the flow of an embodiment of the methods as described above. Any reference to a memory, storage, database or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of formats, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronization chain. Synchlink DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这 些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments may be arbitrarily combined. For the sake of brevity of description, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction between the combinations of these technical features, All should be considered as the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the invention. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (20)

  1. 一种交易处理方法,包括:A transaction processing method, including:
    接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;Receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving when the current transaction node fails Switching parameters of the switched transaction node in the same cluster as the current transaction node;
    将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
    接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若与所述当前交易节点对应的集群中的交易节点均发生故障,则接收所述当前交易节点返回的交易节点故障信息;Receiving transaction node failure information returned by the current transaction node if a transaction node in the cluster corresponding to the current transaction node fails;
    根据所述交易节点故障的信息对所述当前交易节点进行标记;及Marking the current transaction node according to the information of the transaction node failure; and
    若所述当前交易节点正在处理交易请求,则将与所述当前交易节点对应的初步交易处理结果标记为交易失败。If the current transaction node is processing a transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若接收到所述当前交易节点注销的信息,则判断所述当前交易节点是否正在处理交易请求;及If the information of the current transaction node cancellation is received, determining whether the current transaction node is processing a transaction request; and
    若所述当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待所述当前交易节点返回的初步交易处理结果后,将所述当前交易节点的参数删除。If the current transaction node is processing the transaction request, the parameter of the current transaction node is deleted after continuing to wait for the preliminary transaction processing result returned by the current transaction node by the asynchronous non-blocking manner.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若接收到新的交易节点的注册信息,则对所述注册信息进行验证;及If the registration information of the new transaction node is received, the registration information is verified; and
    当验证通过后,则添加所述新的交易节点的参数。When the verification is passed, the parameters of the new trading node are added.
  5. 根据权利要求1所述的方法,其特征在于,所述根据所述初步交易处理结果计算目标交易处理结果,包括:The method according to claim 1, wherein the calculating the target transaction processing result according to the preliminary transaction processing result comprises:
    判断参与交易的所述当前交易节点反馈的初步交易结果表示交易成功的数量是否大于等于预设值;Determining whether the preliminary transaction result fed back by the current trading node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value;
    当表示交易成功的所述初步交易结果的数量大于等于预设值时,则目标交易结果表示交易成功;及When the number of the preliminary transaction results indicating that the transaction is successful is greater than or equal to a preset value, the target transaction result indicates that the transaction is successful;
    当表示交易成功的所述初步交易结果的数量小于预设值时,则目标交易结果表示交易失败。When the number of the preliminary transaction results indicating that the transaction is successful is less than a preset value, the target transaction result indicates that the transaction has failed.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    将所述目标交易结果发送至排序服务器以使所述排序服务器按照预设顺序对所述目标交易结果进行排序,并接收所述当前交易节点的数据获取请求 后,根据所述数据获取请求向所述当前交易节点返回与所述交易请求对应的目标交易结果。Sending the target transaction result to the sorting server, so that the sorting server sorts the target transaction result in a preset order, and after receiving the data acquisition request of the current transaction node, according to the data acquisition request The current trading node returns a target transaction result corresponding to the transaction request.
  7. 一种区块链交易处理装置,包括;A blockchain transaction processing device, comprising:
    交易请求通信模块,用于接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;a transaction request communication module, configured to receive a transaction request, and acquire a current transaction node, and send the transaction request to the current transaction node, so that the current transaction node processes the transaction request;
    节点参数通信模块,用于接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;a node parameter communication module, configured to receive, when the current transaction node fails, a parameter of the switched transaction node that is switched after the current transaction node is in the same cluster;
    替换模块,用于将当前交易节点的参数替换为切换后的交易节点的参数;a replacement module, configured to replace parameters of the current transaction node with parameters of the switched transaction node;
    处理模块,用于接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。And a processing module, configured to receive a preliminary transaction processing result returned by the switched transaction node, and calculate a target transaction processing result according to the preliminary transaction processing result.
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括排序模块,用于将所述目标交易结果发送至排序服务器,以使所述排序服务器按照预设顺序对所述目标交易结果进行排序,并接收所述当前交易节点的数据获取请求后,根据所述数据获取请求向所述当前交易节点返回与所述交易请求对应的目标交易结果。The apparatus according to claim 7, wherein said apparatus further comprises a sorting module for transmitting said target transaction result to said sorting server, so that said sorting server compares said target transaction result in a predetermined order After sorting and receiving the data acquisition request of the current transaction node, returning a target transaction result corresponding to the transaction request to the current transaction node according to the data acquisition request.
  9. 根据权利要求7所述的装置,其特征在于,所述装置还包括:The device according to claim 7, wherein the device further comprises:
    故障接收模块,用于若与所述当前交易节点对应的集群中的交易节点均发生故障,则接收所述当前交易节点返回的交易节点故障信息;及a fault receiving module, configured to receive, when the transaction node in the cluster corresponding to the current transaction node fails, receive the transaction node fault information returned by the current transaction node; and
    标记模块,用于根据所述交易节点故障的信息对所述当前交易节点进行标记;若所述当前交易节点正在处理交易请求,则将与所述当前交易节点对应的初步交易处理结果标记为交易失败。a marking module, configured to mark the current transaction node according to the information of the transaction node failure; if the current transaction node is processing a transaction request, mark a preliminary transaction processing result corresponding to the current transaction node as a transaction failure.
  10. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device comprising a memory and one or more processors having stored therein computer readable instructions, the computer readable instructions being executed by the one or more processors to cause the one or more The processors perform the following steps:
    接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;Receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving when the current transaction node fails Switching parameters of the switched transaction node in the same cluster as the current transaction node;
    将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
    接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
  11. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer apparatus according to claim 10, wherein said processor further performs the following steps when said computer readable instructions are executed:
    若与所述当前交易节点对应的集群中的交易节点均发生故障,则接收所 述当前交易节点返回的交易节点故障信息;Receiving, by the transaction node in the cluster corresponding to the current transaction node, a transaction node failure information returned by the current transaction node;
    根据所述交易节点故障的信息对所述当前交易节点进行标记;及Marking the current transaction node according to the information of the transaction node failure; and
    若所述当前交易节点正在处理交易请求,则将与所述当前交易节点对应的初步交易处理结果标记为交易失败。If the current transaction node is processing a transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
  12. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer apparatus according to claim 10, wherein said processor further performs the following steps when said computer readable instructions are executed:
    若接收到所述当前交易节点注销的信息,则判断所述当前交易节点是否正在处理交易请求;及If the information of the current transaction node cancellation is received, determining whether the current transaction node is processing a transaction request; and
    若所述当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待所述当前交易节点返回的初步交易处理结果后,将所述当前交易节点的参数删除。If the current transaction node is processing the transaction request, the parameter of the current transaction node is deleted after continuing to wait for the preliminary transaction processing result returned by the current transaction node by the asynchronous non-blocking manner.
  13. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer apparatus according to claim 10, wherein said processor further performs the following steps when said computer readable instructions are executed:
    若接收到新的交易节点的注册信息,则对所述注册信息进行验证;及If the registration information of the new transaction node is received, the registration information is verified; and
    当验证通过后,则添加所述新的交易节点的参数。When the verification is passed, the parameters of the new trading node are added.
  14. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时所执行的根据所述初步交易处理结果计算目标交易处理结果,包括:The computer device according to claim 10, wherein the calculation of the target transaction processing result according to the preliminary transaction processing result performed by the processor when the computer readable instructions are executed comprises:
    判断参与交易的所述当前交易节点反馈的初步交易结果表示交易成功的数量是否大于等于预设值;Determining whether the preliminary transaction result fed back by the current trading node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value;
    当表示交易成功的所述初步交易结果的数量大于等于预设值时,则目标交易结果表示交易成功;及When the number of the preliminary transaction results indicating that the transaction is successful is greater than or equal to a preset value, the target transaction result indicates that the transaction is successful;
    当表示交易成功的所述初步交易结果的数量小于预设值时,则目标交易结果表示交易失败。When the number of the preliminary transaction results indicating that the transaction is successful is less than a preset value, the target transaction result indicates that the transaction has failed.
  15. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer apparatus according to claim 10, wherein said processor further performs the following steps when said computer readable instructions are executed:
    将所述目标交易结果发送至排序服务器以使所述排序服务器按照预设顺序对所述目标交易结果进行排序,并接收所述当前交易节点的数据获取请求后,根据所述数据获取请求向所述当前交易节点返回与所述交易请求对应的目标交易结果。Sending the target transaction result to the sorting server, so that the sorting server sorts the target transaction result in a preset order, and after receiving the data acquisition request of the current transaction node, according to the data acquisition request The current trading node returns a target transaction result corresponding to the transaction request.
  16. 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more non-transitory computer readable storage mediums storing computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the following steps:
    接收交易请求,并获取当前交易节点,将所述交易请求发送至所述当前交易节点,以使所述当前交易节点对所述交易请求进行处理;接收在所述当 前交易节点发生故障时、所切换的与所述当前交易节点处于同一集群的切换后的交易节点的参数;Receiving a transaction request, and acquiring a current transaction node, sending the transaction request to the current transaction node, so that the current transaction node processes the transaction request; receiving when the current transaction node fails Switching parameters of the switched transaction node in the same cluster as the current transaction node;
    将当前交易节点的参数替换为切换后的交易节点的参数;及Replace the parameters of the current trading node with the parameters of the switched trading node; and
    接收切换后的交易节点返回的初步交易处理结果,并根据所述初步交易处理结果计算目标交易处理结果。Receiving a preliminary transaction processing result returned by the switched transaction node, and calculating a target transaction processing result according to the preliminary transaction processing result.
  17. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium of claim 16 wherein said computer readable instructions are further executed by said processor to perform the following steps:
    若与所述当前交易节点对应的集群中的交易节点均发生故障,则接收所述当前交易节点返回的交易节点故障信息;Receiving transaction node failure information returned by the current transaction node if a transaction node in the cluster corresponding to the current transaction node fails;
    根据所述交易节点故障的信息对所述当前交易节点进行标记;及Marking the current transaction node according to the information of the transaction node failure; and
    若所述当前交易节点正在处理交易请求,则将与所述当前交易节点对应的初步交易处理结果标记为交易失败。If the current transaction node is processing a transaction request, the preliminary transaction processing result corresponding to the current transaction node is marked as a transaction failure.
  18. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium of claim 16 wherein said computer readable instructions are further executed by said processor to perform the following steps:
    若接收到所述当前交易节点注销的信息,则判断所述当前交易节点是否正在处理交易请求;及If the information of the current transaction node cancellation is received, determining whether the current transaction node is processing a transaction request; and
    若所述当前交易节点正在处理交易请求,则通过异步非阻塞方式继续等待所述当前交易节点返回的初步交易处理结果后,将所述当前交易节点的参数删除。If the current transaction node is processing the transaction request, the parameter of the current transaction node is deleted after continuing to wait for the preliminary transaction processing result returned by the current transaction node by the asynchronous non-blocking manner.
  19. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium of claim 16 wherein said computer readable instructions are further executed by said processor to perform the following steps:
    若接收到新的交易节点的注册信息,则对所述注册信息进行验证;及If the registration information of the new transaction node is received, the registration information is verified; and
    当验证通过后,则添加所述新的交易节点的参数。When the verification is passed, the parameters of the new trading node are added.
  20. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时所执行的根据所述初步交易处理结果计算目标交易处理结果,包括:The storage medium according to claim 16, wherein the calculation of the target transaction processing result according to the preliminary transaction processing result performed by the computer-readable instruction when executed by the processor comprises:
    判断参与交易的所述当前交易节点反馈的初步交易结果表示交易成功的数量是否大于等于预设值;Determining whether the preliminary transaction result fed back by the current trading node participating in the transaction indicates whether the number of successful transactions is greater than or equal to a preset value;
    当表示交易成功的所述初步交易结果的数量大于等于预设值时,则目标交易结果表示交易成功;及When the number of the preliminary transaction results indicating that the transaction is successful is greater than or equal to a preset value, the target transaction result indicates that the transaction is successful;
    当表示交易成功的所述初步交易结果的数量小于预设值时,则目标交易结果表示交易失败。When the number of the preliminary transaction results indicating that the transaction is successful is less than a preset value, the target transaction result indicates that the transaction has failed.
PCT/CN2018/075501 2017-11-23 2018-02-06 Transaction processing method and device, computer equipment, and storage medium WO2019100598A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711180752.0 2017-11-23
CN201711180752.0A CN107886328B (en) 2017-11-23 2017-11-23 Transaction processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2019100598A1 true WO2019100598A1 (en) 2019-05-31

Family

ID=61774690

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075501 WO2019100598A1 (en) 2017-11-23 2018-02-06 Transaction processing method and device, computer equipment, and storage medium

Country Status (2)

Country Link
CN (1) CN107886328B (en)
WO (1) WO2019100598A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108615195B (en) * 2018-04-28 2021-12-07 腾讯科技(深圳)有限公司 Resource transfer information transmission method and device, storage medium and electronic device
CN108600383B (en) * 2018-05-02 2022-08-19 大国创新智能科技(东莞)有限公司 Block chain robot system and implementation method
CN108830710B (en) * 2018-05-02 2021-02-05 大国创新智能科技(东莞)有限公司 Block chain transaction platform and implementation method
CN108848054B (en) * 2018-05-03 2021-01-15 京信通信系统(中国)有限公司 Network equipment registration method and device, computer equipment and storage medium
CN113421089A (en) * 2018-06-13 2021-09-21 创新先进技术有限公司 Block chain-based available resource quota exchange method and device
CN108920278B (en) * 2018-07-02 2021-12-24 中国建设银行股份有限公司 Resource allocation method and device
CN110633804B (en) * 2019-09-12 2022-06-24 简链科技(广东)有限公司 Financial product incoming evaluation method, server and storage medium
CN110852744A (en) * 2019-10-08 2020-02-28 深圳汇商通盈科技有限公司 Method, device, terminal equipment and medium for switching transaction channels
CN115511486A (en) * 2021-06-07 2022-12-23 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment
CN114119241A (en) * 2022-01-27 2022-03-01 通联支付网络服务股份有限公司 Channel transaction system
CN115271736B (en) * 2022-07-11 2023-06-16 中电金信软件有限公司 Method, device, equipment and storage medium for verifying transaction consistency

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101523355A (en) * 2006-08-04 2009-09-02 多伦多证券交易所 Failover system and method
CN101556679A (en) * 2009-05-21 2009-10-14 中国建设银行股份有限公司 Method for processing failures in integrated front-end system and computer equipment
US20120136778A1 (en) * 2009-02-05 2012-05-31 Oracle International Corporation Replicating data in financial systems
CN106970934A (en) * 2017-01-16 2017-07-21 平安银行股份有限公司 Trading processing control method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101986272A (en) * 2010-11-05 2011-03-16 北京大学 Task scheduling method under cloud computing environment
CN105933391B (en) * 2016-04-11 2019-06-21 聚好看科技股份有限公司 A kind of node expansion method, apparatus and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101523355A (en) * 2006-08-04 2009-09-02 多伦多证券交易所 Failover system and method
US20120136778A1 (en) * 2009-02-05 2012-05-31 Oracle International Corporation Replicating data in financial systems
CN101556679A (en) * 2009-05-21 2009-10-14 中国建设银行股份有限公司 Method for processing failures in integrated front-end system and computer equipment
CN106970934A (en) * 2017-01-16 2017-07-21 平安银行股份有限公司 Trading processing control method and system

Also Published As

Publication number Publication date
CN107886328B (en) 2021-01-26
CN107886328A (en) 2018-04-06

Similar Documents

Publication Publication Date Title
WO2019100598A1 (en) Transaction processing method and device, computer equipment, and storage medium
US11496577B2 (en) Broker-based bus protocol and multi-client architecture
WO2019100597A1 (en) Transaction data processing method and device, computer equipment, and storage medium
US10742395B2 (en) Hardware blockchain acceleration
US11294888B2 (en) Blockchain system and blockchain transaction data processing method based on ethereum
WO2019119929A1 (en) Block chain consensus method, apparatus and system, and identification information processing method and apparatus
US11057504B2 (en) System and method for ending view change protocol
US20210165891A1 (en) Systems and methods for providing multi-node resiliency for blockchain peers
WO2020216280A1 (en) Block processing methods, node and system
WO2020125389A1 (en) Image file acquisition method, apparatus, computer device and storage medium
US11917018B2 (en) Broker-based bus protocol and multi-client architecture
CN111343277B (en) Distributed data storage method, system, computer device and storage medium
CN112929225B (en) Session exception handling method and device, computer equipment and storage medium
WO2020053872A1 (en) In a distributed computing system with untrusted entities method and apparatus for enabling coordinated executions of actions
US20230128131A1 (en) Protecting Application Private Keys with Remote and Local Security Controllers and Local MPC Key Generation
WO2020233086A1 (en) Block processing method and apparatus, computer device and storage medium
WO2019100596A1 (en) Method and system for operating distributed system
US11050798B2 (en) Methods for establishing peer-to-peer communications using distributed call ledgers
US9154548B2 (en) Auditable distribution of a data file
CN112468453A (en) Access method, system, electronic device and storage medium of multi-protocol device
WO2020037607A1 (en) Data transmission method and apparatus
EP2739010B1 (en) Method for improving reliability of distributed computer systems based on service-oriented architecture
AU2019101575A4 (en) System and method for ending view change protocol
CN114338056B (en) Network access method based on cloud distribution and system, medium and equipment thereof
US11463422B1 (en) Decoupling secure communication sessions from transport mechanisms

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: 18880999

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18880999

Country of ref document: EP

Kind code of ref document: A1