WO2020220860A1 - Blockchain system-based transaction processing method and apparatus - Google Patents

Blockchain system-based transaction processing method and apparatus Download PDF

Info

Publication number
WO2020220860A1
WO2020220860A1 PCT/CN2020/080520 CN2020080520W WO2020220860A1 WO 2020220860 A1 WO2020220860 A1 WO 2020220860A1 CN 2020080520 W CN2020080520 W CN 2020080520W WO 2020220860 A1 WO2020220860 A1 WO 2020220860A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
conflict
historical
preset
node
Prior art date
Application number
PCT/CN2020/080520
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 WO2020220860A1 publication Critical patent/WO2020220860A1/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/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present invention relates to the blockchain (blockchain) field in the technical field of financial technology (Fintech), and in particular to a transaction processing method and device based on a blockchain system.
  • Blockchain technology is no exception, but due to the security and real-time requirements of the financial industry , Also put forward higher requirements for technology.
  • multiple nodes can be set in the blockchain system, and multiple nodes can communicate with each other.
  • the client device can send a transaction request to a certain node in the blockchain system, and the node receives the transaction request Later, transactions can be processed, and block information corresponding to the transaction can be generated through consensus with other nodes.
  • the blockchain system will process a lot of transactions in a period of time. Therefore, how to deal with each transaction reasonably is very important for the development of the blockchain system.
  • the node after receiving the transaction request sent by the client, the node can usually parse the transaction request to obtain transaction data, such as the initiator of the transaction, the receiver of the transaction, and the type of business to which the transaction belongs; further, The node can compare the transaction data with the transaction data of the historical transaction processed by the blockchain system. If it is determined that the transaction conflicts with the historical transaction, the transaction can be processed according to the conflict processing instruction preset in the blockchain system.
  • the amount of data included in the transaction data is large, and it may take a long time to complete the process of comparing the transaction data with the transaction data of the historical transaction. Under normal circumstances, the transaction in the blockchain system can be Frequent triggers, so the above methods may not be able to process multiple transactions in time, resulting in poor transaction processing efficiency in the blockchain system.
  • the embodiment of the present invention provides a transaction processing method and device based on a blockchain system to improve the efficiency of transaction processing in the blockchain system.
  • an embodiment of the present invention provides a transaction processing method based on a blockchain system, and the method includes:
  • the first node in the blockchain system receives a transaction request sent by the client device, the transaction request includes the identification of the first transaction and a conflict processing instruction, and the conflict processing instruction includes when there is a conflict between the first transaction and a historical transaction
  • the processing method for the first transaction, and/or the processing method for the first transaction when there is no conflict between the first transaction and the historical transaction further, the first node according to the first transaction To determine the conflict result of the first transaction, and process the first transaction according to the conflict result of the first transaction and the conflict processing instruction, and the conflict result of the first transaction is used to indicate Whether there is a conflict between the first transaction and the historical transaction.
  • the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, so that the process of conflict detection for the transaction can be faster and the block
  • the efficiency of transaction processing in the chain system and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, the above technical solutions
  • the transaction processing method is more in line with the actual situation.
  • the first node determining the conflict result of the first transaction according to the identifier of the first transaction includes: the first node first determines the first transaction according to the identifier of the first transaction Further, the first node obtains the identifier of the target historical transaction from the first preset database, and stores the identifier of the target historical transaction in a preset memory space; wherein, the first preset The database includes identifiers of the multiple historical transactions and key values of the multiple historical transactions, and the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database If the first node determines that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, then it determines that the first transaction conflicts with the historical transaction.
  • the above technical solution compares the identification of the first transaction with the identification of the target historical transaction stored in the first memory space in advance, instead of directly comparing Comparing the identifier of the first transaction with the identifier of the historical transaction stored in the first preset database can improve the response speed of the conflict detection process.
  • filtering the target historical transaction in the first preset database based on the key value can reduce the memory occupied by the screening process and improve the screening efficiency; on the other hand, if there is an identifier with the first transaction in the preset memory space For matching target historical transactions, the conflict between the first transaction and the historical transaction can be directly determined, so that subsequent conflict detection processes can be avoided and the efficiency of conflict detection can be improved.
  • the method further includes: if the first node determines that there is no target historical transaction that matches the identifier of the first transaction in the preset memory space, then inputting the identifier of the first transaction into the first preset Assume a filter model, the first preset filter model is obtained by training using transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identifier, key value, transaction data, Conflict processing instructions and conflict times; further, if the output result of the first preset filtering model is that the first transaction does not conflict with the historical transaction, the first node determines that the first transaction does not exist with the historical transaction conflict.
  • the first preset filtering model can be used to perform the second conflict detection on the first transaction, thereby improving the conflict detection performance.
  • Accuracy; and the second conflict detection process can also be executed in a preset memory space, so that conflict detection can be avoided directly through historical transactions in the first preset database, thereby improving detection efficiency. That is to say, in the above technical solution, through two detection processes based on the preset memory space, a relatively large portion of conflicting transactions can be detected, which improves detection efficiency while improving detection accuracy.
  • the method further includes: if the output result of the first preset filtering model is that the first transaction conflicts with the historical transaction, the first node compares the identifier of the first transaction with the The identification of one or more historical transactions in the first preset database is compared, and if it is determined that there is a historical transaction in the first preset database that matches the identification of the first transaction, then the first transaction is determined There is a conflict with a historical transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction does not conflict with the historical transaction.
  • the conflict detection of the first transaction may be performed based on the historical transactions in the first preset database, thereby The conflict result of the first transaction can be obtained, and the detected conflict result of the first transaction is more accurate.
  • the conflict processing instruction includes any one or more of the following: refusing to execute the first transaction when there is a conflict between the first transaction and a historical transaction, and executing when there is a conflict between the first transaction and a historical transaction Redirecting the first transaction to a fault-tolerant contract when there is a conflict between the first transaction, the first transaction and the historical transaction, and executing the first transaction when there is no conflict between the first transaction and the historical transaction;
  • the first node processes the first transaction according to the conflict result of the first transaction and the conflict processing instruction, including: if there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is The first transaction is executed when there is no conflict between the first transaction and the historical transaction, or if there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction
  • the first node executes the first transaction; if the first transaction conflicts with historical transactions, and the conflict processing instruction is that the first transaction conflicts with historical transactions When redirecting the first transaction to the fault
  • the conflict processing instruction is set by the client device. Therefore, the conflict processing instruction that meets the actual situation can be set based on the requirements of the client device or the business scenario. Accordingly, the first transaction is processed based on the conflict processing instruction to enable The processing result of the first transaction meets the needs of the client device and can be more in line with actual conditions.
  • the execution of the first transaction by the first node includes: if the first node determines that the number of nodes in the blockchain system that have reached a consensus on the first transaction is greater than or equal to a preset threshold , The block information corresponding to the first transaction is generated; the first node updates the first preset database and/or the preset memory space according to the transaction information of the first transaction.
  • the updated first preset database and preset memory space can be used to perform conflict detection on the next transaction, thereby make the transaction processing process meet real-time requirements and improve the accuracy of transaction processing.
  • the method further includes: the first node sends the block information corresponding to the first transaction to the client device, and the The block information is used by the client device to correct the first transaction.
  • the conflict processing instructions are set for the client device, there may be some conflicting transactions still being processed.
  • the transaction processing process can be avoided Major mistakes have occurred, improving the business processing capabilities and accuracy of the blockchain system.
  • the first preset database further stores a first check value corresponding to the plurality of historical transaction data, and the first check value is the first node using a preset check algorithm to The multiple historical transaction data are verified;
  • the first node generating block information corresponding to the first transaction includes: the first node generating initial block information corresponding to the first transaction,
  • the bin point uses the preset check algorithm to check the first check value and the transaction information corresponding to the first transaction to obtain a second check value; further, the first node checks the The second check value is added to the initial block information to obtain the block information corresponding to the first transaction.
  • the first check value can be used to identify historical transactions processed by the blockchain system. After the first transaction is processed, the first check value is updated with the first transaction to obtain the second check value.
  • multiple nodes in the blockchain system can achieve consensus based on the same second check value, thereby improving the accuracy of transaction processing in the blockchain system; on the other hand, it can enable the blockchain system to process During the transaction, the historical transactions processed by the blockchain system are updated in real time, thereby improving the accuracy of subsequent transactions.
  • the first node updating the first preset database and/or the preset memory space according to the transaction information of the first transaction includes: the first node uses the first transaction Identifies updating the first preset filtering model to obtain a second preset filtering model, and updating the preset memory space and/or the first preset filtering model in the first preset database to the first 2.
  • a preset filtering model further, the first node adds the transaction information corresponding to the first transaction and the second check value to the first preset database, and uses the second calibration
  • the verification value updates the first verification value in the preset memory space.
  • the pre-based by using the block information of the first transaction to sequentially update the first preset filter model in the first preset database and the preset memory space, the historical transaction information, and the check value of the historical transaction, the pre-based It is assumed that the two conflict detection methods in the memory space and the sequential conflict detection method based on the first preset database perform conflict detection for the next transaction, so that the conflict detection for each transaction can be performed using the above method, and the efficiency of transaction processing is improved.
  • an embodiment of the present invention provides a transaction processing method based on a blockchain system, the method including:
  • the client device sends a transaction request to the first node in the blockchain system, where the transaction request includes the identification of the first transaction and a conflict processing instruction; further, the client device receives the fault-tolerant contract sent by the first node According to the address of the fault-tolerant contract, call the fault-tolerant processing module to correct the first transaction.
  • the method further includes: the client device receives block information corresponding to the first transaction sent by the first node; further, the client device obtains the block information and stores If it is determined that there is a historical transaction whose identifier matches the identifier of the first transaction in the second preset database of the client device, the fault-tolerant processing module is used according to the preset processing rule The first transaction is amended; the second preset database stores multiple historical transactions processed by the client device.
  • the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
  • an embodiment of the present invention provides a transaction processing device based on a blockchain system, the device including:
  • the receiving module is configured to receive a transaction request sent by a client device, the transaction request including the identification of the first transaction and a conflict processing instruction; the conflict processing instruction includes the first transaction when there is a conflict between the first transaction and the historical transaction. A transaction processing method, and/or the processing method of the first transaction when there is no conflict between the first transaction and the historical transaction;
  • a conflict detection module configured to determine a conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and a historical transaction;
  • the processing module is configured to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
  • the conflict detection module is configured to: determine the key value of the first transaction according to the identifier of the first transaction; further, obtain the identifier of the target historical transaction from the first preset database, and compare all The identifier of the target historical transaction is stored in the preset memory space; the first preset database includes the identifier of the plurality of historical transactions and the key value of the plurality of historical transactions, and the target historical transaction is the A historical transaction whose key value matches the key value of the first transaction in the first preset database; if it is determined that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, then the first transaction is determined There is a conflict between transactions and historical transactions.
  • the conflict detection module is further configured to: if it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, input the identifier of the first transaction into the first preset filter Model, the first preset filtering model is obtained by training using transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identification, key value, transaction data, and conflict handling of each historical transaction Instruction, the number of conflicts; further, if the output result of the first preset filtering model is that the first transaction does not conflict with the historical transaction, it is determined that the first transaction does not conflict with the historical transaction.
  • the conflict detection module is further configured to: if the output result of the first preset filtering model is that the first transaction conflicts with the historical transaction, compare the identifier of the first transaction with the first transaction. One or more historical transaction identifiers in a preset database are compared. If it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, then the first transaction is determined to be the same as the historical transaction. There is a conflict in the transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, then it is determined that there is no conflict between the first transaction and the historical transaction.
  • the conflict processing instruction includes any one or more of the following: refusing to execute the first transaction when there is a conflict between the first transaction and a historical transaction, and executing when there is a conflict between the first transaction and a historical transaction Redirecting the first transaction to a fault-tolerant contract when there is a conflict between the first transaction, the first transaction and the historical transaction, and executing the first transaction when there is no conflict between the first transaction and the historical transaction;
  • the processing module is configured to: if the first transaction does not conflict with the historical transaction, and the conflict processing instruction is to execute the first transaction when the first transaction does not conflict with the historical transaction, or if the first transaction does not conflict with the historical transaction, There is a conflict between a transaction and a historical transaction, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, then the first transaction is executed; if the first transaction is in conflict with the historical transaction If there is a conflict, and the conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a
  • the processing module is configured to generate a block corresponding to the first transaction if it is determined that the number of nodes in the blockchain system that have reached a consensus on the first transaction is greater than or equal to a preset threshold Information; further, update the first preset database and/or the preset memory space according to the transaction information of the first transaction.
  • the processing module after the processing module generates the block information corresponding to the first transaction, it is further configured to: send the block information corresponding to the first transaction to the client device, where the block information is used for The client device modifies the first transaction.
  • the first preset database further stores a first check value corresponding to the plurality of historical transaction data, and the first check value is the first node using a preset check algorithm to The multiple historical transaction data are verified;
  • the processing module is specifically configured to: generate initial block information corresponding to the first transaction; further, use the preset verification algorithm to verify the first The check value is checked against the transaction information corresponding to the first transaction to obtain a second check value, and the second check value is added to the initial block information to obtain the first transaction corresponding The block information.
  • the processing module is configured to: use the identifier of the first transaction to update the first preset filter model to obtain a second preset filter model, and configure the preset memory space and/or the first
  • the first preset filtering model in the preset database is updated to the second preset filtering model; further, the transaction information corresponding to the first transaction and the second check value are added to the first
  • the second check value is used to update the first check value in the preset memory space.
  • an embodiment of the present invention provides a transaction processing device based on a blockchain system, the device including:
  • a transceiver module configured to send a transaction request to the first node in the blockchain system, the transaction request including the identification of the first transaction and a conflict processing instruction; and to receive the address of the fault-tolerant contract sent by the first node;
  • the processing module is configured to call the fault-tolerant processing module to correct the first transaction according to the address of the fault-tolerant contract.
  • the receiving module is further configured to: receive block information corresponding to the first transaction sent by the first node; the processing module is further configured to: obtain the block information stored in the block information The identification of the first transaction, if it is determined that there is a historical transaction with an identification matching the identification of the first transaction in the second preset database of the client device, the fault-tolerant processing module is used to perform processing on the first The transaction is modified; the second preset database stores a plurality of historical transactions processed by the client device.
  • the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
  • embodiments of the present invention also provide a computer-readable storage medium, including instructions, which when run on a processor of a computer, cause the processor of the computer to execute any of the above-mentioned first and/or second aspects. The method described in one item.
  • embodiments of the present invention also provide a computer program product, which when it runs on a processor of a computer, causes the processor of the computer to execute the method described in any one of the first aspect and/or the second aspect. .
  • FIG. 1 is a schematic diagram of a system architecture of a blockchain system provided by an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a corresponding process flow of a transaction processing method based on a blockchain system provided by an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a client device and a first node provided in an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a transaction processing device based on a blockchain system provided in an embodiment of the present invention.
  • Figure 5 is a schematic structural diagram of a transaction processing device based on a blockchain system provided in an embodiment of the present invention
  • Figure 6 is a schematic structural diagram of a terminal device provided in an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a back-end device provided in an embodiment of the present invention.
  • FIG 1 is a schematic diagram of a system architecture to which the transaction processing method in an embodiment of the present invention is applicable.
  • the system architecture may include one or more nodes in the blockchain system (such as the one shown in Figure 1). Node 101, node 102, node 103, and node 104) and the client device 200. Among them, one or more nodes in the blockchain system can jointly maintain the blockchain system.
  • the client device 200 can communicate with one or more nodes in the blockchain system by accessing the network.
  • the blockchain system may be a peer-to-peer (Peer To Peer, P2P) network composed of multiple nodes.
  • P2P is an application layer protocol running on the Transmission Control Protocol (TCP) protocol.
  • TCP Transmission Control Protocol
  • the nodes in the blockchain system can be equal to each other. There is no central node in the blockchain system, so each Nodes can connect to other nodes randomly.
  • the client device 200 can send a transaction request to the node 102.
  • the node 102 can obtain the transaction data by parsing the transaction request. And can send transaction data to other nodes in the blockchain system (ie, node 101, node 103, and node 104). Further, nodes 101 to 104 can make a consensus based on the transaction data. If the consensus is passed, the block information corresponding to the transaction can be generated; if the consensus is not passed, the node 102 (or other nodes) can report to the client device 200 sends a transaction response message, the transaction response message is used to indicate that the transaction failed.
  • the nodes in the blockchain system may have multiple functions, such as routing function, transaction function, blockchain function, consensus function, etc.
  • the nodes in the blockchain system can transmit transaction data and other information sent by other nodes to more nodes to achieve communication between nodes; or, the nodes in the blockchain system can be used to support users Perform transactions; or, nodes in the blockchain system can be used to record all transactions in history; or, nodes in the blockchain system can generate new blocks in the blockchain by verifying and recording transactions.
  • the routing function is a function that each node in the blockchain system must have, and other functions can be set by those skilled in the art according to actual needs.
  • a node in the blockchain system can be on a physical machine (server), and a node can specifically refer to a process or a series of processes running in the server.
  • the node 101 in the blockchain network may be a process running on a server, or it may also refer to the server where the node is located, which is not specifically limited.
  • Fig. 2 is a schematic diagram of a process corresponding to a transaction processing method based on a blockchain system provided by an embodiment of the present invention, and the method includes:
  • Step 201 The client device sets the identifier of the first transaction and the conflict processing instruction.
  • the client device determines that the first transaction needs to be executed, it can set the identifier of the first transaction.
  • the client device may set the identifier of the first transaction according to the business scenario to which the first transaction belongs, and the business scenario to which the first transaction belongs may include the business to which the first transaction belongs and the first transaction in the business.
  • the process ie business process.
  • the execution process of the order business may include creating an order process, storing an order process, querying an order process, etc. If the business process to which the first transaction belongs is an order creation process, the first transaction creation can be used to obtain The order number is used as the identification of the first transaction.
  • the length of the order number can be set by those skilled in the art based on experience. For example, it can be variable-length data less than or equal to 256 bytes, or it can also be fixed-length data, which is not specifically limited.
  • the execution process of the interactive data service may include a data transfer process between two parties, a data transfer process to other users, etc., if the business process to which the first transaction belongs is a data transfer process between the two parties, the identification of the first transaction may include The identification of the data sender, the identification of the data receiver and the check value of the data.
  • the identification of the first transaction may include the address of user A 1 , the address of user A 2 , and the hash value of the data.
  • the address of the user A 1 and/or the user A 2 may be an account name, or may also be an email address, or may also be a user name, which is not specifically limited.
  • the client device may also set a conflict processing instruction corresponding to the first transaction.
  • the conflict processing instruction may include the processing method of the first transaction when the first transaction conflicts with the historical transaction, and/or the first transaction and the historical transaction How to handle the first transaction when there is no conflict.
  • the handling of the first transaction when there is a conflict between the first transaction and the historical transaction may include executing the first transaction, redirecting the first transaction to a fault-tolerant contract, and refusing to execute any of the first transaction;
  • the processing method for the first transaction may include executing the first transaction.
  • the conflict processing instruction sent by the client device may include a processing instruction value and additional data.
  • Table 1 is a schematic table of several possible conflict handling instructions provided by the embodiment of the present invention.
  • the embodiment of the present invention defines five conflict processing instructions when the first transaction conflicts with the historical transaction, which are "1", “2", and “3: http://address/0x289” , "4" and "5" also define a conflict processing instruction when there is no conflict between the first transaction and the historical transaction, namely "0".
  • the additional data of the conflict processing instructions "0”, “1”, “2”, “4", and "5" can all be empty, and the processing instruction value of the conflict processing instruction "3: http://address/0x289” It can be 3, and the additional data can be http://address/0x289.
  • the first node may refuse to execute the first transaction; if the first transaction does not conflict with the historical transaction, and the conflict processing instruction is "0", or there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is "2", the first node can execute the first transaction; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is "3" ", the first node can execute the first transaction, and can send the first transaction to the fault-tolerant processing device with the contract address http://address/0x289 for correction; if the first transaction conflicts with the historical transaction, and the conflict is handled If the instruction is "4", the first node can refuse to execute the first transaction and can issue an alarm message; if the first transaction conflicts with historical transactions, and the conflict processing instruction is "5", the first node can execute the first transaction. Transaction, and can print the log record of the first transaction conflict to facilitate subsequent troubleshooting.
  • the conflict described in the embodiment of the present invention is specifically a conflict of multiple transactions generated in the same business process. If the identifiers of multiple transactions generated in the same business process are the same, the multiple transactions may be Conflicting; if the identifiers of multiple transactions generated in the same process of different businesses are the same, or the identifiers of multiple transactions generated in different processes of the same business are the same, the multiple transactions are not in conflict.
  • transaction B 1 is a transaction generated in the second process of business a 1
  • transaction B 2 is a transaction generated in the second process of business a 1
  • transaction B 3 is a transaction generated in the first process of business a 1
  • Transaction B 4 is a transaction generated in the second process of business a 2.
  • transaction B 1 and transaction B 3 belong to different processes of the same business, even if the identifiers of transaction B 1 and transaction B 3 are the same, transaction B 1 and Transaction B 3 does not conflict; accordingly, since transaction B 1 and transaction B 4 belong to the same process of different businesses, even if the identifiers of transaction B 1 and transaction B 4 are the same, transaction B 1 and transaction B 4 do not conflict; and For transactions B 1 and B 2 , since transaction B 1 and transaction B 2 belong to the same process of the same business, if the identifiers of transaction B 1 and transaction B 2 are the same, transaction B 1 and transaction B 2 conflict.
  • the order number can uniquely identify a transaction; if the order numbers of different transactions are the same, it means Different transactions are in conflict.
  • the client device can adopt the same identification setting method for transactions in the same business scenario, so that the transaction identifier can indicate that the transaction is included in multiple transactions in the same business scenario. That is to say, in the embodiment of the present invention, the transaction identifier is set by the client device, and the transaction conflict detection can be performed by comparing the transaction identifier without comparing the specific transaction data, so that the transaction can be conflicted The detection process is faster, and the efficiency of transaction processing in the blockchain system is improved; moreover, the conflict processing instructions can be set by the client device based on actual business scenarios, so that the transaction processing process can be more in line with actual needs.
  • Step 202 The client device sends a transaction request to the first node in the blockchain system.
  • the client device may send a transaction request to the first node in various ways, for example, it may send a transaction request to the first node in a wired manner, or may also send a transaction request to the first node in a wireless manner, which is not specifically limited.
  • the transaction request may include the identification of the first transaction and the conflict processing instruction.
  • the transaction request may include the identification of the first transaction, the conflict processing instruction, and the transaction data of the first transaction.
  • the transaction data of the first transaction may include the key value, account number, contract address, etc. of the first transaction.
  • Step 203 The first node receives the transaction request sent by the client device, and determines the conflict result of the first transaction according to the identifier of the first transaction.
  • the first node may parse the transaction request, and obtain the identifier of the first transaction and the conflict processing instruction (or the identifier of the first transaction, transaction data and the conflict processing instruction). Further, the first node may determine whether there is a conflict between the first transaction and the historical transaction according to the identifier of the first transaction; wherein, the historical transaction may include all transactions processed by the first node before receiving the transaction request of the first transaction . It should be noted that before the first node parses the transaction request, it can also send the transaction request to other nodes in the blockchain system so that other nodes can execute the first transaction. In this way, multiple nodes in the blockchain system The block consensus process can be performed after the first transaction is executed. The process of executing the first transaction by other nodes can be implemented with reference to the process of executing the first transaction by the first node, which will not be repeated here.
  • historical transactions may be stored in the first preset database of the first node.
  • Table 2 is a schematic table of historical transactions stored in the first preset database. .
  • Table 2 An illustration of historical transactions stored in the first preset database
  • the first preset database can store each historical transaction identifier, contract address, key value, transaction account number, conflict handling instructions, and conflict times.
  • the contract address of the historical transaction with the transaction identifier a 1 x 1 (for ease of description, referred to as historical transaction a 1 x 1 ) can be http://address/0x755
  • the key value can be 10.33
  • the transaction account number can be Y 1
  • the conflict processing instruction can be 1 (that is, the historical transaction conflicts with the historical transaction before the historical transaction, and the historical transaction has been rejected)
  • the number of conflicts is 2 (that is, there are two conflicts).
  • the contract address of the transaction can be the address on the blockchain of the contract that implements the business logic, and it can be a piece of fixed-length data, and the contract address of the transaction can be the identifier of the business to which the transaction belongs; as shown in Table 2, Historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 have the same contract address, it can be explained that historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 belong to The business is the same.
  • the key value of the transaction can be a joint key value calculation of the contract address of the transaction and the transaction identifier.
  • the key value can be binary data with a length of less than 255 bytes; the key value obtained based on the contract address and the transaction identifier , Can make the conflict detection process take the business process as the dimension.
  • historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 have the same key value, which can explain historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 are transactions in the same process of the same business, for example, they can all be transactions in the process of creating an order.
  • Historical transaction a 1 x 1 for example, a transaction account transaction history 1 x 1 may be a hash value from the historical trading 1 x 1, said first node can get to a transaction history based on historical trading account is 1 x 1
  • Transaction a 1 x 1 transaction information such as the transaction initiator, transaction receiver, transaction processing receipt, the block to which the transaction belongs, and the block information corresponding to the transaction.
  • the conflict processing instruction of historical transaction a 1 x 1 may refer to the conflict processing instruction configured by the client device sending historical transaction a 1 x 1
  • the number of conflicts may refer to the historical transaction a 1 before the transaction request of the first transaction is received.
  • x 1 and the number of conflicting historical transaction database in the first pre-set for each transaction to determine the history of a 1 x 1 conflict once, the number of collisions historical trading a 1 x 1 can be incremented.
  • the first node may compare the identifier of the first transaction with the identifier of one or more historical transactions in the first preset database, and if it is determined that there is a first If it is determined that there is a conflict between the first transaction and the historical transaction, if it is determined that there is no historical transaction that matches the identifier of the first transaction in the first preset database, then the first transaction and the historical transaction can be determined There is no conflict.
  • the first preset database shown in Table 2 as an example, if the identifier of the first transaction is a 1 x 1 , it can be determined that there is a conflict between the first transaction and the historical transaction. If the identifier of the first transaction is a 8 x 8 , It can be determined that there is no conflict between the first transaction and the historical transaction.
  • the first node may sequentially perform one round of conflict detection or multiple rounds of conflict detection from the first round of conflict detection to the third round of conflict detection on the first transaction, where the first round of conflict detection
  • the processes of the second round of conflict detection can all be executed in the preset memory space, and the process of the third round of conflict detection can be executed in the first preset database. The following specifically describes the implementation process of the first round of conflict detection to the third round of conflict detection.
  • the first node can obtain the contract address of the first transaction from the transaction data of the first transaction, and then can perform a joint key value calculation on the identifier of the first transaction and the contract address of the first transaction to obtain the first transaction's contract address.
  • Key value, and the target historical transaction matching the key value of the first transaction can be obtained from the first preset database; for example, referring to the first preset database shown in Table 2, if the key value of the first transaction 10.33, the target historical transaction can include historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 .
  • the first node may store the identifier of the target historical transaction in a preset memory space, or may also store all the information of the target historical transaction (ie transaction identifier, contract address, key value, transaction identifier) stored in the first preset database.
  • the account number, conflict handling instructions, and conflict times) are stored in a preset memory space, which is not specifically limited.
  • the first node may compare the identifier of the first transaction with the identifier of the target historical transaction stored in the preset memory space, and if it is determined that there is a match in the preset memory space with the identifier of the first transaction If it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, it can be determined that the second round of conflict detection can be performed.
  • the target historical transaction and the first transaction can be transactions in the same process of the same business.
  • the number of comparison transactions in the conflict detection process can be reduced, and the efficiency of conflict detection can be improved.
  • the process of comparing transactions can be executed in the preset memory space instead of in the first preset database, thereby improving the response of the conflict detection process speed.
  • the first round of conflict detection can be applied to scenarios with a high possibility of conflict. If the detection result of the first round of conflict detection is a conflict, it can be determined that the first transaction is in conflict with the historical transaction. Round conflict detection can detect transactions with a high probability of conflict, thereby reducing the number of times to query historical transactions in the first preset database, improving the calculation speed of conflict detection, and saving system overhead.
  • the first preset filtering model may also be set in the first preset database. If the first node receives the transaction request of the first transaction sent by the client device, it may obtain the data in the first preset database. The first preset filter model is stored, and the first preset filter model is stored in the preset memory space. Correspondingly, if the detection result of the first round of conflict detection is that the first transaction does not conflict with the historical transaction (that is, there is no target historical transaction that matches the identifier of the first transaction in the preset memory space), the first node can transfer the first transaction The identification of a transaction is input into the first preset filtering model stored in the preset memory space.
  • the first preset filtering model can perform a second round of conflict detection on the first transaction, and can output the conflict result of the first transaction;
  • the conflict result of the first transaction can be any one of the first result and the second result
  • the first result is used to indicate that there is no conflict between the first transaction and the historical transaction
  • the second result is used to indicate that the first transaction may conflict with the historical transaction.
  • the model structure of the first preset filtering model can be set by those skilled in the art based on experience, and is not specifically limited.
  • the first preset filtering model can be a model based on bits, such as a Bloom filter; according to experiments, it is found that if the memory of the Bloom filter is small, the output result will be misjudged as the second result. If the memory of the Bloom filter is large, it will cause a waste of system space.
  • the embodiment of the present invention has been experimentally determined that the memory of the Bloom filter is set to 200M and is based on transaction information of historical transactions in the last 3 years (including historical transaction identifiers, key values, transaction data, conflict processing instructions, conflicts
  • the error rate of the output result of the Bloom filter can be less than 1%.
  • the above is only an exemplary simple description. Those skilled in the art can also set the memory of the Bloom filter and/or train the historical transaction of the Bloom filter according to actual needs. The above setting does not constitute a cost Limitations of the plan.
  • the memory of the Bloom filter can be greater than 200M, or it can be less than 200M, such as 400M or 100M; accordingly, the historical transaction of the training Bloom filter can be the historical transaction in the last 2 years, or also It can be historical transactions within the last 5 years, and the specifics are not limited.
  • the second round of conflict detection can be applied to scenarios where the possibility of conflict is small. If the detection result of the second round of conflict detection is no conflict, it can be determined that there is no conflict between the first transaction and the historical transaction.
  • the second round of conflict detection can detect transactions that are less likely to conflict.
  • the conflict results of most transactions can be obtained through the first round of conflict detection and the second round of conflict detection based on the preset memory space in advance, thereby The number of times to query historical transactions in the first preset database can be reduced, the calculation speed and efficiency of conflict detection can be improved, and system overhead can be saved.
  • the first node can perform the third round of conflict detection . Specifically, the first node may compare the identifier of the first transaction with the identifier of the historical transaction in the first preset database, and if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, then It can be determined that there is a conflict between the first transaction and the historical transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, it can be determined that there is no conflict between the first transaction and the historical transaction.
  • the conflicting transactions can be detected by using the first round of conflict detection and the second round of conflict detection, because both the first round of conflict detection and the second round of conflict detection are executed in the preset memory space , which can make the response speed faster and improve the efficiency of conflict detection.
  • the third round of conflict detection can be applied to any scenario. If the conflict result of the first transaction is not obtained based on the first round of conflict detection and the second round of conflict detection, the first transaction can be compared with the first transaction based on the third round of conflict detection. The historical transactions in a preset database are compared, so that the conflict result of the first transaction can be obtained.
  • by using the first round of conflict detection to the third round of conflict detection it is possible to avoid directly querying historical transactions in the first preset database, thereby reducing system overhead and improving the efficiency of conflict detection. Accurate conflict results.
  • Step 204 The first node processes the first transaction according to the conflict result of the first transaction and the conflict processing instruction to obtain the processing result of the first transaction.
  • step 204 in detail in conjunction with Table 1 and Table 3.
  • Table 3 shows several processing methods that the first node executes on the first transaction according to the conflict results and conflict processing instructions of the first transaction.
  • the schematic table The schematic table.
  • Table 3 Schematic of several ways for the first node to process the first transaction
  • the first node can execute the first transaction :
  • the first condition, the conflict result is that there is no conflict between the first transaction and the historical transaction
  • the conflict processing instruction is that the first transaction is executed when there is no conflict between the first transaction and the historical transaction (ie "0");
  • the second condition, the conflict result is that the first transaction conflicts with the historical transaction
  • the conflict processing instruction is that the first transaction is executed when there is a conflict between the first transaction and the historical transaction (ie "2");
  • the third condition, the conflict result is that the first transaction conflicts with the historical transaction
  • the conflict processing instruction is that the first transaction conflicts with the historical transaction, redirect the first transaction to the fault-tolerant contract (ie "3");
  • the fourth condition is that the conflict result is that the first transaction conflicts with the historical transaction, and the conflict processing instruction is to execute the first transaction and print the log when there is a conflict between the first transaction and the historical transaction (ie, "5").
  • the first node can generate the first log after processing the first transaction, and can change the timestamp of the processing of the first transaction Information, transaction data, and conflict indication values are added to the first log, and then the first log is saved, so that the operation and maintenance personnel can perform troubleshooting work.
  • the first node may refuse to execute the first transaction:
  • the fifth condition, the first transaction conflicts with the historical transaction, and the conflict processing instruction is to refuse to execute the first transaction when the first transaction conflicts with the historical transaction (ie "1");
  • the sixth condition is that the first transaction conflicts with the historical transaction
  • the conflict processing instruction is that when the first transaction conflicts with the historical transaction, the first transaction is rejected and an alarm is issued (ie, "3").
  • the first node can generate alarm information while refusing to process the first transaction, and can send the alarm information to the client device. In order to facilitate the operation and maintenance personnel to perform troubleshooting.
  • the following describes the specific implementation process of the first node processing the first transaction from two scenarios.
  • the first node can execute the first transaction, that is, the conflict result of the first transaction and the conflict processing instruction satisfy the first condition, or the second condition, or the third condition, or the fourth Kind of conditions.
  • the first node may first update the target historical transaction included in the preset memory space. In an example, if there is no historical transaction with the same identifier of the first transaction in the preset memory space, the first node may add the first transaction to the preset memory space. In this way, the preset memory space includes The target historical transaction may include the first transaction. If the first node receives a second transaction with the same identifier as the first transaction during the execution of the first transaction, the second transaction can be determined through the first round of conflict detection It conflicts with the first transaction, so there is no need to execute a second transaction that is repeated with the first transaction.
  • the first node may update the target historical transaction information stored in the preset database, for example, the target historical transaction may be updated
  • the number of conflicts, conflict processing instructions, etc. in this way can make the preset filtering model determined based on the historical transactions in the preset memory space more accurate.
  • the transaction processing process of the first node can be made more efficient.
  • the first node can communicate with other nodes in the blockchain system to execute the consensus process of the first transaction, if it is determined that the number of nodes that reach consensus on the first transaction in the blockchain system is greater than or equal to the preset threshold ,
  • the block information corresponding to the first transaction can be generated, and the block information corresponding to the first transaction can be used to update the first preset database and/or the preset memory space.
  • the first transaction can be updated according to the block information of the first transaction.
  • a preset database may also update the preset memory space according to the block information of the first transaction, or may also update the first preset database and the preset memory space according to the block information of the first transaction, which is not specifically limited.
  • the preset threshold may be set by those skilled in the art based on experience, for example, it may be 3/4 of the number of nodes included in the blockchain system, which is not specifically limited.
  • the first preset database may store the first check value
  • the first check The value may be obtained by verifying multiple historical transactions by the first node using a preset verification algorithm, for example, may be a hash value of multiple historical transactions.
  • the first node may obtain the first check value from the first preset database, and may store the first check value in the preset memory space; further, in In the process of executing the first transaction, the first node can generate the initial block information corresponding to the first transaction in advance, and can use a preset verification algorithm to verify the first verification value and the first transaction to obtain the second verification.
  • the first node can add the second check value to the initial block information, and can reach a consensus with other nodes in the blockchain system. If the consensus is passed, the corresponding value of the first transaction can be obtained Block information, and can use the second check value to update the first check value stored in the preset memory space.
  • a circular hash algorithm can be used to determine the second check value, and the program implementation process can be as follows:
  • HASH_NEW HASH_DATA
  • the first node determines to execute transaction data[0], historical transaction data[1], and historical transaction data[2]; according to the second line of program, the first node can obtain the calibration stored in the preset memory space The verification value HASH_NEW; according to the third to fourth lines of the program, the first node can get the hash value of transaction data[0] to obtain the verification value hash(Data[1]) of transaction data[0], and then can The first check value HASH_NEW and the check value hash(Data[1]) of transaction data[0] take the hash value to obtain the check value of historical transactions including transaction data[0]; accordingly, the first The node can obtain the check value of historical transaction including transaction data[0] and transaction data[1] according to the check value of historical transaction including transaction data[0] and transaction data[1], and then can According to the check value of the historical transaction including transaction data[0] and transaction data[1] and transaction data[2], obtain transaction data[0], transaction data[1] and transaction data[0] and transaction data[0
  • the foregoing is only an exemplary simple description, and the manner in which the cyclic hash algorithm is used to determine the second check value is only for the convenience of explaining the solution, and does not constitute a limitation on the solution.
  • the method for determining the second check value can be set by those skilled in the art based on experience.
  • the merkle root algorithm can be used to determine the second check value, or the acyclic hash algorithm can be used to determine the second check value. The details are not limited.
  • the first check value can be used to identify historical transactions processed by the blockchain system. After the first transaction is executed, the first check value is updated with the first transaction to obtain the second check value.
  • multiple nodes in the blockchain system can achieve consensus based on the same second check value, thereby improving the accuracy of transaction processing in the blockchain system; on the other hand, it can make the blockchain system in In the process of processing transactions, the historical transactions processed by the blockchain system are updated in real time, thereby improving the accuracy of subsequent processing transactions.
  • the block information corresponding to the first transaction can be stored in the blockchain system.
  • the processing result of the first transaction can include the block information corresponding to the first transaction.
  • the first node may use the block information according to the first transaction to update the first preset database and/or the preset memory space.
  • the first node may use the identifier of the first transaction to train the first preset filtering model to obtain the second preset filtering model, and may use the first preset stored in the first preset database
  • the filtering model is updated to the second preset filtering model; and the first node can add the transaction information corresponding to the first transaction to the first preset database, and can use the second check value determined above to update the first preset Set the first check value stored in the database; further, the first node can use the second preset filter model and the second check value to respectively update the first preset filter model and the first check value stored in the preset memory space. Value.
  • the processing result of the first transaction may include first instruction information, and the first instruction information is used to indicate that the processing of the first transaction fails.
  • the first node since the first node has added the first transaction to the preset memory space when it determines to execute the first transaction, if the first transaction is not successfully executed, the first node may add the preset memory The first transaction stored in the space is deleted, thereby avoiding the subsequent acquisition of a transaction with the same identifier as the first transaction from failing the first round of conflict detection, ensuring the accuracy of subsequent transaction processing.
  • the verification value based on The updated preset memory space and the first preset database perform conflict detection for the next transaction, thereby improving the accuracy of conflict detection.
  • the first node can also obtain the address of the fault-tolerant contract included in the transaction request after executing the first transaction, and can also obtain the address of the fault-tolerant contract included in the transaction request according to the The address of the fault-tolerant contract calls the fault-tolerant processing module to correct the first transaction.
  • the processing result of the first transaction may also include the address of the fault-tolerant contract, and the address of the fault-tolerant contract is used to call the fault-tolerant processing module in the client device to correct the first transaction.
  • the first node may refuse to execute the first transaction, that is, the conflict result of the first transaction and the conflict processing instruction can satisfy the fifth condition or the sixth condition.
  • the first node may generate a conflict indicator code, the conflict indicator code is used to indicate that the first transaction conflicts with the historical transaction, and the first node has not executed the first transaction. Therefore, the processing result of the first transaction may include the conflict indicator code.
  • Step 205 The first node sends the first information or the second information to the client device.
  • the processing result of the first transaction may include any one or more of the block information of the first transaction, the first instruction information, the conflict indicator code, and the address of the fault-tolerant contract. If the processing result of the first transaction includes the block information of the first transaction and/or the address of the fault-tolerant contract, indicating that the first transaction has been successfully executed by the first node, the first node may send the first information to the client device; if The processing result of the first transaction includes the first instruction information or the conflict instruction code, indicating that the first transaction has not been successfully executed by the first node, and the first node may send the second information to the client device.
  • the conflict processing instructions set by the client device include "execute the first transaction when the first node conflicts with the historical transaction", “redirect to the fault-tolerant module when the first node conflicts with the historical transaction” and " When the first node conflicts with the historical transaction, execute the first transaction and print the log.
  • the first node may send the first information to the client device after successfully executing the first transaction.
  • the first information may include the block information of the first transaction and/or the address of the fault-tolerant contract. In this way, after receiving the first information, the client device can correct the first transaction according to the first information.
  • the processing result of the first transaction includes the first indication information, it means that the first transaction has passed the conflict detection but not successfully executed by the first node; if the processing result of the first transaction includes the conflict indication value, it means that A transaction failed the conflict processing instruction and was not successfully executed by the first node. Since the first transaction was not successfully executed, there will be no major business errors. Therefore, the first node may send the second information to the client device, and the second information may be used to indicate that the first transaction was not successfully executed.
  • Step 206 The client device receives the first information or the second information sent by the first node, and calls the fault-tolerant processing module to correct the first transaction.
  • a second preset database may be provided in the client device, and all historical transactions processed by the client device may be stored in the second preset database.
  • the client device receives the first information sent by the first node, it means that the first transaction has been successfully executed by the first node. In this way, the client device can pair The first transaction performs conflict detection to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device.
  • the client device can directly compare the identifier of the first transaction with the identifier of the historical transaction stored in the second preset database to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device; In another example, the client device may sequentially perform the first round of conflict detection to the third round of conflict detection on the first transaction, so as to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device.
  • the above two examples can be implemented with reference to the process of determining whether there is a conflict between the first transaction and the historical transaction processed by the first node in step 203, and the details are not repeated here.
  • the processing module corrects the first transaction according to the preset processing rules.
  • the preset processing rules may include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
  • the fault-tolerant processing module may prejudge the business process to which the first transaction belongs. If it is determined that the first transaction is a transaction in a non-critical business process, the fault-tolerant processing module may correct the first transaction in a variety of ways. In one example, the fault-tolerant processing module may obtain the log information and/or database information of the first transaction, and may send the log information and/or database information of the first transaction to the operation and maintenance personnel for maintenance; in another example, The fault-tolerant processing module can perform subsequent processing on the first transaction according to the address of the fault-tolerant contract and the preset processing rules set in the fault-tolerant contract. Since the transaction in the non-critical business process has a small impact on the business, the above-mentioned method is used to modify the transaction in the non-critical business process to improve the processing efficiency of the system.
  • the fault-tolerant processing module can correct the first transaction according to the business process to which the first transaction belongs. For example, if the first transaction to create a new order X, the fault-tolerant processing module may be the order of X state to the inactive state; if the first transaction to add revenue L 1, the fault-tolerant processing module in Q 1 can account from the Account Q revenue minus 1 L 1; if the first transaction for the account to the account Q 2 Q 1 transfer funds L 2, then the fault-tolerant processing module may be on account of capital Q 2 Q 1 L accounts returned; if the first transaction If asset N is abnormally drawn from account Q 3 repeatedly, the fault-tolerant processing module can freeze account Q 3 .
  • the foregoing is only an exemplary simple description, and the manners of modifying the first transaction listed therein are only for the convenience of explaining the solution, and do not constitute a limitation on the solution.
  • the method for modifying the first transaction can be set by a person skilled in the art based on experience, or can be set according to actual business needs, which is not specifically limited.
  • the conflict processing instruction is set by the client device, some conflicting transactions may still be processed.
  • the client device By sending block information to the client device after the transaction is processed, the client device The device corrects the transaction, so as to avoid major errors in the transaction processing process, and improve the business processing capability and accuracy of the blockchain system.
  • the client device can call the fault-tolerant processing module to obtain the relevant information of the first transaction, such as the timestamp of the first transaction, transaction data, Conflict results and conflict processing instructions, etc.; further, the fault-tolerant processing module can store relevant information of the first transaction in log information or database information, so that the operation and maintenance personnel can perform troubleshooting based on the log information or database information.
  • the fault-tolerant processing module can store relevant information of the first transaction in log information or database information, so that the operation and maintenance personnel can perform troubleshooting based on the log information or database information.
  • the first node in the blockchain system receives the transaction request sent by the client device, the transaction request includes the identification of the first transaction and the conflict processing instruction, and the conflict processing instruction includes the first transaction and the existence of historical transactions.
  • the conflict result, and the first transaction is processed according to the conflict result of the first transaction and the conflict processing instruction; wherein the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction.
  • the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, thereby making the process of conflict detection for the transaction faster and improving The efficiency of transaction processing in the blockchain system; and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, in the above technical solution
  • the transaction processing method is more in line with the actual situation.
  • FIG. 3 is a schematic structural diagram of a client device and a first node according to an embodiment of the present invention.
  • the first node may be provided with a conflict detection unit, a transaction execution unit, and an update unit, and the conflict detection unit, the transaction execution unit, and the update unit may be connected in sequence.
  • a preset memory space, a first preset filtering model, and a first preset database may also be set in the first node; accordingly, a second preset database may be set in the client device.
  • the process of processing the first transaction based on the client device and the first node as shown in FIG. 3 may be as shown in the following steps 1 to 6:
  • Step 1 The client device sends a transaction request to the conflict detection unit provided in the first node, and the transaction request includes the identifier of the first transaction and the conflict processing instruction of the first transaction.
  • Step 2 After receiving the transaction request sent by the client device, the conflict detection unit obtains the identifier of the first transaction, and based on any one or more of the preset memory space, the first preset filtering model, and the first preset database Perform conflict detection on the first transaction.
  • the conflict detection unit may perform conflict detection on the first transaction based only on the preset memory space, or perform conflict detection on the first transaction based on the first preset filtering model only, or based only on the first preset database Perform conflict detection on the first transaction; in another example, the conflict detection unit may perform conflict detection on the first transaction based on the preset memory space and the first preset filtering model, or based on the preset memory space and the first preset database Perform conflict detection on the first transaction, or perform conflict detection on the first transaction based on the first preset filtering model and the first preset database; in another example, the conflict detection unit may be based on the preset memory space and the first preset database. The filter model and the first preset database perform conflict detection on the first transaction.
  • the conflict detection unit may perform the first round of conflict detection on the first transaction based on a preset memory space. If the first round of conflict detection determines that there is a historical transaction matching the identifier of the first transaction in the preset memory space, the conflict detection unit may determine that the first transaction conflicts with the historical transaction; if the first round of conflict detection determines the preset memory space If there is no historical transaction matching the identifier of the first transaction, the conflict detection unit may perform the second round of conflict detection on the first transaction based on the first preset filtering model.
  • the conflict detection unit can determine that the first transaction does not conflict with the historical transaction; if the second round of conflict detection determines that the first transaction conflicts with the historical transaction, then The conflict detection unit may perform a third round of conflict detection on the first transaction based on the first preset database. If the third round of conflict detection determines that there is a historical transaction matching the identification of the first transaction in the first preset database, the conflict detection unit may determine that the first transaction conflicts with the historical transaction; if the first round of conflict detection determines that the first predetermined Assuming that there is no historical transaction matching the identifier of the first transaction in the database, the conflict detection unit may determine that there is no conflict between the first transaction and the historical transaction.
  • the first node and the client device can perform the following steps 3.1 and 4.1:
  • Step 3.1 The conflict detection unit (or the first node) sends a conflict indication code to the client device.
  • Step 4.1 The client device receives the conflict indication code sent by the conflict detection unit, and calls the fault-tolerant processing module to perform conflict processing on the first transaction.
  • the fault-tolerant processing module can obtain the time stamp, transaction data, and conflict indicator code of the first transaction, and can record the time stamp, transaction data, and conflict indicator code of the first transaction in log information or a database.
  • the conflict processing instruction is "execute the first transaction when there is no conflict between the first transaction and the historical transaction", or there is a conflict between the first transaction and the historical transaction, and the conflict is handled
  • the instruction is "execute the first transaction when the first transaction conflicts with the historical transaction", or the first transaction conflicts with the historical transaction, and the conflict processing instruction is "redirect to the fault-tolerant processing module when the first transaction conflicts with the historical transaction"
  • the first node and the client device can perform the following step 3.2, step 4.2 to step 6:
  • Step 3.2 The conflict detection unit sends the first transaction to the transaction execution unit, so that the transaction execution unit executes the first transaction.
  • the transaction execution unit can use the smart contract to execute the first transaction, and can reach consensus with other nodes in the blockchain system through the network. If the number of nodes that have reached a consensus is greater than or equal to the preset threshold, the transaction execution unit can generate block information corresponding to the first transaction, and can store the block information corresponding to the first transaction in the underlying blockchain; if If the number of nodes that have reached a consensus is less than the preset threshold, the transaction execution unit (or the first node) can send the first transaction execution failure information to the client device, so that the client device can call the fault-tolerant processing module to process the first transaction (the The process is not shown in Figure 3).
  • Step 4.2 After the transaction execution unit determines that the first transaction is successfully executed, it sends an update request to the update unit.
  • the update request includes block information corresponding to the first transaction.
  • Step 5 After receiving the update request sent by the transaction execution unit, the update unit uses the block information corresponding to the first transaction to update the preset memory space, the first preset filter model, and the first preset database. Specifically, the update unit may add the first transaction to the preset memory space and the first preset database, and may update the first preset filtering model based on the historical transactions and the first transaction included in the first preset database.
  • Step 6 If the first node determines that the update of the preset memory space, the first preset filter model, and the first preset database is completed, it sends a transaction response message to the client device.
  • the transaction response message includes the block corresponding to the first node information.
  • a second preset database may be set in the client device. If the client device receives the block information corresponding to the first node, the first node can be obtained from the block information corresponding to the first node. The identifier of the first node can be matched with the multiple historical transactions stored in the second preset database. If it is determined that there is no historical transaction with the same identifier as the first transaction in the second preset database, the client device can add the first transaction to the second preset database; if it is determined that the second preset database exists in the same For a historical transaction with the same transaction identifier, the client device can call the fault-tolerant processing module to correct the first transaction. The specific implementation process can be implemented with reference to step 206, which will not be repeated here.
  • the conflict detection process of the first transaction and the transaction execution process of the first transaction can be executed in two processes respectively, so that conflict detection and contract can be implemented.
  • the decoupling of calculation and block consensus improves the efficiency of transaction processing.
  • the embodiment of the present invention also provides a transaction processing device based on a blockchain system, and the specific content of the device can be implemented with reference to the above method.
  • Figure 4 is a schematic structural diagram of a transaction processing device based on a blockchain system provided by an embodiment of the present invention, including:
  • the transceiver module 401 is configured to receive a transaction request sent by a client device.
  • the transaction request includes an identifier of a first transaction and a conflict processing instruction;
  • the conflict processing instruction includes a conflict between the first transaction and a historical transaction.
  • the processing method of the first transaction, and/or the processing method of the first transaction when there is no conflict between the first transaction and the historical transaction;
  • the conflict detection module 402 is configured to determine the conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction;
  • the processing module 403 is configured to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
  • the transaction request further includes the contract address of the first transaction;
  • the conflict detection module 402 is configured to:
  • the first preset database includes the identifiers of multiple historical transactions and the multiple histories A key value of the transaction, where the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database;
  • the conflict detection module 402 is further configured to:
  • the identifier of the first transaction is input into a first preset filtering model;
  • the first preset filtering model is It is obtained by training using the transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identification, key value, transaction data, conflict processing instruction and the number of conflicts of each historical transaction;
  • the output result of the first preset filtering model is that there is no conflict between the first transaction and the historical transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
  • the conflict detection module 402 is further configured to:
  • the identification of the first transaction is performed with the identification of multiple historical transactions in the first preset database In contrast, if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction conflicts with the historical transaction; if it is determined that there is no historical transaction in the first preset database If there is a historical transaction matching the identifier of the first transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
  • the conflict processing instruction when the first transaction does not conflict with the historical transaction includes executing the first transaction;
  • the conflict processing instruction when the first transaction conflicts with the historical transaction includes any one of the following: reject Execute the first transaction, execute the first transaction, and redirect the first transaction to a fault-tolerant contract;
  • the processing module 403 is used to:
  • the conflict processing instruction is to execute the first transaction when there is no conflict between the first transaction and the historical transaction, or if the first transaction and the historical transaction There is a conflict, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, then the first transaction is executed; if the first transaction conflicts with the historical transaction, and all The conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a conflict between the first transaction and the historical transaction, then execute the first transaction, and obtain the address of the fault-tolerant contract included in the conflict processing instruction , Sending the address of the fault-tolerant contract to the client device; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction, the first transaction is rejected A transaction, a conflict indicator value is sent to the client device, and the conflict indicator value is used to indicate that the first transaction conflicts with the historical transaction.
  • processing module 403 is used to:
  • processing module 403 After the processing module 403 generates the block information corresponding to the first transaction, it is further used to:
  • a first check value is stored in the first preset database, and the first check value is a check value stored in the first preset database by the first node using a preset check algorithm Obtained by verifying the multiple historical transactions;
  • the processing module 403 is specifically configured to:
  • the second check value is added to the initial block information to obtain block information corresponding to the first transaction.
  • processing module 403 is used to:
  • Figure 5 is a schematic structural diagram of a transaction processing device based on a blockchain system provided by an embodiment of the present invention, including:
  • the configuration module 501 is used to configure the identification of the first transaction and the conflict processing instruction
  • the transceiver module 502 is configured to send a transaction request to the first node in the blockchain system, the transaction request including the identifier of the first transaction and the conflict processing instruction; and, to receive the fault tolerance sent by the first node The address of the contract;
  • the correction module 503 is configured to call the fault-tolerant processing module to correct the first transaction according to the address of the fault-tolerant contract.
  • the transceiver module 502 is further configured to: receive block information corresponding to the first transaction sent by the first node;
  • the modification module 503 is further configured to: parse the block information corresponding to the first transaction to obtain the identifier of the first transaction; if it is determined that the identifier and the first transaction exist in the second preset database of the client device For a historical transaction that matches the transaction identifier, the fault-tolerant processing module is used to correct the first transaction in accordance with preset processing rules; the second preset database stores multiple histories processed by the client device transaction.
  • the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
  • the first node in the blockchain system receives the transaction request sent by the client device, the transaction request includes the identification of the first transaction and the conflict processing instruction, and the conflict processing instruction includes The method of processing the first transaction when there is a conflict between the first transaction and the historical transaction, and/or the method of processing the first transaction when there is no conflict between the first transaction and the historical transaction; further, the first node according to the first transaction Identification, to determine the conflict result of the first transaction, and process the first transaction according to the conflict result of the first transaction and the conflict processing instruction; wherein the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction .
  • the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, thereby making the process of conflict detection for the transaction faster and improving The efficiency of transaction processing in the blockchain system; and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, in the above technical solution
  • the transaction processing method is more in line with the actual situation.
  • an embodiment of the present invention provides a terminal device, as shown in FIG. 6, including at least one processor 1101 and a memory 1102 connected to the at least one processor.
  • the embodiment of the present invention does not limit the processor.
  • the connection between processor 1101 and memory 1102 in FIG. 6 is taken as an example.
  • the bus can be divided into address bus, data bus, control bus, etc.
  • the memory 1102 stores instructions that can be executed by at least one processor 1101. By executing the instructions stored in the memory 1102, the at least one processor 1101 can execute the aforementioned transaction processing methods based on the blockchain system. Steps included.
  • the processor 1101 is the control center of the terminal device, which can use various interfaces and lines to connect various parts of the terminal device, and realize data by running or executing instructions stored in the memory 1102 and calling data stored in the memory 1102. deal with.
  • the processor 1101 may include one or more processing units, and the processor 1101 may integrate an application processor and a modem processor.
  • the application processor mainly processes an operating system, a user interface, and an application program.
  • the adjustment processor mainly processes instructions issued by operation and maintenance personnel. It is understandable that the foregoing modem processor may not be integrated into the processor 1101.
  • the processor 1101 and the memory 1102 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
  • the processor 1101 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiment of the transaction processing method based on the blockchain system can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • the memory 1102 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules.
  • the memory 1102 may include at least one type of storage medium, for example, it may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc.
  • the memory 1102 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 1102 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
  • an embodiment of the present invention provides a back-end device. As shown in FIG. 7, it includes at least one processor 1201 and a memory 1202 connected to the at least one processor.
  • the embodiment of the present invention does not limit the processing.
  • the connection between the processor 1201 and the memory 1202 in FIG. 7 is taken as an example.
  • the bus can be divided into address bus, data bus, control bus, etc.
  • the memory 1202 stores instructions that can be executed by at least one processor 1201. By executing the instructions stored in the memory 1202, the at least one processor 1201 can execute the aforementioned transaction processing methods based on the blockchain system. Steps included.
  • the processor 1201 is the control center of the back-end equipment, which can use various interfaces and lines to connect to various parts of the back-end equipment, and by running or executing instructions stored in the memory 1202 and calling data stored in the memory 1202, Realize data processing.
  • the processor 1201 may include one or more processing units, and the processor 1201 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, application programs, etc., and the modem processor Mainly analyze the received instructions and analyze the received results. It can be understood that the foregoing modem processor may not be integrated into the processor 1201.
  • the processor 1201 and the memory 1202 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
  • the processor 1201 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiment of the transaction processing method based on the blockchain system can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • the memory 1202 as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules.
  • the memory 1202 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc.
  • the memory 1202 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 1202 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Abstract

A blockchain system-based transaction processing method and apparatus, wherein the method comprises: a first node in a blockchain system receiving a transaction request sent by a client device, and determining a conflict result of a first transaction comprised in the transaction request according to the identification of the first transaction, and then processing the first transaction according to the conflict result of the first transaction and a conflict processing instruction comprised in the transaction request. By means of performing conflict detection on the first transaction on the basis of the identification of the transaction, complete transaction data may not need to be compared, and thus the efficiency of transaction processing in the blockchain system may be improved. Moreover, the identification of the transaction and the conflict processing instruction may be set by the client device. Therefore, different conflict processing instructions may be set on the basis of different service scenarios and the requirements of the client device, that is, the described transaction processing method is more in line with actual circumstances.

Description

一种基于区块链系统的交易处理方法及装置A transaction processing method and device based on block chain system
相关申请的交叉引用Cross references to related applications
本申请要求在2019年04月28日提交中国专利局、申请号为201910350093.3、申请名称为“一种基于区块链系统的交易处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 28, 2019, the application number is 201910350093.3, and the application name is "a method and device for transaction processing based on a blockchain system". The reference is incorporated in this application.
技术领域Technical field
本发明涉及金融科技(Fintech)技术领域中的区块链(blockchain)领域,尤其涉及一种基于区块链系统的交易处理方法及装置。The present invention relates to the blockchain (blockchain) field in the technical field of financial technology (Fintech), and in particular to a transaction processing method and device based on a blockchain system.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融行业正在逐步向金融科技(Fintech)转变,区块链技术也不例外,但由于金融行业的安全性、实时性要求,也对技术提出了更高的要求。区块链系统中通常可以设置有多个节点,多个节点之间可以互相通信,一般来说,客户端设备可以向区块链系统中的某一个节点发送交易请求,该节点接收到交易请求后,可以处理交易,并可以通过与其它节点的共识,生成交易对应的区块信息。在实际操作中,由于业务类型的多样性,区块链系统在一段时间内处理的交易会非常多,因此,如何合理处理每一个交易,对于区块链系统的发展是非常重要的。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually shifting to Fintech. Blockchain technology is no exception, but due to the security and real-time requirements of the financial industry , Also put forward higher requirements for technology. Generally, multiple nodes can be set in the blockchain system, and multiple nodes can communicate with each other. Generally speaking, the client device can send a transaction request to a certain node in the blockchain system, and the node receives the transaction request Later, transactions can be processed, and block information corresponding to the transaction can be generated through consensus with other nodes. In actual operation, due to the diversity of business types, the blockchain system will process a lot of transactions in a period of time. Therefore, how to deal with each transaction reasonably is very important for the development of the blockchain system.
现有技术中,节点在接收到客户端发送的交易请求后,通常可以对交易请求进行解析,获取交易数据,比如交易的发起方、交易的接收方和交易所属的业务类型等;进一步地,节点可以将交易数据与区块链系统处理的历史交易的交易数据进行对比,若确定交易与历史交易发生冲突,则可以根据区块链系统中预设的冲突处理指令对交易进行处理。然而,采用该种方式,交易数据中包括的数据量较多,可能需要耗费较长的时间完成交易数据与历史 交易的交易数据的对比过程,通常情况下,区块链系统中的交易可以被频繁触发,因此采用上述方式可能并不能及时地处理多个交易,导致区块链系统中交易处理的效率较差。In the prior art, after receiving the transaction request sent by the client, the node can usually parse the transaction request to obtain transaction data, such as the initiator of the transaction, the receiver of the transaction, and the type of business to which the transaction belongs; further, The node can compare the transaction data with the transaction data of the historical transaction processed by the blockchain system. If it is determined that the transaction conflicts with the historical transaction, the transaction can be processed according to the conflict processing instruction preset in the blockchain system. However, with this method, the amount of data included in the transaction data is large, and it may take a long time to complete the process of comparing the transaction data with the transaction data of the historical transaction. Under normal circumstances, the transaction in the blockchain system can be Frequent triggers, so the above methods may not be able to process multiple transactions in time, resulting in poor transaction processing efficiency in the blockchain system.
综上,目前亟需一种基于区块链系统的交易处理方法,用以提高区块链系统中交易处理的效率。In summary, there is an urgent need for a transaction processing method based on a blockchain system to improve the efficiency of transaction processing in the blockchain system.
发明内容Summary of the invention
本发明实施例提供一种基于区块链系统的交易处理方法及装置,用以提高区块链系统中交易处理的效率。The embodiment of the present invention provides a transaction processing method and device based on a blockchain system to improve the efficiency of transaction processing in the blockchain system.
第一方面,本发明实施例提供的一种基于区块链系统的交易处理方法,所述方法包括:In the first aspect, an embodiment of the present invention provides a transaction processing method based on a blockchain system, and the method includes:
区块链系统中的第一节点接收客户端设备发送的交易请求,所述交易请求包括第一交易的标识和冲突处理指令,所述冲突处理指令包括所述第一交易与历史交易存在冲突时对所述第一交易的处理方式,和/或,所述第一交易与历史交易不存在冲突时对所述第一交易的处理方式;进一步地,所述第一节点根据所述第一交易的标识,确定所述第一交易的冲突结果,并根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理,所述第一交易的冲突结果用于指示所述第一交易与历史交易是否存在冲突。The first node in the blockchain system receives a transaction request sent by the client device, the transaction request includes the identification of the first transaction and a conflict processing instruction, and the conflict processing instruction includes when there is a conflict between the first transaction and a historical transaction The processing method for the first transaction, and/or the processing method for the first transaction when there is no conflict between the first transaction and the historical transaction; further, the first node according to the first transaction To determine the conflict result of the first transaction, and process the first transaction according to the conflict result of the first transaction and the conflict processing instruction, and the conflict result of the first transaction is used to indicate Whether there is a conflict between the first transaction and the historical transaction.
上述技术方案中,通过设置交易的标识,可以采用对比交易的标识的方式对第一交易进行冲突检测,而无需对比交易数据,从而可以使得对交易进行冲突检测的过程更为快速,提高区块链系统中交易处理的效率;且,由于冲突处理指令由客户端设备进行设置,因此可以基于不同的业务场景和客户端设备的要求设置不同的冲突处理指令,也就是说,上述技术方案中的交易处理方法更加符合实际情况。In the above technical solution, by setting the transaction identifier, the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, so that the process of conflict detection for the transaction can be faster and the block The efficiency of transaction processing in the chain system; and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, the above technical solutions The transaction processing method is more in line with the actual situation.
可选地,所述第一节点根据所述第一交易的标识,确定所述第一交易的冲突结果,包括:所述第一节点首先根据所述第一交易的标识确定所述第一交易的键值;进一步地,所述第一节点从第一预设数据库中获取目标历史交 易的标识,并将所述目标历史交易的标识存储到预设内存空间;其中,所述第一预设数据库包括所述多个历史交易的标识和所述多个历史交易的键值,所述目标历史交易为所述第一预设数据库中键值与所述第一交易的键值匹配的历史交易;所述第一节点若确定所述预设内存空间中存在与所述第一交易的标识匹配的目标历史交易,则确定所述第一交易与历史交易存在冲突。Optionally, the first node determining the conflict result of the first transaction according to the identifier of the first transaction includes: the first node first determines the first transaction according to the identifier of the first transaction Further, the first node obtains the identifier of the target historical transaction from the first preset database, and stores the identifier of the target historical transaction in a preset memory space; wherein, the first preset The database includes identifiers of the multiple historical transactions and key values of the multiple historical transactions, and the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database If the first node determines that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, then it determines that the first transaction conflicts with the historical transaction.
上述技术方案中,由于第一预设数据库的响应速度通常较慢,因此上述技术方案预先将第一交易的标识与第一内存空间中存储的目标历史交易的标识进行对比,而并未直接将第一交易的标识与第一预设数据库中存储的历史交易的标识进行对比,可以提高冲突检测过程的响应速度。一方面,基于键值对第一预设数据库中的目标历史交易进行筛选,可以降低筛选过程所占用的内存,提高筛选效率;另一方面,若预设内存空间中存在与第一交易的标识匹配的目标历史交易,则可以直接确定第一交易与历史交易冲突,从而可以避免执行后续的冲突检测过程,提高冲突检测的效率。In the above technical solution, since the response speed of the first preset database is generally slow, the above technical solution compares the identification of the first transaction with the identification of the target historical transaction stored in the first memory space in advance, instead of directly comparing Comparing the identifier of the first transaction with the identifier of the historical transaction stored in the first preset database can improve the response speed of the conflict detection process. On the one hand, filtering the target historical transaction in the first preset database based on the key value can reduce the memory occupied by the screening process and improve the screening efficiency; on the other hand, if there is an identifier with the first transaction in the preset memory space For matching target historical transactions, the conflict between the first transaction and the historical transaction can be directly determined, so that subsequent conflict detection processes can be avoided and the efficiency of conflict detection can be improved.
可选地,所述方法还包括:所述第一节点若确定预设内存空间中不存在与所述第一交易的标识匹配的目标历史交易,则将第一交易的标识输入到第一预设过滤模型,所述第一预设过滤模型为使用所述多个历史交易的交易信息训练得到的,每个历史交易的交易信息包括所述每个历史交易的标识、键值、交易数据、冲突处理指令、冲突次数;进一步地,若所述第一预设过滤模型输出的结果为所述第一交易与历史交易不存在冲突,则所述第一节点确定第一交易与历史交易不存在冲突。Optionally, the method further includes: if the first node determines that there is no target historical transaction that matches the identifier of the first transaction in the preset memory space, then inputting the identifier of the first transaction into the first preset Assume a filter model, the first preset filter model is obtained by training using transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identifier, key value, transaction data, Conflict processing instructions and conflict times; further, if the output result of the first preset filtering model is that the first transaction does not conflict with the historical transaction, the first node determines that the first transaction does not exist with the historical transaction conflict.
上述技术方案中,在基于内存中的目标历史交易对第一交易进行第一次冲突检测后,可以使用第一预设过滤模型对第一交易进行第二次冲突检测,从而可以提高冲突检测的准确率;且,第二次冲突检测的过程也可以是在预设内存空间中执行的,从而可以避免直接通过第一预设数据库中的历史交易进行冲突检测,从而提高检测效率。也就是说,上述技术方案中,通过基于预设内存空间中的两次检测过程,可以将较大部分的冲突交易检测出来,在提高检测效率的同时提高检测准确性。In the above technical solution, after the first conflict detection is performed on the first transaction based on the target historical transaction in the memory, the first preset filtering model can be used to perform the second conflict detection on the first transaction, thereby improving the conflict detection performance. Accuracy; and the second conflict detection process can also be executed in a preset memory space, so that conflict detection can be avoided directly through historical transactions in the first preset database, thereby improving detection efficiency. That is to say, in the above technical solution, through two detection processes based on the preset memory space, a relatively large portion of conflicting transactions can be detected, which improves detection efficiency while improving detection accuracy.
可选地,所述方法还包括:若所述第一预设过滤模型输出的结果为所述第一交易与历史交易存在冲突,则所述第一节点将所述第一交易的标识与所述第一预设数据库中的一个或多个历史交易的标识进行对比,若确定所述第一预设数据库中存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易存在冲突;若确定所述第一预设数据库中不存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易不存在冲突。Optionally, the method further includes: if the output result of the first preset filtering model is that the first transaction conflicts with the historical transaction, the first node compares the identifier of the first transaction with the The identification of one or more historical transactions in the first preset database is compared, and if it is determined that there is a historical transaction in the first preset database that matches the identification of the first transaction, then the first transaction is determined There is a conflict with a historical transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction does not conflict with the historical transaction.
上述技术方案中,若基于预设内存空间中的两次冲突检测过程均未检测出第一交易的冲突结果,则可以基于第一预设数据库中的历史交易对第一交易进行冲突检测,从而可以获取到第一交易的冲突结果,且使得检测得到的第一交易的冲突结果较为准确。In the above technical solution, if the conflict result of the first transaction is not detected based on the two conflict detection processes in the preset memory space, the conflict detection of the first transaction may be performed based on the historical transactions in the first preset database, thereby The conflict result of the first transaction can be obtained, and the detected conflict result of the first transaction is more accurate.
可选地,所述冲突处理指令包括以下任意一项或任意多项:所述第一交易与历史交易存在冲突时拒绝执行所述第一交易、所述第一交易与历史交易存在冲突时执行所述第一交易、所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约、所述第一交易与历史交易不存在冲突时执行所述第一交易;所述第一节点根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理,包括:若所述第一交易与历史交易不存在冲突,且所述冲突处理指令为所述第一交易与历史交易不存在冲突时执行所述第一交易,或者,若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时执行所述第一交易,则所述第一节点执行所述第一交易;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约,则所述第一节点获取所述冲突处理指令中包括的容错合约的地址,并向所述客户端设备发送所述容错合约的地址;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时拒绝执行所述第一交易,则所述第一节点向所述客户端设备发送冲突指示值,所述冲突指示值用于指示所述第一交易与所述历史交易存在冲突。Optionally, the conflict processing instruction includes any one or more of the following: refusing to execute the first transaction when there is a conflict between the first transaction and a historical transaction, and executing when there is a conflict between the first transaction and a historical transaction Redirecting the first transaction to a fault-tolerant contract when there is a conflict between the first transaction, the first transaction and the historical transaction, and executing the first transaction when there is no conflict between the first transaction and the historical transaction; The first node processes the first transaction according to the conflict result of the first transaction and the conflict processing instruction, including: if there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is The first transaction is executed when there is no conflict between the first transaction and the historical transaction, or if there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction When the first transaction is executed, the first node executes the first transaction; if the first transaction conflicts with historical transactions, and the conflict processing instruction is that the first transaction conflicts with historical transactions When redirecting the first transaction to the fault-tolerant contract, the first node obtains the address of the fault-tolerant contract included in the conflict processing instruction, and sends the address of the fault-tolerant contract to the client device; If there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is to refuse to execute the first transaction when there is a conflict between the first transaction and the historical transaction, the first node sends the conflict to the client device An indicator value, where the conflict indicator value is used to indicate that there is a conflict between the first transaction and the historical transaction.
上述技术方案中,冲突处理指令是由客户端设备设置的,因此可以基于 客户端设备的要求或者业务场景设置符合实际情况的冲突处理指令,相应地,基于冲突处理指令处理第一交易,可以使得第一交易的处理结果满足客户端设备的需要,且可以更加符合实际情况。In the above technical solution, the conflict processing instruction is set by the client device. Therefore, the conflict processing instruction that meets the actual situation can be set based on the requirements of the client device or the business scenario. Accordingly, the first transaction is processed based on the conflict processing instruction to enable The processing result of the first transaction meets the needs of the client device and can be more in line with actual conditions.
可选地,所述第一节点执行所述第一交易,包括:所述第一节点若确定所述区块链系统中对所述第一交易达成共识的节点的数量大于或等于预设阈值,则生成所述第一交易对应的区块信息;所述第一节点根据所述第一交易的交易信息更新所述第一预设数据库和/或所述预设内存空间。Optionally, the execution of the first transaction by the first node includes: if the first node determines that the number of nodes in the blockchain system that have reached a consensus on the first transaction is greater than or equal to a preset threshold , The block information corresponding to the first transaction is generated; the first node updates the first preset database and/or the preset memory space according to the transaction information of the first transaction.
上述技术方案中,通过使用第一交易的区块信息更新第一预设数据库和预设内存空间,可以使用更新后的第一预设数据库和预设内存空间对下一个交易进行冲突检测,从而使得交易处理过程满足实时性要求,提高交易处理的准确性。In the above technical solution, by using the block information of the first transaction to update the first preset database and preset memory space, the updated first preset database and preset memory space can be used to perform conflict detection on the next transaction, thereby Make the transaction processing process meet real-time requirements and improve the accuracy of transaction processing.
可选地,所述第一节点生成所述第一交易对应的区块信息之后,还包括:所述第一节点向所述客户端设备发送所述第一交易对应的区块信息,所述区块信息用于所述客户端设备对所述第一交易进行修正。Optionally, after the first node generates the block information corresponding to the first transaction, the method further includes: the first node sends the block information corresponding to the first transaction to the client device, and the The block information is used by the client device to correct the first transaction.
上述技术方案中,由于冲突处理指令为客户端设备设置的,因此可能会存在某些发生冲突的交易仍然被处理,通过在处理完交易后使用客户端设备对交易进行修正,可以避免交易处理过程出现较大的失误,提高区块链系统的业务处理能力和业务处理的准确性。In the above technical solution, because the conflict processing instructions are set for the client device, there may be some conflicting transactions still being processed. By using the client device to correct the transaction after the transaction is processed, the transaction processing process can be avoided Major mistakes have occurred, improving the business processing capabilities and accuracy of the blockchain system.
可选地,所述第一预设数据库中还存储有所述多个历史交易数据对应的第一校验值,所述第一校验值为所述第一节点使用预设校验算法对所述多个历史交易数据进行校验得到的;所述第一节点生成所述第一交易对应的区块信息,包括:所述第一节点生成所述第一交易对应的初始区块信息,斌点使用所述预设校验算法对所述第一校验值和所述第一交易对应的交易信息进行校验,得到第二校验值;进一步地,所述第一节点将所述第二校验值添加到所述初始区块信息中,得到所述第一交易对应的区块信息。Optionally, the first preset database further stores a first check value corresponding to the plurality of historical transaction data, and the first check value is the first node using a preset check algorithm to The multiple historical transaction data are verified; the first node generating block information corresponding to the first transaction includes: the first node generating initial block information corresponding to the first transaction, The bin point uses the preset check algorithm to check the first check value and the transaction information corresponding to the first transaction to obtain a second check value; further, the first node checks the The second check value is added to the initial block information to obtain the block information corresponding to the first transaction.
上述技术方案中,第一校验值可以用于标识区块链系统所处理过的历史交易,通过在处理第一交易后,使用第一交易更新第一校验值得到第二校验 值,一方面,可以使得区块链系统中的多个节点基于相同的第二校验值实现共识,从而提高区块链系统中交易处理的准确性;另一方面,可以使得区块链系统在处理交易的过程中实时更新区块链系统所处理过的历史交易,从而提高后续处理交易的准确性。In the above technical solution, the first check value can be used to identify historical transactions processed by the blockchain system. After the first transaction is processed, the first check value is updated with the first transaction to obtain the second check value. On the one hand, multiple nodes in the blockchain system can achieve consensus based on the same second check value, thereby improving the accuracy of transaction processing in the blockchain system; on the other hand, it can enable the blockchain system to process During the transaction, the historical transactions processed by the blockchain system are updated in real time, thereby improving the accuracy of subsequent transactions.
可选地,所述第一节点根据所述第一交易的交易信息更新所述第一预设数据库和/或所述预设内存空间,包括:所述第一节点使用所述第一交易的标识更新所述第一预设过滤模型,得到第二预设过滤模型,并将预设内存空间和/或所述第一预设数据库中的所述第一预设过滤模型更新为所述第二预设过滤模型;进一步地,所述第一节点将所述第一交易对应的交易信息和所述第二校验值添加到所述第一预设数据库中,并使用所述第二校验值更新所述预设内存空间中的所述第一校验值。Optionally, the first node updating the first preset database and/or the preset memory space according to the transaction information of the first transaction includes: the first node uses the first transaction Identifies updating the first preset filtering model to obtain a second preset filtering model, and updating the preset memory space and/or the first preset filtering model in the first preset database to the first 2. A preset filtering model; further, the first node adds the transaction information corresponding to the first transaction and the second check value to the first preset database, and uses the second calibration The verification value updates the first verification value in the preset memory space.
上述技术方案中,通过使用第一交易的区块信息依次更新第一预设数据库和预设内存空间中的第一预设过滤模型、历史交易信息和历史交易的校验值,可以采用基于预设内存空间的两次冲突检测方法和基于第一预设数据库的依次冲突检测方法对下一个交易进行冲突检测,从而可以使得采用上述方法对每一个交易进行冲突检测,提高交易处理的效率。In the above technical solution, by using the block information of the first transaction to sequentially update the first preset filter model in the first preset database and the preset memory space, the historical transaction information, and the check value of the historical transaction, the pre-based It is assumed that the two conflict detection methods in the memory space and the sequential conflict detection method based on the first preset database perform conflict detection for the next transaction, so that the conflict detection for each transaction can be performed using the above method, and the efficiency of transaction processing is improved.
第二方面,本发明实施例提供一种基于区块链系统的交易处理方法,所述方法包括:In the second aspect, an embodiment of the present invention provides a transaction processing method based on a blockchain system, the method including:
客户端设备向区块链系统中的第一节点发送交易请求,所述交易请求包括第一交易的标识和冲突处理指令;进一步地,所述客户端设备接收所述第一节点发送的容错合约的地址,并根据所述容错合约的地址,调用容错处理模块对所述第一交易进行修正。The client device sends a transaction request to the first node in the blockchain system, where the transaction request includes the identification of the first transaction and a conflict processing instruction; further, the client device receives the fault-tolerant contract sent by the first node According to the address of the fault-tolerant contract, call the fault-tolerant processing module to correct the first transaction.
可选地,所述方法还包括:所述客户端设备接收所述第一节点发送的所述第一交易对应的区块信息;进一步地,所述客户端设备获取所述区块信息中存储的所述第一交易的标识,若确定所述客户端设备的第二预设数据库中存在标识与所述第一交易的标识匹配的历史交易,则使用所述容错处理模块按照预设处理规则对所述第一交易进行修正;所述第二预设数据库中存储有 所述客户端设备处理的多个历史交易。Optionally, the method further includes: the client device receives block information corresponding to the first transaction sent by the first node; further, the client device obtains the block information and stores If it is determined that there is a historical transaction whose identifier matches the identifier of the first transaction in the second preset database of the client device, the fault-tolerant processing module is used according to the preset processing rule The first transaction is amended; the second preset database stores multiple historical transactions processed by the client device.
可选地,所述预设处理规则包括输出日志记录、输出第二预设数据库的交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。Optionally, the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
第三方面,本发明实施例提供一种基于区块链系统的交易处理装置,所述装置包括:In a third aspect, an embodiment of the present invention provides a transaction processing device based on a blockchain system, the device including:
接收模块,用于接收客户端设备发送的交易请求,所述交易请求包括第一交易的标识和冲突处理指令;所述冲突处理指令包括所述第一交易与历史交易存在冲突时对所述第一交易的处理方式,和/或,所述第一交易与历史交易不存在冲突时对所述第一交易的处理方式;The receiving module is configured to receive a transaction request sent by a client device, the transaction request including the identification of the first transaction and a conflict processing instruction; the conflict processing instruction includes the first transaction when there is a conflict between the first transaction and the historical transaction. A transaction processing method, and/or the processing method of the first transaction when there is no conflict between the first transaction and the historical transaction;
冲突检测模块,用于根据所述第一交易的标识,确定所述第一交易的冲突结果,所述第一交易的冲突结果用于指示所述第一交易与历史交易是否存在冲突;A conflict detection module, configured to determine a conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and a historical transaction;
处理模块,用于根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理。The processing module is configured to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
可选地,所述冲突检测模块用于:根据所述第一交易的标识确定所述第一交易的键值;进一步地,从第一预设数据库中获取目标历史交易的标识,并将所述目标历史交易的标识存储到所述预设内存空间;所述第一预设数据库包括所述多个历史交易的标识和所述多个历史交易的键值,所述目标历史交易为所述第一预设数据库中键值与所述第一交易的键值匹配的历史交易;若确定预设内存空间中存在与所述第一交易的标识匹配的目标历史交易,则确定所述第一交易与历史交易存在冲突。Optionally, the conflict detection module is configured to: determine the key value of the first transaction according to the identifier of the first transaction; further, obtain the identifier of the target historical transaction from the first preset database, and compare all The identifier of the target historical transaction is stored in the preset memory space; the first preset database includes the identifier of the plurality of historical transactions and the key value of the plurality of historical transactions, and the target historical transaction is the A historical transaction whose key value matches the key value of the first transaction in the first preset database; if it is determined that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, then the first transaction is determined There is a conflict between transactions and historical transactions.
可选地,所述冲突检测模块还用于:若确定预设内存空间中不存在与所述第一交易的标识匹配的目标历史交易,则将第一交易的标识输入到第一预设过滤模型,所述第一预设过滤模型为使用所述多个历史交易的交易信息训练得到的,每个历史交易的交易信息包括所述每个历史交易的标识、键值、交易数据、冲突处理指令、冲突次数;进一步地,若所述第一预设过滤模型输出的结果为所述第一交易与历史交易不存在冲突,则确定第一交易与历史 交易不存在冲突。Optionally, the conflict detection module is further configured to: if it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, input the identifier of the first transaction into the first preset filter Model, the first preset filtering model is obtained by training using transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identification, key value, transaction data, and conflict handling of each historical transaction Instruction, the number of conflicts; further, if the output result of the first preset filtering model is that the first transaction does not conflict with the historical transaction, it is determined that the first transaction does not conflict with the historical transaction.
可选地,所述冲突检测模块还用于:若所述第一预设过滤模型输出的结果为所述第一交易与历史交易存在冲突,则将所述第一交易的标识与所述第一预设数据库中的一个或多个历史交易的标识进行对比,若确定所述第一预设数据库中存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易存在冲突;若确定所述第一预设数据库中不存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易不存在冲突。Optionally, the conflict detection module is further configured to: if the output result of the first preset filtering model is that the first transaction conflicts with the historical transaction, compare the identifier of the first transaction with the first transaction. One or more historical transaction identifiers in a preset database are compared. If it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, then the first transaction is determined to be the same as the historical transaction. There is a conflict in the transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, then it is determined that there is no conflict between the first transaction and the historical transaction.
可选地,所述冲突处理指令包括以下任意一项或任意多项:所述第一交易与历史交易存在冲突时拒绝执行所述第一交易、所述第一交易与历史交易存在冲突时执行所述第一交易、所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约、所述第一交易与历史交易不存在冲突时执行所述第一交易;所述处理模块用于:若所述第一交易与历史交易不存在冲突,且所述冲突处理指令为所述第一交易与历史交易不存在冲突时执行所述第一交易,或者,若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时执行所述第一交易,则执行所述第一交易;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约,则获取所述冲突处理指令中包括的容错合约的地址,并向所述客户端设备发送所述容错合约的地址;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时拒绝执行所述第一交易,则向所述客户端设备发送冲突指示值,所述冲突指示值用于指示所述第一交易与所述历史交易存在冲突。Optionally, the conflict processing instruction includes any one or more of the following: refusing to execute the first transaction when there is a conflict between the first transaction and a historical transaction, and executing when there is a conflict between the first transaction and a historical transaction Redirecting the first transaction to a fault-tolerant contract when there is a conflict between the first transaction, the first transaction and the historical transaction, and executing the first transaction when there is no conflict between the first transaction and the historical transaction; The processing module is configured to: if the first transaction does not conflict with the historical transaction, and the conflict processing instruction is to execute the first transaction when the first transaction does not conflict with the historical transaction, or if the first transaction does not conflict with the historical transaction, There is a conflict between a transaction and a historical transaction, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, then the first transaction is executed; if the first transaction is in conflict with the historical transaction If there is a conflict, and the conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a conflict between the first transaction and the historical transaction, then obtain the address of the fault-tolerant contract included in the conflict processing instruction, and send it to The client device sends the address of the fault-tolerant contract; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction, refuse to execute the first transaction , Sending a conflict indication value to the client device, where the conflict indication value is used to indicate that the first transaction conflicts with the historical transaction.
可选地,所述处理模块用于:若确定所述区块链系统中对所述第一交易达成共识的节点的数量大于或等于预设阈值,则生成所述第一交易对应的区块信息;进一步地,根据所述第一交易的交易信息更新所述第一预设数据库和/或所述预设内存空间。Optionally, the processing module is configured to generate a block corresponding to the first transaction if it is determined that the number of nodes in the blockchain system that have reached a consensus on the first transaction is greater than or equal to a preset threshold Information; further, update the first preset database and/or the preset memory space according to the transaction information of the first transaction.
可选地,所述处理模块生成所述第一交易对应的区块信息之后,还用于: 向所述客户端设备发送所述第一交易对应的区块信息,所述区块信息用于所述客户端设备对所述第一交易进行修正。Optionally, after the processing module generates the block information corresponding to the first transaction, it is further configured to: send the block information corresponding to the first transaction to the client device, where the block information is used for The client device modifies the first transaction.
可选地,所述第一预设数据库中还存储有所述多个历史交易数据对应的第一校验值,所述第一校验值为所述第一节点使用预设校验算法对所述多个历史交易数据进行校验得到的;所述处理模块具体用于:生成所述第一交易对应的初始区块信息;进一步地,使用所述预设校验算法对所述第一校验值和所述第一交易对应的交易信息进行校验,得到第二校验值,并将所述第二校验值添加到所述初始区块信息中,得到所述第一交易对应的区块信息。Optionally, the first preset database further stores a first check value corresponding to the plurality of historical transaction data, and the first check value is the first node using a preset check algorithm to The multiple historical transaction data are verified; the processing module is specifically configured to: generate initial block information corresponding to the first transaction; further, use the preset verification algorithm to verify the first The check value is checked against the transaction information corresponding to the first transaction to obtain a second check value, and the second check value is added to the initial block information to obtain the first transaction corresponding The block information.
可选地,所述处理模块用于:使用所述第一交易的标识更新所述第一预设过滤模型,得到第二预设过滤模型,并将预设内存空间和/或所述第一预设数据库中的所述第一预设过滤模型更新为所述第二预设过滤模型;进一步地,将所述第一交易对应的交易信息和所述第二校验值添加到所述第一预设数据库中,并使用所述第二校验值更新所述预设内存空间中的所述第一校验值。Optionally, the processing module is configured to: use the identifier of the first transaction to update the first preset filter model to obtain a second preset filter model, and configure the preset memory space and/or the first The first preset filtering model in the preset database is updated to the second preset filtering model; further, the transaction information corresponding to the first transaction and the second check value are added to the first In a preset database, the second check value is used to update the first check value in the preset memory space.
第四方面,本发明实施例提供一种基于区块链系统的交易处理装置,所述装置包括:In a fourth aspect, an embodiment of the present invention provides a transaction processing device based on a blockchain system, the device including:
收发模块,用于向区块链系统中的第一节点发送交易请求,所述交易请求包括第一交易的标识和冲突处理指令;以及,接收所述第一节点发送的容错合约的地址;A transceiver module, configured to send a transaction request to the first node in the blockchain system, the transaction request including the identification of the first transaction and a conflict processing instruction; and to receive the address of the fault-tolerant contract sent by the first node;
处理模块,用于根据所述容错合约的地址,调用容错处理模块对所述第一交易进行修正。The processing module is configured to call the fault-tolerant processing module to correct the first transaction according to the address of the fault-tolerant contract.
可选地,所述接收模块还用于:接收所述第一节点发送的所述第一交易对应的区块信息;所述处理模块还用于:获取所述区块信息中存储的所述第一交易的标识,若确定客户端设备的第二预设数据库中存在标识与所述第一交易的标识匹配的历史交易,则使用所述容错处理模块按照预设处理规则对所述第一交易进行修正;所述第二预设数据库中存储有所述客户端设备处理的多个历史交易。Optionally, the receiving module is further configured to: receive block information corresponding to the first transaction sent by the first node; the processing module is further configured to: obtain the block information stored in the block information The identification of the first transaction, if it is determined that there is a historical transaction with an identification matching the identification of the first transaction in the second preset database of the client device, the fault-tolerant processing module is used to perform processing on the first The transaction is modified; the second preset database stores a plurality of historical transactions processed by the client device.
可选地,所述预设处理规则包括输出日志记录、输出第二预设数据库的 交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。Optionally, the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
第五方面,本发明实施例还提供一种计算机可读存储介质,包括指令,当其在计算机的处理器上运行时,使得计算机的处理器执行如上述第一方面和/或第二方面任一项所述的方法。In a fifth aspect, embodiments of the present invention also provide a computer-readable storage medium, including instructions, which when run on a processor of a computer, cause the processor of the computer to execute any of the above-mentioned first and/or second aspects. The method described in one item.
第六方面,本发明实施例还提供一种计算机程序产品,当其在计算机的处理器上运行时,使得计算机的处理器执行上述第一方面和/或第二方面任一项所述的方法。In a sixth aspect, embodiments of the present invention also provide a computer program product, which when it runs on a processor of a computer, causes the processor of the computer to execute the method described in any one of the first aspect and/or the second aspect. .
本申请的这些方面或其他方面在以下实施例的描述中会更加简明易懂。These and other aspects of the application will be more concise and understandable in the description of the following embodiments.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings may be obtained from these drawings without creative labor.
图1为本发明实施例提供的一种区块链系统的系统架构示意图;FIG. 1 is a schematic diagram of a system architecture of a blockchain system provided by an embodiment of the present invention;
图2为本发明实施例提供的一种基于区块链系统的交易处理方法对应的流程示意图;2 is a schematic diagram of a corresponding process flow of a transaction processing method based on a blockchain system provided by an embodiment of the present invention;
图3为本发明实施例中提供的一种客户端设备与第一节点的结构示意图;FIG. 3 is a schematic structural diagram of a client device and a first node provided in an embodiment of the present invention;
图4为本发明实施例中提供的一种基于区块链系统的交易处理装置的结构示意图;4 is a schematic structural diagram of a transaction processing device based on a blockchain system provided in an embodiment of the present invention;
图5为本发明实施例中提供的一种基于区块链系统的交易处理装置的结构示意图;Figure 5 is a schematic structural diagram of a transaction processing device based on a blockchain system provided in an embodiment of the present invention;
图6为本发明实施例中提供的一种终端设备的结构示意图;Figure 6 is a schematic structural diagram of a terminal device provided in an embodiment of the present invention;
图7为本发明实施例中提供的一种的后端设备的结构示意图。FIG. 7 is a schematic structural diagram of a back-end device provided in an embodiment of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本 发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
金融科技(Fintech)领域中通常涉及到大量的交易,通过采用区块链技术实现对交易的处理,可以使得不同节点之间的交易顺利执行。因此,提高保证区块链系统中交易处理的效率,对于金融行业的发展尤为重要。In the field of financial technology (Fintech), a large number of transactions are usually involved. By using blockchain technology to process transactions, transactions between different nodes can be executed smoothly. Therefore, improving the efficiency of guaranteeing transaction processing in the blockchain system is particularly important for the development of the financial industry.
图1为本发明实施例中的交易处理方法所适用的一种系统架构示意图,如图1所示,该系统架构中可以包括区块链系统中的一个或多个节点(比如图1所示意出的节点101、节点102、节点103与节点104)和客户端设备200。其中,区块链系统中的一个或多个节点可以共同维护区块链系统。客户端设备200可以通过接入网络而与区块链系统中的一个或多个节点进行通信。Figure 1 is a schematic diagram of a system architecture to which the transaction processing method in an embodiment of the present invention is applicable. As shown in Figure 1, the system architecture may include one or more nodes in the blockchain system (such as the one shown in Figure 1). Node 101, node 102, node 103, and node 104) and the client device 200. Among them, one or more nodes in the blockchain system can jointly maintain the blockchain system. The client device 200 can communicate with one or more nodes in the blockchain system by accessing the network.
本发明实施例中,区块链系统可以是由多个节点组成的点对点(Peer To Peer,P2P)网络。P2P是一种运行在传输控制协议(Transmission Control Protocol,TCP)协议之上的应用层协议,在区块链系统中的节点可以彼此对等,区块链系统中不存在中心节点,因此每个节点都可以随机地连接其它节点。In the embodiment of the present invention, the blockchain system may be a peer-to-peer (Peer To Peer, P2P) network composed of multiple nodes. P2P is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. The nodes in the blockchain system can be equal to each other. There is no central node in the blockchain system, so each Nodes can connect to other nodes randomly.
以客户端设备200与节点102之间的交易过程为例,具体实施中,客户端设备200可以向节点102发送交易请求,节点102接收到交易请求后,可以通过解析交易请求获取到交易数据,并可以向区块链系统中的其它节点(即节点101、节点103和节点104)发送交易数据。进一步地,节点101~节点104可以基于交易数据进行共识,若共识通过,则可以生成交易对应的区块信息;若共识不通过,则节点102(或者也可以为其它节点)可以向客户端设备200发送交易响应消息,交易响应消息用于指示交易失败。Taking the transaction process between the client device 200 and the node 102 as an example, in specific implementation, the client device 200 can send a transaction request to the node 102. After receiving the transaction request, the node 102 can obtain the transaction data by parsing the transaction request. And can send transaction data to other nodes in the blockchain system (ie, node 101, node 103, and node 104). Further, nodes 101 to 104 can make a consensus based on the transaction data. If the consensus is passed, the block information corresponding to the transaction can be generated; if the consensus is not passed, the node 102 (or other nodes) can report to the client device 200 sends a transaction response message, the transaction response message is used to indicate that the transaction failed.
本发明实施例中,区块链系统中的节点可以具有多种功能,比如,路由功能、交易功能、区块链功能和共识功能等。具体地说,区块链系统中的节点可以把其他节点传送过来的交易数据等信息传送给更多的节点以实现节点 之间的通信;或者,区块链系统中的节点可以用于支持用户进行交易;或者,区块链系统中的节点可以用于记录历史上的所有交易;或者,区块链系统中的节点可以通过验证和记录交易生成区块链中的新区块。实际应用中,路由功能是区块链系统中的每个节点必须具有的功能,而其它功能可由本领域技术人员根据实际需要进行设置。In the embodiment of the present invention, the nodes in the blockchain system may have multiple functions, such as routing function, transaction function, blockchain function, consensus function, etc. Specifically, the nodes in the blockchain system can transmit transaction data and other information sent by other nodes to more nodes to achieve communication between nodes; or, the nodes in the blockchain system can be used to support users Perform transactions; or, nodes in the blockchain system can be used to record all transactions in history; or, nodes in the blockchain system can generate new blocks in the blockchain by verifying and recording transactions. In practical applications, the routing function is a function that each node in the blockchain system must have, and other functions can be set by those skilled in the art according to actual needs.
需要说明的是,区块链系统中的一个节点可以在一台物理机(服务器)上,且一个节点具体可以是指服务器中运行的一个进程或者一系列进程。比如,区块链网络中的节点101可以为一个服务器上运行的一个进程,或者也可以为是指节点所在的服务器,具体不作限定。It should be noted that a node in the blockchain system can be on a physical machine (server), and a node can specifically refer to a process or a series of processes running in the server. For example, the node 101 in the blockchain network may be a process running on a server, or it may also refer to the server where the node is located, which is not specifically limited.
基于图1所示意的系统架构,图2为本发明实施例提供的一种基于区块链系统的交易处理方法对应的流程示意图,该方法包括:Based on the system architecture shown in Fig. 1, Fig. 2 is a schematic diagram of a process corresponding to a transaction processing method based on a blockchain system provided by an embodiment of the present invention, and the method includes:
步骤201,客户端设备设置第一交易的标识和冲突处理指令。Step 201: The client device sets the identifier of the first transaction and the conflict processing instruction.
本发明实施例中,客户端设备若确定需要执行第一交易,则可以设置第一交易的标识。在一种可能的实现方式中,客户端设备可以根据第一交易所属的业务场景设置第一交易的标识,第一交易所属的业务场景可以包括第一交易所属的业务和第一交易在业务中的流程(即业务流程)。举例来说,在一个示例中,订单业务的执行流程可以包括创建订单流程、存储订单流程、查询订单流程等,若第一交易所属的业务流程为创建订单流程,则可以使用第一交易创建得到的订单号作为第一交易的标识。其中,订单号的长度可以由本领域技术人员根据经验进行设置,比如可以为小于或等于256字节的可变长度的数据,或者也可以为固定长度的数据,具体不作限定。在另一个示例中,交互数据业务的执行流程可以包括双方传递数据流程、一方向其他用户传递数据流程等,若第一交易所属的业务流程为双方传递数据流程,则第一交易的标识可以包括数据发送方的标识、数据接收方的标识和数据的校验值。比如,若第一交易为用户A 1向用户A 2传递数据的交易,则第一交易的标识可以包括用户A 1的地址、用户A 2的地址和数据的哈希(Hash)值。其中,用户A 1和/或用户A 2的地址可以为账号名,或者也可以为邮件地址,或者还可以为用 户名,具体不作限定。 In the embodiment of the present invention, if the client device determines that the first transaction needs to be executed, it can set the identifier of the first transaction. In a possible implementation, the client device may set the identifier of the first transaction according to the business scenario to which the first transaction belongs, and the business scenario to which the first transaction belongs may include the business to which the first transaction belongs and the first transaction in the business. The process (ie business process). For example, in an example, the execution process of the order business may include creating an order process, storing an order process, querying an order process, etc. If the business process to which the first transaction belongs is an order creation process, the first transaction creation can be used to obtain The order number is used as the identification of the first transaction. The length of the order number can be set by those skilled in the art based on experience. For example, it can be variable-length data less than or equal to 256 bytes, or it can also be fixed-length data, which is not specifically limited. In another example, the execution process of the interactive data service may include a data transfer process between two parties, a data transfer process to other users, etc., if the business process to which the first transaction belongs is a data transfer process between the two parties, the identification of the first transaction may include The identification of the data sender, the identification of the data receiver and the check value of the data. For example, if the first transaction is a transaction in which user A 1 transfers data to user A 2 , the identification of the first transaction may include the address of user A 1 , the address of user A 2 , and the hash value of the data. Wherein, the address of the user A 1 and/or the user A 2 may be an account name, or may also be an email address, or may also be a user name, which is not specifically limited.
进一步地,客户端设备还可以设置第一交易对应的冲突处理指令,冲突处理指令可以包括第一交易与历史交易存在冲突时对第一交易的处理方式,和/或,第一交易与历史交易不存在冲突时对第一交易的处理方式。在一个示例中,第一交易与历史交易存在冲突时对第一交易的处理方式可以包括执行第一交易、将第一交易重定向到容错合约、拒绝执行第一交易中的任意一项;第一交易与历史交易不存在冲突时对第一交易的处理方式可以包括执行第一交易。Further, the client device may also set a conflict processing instruction corresponding to the first transaction. The conflict processing instruction may include the processing method of the first transaction when the first transaction conflicts with the historical transaction, and/or the first transaction and the historical transaction How to handle the first transaction when there is no conflict. In an example, the handling of the first transaction when there is a conflict between the first transaction and the historical transaction may include executing the first transaction, redirecting the first transaction to a fault-tolerant contract, and refusing to execute any of the first transaction; When there is no conflict between a transaction and a historical transaction, the processing method for the first transaction may include executing the first transaction.
在一种可能的实现方式中,客户端设备发送的冲突处理指令可以包括处理指示值和附加数据。表1为本发明实施例提供的几种可能的冲突处理指令的示意表。In a possible implementation manner, the conflict processing instruction sent by the client device may include a processing instruction value and additional data. Table 1 is a schematic table of several possible conflict handling instructions provided by the embodiment of the present invention.
表1:几种冲突处理指令的示意Table 1: Schematic of several conflict handling instructions
冲突处理指令Conflict handling instructions 含义meaning
11 拒绝执行Refuse to execute
22 执行carried out
3:http://address/0x2893: http://address/0x289 重定向到容错合约Redirect to fault-tolerant contract
44 拒绝执行且发出告警Refuse to execute and issue an alert
55 执行且打印日志Execute and print log
00 执行carried out
如表1所示,本发明实施例中定义了第一交易与历史交易存在冲突时的5种冲突处理指令,分别为“1”、“2”、“3:http://address/0x289”、“4”、“5”,还定义了第一交易与历史交易不存在冲突时的1种冲突处理指令,即“0”。其中,冲突处理指令“0”、“1”、“2”、“4”、“5”的附加数据均可以为空,冲突处理指令“3:http://address/0x289”的处理指示值可以为3,附加数据可以为http://address/0x289。具体地说,若第一交易与历史交易存在冲突,且冲突处理指令为“1”,则第一节点可以拒绝执行第一交易;若第一交易与历史交易 不存在冲突,且冲突处理指令为“0”,或者第一交易与历史交易存在冲突,且冲突处理指令为“2”,则第一节点可以执行第一交易;若第一交易与历史交易存在冲突,且冲突处理指令为“3”,则第一节点可以执行第一交易,并可以将第一交易发送给合约地址为http://address/0x289的容错处理装置进行修正;若第一交易与历史交易存在冲突,且冲突处理指令为“4”,则第一节点可以拒绝执行第一交易,且可以发出告警信息;若第一交易与历史交易存在冲突,且冲突处理指令为“5”,则第一节点可以执行第一交易,且可以打印第一交易冲突的日志记录,以便于后续排错。As shown in Table 1, the embodiment of the present invention defines five conflict processing instructions when the first transaction conflicts with the historical transaction, which are "1", "2", and "3: http://address/0x289" , "4" and "5" also define a conflict processing instruction when there is no conflict between the first transaction and the historical transaction, namely "0". Among them, the additional data of the conflict processing instructions "0", "1", "2", "4", and "5" can all be empty, and the processing instruction value of the conflict processing instruction "3: http://address/0x289" It can be 3, and the additional data can be http://address/0x289. Specifically, if there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is "1", the first node may refuse to execute the first transaction; if the first transaction does not conflict with the historical transaction, and the conflict processing instruction is "0", or there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is "2", the first node can execute the first transaction; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is "3" ", the first node can execute the first transaction, and can send the first transaction to the fault-tolerant processing device with the contract address http://address/0x289 for correction; if the first transaction conflicts with the historical transaction, and the conflict is handled If the instruction is "4", the first node can refuse to execute the first transaction and can issue an alarm message; if the first transaction conflicts with historical transactions, and the conflict processing instruction is "5", the first node can execute the first transaction. Transaction, and can print the log record of the first transaction conflict to facilitate subsequent troubleshooting.
需要说明的是,本发明实施例中所述的冲突具体为同一个业务流程中生成的多个交易的冲突,若同一个业务流程中生成的多个交易的标识相同,则多个交易可以是冲突的;若不同业务的同一流程中生成的多个交易的标识相同,或者同一个业务的不同流程中生成的多个交易的标识相同,则多个交易是不冲突的。举例说明,交易B 1为业务a 1的第二流程中生成的交易,交易B 2为业务a 1的第二流程中生成的交易,交易B 3为业务a 1的第一流程中生成的交易,交易B 4为业务a 2的第二流程中生成的交易,则由于交易B 1与交易B 3属于同一业务的不同流程,因此即使交易B 1与交易B 3的标识相同,交易B 1与交易B 3也不冲突;相应地,由于交易B 1与交易B 4属于不同业务的同一流程,因此即使交易B 1与交易B 4的标识相同,交易B 1与交易B 4也不冲突;而针对于交易B 1与B 2,由于交易B 1与交易B 2属于同一业务的同一流程,因此若交易B 1与交易B 2的标识相同,则交易B 1与交易B 2冲突。 It should be noted that the conflict described in the embodiment of the present invention is specifically a conflict of multiple transactions generated in the same business process. If the identifiers of multiple transactions generated in the same business process are the same, the multiple transactions may be Conflicting; if the identifiers of multiple transactions generated in the same process of different businesses are the same, or the identifiers of multiple transactions generated in different processes of the same business are the same, the multiple transactions are not in conflict. For example, transaction B 1 is a transaction generated in the second process of business a 1 , transaction B 2 is a transaction generated in the second process of business a 1 , and transaction B 3 is a transaction generated in the first process of business a 1 , Transaction B 4 is a transaction generated in the second process of business a 2. Since transaction B 1 and transaction B 3 belong to different processes of the same business, even if the identifiers of transaction B 1 and transaction B 3 are the same, transaction B 1 and Transaction B 3 does not conflict; accordingly, since transaction B 1 and transaction B 4 belong to the same process of different businesses, even if the identifiers of transaction B 1 and transaction B 4 are the same, transaction B 1 and transaction B 4 do not conflict; and For transactions B 1 and B 2 , since transaction B 1 and transaction B 2 belong to the same process of the same business, if the identifiers of transaction B 1 and transaction B 2 are the same, transaction B 1 and transaction B 2 conflict.
以第一交易为创建订单号的交易为例,由于同一个业务的创建订单流程中不同交易创建得到的订单号不同,因此订单号可以唯一标识一个交易;若不同交易的订单号相同,则说明不同交易是冲突的。为了生成不冲突的订单号,可以设置相邻交易之间的订单号是递增的,或者也可以在不同订单号中添加随机数序列或交易的哈希值。Take the first transaction as the transaction that creates an order number as an example. Because the order numbers created by different transactions in the order creation process of the same business are different, the order number can uniquely identify a transaction; if the order numbers of different transactions are the same, it means Different transactions are in conflict. In order to generate non-conflicting order numbers, you can set the order numbers between adjacent transactions to be incremental, or you can add random number sequences or transaction hash values to different order numbers.
本发明实施例中,通过以业务场景为维度,可以使得客户端设备为同一业务场景的交易采用同一种标识设置方式,从而可以使得交易的标识能够表 征交易在同一业务场景包括的多个交易中的唯一性;也就是说,本发明实施例通过客户端设备设置交易的标识,可以采用对比交易的标识的方式对交易进行冲突检测,而无需对比具体的交易数据,从而可以使得对交易进行冲突检测的过程更为快速,提高区块链系统中交易处理的效率;且,冲突处理指令可以由客户端设备基于实际业务场景进行设置,从而可以使得交易处理过程更加符合实际需要。In the embodiment of the present invention, by taking the business scenario as the dimension, the client device can adopt the same identification setting method for transactions in the same business scenario, so that the transaction identifier can indicate that the transaction is included in multiple transactions in the same business scenario. That is to say, in the embodiment of the present invention, the transaction identifier is set by the client device, and the transaction conflict detection can be performed by comparing the transaction identifier without comparing the specific transaction data, so that the transaction can be conflicted The detection process is faster, and the efficiency of transaction processing in the blockchain system is improved; moreover, the conflict processing instructions can be set by the client device based on actual business scenarios, so that the transaction processing process can be more in line with actual needs.
步骤202,客户端设备向区块链系统中的第一节点发送交易请求。Step 202: The client device sends a transaction request to the first node in the blockchain system.
此处,客户端设备可以通过多种方式向第一节点发送交易请求,比如可以通过有线方式向第一节点发送交易请求,或者也可以通过无线方式向第一节点发送交易请求,具体不作限定。Here, the client device may send a transaction request to the first node in various ways, for example, it may send a transaction request to the first node in a wired manner, or may also send a transaction request to the first node in a wireless manner, which is not specifically limited.
在一个示例中,交易请求中可以包括第一交易的标识和冲突处理指令。在另一个示例中,交易请求中可以包括第一交易的标识、冲突处理指令和第一交易的交易数据,第一交易的交易数据可以包括第一交易的键值、账号、合约地址等。In an example, the transaction request may include the identification of the first transaction and the conflict processing instruction. In another example, the transaction request may include the identification of the first transaction, the conflict processing instruction, and the transaction data of the first transaction. The transaction data of the first transaction may include the key value, account number, contract address, etc. of the first transaction.
步骤203,第一节点接收客户端设备发送的交易请求,并根据第一交易的标识,确定第一交易的冲突结果。Step 203: The first node receives the transaction request sent by the client device, and determines the conflict result of the first transaction according to the identifier of the first transaction.
具体实施中,第一节点可以解析交易请求,获取第一交易的标识和冲突处理指令(或者第一交易的标识、交易数据和冲突处理指令)。进一步地,第一节点可以根据第一交易的标识,确定第一交易与历史交易是否存在冲突;其中,历史交易可以包括第一节点在接收到第一交易的交易请求之前所处理过的全部交易。需要说明的是,第一节点在解析交易请求之前,还可以将交易请求发送给区块链系统中的其它节点,以使其它节点执行第一交易,如此,区块链系统中的多个节点可以在执行第一交易后,进行区块共识过程。其它节点执行第一交易的过程可以参照第一节点执行第一交易的过程进行实现,此处不再赘述。In specific implementation, the first node may parse the transaction request, and obtain the identifier of the first transaction and the conflict processing instruction (or the identifier of the first transaction, transaction data and the conflict processing instruction). Further, the first node may determine whether there is a conflict between the first transaction and the historical transaction according to the identifier of the first transaction; wherein, the historical transaction may include all transactions processed by the first node before receiving the transaction request of the first transaction . It should be noted that before the first node parses the transaction request, it can also send the transaction request to other nodes in the blockchain system so that other nodes can execute the first transaction. In this way, multiple nodes in the blockchain system The block consensus process can be performed after the first transaction is executed. The process of executing the first transaction by other nodes can be implemented with reference to the process of executing the first transaction by the first node, which will not be repeated here.
本发明实施例中,历史交易可以存储在第一节点的第一预设数据库中,基于表1所示意的冲突处理指令,表2为一种第一预设数据库中存储的历史交 易的示意表。In the embodiment of the present invention, historical transactions may be stored in the first preset database of the first node. Based on the conflict handling instructions shown in Table 1, Table 2 is a schematic table of historical transactions stored in the first preset database. .
表2:一种第一预设数据库中存储的历史交易的示意Table 2: An illustration of historical transactions stored in the first preset database
Figure PCTCN2020080520-appb-000001
Figure PCTCN2020080520-appb-000001
如表2所示,第一预设数据库中可以存储有每个历史交易的标识、合约地址、键值、交易账号、冲突处理指令和冲突次数。比如,交易的标识为a 1x 1的历史交易(为便于描述,简称为历史交易a 1x 1)的合约地址可以为http://address/0x755,键值可以为10.33,交易账号可以为Y 1,冲突处理指令可以为1(即该历史交易与该历史交易之前的历史交易存在冲突,且已拒绝处理该历史交易),冲突次数为2(即已存在两次冲突)。 As shown in Table 2, the first preset database can store each historical transaction identifier, contract address, key value, transaction account number, conflict handling instructions, and conflict times. For example, the contract address of the historical transaction with the transaction identifier a 1 x 1 (for ease of description, referred to as historical transaction a 1 x 1 ) can be http://address/0x755, the key value can be 10.33, and the transaction account number can be Y 1 , the conflict processing instruction can be 1 (that is, the historical transaction conflicts with the historical transaction before the historical transaction, and the historical transaction has been rejected), and the number of conflicts is 2 (that is, there are two conflicts).
具体地说,交易的合约地址可以为实现业务逻辑的合约在区块链上的地址,可以为一段固定长度的数据,交易的合约地址可以为交易所属的业务的标识;如表2所示,历史交易a 1x 1、历史交易a 4x 4与历史交易a 6x 6的合约地址相同,则可以说明历史交易a 1x 1、历史交易a 4x 4与历史交易a 6x 6所属的业务相同。相应地,交易的键值可以为对交易的合约地址和交易的标识进行联合键值计算得到的,键值可以为长度小于255字节的二进制数据;基于合约地址与交易的标识得到的键值,可以使得冲突检测过程以业务流程为维度。如表2所示,历史交易a 1x 1、历史交易a 4x 4与历史交易a 6x 6的键值相同,可以说明历史交易a 1x 1、历史交易a 4x 4与历史交易a 6x 6为同一个业务的同一个流程中的交易,比如可以 均为创建订单的流程中的交易。以历史交易a 1x 1为例,历史交易a 1x 1的交易账号可以由历史交易a 1x 1的哈希值表示,第一节点可以根据历史交易a 1x 1的交易账号获取到历史交易a 1x 1的交易信息,比如交易发起方、交易接收方、交易处理回执,交易所属的区块、交易对应的区块信息等。历史交易a 1x 1的冲突处理指令可以是指发送历史交易a 1x 1的客户端设备配置的冲突处理指令,而冲突次数可以是指接收到第一交易的交易请求之前,历史交易a 1x 1与第一预设数据库中的历史交易存在冲突的次数,每确定历史交易a 1x 1冲突一次,则可以将历史交易a 1x 1的冲突次数加1。 Specifically, the contract address of the transaction can be the address on the blockchain of the contract that implements the business logic, and it can be a piece of fixed-length data, and the contract address of the transaction can be the identifier of the business to which the transaction belongs; as shown in Table 2, Historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 have the same contract address, it can be explained that historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 belong to The business is the same. Correspondingly, the key value of the transaction can be a joint key value calculation of the contract address of the transaction and the transaction identifier. The key value can be binary data with a length of less than 255 bytes; the key value obtained based on the contract address and the transaction identifier , Can make the conflict detection process take the business process as the dimension. As shown in Table 2, historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 have the same key value, which can explain historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 are transactions in the same process of the same business, for example, they can all be transactions in the process of creating an order. Historical transaction a 1 x 1, for example, a transaction account transaction history 1 x 1 may be a hash value from the historical trading 1 x 1, said first node can get to a transaction history based on historical trading account is 1 x 1 Transaction a 1 x 1 transaction information, such as the transaction initiator, transaction receiver, transaction processing receipt, the block to which the transaction belongs, and the block information corresponding to the transaction. The conflict processing instruction of historical transaction a 1 x 1 may refer to the conflict processing instruction configured by the client device sending historical transaction a 1 x 1 , and the number of conflicts may refer to the historical transaction a 1 before the transaction request of the first transaction is received. x 1 and the number of conflicting historical transaction database in the first pre-set for each transaction to determine the history of a 1 x 1 conflict once, the number of collisions historical trading a 1 x 1 can be incremented.
在一种可能的实现方式中,第一节点可以将第一交易的标识与第一预设数据库中的一个或多个历史交易的标识进行对比,若确定第一预设数据库中存在与第一交易的标识匹配的历史交易,则可以确定第一交易与历史交易存在冲突;若确定第一预设数据库中不存在与第一交易的标识匹配的历史交易,则可以确定第一交易与历史交易不存在冲突。以表2所示意的第一预设数据库为例,若第一交易的标识为a 1x 1,则可以确定第一交易与历史交易存在冲突,若第一交易的标识为a 8x 8,则可以确定第一交易与历史交易不存在冲突。 In a possible implementation, the first node may compare the identifier of the first transaction with the identifier of one or more historical transactions in the first preset database, and if it is determined that there is a first If it is determined that there is a conflict between the first transaction and the historical transaction, if it is determined that there is no historical transaction that matches the identifier of the first transaction in the first preset database, then the first transaction and the historical transaction can be determined There is no conflict. Taking the first preset database shown in Table 2 as an example, if the identifier of the first transaction is a 1 x 1 , it can be determined that there is a conflict between the first transaction and the historical transaction. If the identifier of the first transaction is a 8 x 8 , It can be determined that there is no conflict between the first transaction and the historical transaction.
在该实现方式中,通过直接将第一交易的标识与第一预设数据库中的历史交易的标识进行对比,经过一轮冲突检测过程即可确定出第一交易与历史交易是否存在冲突,从而可以简化冲突检测的过程,便于实现。In this implementation, by directly comparing the identifier of the first transaction with the identifier of the historical transaction in the first preset database, after a round of conflict detection process, it can be determined whether there is a conflict between the first transaction and the historical transaction. It can simplify the process of conflict detection and facilitate implementation.
在另一种可能的实现方式中,第一节点可以对第一交易依次执行第一轮冲突检测~第三轮冲突检测中的一轮冲突检测或多轮冲突检测,其中,第一轮冲突检测与第二轮冲突检测的过程可以均在预设内存空间中执行,第三轮冲突检测的过程可以在第一预设数据库中执行。下面具体描述第一轮冲突检测~第三轮冲突检测的实现过程。In another possible implementation manner, the first node may sequentially perform one round of conflict detection or multiple rounds of conflict detection from the first round of conflict detection to the third round of conflict detection on the first transaction, where the first round of conflict detection The processes of the second round of conflict detection can all be executed in the preset memory space, and the process of the third round of conflict detection can be executed in the first preset database. The following specifically describes the implementation process of the first round of conflict detection to the third round of conflict detection.
第一轮冲突检测The first round of conflict detection
具体实施中,第一节点可以从第一交易的交易数据中获取第一交易的合约地址,进而可以对第一交易的标识和第一交易的合约地址进行联合键值计算,得到第一交易的键值,并可以从第一预设数据库中获取与第一交易的键 值匹配的目标历史交易;举例来说,参照表2所示意的第一预设数据库,若第一交易的键值为10.33,则目标历史交易可以包括历史交易a 1x 1、历史交易a 4x 4与历史交易a 6x 6。进一步地,第一节点可以将目标历史交易的标识存储到预设内存空间,或者也可以将第一预设数据库中存储的目标历史交易的全部信息(即交易标识、合约地址、键值、交易账号、冲突处理指令和冲突次数)存储到预设内存空间,具体不作限定。在执行第一轮冲突检测时,第一节点可以将第一交易的标识与预设内存空间中存储的目标历史交易的标识进行对比,若确定预设内存空间中存在与第一交易的标识匹配的目标历史交易,则可以确定第一交易与历史交易存在冲突;若确定预设内存空间中不存在与第一交易的标识匹配的目标历史交易,则可以执行第二轮冲突检测。 In specific implementation, the first node can obtain the contract address of the first transaction from the transaction data of the first transaction, and then can perform a joint key value calculation on the identifier of the first transaction and the contract address of the first transaction to obtain the first transaction's contract address. Key value, and the target historical transaction matching the key value of the first transaction can be obtained from the first preset database; for example, referring to the first preset database shown in Table 2, if the key value of the first transaction 10.33, the target historical transaction can include historical transaction a 1 x 1 , historical transaction a 4 x 4 and historical transaction a 6 x 6 . Further, the first node may store the identifier of the target historical transaction in a preset memory space, or may also store all the information of the target historical transaction (ie transaction identifier, contract address, key value, transaction identifier) stored in the first preset database. The account number, conflict handling instructions, and conflict times) are stored in a preset memory space, which is not specifically limited. When performing the first round of conflict detection, the first node may compare the identifier of the first transaction with the identifier of the target historical transaction stored in the preset memory space, and if it is determined that there is a match in the preset memory space with the identifier of the first transaction If it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, it can be determined that the second round of conflict detection can be performed.
在第一轮冲突检测中,由于目标历史交易的键值与第一交易的键值匹配,因此目标历史交易与第一交易可以为同一个业务的同一个流程中的交易。一方面,通过基于与第一交易所属的业务流程相同的目标历史交易对第一交易进行第一轮冲突检测,可以减少冲突检测过程中对比交易的次数,提高冲突检测的效率。另一方面,通过预先将目标历史交易存储到预设内存空间,可以使得对比交易的过程在预设内存空间中执行,而无需在第一预设数据库中执行,从而可以提高冲突检测过程的响应速度。In the first round of conflict detection, since the key value of the target historical transaction matches the key value of the first transaction, the target historical transaction and the first transaction can be transactions in the same process of the same business. On the one hand, by performing the first round of conflict detection on the first transaction based on the same target historical transaction as the business process to which the first transaction belongs, the number of comparison transactions in the conflict detection process can be reduced, and the efficiency of conflict detection can be improved. On the other hand, by storing the target historical transaction in the preset memory space in advance, the process of comparing transactions can be executed in the preset memory space instead of in the first preset database, thereby improving the response of the conflict detection process speed.
本发明实施例中,第一轮冲突检测可以适用于冲突可能性较大的场景,若第一轮冲突检测的检测结果为冲突,则可以确定第一交易与历史交易存在冲突,通过执行第一轮冲突检测,可以将冲突可能性较大的交易检测出来,从而可以减少到第一预设数据库中查询历史交易的次数,提高冲突检测的计算速度,节省系统开销。In the embodiment of the present invention, the first round of conflict detection can be applied to scenarios with a high possibility of conflict. If the detection result of the first round of conflict detection is a conflict, it can be determined that the first transaction is in conflict with the historical transaction. Round conflict detection can detect transactions with a high probability of conflict, thereby reducing the number of times to query historical transactions in the first preset database, improving the calculation speed of conflict detection, and saving system overhead.
第二轮冲突检测The second round of conflict detection
本发明实施例中,第一预设数据库中还可以设置有第一预设过滤模型,若第一节点接收到客户端设备发送的第一交易的交易请求,则可以获取第一预设数据库中存储的第一预设过滤模型,并将第一预设过滤模型存储到预设内存空间中。相应地,若第一轮冲突检测的检测结果为第一交易与历史交易 不冲突(即预设内存空间中不存在与第一交易的标识匹配的目标历史交易),则第一节点可以将第一交易的标识输入到预设内存空间中存储的第一预设过滤模型中。In the embodiment of the present invention, the first preset filtering model may also be set in the first preset database. If the first node receives the transaction request of the first transaction sent by the client device, it may obtain the data in the first preset database. The first preset filter model is stored, and the first preset filter model is stored in the preset memory space. Correspondingly, if the detection result of the first round of conflict detection is that the first transaction does not conflict with the historical transaction (that is, there is no target historical transaction that matches the identifier of the first transaction in the preset memory space), the first node can transfer the first transaction The identification of a transaction is input into the first preset filtering model stored in the preset memory space.
进一步地,第一预设过滤模型可以对第一交易执行第二轮冲突检测,并可以输出第一交易的冲突结果;第一交易的冲突结果可以为第一结果和第二结果中的任意一种,第一结果用于指示第一交易与历史交易不存在冲突,第二结果用于指示第一交易与历史交易可能存在冲突。如此,第一节点将第一交易输入第一预设过滤模型后,若输出结果为第一结果,则可以确定第一交易与历史交易不存在冲突;若输出结果为第二结果,则可以执行第三轮冲突检测。Further, the first preset filtering model can perform a second round of conflict detection on the first transaction, and can output the conflict result of the first transaction; the conflict result of the first transaction can be any one of the first result and the second result The first result is used to indicate that there is no conflict between the first transaction and the historical transaction, and the second result is used to indicate that the first transaction may conflict with the historical transaction. In this way, after the first node inputs the first transaction into the first preset filtering model, if the output result is the first result, it can be determined that there is no conflict between the first transaction and the historical transaction; if the output result is the second result, it can be executed The third round of conflict detection.
具体实施中,第一预设过滤模型的模型结构可以由本领域技术人员根据经验进行设置,具体不作限定。作为一种示例,第一预设过滤模型可以为基于比特位得到的模型,比如布隆过滤器;根据实验发现,若布隆过滤器的内存较小,会增大将输出结果误判为第二结果的概率,若布隆过滤器的内存较大,会造成系统空间的浪费。因此,本发明实施例经过实验确定,将布隆过滤器的内存设置为200M、且基于最近3年内的历史交易的交易信息(包括历史交易的标识、键值、交易数据、冲突处理指令、冲突次数等)对布隆过滤器进行训练时,可以使得布隆过滤器的输出结果的误判率小于1%。通过设置布隆过滤器的内存大小以及训练布隆过滤器的历史交易,既可以节省系统空间,又能够提高输出结果的准确性。In specific implementation, the model structure of the first preset filtering model can be set by those skilled in the art based on experience, and is not specifically limited. As an example, the first preset filtering model can be a model based on bits, such as a Bloom filter; according to experiments, it is found that if the memory of the Bloom filter is small, the output result will be misjudged as the second result. If the memory of the Bloom filter is large, it will cause a waste of system space. Therefore, the embodiment of the present invention has been experimentally determined that the memory of the Bloom filter is set to 200M and is based on transaction information of historical transactions in the last 3 years (including historical transaction identifiers, key values, transaction data, conflict processing instructions, conflicts When training the Bloom filter, the error rate of the output result of the Bloom filter can be less than 1%. By setting the memory size of the bloom filter and training the historical transactions of the bloom filter, you can save system space and improve the accuracy of the output results.
需要说明的是,上述仅是一种示例性的简单说明,本领域技术人员也可以根据实际需要设置布隆过滤器的内存和/或训练布隆过滤器的历史交易,上述设置并不构成对本方案的限定。在具体实施中,布隆过滤器的内存可以大于200M,或者也可以小于200M,比如可以为400M或100M;相应地,训练布隆过滤器的历史交易可以为最近2年内的历史交易,或者也可以为最近5年内的历史交易,具体不作限定。It should be noted that the above is only an exemplary simple description. Those skilled in the art can also set the memory of the Bloom filter and/or train the historical transaction of the Bloom filter according to actual needs. The above setting does not constitute a cost Limitations of the plan. In a specific implementation, the memory of the Bloom filter can be greater than 200M, or it can be less than 200M, such as 400M or 100M; accordingly, the historical transaction of the training Bloom filter can be the historical transaction in the last 2 years, or also It can be historical transactions within the last 5 years, and the specifics are not limited.
本发明实施例中,第二轮冲突检测可以适用于冲突可能性较小的场景, 若第二轮冲突检测的检测结果为不冲突,则可以确定第一交易与历史交易不存在冲突,通过执行第二轮冲突检测,可以将冲突可能性较小的交易检测出来。本发明实施例中,在到第一预设数据库中执行冲突检测之前,预先通过基于预设内存空间中的第一轮冲突检测和第二轮冲突检测,可以得到大多数交易的冲突结果,从而可以减少到第一预设数据库中查询历史交易的次数,提高冲突检测的计算速度和效率,节省系统开销。In the embodiment of the present invention, the second round of conflict detection can be applied to scenarios where the possibility of conflict is small. If the detection result of the second round of conflict detection is no conflict, it can be determined that there is no conflict between the first transaction and the historical transaction. The second round of conflict detection can detect transactions that are less likely to conflict. In the embodiment of the present invention, before the conflict detection is performed in the first preset database, the conflict results of most transactions can be obtained through the first round of conflict detection and the second round of conflict detection based on the preset memory space in advance, thereby The number of times to query historical transactions in the first preset database can be reduced, the calculation speed and efficiency of conflict detection can be improved, and system overhead can be saved.
第三轮冲突检测The third round of conflict detection
若第二轮冲突检测的输出结果为第一交易与历史交易冲突(即第一预设过滤模型输出的结果为第一交易与历史交易存在冲突),则第一节点可以执行第三轮冲突检测。具体地说,第一节点可以将第一交易的标识与第一预设数据库中的历史交易的标识进行对比,若确定第一预设数据库中存在与第一交易的标识匹配的历史交易,则可以确定第一交易与历史交易存在冲突;若确定第一预设数据库中不存在与第一交易的标识匹配的历史交易,则可以确定第一交易与历史交易不存在冲突。If the output result of the second round of conflict detection is that the first transaction conflicts with the historical transaction (that is, the output of the first preset filtering model is that the first transaction conflicts with the historical transaction), the first node can perform the third round of conflict detection . Specifically, the first node may compare the identifier of the first transaction with the identifier of the historical transaction in the first preset database, and if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, then It can be determined that there is a conflict between the first transaction and the historical transaction; if it is determined that there is no historical transaction matching the identifier of the first transaction in the first preset database, it can be determined that there is no conflict between the first transaction and the historical transaction.
本发明实施例中,通过采用第一轮冲突检测和第二轮冲突检测即可检测出大部分的冲突交易,由于第一轮冲突检测和第二轮冲突检测均是在预设内存空间中执行的,从而可以使得响应速度较快,提高冲突检测的效率。且,第三轮冲突检测可以适用于任意场景,若基于第一轮冲突检测和第二轮冲突检测均未得到第一交易的冲突结果,则可以基于第三轮冲突检测将第一交易与第一预设数据库中的历史交易进行对比,从而可以得到第一交易的冲突结果。本发明实施例中,通过采用第一轮冲突检测~第三轮冲突检测,可以避免直接到第一预设数据库中查询历史交易,从而可以在降低系统开销、提高冲突检测效率的同时,得到较为准确的冲突结果。In the embodiment of the present invention, most of the conflicting transactions can be detected by using the first round of conflict detection and the second round of conflict detection, because both the first round of conflict detection and the second round of conflict detection are executed in the preset memory space , Which can make the response speed faster and improve the efficiency of conflict detection. Moreover, the third round of conflict detection can be applied to any scenario. If the conflict result of the first transaction is not obtained based on the first round of conflict detection and the second round of conflict detection, the first transaction can be compared with the first transaction based on the third round of conflict detection. The historical transactions in a preset database are compared, so that the conflict result of the first transaction can be obtained. In the embodiment of the present invention, by using the first round of conflict detection to the third round of conflict detection, it is possible to avoid directly querying historical transactions in the first preset database, thereby reducing system overhead and improving the efficiency of conflict detection. Accurate conflict results.
步骤204,第一节点根据第一交易的冲突结果和冲突处理指令,对第一交易进行处理,得到第一交易的处理结果。Step 204: The first node processes the first transaction according to the conflict result of the first transaction and the conflict processing instruction to obtain the processing result of the first transaction.
下面结合表1和表3,详细描述步骤204,根据表1所示意的冲突处理指令,表3为第一节点根据第一交易的冲突结果和冲突处理指令对第一交易执行的 几种处理方式的示意表。The following describes step 204 in detail in conjunction with Table 1 and Table 3. According to the conflict processing instructions shown in Table 1, Table 3 shows several processing methods that the first node executes on the first transaction according to the conflict results and conflict processing instructions of the first transaction. The schematic table.
表3:第一节点处理第一交易的几种方式的示意Table 3: Schematic of several ways for the first node to process the first transaction
Figure PCTCN2020080520-appb-000002
Figure PCTCN2020080520-appb-000002
如表1和表3所示,若第一交易的冲突结果和冲突处理指令满足如下所示的第一种条件~第四种条件中的任一种条件,则第一节点可以执行第一交易:As shown in Table 1 and Table 3, if the conflict result of the first transaction and the conflict processing instruction satisfy any one of the first to fourth conditions shown below, the first node can execute the first transaction :
第一种条件,冲突结果为第一交易与历史交易不存在冲突,且冲突处理指令为第一交易与历史交易不存在冲突时执行第一交易(即“0”);The first condition, the conflict result is that there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is that the first transaction is executed when there is no conflict between the first transaction and the historical transaction (ie "0");
第二种条件,冲突结果为第一交易与历史交易存在冲突,且冲突处理指令为第一交易与历史交易存在冲突时执行第一交易(即“2”);The second condition, the conflict result is that the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction is executed when there is a conflict between the first transaction and the historical transaction (ie "2");
第三种条件,冲突结果为第一交易与历史交易存在冲突,且冲突处理指令为第一交易与历史交易存在冲突时将第一交易重定向到容错合约(即“3”);The third condition, the conflict result is that the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction, redirect the first transaction to the fault-tolerant contract (ie "3");
第四种条件,冲突结果为第一交易与历史交易存在冲突,且冲突处理指令为第一交易与历史交易存在冲突时执行第一交易且打印日志(即“5”)。The fourth condition is that the conflict result is that the first transaction conflicts with the historical transaction, and the conflict processing instruction is to execute the first transaction and print the log when there is a conflict between the first transaction and the historical transaction (ie, "5").
需要说明的是,若第一交易的冲突结果和冲突处理指令满足第三种条件,则第一节点可以在处理完第一交易后,生成第一日志,并可以将处理第一交易的时间戳信息、交易数据和冲突指示值添加到第一日志中,进而保存第一日志,以便于运维人员执行排错工作。It should be noted that, if the conflict result of the first transaction and the conflict processing instruction satisfy the third condition, the first node can generate the first log after processing the first transaction, and can change the timestamp of the processing of the first transaction Information, transaction data, and conflict indication values are added to the first log, and then the first log is saved, so that the operation and maintenance personnel can perform troubleshooting work.
相应地,若第一交易的冲突结果和冲突处理指令满足如下所示的第五种条件或第六种条件,则第一节点可以拒绝执行第一交易:Correspondingly, if the conflict result of the first transaction and the conflict processing instruction satisfy the fifth condition or the sixth condition as shown below, the first node may refuse to execute the first transaction:
第五种条件,第一交易与历史交易存在冲突,且冲突处理指令为第一交易与历史交易存在冲突时拒绝执行第一交易(即“1”);The fifth condition, the first transaction conflicts with the historical transaction, and the conflict processing instruction is to refuse to execute the first transaction when the first transaction conflicts with the historical transaction (ie "1");
第六种条件,第一交易与历史交易存在冲突,且冲突处理指令为第一交易与历史交易存在冲突时拒绝执行第一交易,且告警(即“3”)。The sixth condition is that the first transaction conflicts with the historical transaction, and the conflict processing instruction is that when the first transaction conflicts with the historical transaction, the first transaction is rejected and an alarm is issued (ie, "3").
需要说明的是,若第一交易的冲突结果和冲突处理指令满足第六种条件,则第一节点可以在拒绝处理第一交易的同时,生成告警信息,并可以向客户端设备发送告警信息,以便于运维人员执行排错工作。It should be noted that if the conflict result of the first transaction and the conflict processing instruction satisfy the sixth condition, the first node can generate alarm information while refusing to process the first transaction, and can send the alarm information to the client device. In order to facilitate the operation and maintenance personnel to perform troubleshooting.
下面分别从两种情形描述第一节点处理第一交易的具体实现过程。The following describes the specific implementation process of the first node processing the first transaction from two scenarios.
情形一Situation One
在情形一中,第一节点可以执行第一交易,即第一交易的冲突结果和冲突处理指令满足上述第一种条件,或者满足第二种条件,或者满足第三种条件,或者满足第四种条件。In scenario 1, the first node can execute the first transaction, that is, the conflict result of the first transaction and the conflict processing instruction satisfy the first condition, or the second condition, or the third condition, or the fourth Kind of conditions.
在一个示例中,第一节点若确定执行第一交易,则可以先对预设内存空间中包括的目标历史交易进行更新。在一个示例中,若预设内存空间中不存在与第一交易的标识相同的历史交易,则第一节点可以将第一交易添加到预设内存空间中,如此,预设内存空间中包括的目标历史交易中可以包括第一交易,第一节点若在执行第一交易的过程中接收到与第一交易的标识相同的第二交易,则通过第一轮冲突检测,即可确定第二交易与第一交易冲突,从而可以无需执行与第一交易重复的第二交易。在另一个示例中,若预设内存空间中存在与第一交易的标识相同的目标历史交易,则第一节点可以更新预设数据库中存储的目标历史交易的信息,比如可以更新目标历史交易的冲突次数、冲突处理指令等,如此,可以使得基于预设内存空间中的历史交易确定的预设过滤模型更为准确。本发明实施例中,通过在确定执行第一交易时更新预设内存空间,可以使得第一节点的交易处理过程更高效。In an example, if the first node determines to execute the first transaction, it may first update the target historical transaction included in the preset memory space. In an example, if there is no historical transaction with the same identifier of the first transaction in the preset memory space, the first node may add the first transaction to the preset memory space. In this way, the preset memory space includes The target historical transaction may include the first transaction. If the first node receives a second transaction with the same identifier as the first transaction during the execution of the first transaction, the second transaction can be determined through the first round of conflict detection It conflicts with the first transaction, so there is no need to execute a second transaction that is repeated with the first transaction. In another example, if there is a target historical transaction with the same identifier as the first transaction in the preset memory space, the first node may update the target historical transaction information stored in the preset database, for example, the target historical transaction may be updated The number of conflicts, conflict processing instructions, etc., in this way can make the preset filtering model determined based on the historical transactions in the preset memory space more accurate. In the embodiment of the present invention, by updating the preset memory space when the first transaction is determined to be executed, the transaction processing process of the first node can be made more efficient.
进一步地,第一节点可以与区块链系统中的其它节点进行通信,执行第一交易的共识过程,若确定区块链系统中对第一交易达成共识的节点的数量大于或等于预设阈值,则可以生成第一交易对应的区块信息,并可以使用第 一交易对应的区块信息更新第一预设数据库和/或预设内存空间,比如可以根据第一交易的区块信息更新第一预设数据库,或者也可以根据第一交易的区块信息更新预设内存空间,或者还可以根据第一交易的区块信息更新第一预设数据库和预设内存空间,具体不作限定。相应地,若确定区块链系统中对第一交易达成共识的节点的数量小于预设阈值,则可以向客户端设备发送执行第一交易失败的消息。其中,预设阈值可以由本领域技术人员根据经验设置,比如可以为区块链系统所包括的节点数量的3/4,具体不作限定。Further, the first node can communicate with other nodes in the blockchain system to execute the consensus process of the first transaction, if it is determined that the number of nodes that reach consensus on the first transaction in the blockchain system is greater than or equal to the preset threshold , The block information corresponding to the first transaction can be generated, and the block information corresponding to the first transaction can be used to update the first preset database and/or the preset memory space. For example, the first transaction can be updated according to the block information of the first transaction. A preset database may also update the preset memory space according to the block information of the first transaction, or may also update the first preset database and the preset memory space according to the block information of the first transaction, which is not specifically limited. Correspondingly, if it is determined that the number of nodes that have reached a consensus on the first transaction in the blockchain system is less than the preset threshold, a message indicating that the execution of the first transaction has failed may be sent to the client device. The preset threshold may be set by those skilled in the art based on experience, for example, it may be 3/4 of the number of nodes included in the blockchain system, which is not specifically limited.
本发明实施例中,生成第一交易对应的区块信息的方式可以有多种,在一种可能的实现方式中,第一预设数据库中可以存储有第一校验值,第一校验值可以为第一节点使用预设校验算法对多个历史交易进行校验得到的,比如可以为多个历史交易的哈希值。具体实施中,在确定执行第一交易之前,第一节点可以从第一预设数据库中获取第一校验值,并可以将第一校验值存储在预设内存空间中;进一步地,在执行第一交易的过程中,第一节点可以预先生成第一交易对应的初始区块信息,并可以使用预设校验算法对第一校验值和第一交易进行校验,得到第二校验值;进一步地,第一节点可以将第二校验值添加到初始区块信息中,并可以与区块链系统中的其它节点进行共识,若共识通过,则可以得到第一交易对应的区块信息,并可以使用第二校验值更新预设内存空间中存储的第一校验值。In the embodiment of the present invention, there may be multiple ways to generate block information corresponding to the first transaction. In a possible implementation manner, the first preset database may store the first check value, and the first check The value may be obtained by verifying multiple historical transactions by the first node using a preset verification algorithm, for example, may be a hash value of multiple historical transactions. In specific implementation, before determining to execute the first transaction, the first node may obtain the first check value from the first preset database, and may store the first check value in the preset memory space; further, in In the process of executing the first transaction, the first node can generate the initial block information corresponding to the first transaction in advance, and can use a preset verification algorithm to verify the first verification value and the first transaction to obtain the second verification. Further, the first node can add the second check value to the initial block information, and can reach a consensus with other nodes in the blockchain system. If the consensus is passed, the corresponding value of the first transaction can be obtained Block information, and can use the second check value to update the first check value stored in the preset memory space.
在一个示例中,可以采用循环hash算法确定第二校验值,其程序实现过程可以如下所示:In an example, a circular hash algorithm can be used to determine the second check value, and the program implementation process can be as follows:
Data[3]={data[0],data[1],data[2]};Data[3]={data[0],data[1],data[2]};
HASH_NEW=HASH_DATA;HASH_NEW=HASH_DATA;
for(i=0;i<3;i++)for(i=0; i<3; i++)
{HASH_NEW=hash(HASH_NEW+hash(Data[i]));}{HASH_NEW=hash(HASH_NEW+hash(Data[i]));}
HASH_DATA=HASH_NEWHASH_DATA=HASH_NEW
根据第一行程序,第一节点确定执行交易data[0]、历史交易data[1]和历史交易data[2];根据第二行程序,第一节点可以获取预设内存空间中存储的校验 值HASH_NEW;根据第三行~第四行程序,第一节点可以对交易data[0]取哈希值,得到交易data[0]的校验值hash(Data[1]),进而可以对第一校验值HASH_NEW和交易data[0]的校验值hash(Data[1])取哈希值,得到包括交易data[0]在内的历史交易的校验值;相应地,第一节点可以根据包括交易data[0]在内的历史交易的校验值和交易data[1],得到包括交易data[0]与交易data[1]在内的历史交易的校验值,进而可以根据包括交易data[0]与交易data[1]在内的历史交易的校验值和交易data[2],得到包括交易data[0]、交易data[1]与交易data[2]在内的历史交易的校验值;根据第五行程序,可以使用包括交易data[0]、交易data[1]与交易data[2]在内的历史交易的校验值更新预设内存空间中存储的历史交易的校验值。According to the first line of program, the first node determines to execute transaction data[0], historical transaction data[1], and historical transaction data[2]; according to the second line of program, the first node can obtain the calibration stored in the preset memory space The verification value HASH_NEW; according to the third to fourth lines of the program, the first node can get the hash value of transaction data[0] to obtain the verification value hash(Data[1]) of transaction data[0], and then can The first check value HASH_NEW and the check value hash(Data[1]) of transaction data[0] take the hash value to obtain the check value of historical transactions including transaction data[0]; accordingly, the first The node can obtain the check value of historical transaction including transaction data[0] and transaction data[1] according to the check value of historical transaction including transaction data[0] and transaction data[1], and then can According to the check value of the historical transaction including transaction data[0] and transaction data[1] and transaction data[2], obtain transaction data[0], transaction data[1] and transaction data[2] The check value of the historical transaction; according to the fifth line of the program, the check value of the historical transaction including transaction data[0], transaction data[1] and transaction data[2] can be used to update the preset memory space The check value of historical transactions.
需要说明的是,上述仅是一种示例性的简单说明,其所列举的采用循环hash算法确定第二校验值的方式仅是为了便于说明方案,并不构成对方案的限定。在具体实施中,确定第二校验值的方式可以由本领域技术人员根据经验进行设置,比如可以采用merkle root算法确定第二校验值,或者可以采用非循环hash算法确定第二校验值,具体不作限定。It should be noted that the foregoing is only an exemplary simple description, and the manner in which the cyclic hash algorithm is used to determine the second check value is only for the convenience of explaining the solution, and does not constitute a limitation on the solution. In specific implementation, the method for determining the second check value can be set by those skilled in the art based on experience. For example, the merkle root algorithm can be used to determine the second check value, or the acyclic hash algorithm can be used to determine the second check value. The details are not limited.
本发明实施例中,第一校验值可以用于标识区块链系统所处理过的历史交易,通过在执行第一交易后,使用第一交易更新第一校验值得到第二校验值,一方面,可以使得区块链系统中的多个节点基于相同的第二校验值实现共识,从而提高区块链系统中交易处理的准确性;另一方面,可以使得区块链系统在处理交易的过程中实时更新区块链系统所处理过的历史交易,从而提高后续处理交易的准确性。In the embodiment of the present invention, the first check value can be used to identify historical transactions processed by the blockchain system. After the first transaction is executed, the first check value is updated with the first transaction to obtain the second check value On the one hand, multiple nodes in the blockchain system can achieve consensus based on the same second check value, thereby improving the accuracy of transaction processing in the blockchain system; on the other hand, it can make the blockchain system in In the process of processing transactions, the historical transactions processed by the blockchain system are updated in real time, thereby improving the accuracy of subsequent processing transactions.
若第一节点成功执行第一交易,则第一交易对应的区块信息可以被存储在区块链系统中,如此,第一交易的处理结果可以包括第一交易对应的区块信息。进一步地,第一节点可以使用据第一交易的区块信息更新第一预设数据库和/或预设内存空间。在一种可能的实现方式中,第一节点可以使用第一交易的标识训练第一预设过滤模型,得到第二预设过滤模型,并可以将第一预设数据库中存储的第一预设过滤模型更新为第二预设过滤模型;且,第一 节点可以将第一交易对应的交易信息添加到第一预设数据库中,并可以使用上述确定得到的第二校验值更新第一预设数据库中存储的第一校验值;进一步地,第一节点可以使用第二预设过滤模型和第二校验值分别更新预设内存空间中存储的第一预设过滤模型和第一校验值。If the first node successfully executes the first transaction, the block information corresponding to the first transaction can be stored in the blockchain system. In this way, the processing result of the first transaction can include the block information corresponding to the first transaction. Further, the first node may use the block information according to the first transaction to update the first preset database and/or the preset memory space. In a possible implementation manner, the first node may use the identifier of the first transaction to train the first preset filtering model to obtain the second preset filtering model, and may use the first preset stored in the first preset database The filtering model is updated to the second preset filtering model; and the first node can add the transaction information corresponding to the first transaction to the first preset database, and can use the second check value determined above to update the first preset Set the first check value stored in the database; further, the first node can use the second preset filter model and the second check value to respectively update the first preset filter model and the first check value stored in the preset memory space. Value.
相应地,若第一节点未成功执行第一交易(比如节点共识未通过),则第一交易的处理结果可以包括第一指示信息,第一指示信息用于指示第一交易处理失败。在一个示例中,由于第一节点在确定执行第一交易时,即已将第一交易添加到预设内存空间中,因此,若未成功执行第一交易,则第一节点可以将预设内存空间中存储的第一交易删除,从而可以避免后续获取到的与第一交易的标识相同的交易无法通过第一轮冲突检测,保证后续交易处理的准确性。Correspondingly, if the first node does not successfully execute the first transaction (for example, the node consensus fails), the processing result of the first transaction may include first instruction information, and the first instruction information is used to indicate that the processing of the first transaction fails. In an example, since the first node has added the first transaction to the preset memory space when it determines to execute the first transaction, if the first transaction is not successfully executed, the first node may add the preset memory The first transaction stored in the space is deleted, thereby avoiding the subsequent acquisition of a transaction with the same identifier as the first transaction from failing the first round of conflict detection, ensuring the accuracy of subsequent transaction processing.
本发明实施例中,通过使用第一交易的区块信息依次更新第一预设数据库和预设内存空间中的第一预设过滤模型、历史交易信息和历史交易的校验值,可以采用基于更新后的预设内存空间和第一预设数据库对下一个交易进行冲突检测,从而可以提高冲突检测的准确性。In the embodiment of the present invention, by using the block information of the first transaction to sequentially update the first preset filter model, historical transaction information and the check value of the historical transaction in the first preset database and the preset memory space, the verification value based on The updated preset memory space and the first preset database perform conflict detection for the next transaction, thereby improving the accuracy of conflict detection.
需要说明的是,若第一交易的冲突结果和冲突处理指令满足上述第四种条件,则第一节点在执行第一交易后,还可以获取交易请求中包括的容错合约的地址,并可以根据容错合约的地址调用容错处理模块对第一交易进行修正。如此,第一交易的处理结果中还可以包括容错合约的地址,容错合约的地址用于调用客户端设备中的容错处理模块对第一交易进行修正。It should be noted that if the conflict result of the first transaction and the conflict processing instruction satisfy the fourth condition, the first node can also obtain the address of the fault-tolerant contract included in the transaction request after executing the first transaction, and can also obtain the address of the fault-tolerant contract included in the transaction request according to the The address of the fault-tolerant contract calls the fault-tolerant processing module to correct the first transaction. In this way, the processing result of the first transaction may also include the address of the fault-tolerant contract, and the address of the fault-tolerant contract is used to call the fault-tolerant processing module in the client device to correct the first transaction.
情形二Situation two
在情形二中,第一节点可以拒绝执行第一交易,即第一交易的冲突结果和冲突处理指令可以满足上述第五种条件或上述第六种条件。In the second situation, the first node may refuse to execute the first transaction, that is, the conflict result of the first transaction and the conflict processing instruction can satisfy the fifth condition or the sixth condition.
具体实施中,若第一节点拒绝执行第一交易,则第一节点可以生成冲突指示码,冲突指示码用于指示第一交易与历史交易存在冲突,且第一节点未执行第一交易。因此,第一交易的处理结果中可以包括冲突指示码。In specific implementation, if the first node refuses to execute the first transaction, the first node may generate a conflict indicator code, the conflict indicator code is used to indicate that the first transaction conflicts with the historical transaction, and the first node has not executed the first transaction. Therefore, the processing result of the first transaction may include the conflict indicator code.
步骤205,第一节点向客户端设备发送第一信息或第二信息。Step 205: The first node sends the first information or the second information to the client device.
具体实施中,第一交易的处理结果可以包括第一交易的区块信息、第一指示信息、冲突指示码、容错合约的地址中的任意一项或任意多项。若第一交易的处理结果包括第一交易的区块信息和/或容错合约的地址,说明第一交易已被第一节点成功执行,则第一节点可以向客户端设备发送第一信息;若第一交易的处理结果包括第一指示信息或冲突指示码,说明第一交易未被第一节点成功执行,则第一节点可以向客户端设备发送第二信息。In specific implementation, the processing result of the first transaction may include any one or more of the block information of the first transaction, the first instruction information, the conflict indicator code, and the address of the fault-tolerant contract. If the processing result of the first transaction includes the block information of the first transaction and/or the address of the fault-tolerant contract, indicating that the first transaction has been successfully executed by the first node, the first node may send the first information to the client device; if The processing result of the first transaction includes the first instruction information or the conflict instruction code, indicating that the first transaction has not been successfully executed by the first node, and the first node may send the second information to the client device.
本发明实施例中,客户端设备设置的冲突处理指令中存在“第一节点与历史交易存在冲突时执行第一交易”、“第一节点与历史交易存在冲突时重定向到容错模块”和“第一节点与历史交易存在冲突时执行第一交易且打印日志”这三种情况,即第一交易与历史交易存在冲突时第一交易也可能被第一节点成功执行。因此,为了避免第一交易存在较大的业务失误,第一节点可以在成功执行第一交易后,向客户端设备发送第一信息。在一个示例中,第一信息中可以包括第一交易的区块信息和/或容错合约的地址,如此,客户端设备接受到第一信息后,可以根据第一信息对第一交易进行修正。In the embodiment of the present invention, the conflict processing instructions set by the client device include "execute the first transaction when the first node conflicts with the historical transaction", "redirect to the fault-tolerant module when the first node conflicts with the historical transaction" and " When the first node conflicts with the historical transaction, execute the first transaction and print the log. These three situations, that is, when the first transaction conflicts with the historical transaction, the first transaction may be successfully executed by the first node. Therefore, in order to avoid major business errors in the first transaction, the first node may send the first information to the client device after successfully executing the first transaction. In an example, the first information may include the block information of the first transaction and/or the address of the fault-tolerant contract. In this way, after receiving the first information, the client device can correct the first transaction according to the first information.
相应地,若第一交易的处理结果包括第一指示信息,则说明第一交易已通过冲突检测,但未被第一节点成功执行;若第一交易的处理结果包括冲突指示值,则说明第一交易未通过冲突处理指令,且未被第一节点成功执行。由于第一交易未被成功执行,因此不会存在较大的业务失误,因此,第一节点可以向客户端设备发送第二信息,第二信息可以用于指示第一交易未被成功执行。Correspondingly, if the processing result of the first transaction includes the first indication information, it means that the first transaction has passed the conflict detection but not successfully executed by the first node; if the processing result of the first transaction includes the conflict indication value, it means that A transaction failed the conflict processing instruction and was not successfully executed by the first node. Since the first transaction was not successfully executed, there will be no major business errors. Therefore, the first node may send the second information to the client device, and the second information may be used to indicate that the first transaction was not successfully executed.
步骤206,客户端设备接收第一节点发送的第一信息或第二信息,并调用容错处理模块对第一交易进行修正。Step 206: The client device receives the first information or the second information sent by the first node, and calls the fault-tolerant processing module to correct the first transaction.
具体实施中,客户端设备中可以设置有第二预设数据库,第二预设数据库中可以存储有客户端设备处理过的全部历史交易。在一种可能的实现方式中,若客户端设备接收到第一节点发送的第一信息,则说明第一交易已被第一节点成功执行,如此,客户端设备可以基于第二预设数据库对第一交易进行冲突检测,确定第一交易与客户端设备处理过的历史交易是否存在冲突。 在一个示例中,客户端设备可以直接将第一交易的标识与第二预设数据库中存储的历史交易的标识进行对比,确定第一交易与客户端设备处理过的历史交易是否存在冲突;在另一个示例中,客户端设备可以对第一交易依次执行第一轮冲突检测~第三轮冲突检测,从而确定第一交易与客户端设备处理过的历史交易是否存在冲突。此处,上述两个示例可以参照步骤203中确定第一交易与第一节点处理过的历史交易是否存在冲突的过程进行实现,具体不再赘述。In a specific implementation, a second preset database may be provided in the client device, and all historical transactions processed by the client device may be stored in the second preset database. In a possible implementation, if the client device receives the first information sent by the first node, it means that the first transaction has been successfully executed by the first node. In this way, the client device can pair The first transaction performs conflict detection to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device. In an example, the client device can directly compare the identifier of the first transaction with the identifier of the historical transaction stored in the second preset database to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device; In another example, the client device may sequentially perform the first round of conflict detection to the third round of conflict detection on the first transaction, so as to determine whether there is a conflict between the first transaction and the historical transaction processed by the client device. Here, the above two examples can be implemented with reference to the process of determining whether there is a conflict between the first transaction and the historical transaction processed by the first node in step 203, and the details are not repeated here.
进一步地,若第二预设数据库中不存在标识与第一交易的标识匹配的历史交易,则说明客户端设备之前未处理过与第一交易的标识相同的交易;如此,客户端设备可以将第一交易添加到第二预设数据库中。相应地,若第二预设数据库中存在标识与第一交易的标识匹配的历史交易,则说明客户端设备之前已处理过与第一交易的标识相同的交易;如此,客户端设备可以使用容错处理模块按照预设处理规则对第一交易进行修正。其中,预设处理规则可以包括输出日志记录、输出第二预设数据库的交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。Further, if there is no historical transaction with an identifier matching the identifier of the first transaction in the second preset database, it means that the client device has not previously processed a transaction with the same identifier as the first transaction; in this way, the client device can The first transaction is added to the second preset database. Correspondingly, if there is a historical transaction whose identifier matches the identifier of the first transaction in the second preset database, it means that the client device has previously processed the same transaction as the identifier of the first transaction; in this way, the client device can use fault tolerance The processing module corrects the first transaction according to the preset processing rules. The preset processing rules may include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
具体实施中,容错处理模块可以预先判断第一交易所属的业务流程,若确定第一交易为非关键型业务流程中的交易,则容错处理模块可以采用多种方式对第一交易进行修正。在一个示例中,容错处理模块可以获取第一交易的日志信息和/或数据库信息,并可以将第一交易的日志信息和/或数据库信息发送给运维人员进行维护;在另一个示例中,容错处理模块可以根据容错合约的地址,按照容错合约中设置的预设处理规则对第一交易进行后续处理。由于非关键性业务流程中的交易对业务的影响较小,因此采用上述方式对非关键性业务流程中的交易进行修正,可以提高系统的处理效率。In specific implementation, the fault-tolerant processing module may prejudge the business process to which the first transaction belongs. If it is determined that the first transaction is a transaction in a non-critical business process, the fault-tolerant processing module may correct the first transaction in a variety of ways. In one example, the fault-tolerant processing module may obtain the log information and/or database information of the first transaction, and may send the log information and/or database information of the first transaction to the operation and maintenance personnel for maintenance; in another example, The fault-tolerant processing module can perform subsequent processing on the first transaction according to the address of the fault-tolerant contract and the preset processing rules set in the fault-tolerant contract. Since the transaction in the non-critical business process has a small impact on the business, the above-mentioned method is used to modify the transaction in the non-critical business process to improve the processing efficiency of the system.
相应地,若确定第一交易为关键型业务流程中的交易,则容错处理模块可以根据第一交易所属的业务流程对第一交易进行修正。比如,若第一交易为创建新的订单X,则容错处理模块可以将订单X的状态设置为无效状态;若第一交易为在账户Q 1中添加收益L 1,则容错处理模块可以从账户Q 1上减去收 益L 1;若第一交易为账户Q 1向账户Q 2转账资金L 2,则容错处理模块可以将账户Q 2上中的资金L退回账户Q 1;若第一交易为重复从账户Q 3中非正常地划出资产N,则容错处理模块可以将账户Q 3冻结。 Correspondingly, if it is determined that the first transaction is a transaction in a critical business process, the fault-tolerant processing module can correct the first transaction according to the business process to which the first transaction belongs. For example, if the first transaction to create a new order X, the fault-tolerant processing module may be the order of X state to the inactive state; if the first transaction to add revenue L 1, the fault-tolerant processing module in Q 1 can account from the Account Q revenue minus 1 L 1; if the first transaction for the account to the account Q 2 Q 1 transfer funds L 2, then the fault-tolerant processing module may be on account of capital Q 2 Q 1 L accounts returned; if the first transaction If asset N is abnormally drawn from account Q 3 repeatedly, the fault-tolerant processing module can freeze account Q 3 .
需要说明的是,上述仅是一种示例性的简单说明,其所列举的对第一交易进行修正的方式仅是为了便于说明方案,并不构成对方案的限定。在具体实施中,对第一交易进行修正的方式可以由本领域技术人员根据经验进行设置,或者可以根据实际业务需要进行设置,具体不作限定。It should be noted that the foregoing is only an exemplary simple description, and the manners of modifying the first transaction listed therein are only for the convenience of explaining the solution, and do not constitute a limitation on the solution. In a specific implementation, the method for modifying the first transaction can be set by a person skilled in the art based on experience, or can be set according to actual business needs, which is not specifically limited.
本发明实施例中,由于冲突处理指令为客户端设备设置的,因此可能会存在某些发生冲突的交易仍然被处理,通过在处理完交易后向客户端设备发送区块信息,可以使得客户端设备对交易进行修正,从而可以避免交易处理过程出现较大的失误,提高区块链系统的业务处理能力和业务处理的准确性。In the embodiment of the present invention, because the conflict processing instruction is set by the client device, some conflicting transactions may still be processed. By sending block information to the client device after the transaction is processed, the client device The device corrects the transaction, so as to avoid major errors in the transaction processing process, and improve the business processing capability and accuracy of the blockchain system.
在另一种可能的实现方式中,客户端设备若接收到第一节点发送的第二信息,则可以调用容错处理模块获取第一交易的相关信息,比如第一交易的时间戳、交易数据、冲突结果和冲突处理指令等;进一步地,容错处理模块可以将第一交易的相关信息存储到日志信息或数据库信息中,以便运维人员根据日志信息或数据库信息进行排错。In another possible implementation manner, if the client device receives the second information sent by the first node, it can call the fault-tolerant processing module to obtain the relevant information of the first transaction, such as the timestamp of the first transaction, transaction data, Conflict results and conflict processing instructions, etc.; further, the fault-tolerant processing module can store relevant information of the first transaction in log information or database information, so that the operation and maintenance personnel can perform troubleshooting based on the log information or database information.
本发明的上述实施例中,区块链系统中的第一节点接收客户端设备发送的交易请求,交易请求包括第一交易的标识和冲突处理指令,冲突处理指令包括第一交易与历史交易存在冲突时对第一交易的处理方式,和/或,第一交易与历史交易不存在冲突时对第一交易的处理方式;进一步地,第一节点根据第一交易的标识,确定第一交易的冲突结果,并根据第一交易的冲突结果和冲突处理指令,对第一交易进行处理;其中,第一交易的冲突结果用于指示第一交易与历史交易是否存在冲突。本发明实施例中,通过设置交易的标识,可以采用对比交易的标识的方式对第一交易进行冲突检测,而无需对比交易数据,从而可以使得对交易进行冲突检测的过程更为快速,提高区块链系统中交易处理的效率;且,由于冲突处理指令由客户端设备进行设置,因此可以基于不同的业务场景和客户端设备的要求设置不同的冲突处理指令, 也就是说,上述技术方案中的交易处理方法更加符合实际情况。In the above-mentioned embodiment of the present invention, the first node in the blockchain system receives the transaction request sent by the client device, the transaction request includes the identification of the first transaction and the conflict processing instruction, and the conflict processing instruction includes the first transaction and the existence of historical transactions. The way to deal with the first transaction when there is a conflict, and/or the way to deal with the first transaction when there is no conflict between the first transaction and the historical transaction; further, the first node determines the first transaction according to the identifier of the first transaction The conflict result, and the first transaction is processed according to the conflict result of the first transaction and the conflict processing instruction; wherein the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction. In the embodiment of the present invention, by setting the transaction identifier, the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, thereby making the process of conflict detection for the transaction faster and improving The efficiency of transaction processing in the blockchain system; and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, in the above technical solution The transaction processing method is more in line with the actual situation.
基于图1所示意的系统架构和图2所示意的交易处理方法,图3为本发明实施例提供的一种客户端设备与第一节点的结构示意图。如图3所示,第一节点中可以设置有冲突检测单元、交易执行单元和更新单元,冲突检测单元、交易执行单元和更新单元之间可以依次连接。且,第一节点中还可以设置有预设内存空间、第一预设过滤模型和第一预设数据库;相应地,客户端设备中可以设置有第二预设数据库。Based on the system architecture shown in FIG. 1 and the transaction processing method shown in FIG. 2, FIG. 3 is a schematic structural diagram of a client device and a first node according to an embodiment of the present invention. As shown in FIG. 3, the first node may be provided with a conflict detection unit, a transaction execution unit, and an update unit, and the conflict detection unit, the transaction execution unit, and the update unit may be connected in sequence. Moreover, a preset memory space, a first preset filtering model, and a first preset database may also be set in the first node; accordingly, a second preset database may be set in the client device.
基于图3所示意的客户端设备与第一节点对第一交易进行处理的过程可以如下列步骤1~步骤6所示:The process of processing the first transaction based on the client device and the first node as shown in FIG. 3 may be as shown in the following steps 1 to 6:
步骤1,客户端设备向第一节点中设置的冲突检测单元发送交易请求,交易请求中包括第一交易的标识与第一交易的冲突处理指令。 Step 1. The client device sends a transaction request to the conflict detection unit provided in the first node, and the transaction request includes the identifier of the first transaction and the conflict processing instruction of the first transaction.
步骤2,冲突检测单元接收客户端设备发送的交易请求后,获取第一交易的标识,并基于预设内存空间、第一预设过滤模型和第一预设数据库中的任意一个或任意多个对第一交易进行冲突检测。比如,在一个示例中,冲突检测单元可以仅基于预设内存空间对第一交易进行冲突检测,或者仅基于第一预设过滤模型对第一交易进行冲突检测,或者仅基于第一预设数据库对第一交易进行冲突检测;在另一个示例中,冲突检测单元可以基于预设内存空间和第一预设过滤模型对第一交易进行冲突检测,或者基于预设内存空间和第一预设数据库对第一交易进行冲突检测,或者基于第一预设过滤模型和第一预设数据库对第一交易进行冲突检测;在又一个示例中,冲突检测单元可以基于预设内存空间、第一预设过滤模型和第一预设数据库对第一交易进行冲突检测。Step 2: After receiving the transaction request sent by the client device, the conflict detection unit obtains the identifier of the first transaction, and based on any one or more of the preset memory space, the first preset filtering model, and the first preset database Perform conflict detection on the first transaction. For example, in one example, the conflict detection unit may perform conflict detection on the first transaction based only on the preset memory space, or perform conflict detection on the first transaction based on the first preset filtering model only, or based only on the first preset database Perform conflict detection on the first transaction; in another example, the conflict detection unit may perform conflict detection on the first transaction based on the preset memory space and the first preset filtering model, or based on the preset memory space and the first preset database Perform conflict detection on the first transaction, or perform conflict detection on the first transaction based on the first preset filtering model and the first preset database; in another example, the conflict detection unit may be based on the preset memory space and the first preset database. The filter model and the first preset database perform conflict detection on the first transaction.
在一种可能的实现方式中,冲突检测单元可以基于预设内存空间对第一交易执行第一轮冲突检测。若第一轮冲突检测确定预设内存空间中存在与第一交易的标识匹配的历史交易,则冲突检测单元可以确定第一交易与历史交易存在冲突;若第一轮冲突检测确定预设内存空间中不存在与第一交易的标识匹配的历史交易,则冲突检测单元可以基于第一预设过滤模型对第一交易 执行第二轮冲突检测。若第二轮冲突检测确定第一交易与历史交易不存在冲突,则冲突检测单元可以确定第一交易与历史交易不存在冲突;若第二轮冲突检测确定第一交易与历史交易存在冲突,则冲突检测单元可以基于第一预设数据库对第一交易执行第三轮冲突检测。若第三轮冲突检测确定第一预设数据库中存在与第一交易的标识匹配的历史交易,则冲突检测单元可以确定第一交易与历史交易存在冲突;若第一轮冲突检测确定第一预设数据库中不存在与第一交易的标识匹配的历史交易,则冲突检测单元可以确定第一交易与历史交易不存在冲突。In a possible implementation manner, the conflict detection unit may perform the first round of conflict detection on the first transaction based on a preset memory space. If the first round of conflict detection determines that there is a historical transaction matching the identifier of the first transaction in the preset memory space, the conflict detection unit may determine that the first transaction conflicts with the historical transaction; if the first round of conflict detection determines the preset memory space If there is no historical transaction matching the identifier of the first transaction, the conflict detection unit may perform the second round of conflict detection on the first transaction based on the first preset filtering model. If the second round of conflict detection determines that the first transaction does not conflict with the historical transaction, the conflict detection unit can determine that the first transaction does not conflict with the historical transaction; if the second round of conflict detection determines that the first transaction conflicts with the historical transaction, then The conflict detection unit may perform a third round of conflict detection on the first transaction based on the first preset database. If the third round of conflict detection determines that there is a historical transaction matching the identification of the first transaction in the first preset database, the conflict detection unit may determine that the first transaction conflicts with the historical transaction; if the first round of conflict detection determines that the first predetermined Assuming that there is no historical transaction matching the identifier of the first transaction in the database, the conflict detection unit may determine that there is no conflict between the first transaction and the historical transaction.
若确定第一交易与历史交易存在冲突,且冲突处理指令为“第一交易与历史交易存在冲突时拒绝执行第一交易”,则第一节点与客户端设备可以执行如下步骤3.1和步骤4.1:If it is determined that there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is "refuse to execute the first transaction when there is a conflict between the first transaction and the historical transaction", the first node and the client device can perform the following steps 3.1 and 4.1:
步骤3.1,冲突检测单元(或第一节点)向客户端设备发送冲突指示码。Step 3.1: The conflict detection unit (or the first node) sends a conflict indication code to the client device.
步骤4.1,客户端设备接收冲突检测单元发送的冲突指示码,并调用容错处理模块对第一交易进行冲突处理。在一个示例中,容错处理模块可以获取第一交易的时间戳、交易数据和冲突指示码,并可以将第一交易的时间戳、交易数据和冲突指示码记录到日志信息或数据库中。Step 4.1: The client device receives the conflict indication code sent by the conflict detection unit, and calls the fault-tolerant processing module to perform conflict processing on the first transaction. In an example, the fault-tolerant processing module can obtain the time stamp, transaction data, and conflict indicator code of the first transaction, and can record the time stamp, transaction data, and conflict indicator code of the first transaction in log information or a database.
相应地,若确定第一交易与历史交易不存在冲突,且冲突处理指令为“第一交易与历史交易不存在冲突时执行第一交易”,或者第一交易与历史交易存在冲突,且冲突处理指令为“第一交易与历史交易存在冲突时执行第一交易”,或者第一交易与历史交易存在冲突,且冲突处理指令为“第一交易与历史交易存在冲突时重定向到容错处理模块”,则第一节点与客户端设备可以执行如下步骤3.2、步骤4.2~步骤6:Correspondingly, if it is determined that there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is "execute the first transaction when there is no conflict between the first transaction and the historical transaction", or there is a conflict between the first transaction and the historical transaction, and the conflict is handled The instruction is "execute the first transaction when the first transaction conflicts with the historical transaction", or the first transaction conflicts with the historical transaction, and the conflict processing instruction is "redirect to the fault-tolerant processing module when the first transaction conflicts with the historical transaction" , The first node and the client device can perform the following step 3.2, step 4.2 to step 6:
步骤3.2,冲突检测单元将第一交易发送给交易执行单元,以使交易执行单元执行第一交易。Step 3.2: The conflict detection unit sends the first transaction to the transaction execution unit, so that the transaction execution unit executes the first transaction.
具体实施中,交易执行单元可以使用智能合约执行第一交易,并可以通过网络与区块链系统中的其它节点进行共识。若达成共识的节点的数量大于或等于预设阈值,则交易执行单元可以生成第一交易对应的区块信息,并可 以将第一交易对应的区块信息存储到底层的区块链中;若达成共识的节点的数量小于预设阈值,则交易执行单元(或第一节点)可以向客户端设备发送第一交易执行失败的信息,以使客户端设备调用容错处理模块处理第一交易(该过程未在图3中示出)。In specific implementation, the transaction execution unit can use the smart contract to execute the first transaction, and can reach consensus with other nodes in the blockchain system through the network. If the number of nodes that have reached a consensus is greater than or equal to the preset threshold, the transaction execution unit can generate block information corresponding to the first transaction, and can store the block information corresponding to the first transaction in the underlying blockchain; if If the number of nodes that have reached a consensus is less than the preset threshold, the transaction execution unit (or the first node) can send the first transaction execution failure information to the client device, so that the client device can call the fault-tolerant processing module to process the first transaction (the The process is not shown in Figure 3).
步骤4.2,交易执行单元确定成功执行第一交易后,向更新单元发送更新请求,更新请求中包括第一交易对应的区块信息。Step 4.2: After the transaction execution unit determines that the first transaction is successfully executed, it sends an update request to the update unit. The update request includes block information corresponding to the first transaction.
步骤5,更新单元接收到交易执行单元发送的更新请求后,使用第一交易对应的区块信息更新预设内存空间、第一预设过滤模型和第一预设数据库。具体地说,更新单元可以将第一交易添加到预设内存空间和第一预设数据库中,并可以基于第一预设数据库中包括的历史交易和第一交易更新第一预设过滤模型。 Step 5. After receiving the update request sent by the transaction execution unit, the update unit uses the block information corresponding to the first transaction to update the preset memory space, the first preset filter model, and the first preset database. Specifically, the update unit may add the first transaction to the preset memory space and the first preset database, and may update the first preset filtering model based on the historical transactions and the first transaction included in the first preset database.
步骤6,第一节点若确定预设内存空间、第一预设过滤模型和第一预设数据库更新完成,则向客户端设备发送交易响应消息,交易响应消息中包括第一节点对应的区块信息。 Step 6. If the first node determines that the update of the preset memory space, the first preset filter model, and the first preset database is completed, it sends a transaction response message to the client device. The transaction response message includes the block corresponding to the first node information.
如图3所示,客户端设备中可以设置有第二预设数据库,若客户端设备接收到第一节点对应的区块信息,则可以从第一节点对应的区块信息中获取第一节点的标识,进而可以将第一节点的标识与第二预设数据库中存储的多个历史交易进行匹配。若确定第二预设数据库中不存在与第一交易的标识相同的历史交易,则客户端设备可以将第一交易添加到第二预设数据库中;若确定第二预设数据库中存在与第一交易的标识相同的历史交易,则客户端设备可以调用容错处理模块对第一交易进行修正,具体实现过程可以参照步骤206进行实现,此处不再赘述。As shown in Figure 3, a second preset database may be set in the client device. If the client device receives the block information corresponding to the first node, the first node can be obtained from the block information corresponding to the first node. The identifier of the first node can be matched with the multiple historical transactions stored in the second preset database. If it is determined that there is no historical transaction with the same identifier as the first transaction in the second preset database, the client device can add the first transaction to the second preset database; if it is determined that the second preset database exists in the same For a historical transaction with the same transaction identifier, the client device can call the fault-tolerant processing module to correct the first transaction. The specific implementation process can be implemented with reference to step 206, which will not be repeated here.
本发明实施例中,通过在第一节点中设置冲突检测单元,可以使得第一交易的冲突检测过程与第一交易的交易执行过程分别在两个流程中执行,从而可以实现冲突检测、和合约计算、区块共识的解耦,提高交易处理的效率。In the embodiment of the present invention, by setting the conflict detection unit in the first node, the conflict detection process of the first transaction and the transaction execution process of the first transaction can be executed in two processes respectively, so that conflict detection and contract can be implemented. The decoupling of calculation and block consensus improves the efficiency of transaction processing.
针对图2所示意的方法流程,本发明实施例还提供一种基于区块链系统的交易处理装置,该装置的具体内容可以参照上述方法实施。Regarding the method flow illustrated in FIG. 2, the embodiment of the present invention also provides a transaction processing device based on a blockchain system, and the specific content of the device can be implemented with reference to the above method.
图4为本发明实施例提供的一种基于区块链系统的交易处理装置的结构示意图,包括:Figure 4 is a schematic structural diagram of a transaction processing device based on a blockchain system provided by an embodiment of the present invention, including:
收发模块401,用于接收客户端设备发送的交易请求,所述交易请求包括第一交易的标识和冲突处理指令;所述冲突处理指令包括所述第一交易与历史交易存在冲突时对所述第一交易的处理方式,和/或,所述第一交易与历史交易不存在冲突时对所述第一交易的处理方式;The transceiver module 401 is configured to receive a transaction request sent by a client device. The transaction request includes an identifier of a first transaction and a conflict processing instruction; the conflict processing instruction includes a conflict between the first transaction and a historical transaction. The processing method of the first transaction, and/or the processing method of the first transaction when there is no conflict between the first transaction and the historical transaction;
冲突检测模块402,用于根据所述第一交易的标识,确定所述第一交易的冲突结果,所述第一交易的冲突结果用于指示所述第一交易与历史交易是否存在冲突;The conflict detection module 402 is configured to determine the conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction;
处理模块403,用于根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理。The processing module 403 is configured to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
可选地,所述交易请求还包括第一交易的合约地址;所述冲突检测模块402用于:Optionally, the transaction request further includes the contract address of the first transaction; the conflict detection module 402 is configured to:
根据所述第一交易的标识与所述第一交易的合约地址,确定所述第一交易的键值;Determine the key value of the first transaction according to the identifier of the first transaction and the contract address of the first transaction;
从第一预设数据库中获取目标历史交易的标识,并将所述目标历史交易的标识存储到预设内存空间;所述第一预设数据库包括多个历史交易的标识和所述多个历史交易的键值,所述目标历史交易为所述第一预设数据库中键值与所述第一交易的键值匹配的历史交易;Obtain the identifier of the target historical transaction from the first preset database, and store the identifier of the target historical transaction in a preset memory space; the first preset database includes the identifiers of multiple historical transactions and the multiple histories A key value of the transaction, where the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database;
若确定所述预设内存空间中存在与所述第一交易的标识匹配的目标历史交易,则确定所述第一交易与历史交易存在冲突。If it is determined that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, it is determined that the first transaction conflicts with the historical transaction.
可选地,所述冲突检测模块402还用于:Optionally, the conflict detection module 402 is further configured to:
若确定预设内存空间中不存在与所述第一交易的标识匹配的目标历史交易,则将所述第一交易的标识输入到第一预设过滤模型;所述第一预设过滤模型为使用所述多个历史交易的交易信息训练得到的,每个历史交易的交易信息包括所述每个历史交易的标识、键值、交易数据、冲突处理指令和冲突次数;If it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, then the identifier of the first transaction is input into a first preset filtering model; the first preset filtering model is It is obtained by training using the transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identification, key value, transaction data, conflict processing instruction and the number of conflicts of each historical transaction;
若所述第一预设过滤模型的输出结果为所述第一交易与历史交易不存在冲突,则确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that there is no conflict between the first transaction and the historical transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
可选地,所述冲突检测模块402还用于:Optionally, the conflict detection module 402 is further configured to:
若所述第一预设过滤模型的输出结果为所述第一交易与历史交易存在冲突,则将所述第一交易的标识与所述第一预设数据库中的多个历史交易的标识进行对比,若确定所述第一预设数据库中存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易存在冲突;若确定所述第一预设数据库中不存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that there is a conflict between the first transaction and the historical transaction, the identification of the first transaction is performed with the identification of multiple historical transactions in the first preset database In contrast, if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction conflicts with the historical transaction; if it is determined that there is no historical transaction in the first preset database If there is a historical transaction matching the identifier of the first transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
可选地,所述第一交易与历史交易不存在冲突时的冲突处理指令包括执行所述第一交易;所述第一交易与历史交易存在冲突时的冲突处理指令包括以下任意一项:拒绝执行所述第一交易、执行所述第一交易、将所述第一交易重定向到容错合约;Optionally, the conflict processing instruction when the first transaction does not conflict with the historical transaction includes executing the first transaction; the conflict processing instruction when the first transaction conflicts with the historical transaction includes any one of the following: reject Execute the first transaction, execute the first transaction, and redirect the first transaction to a fault-tolerant contract;
所述处理模块403用于:The processing module 403 is used to:
若所述第一交易与历史交易不存在冲突,且所述冲突处理指令为所述第一交易与历史交易不存在冲突时执行所述第一交易,或者,若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时执行所述第一交易,则执行所述第一交易;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约,则执行所述第一交易,并获取所述冲突处理指令中包括的容错合约的地址,向所述客户端设备发送所述容错合约的地址;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时拒绝执行所述第一交易,则向所述客户端设备发送冲突指示值,所述冲突指示值用于指示所述第一交易与所述历史交易存在冲突。If there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is to execute the first transaction when there is no conflict between the first transaction and the historical transaction, or if the first transaction and the historical transaction There is a conflict, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, then the first transaction is executed; if the first transaction conflicts with the historical transaction, and all The conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a conflict between the first transaction and the historical transaction, then execute the first transaction, and obtain the address of the fault-tolerant contract included in the conflict processing instruction , Sending the address of the fault-tolerant contract to the client device; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction, the first transaction is rejected A transaction, a conflict indicator value is sent to the client device, and the conflict indicator value is used to indicate that the first transaction conflicts with the historical transaction.
可选地,所述处理模块403用于:Optionally, the processing module 403 is used to:
若确定所述区块链系统中对所述第一交易达成共识的节点的数量大于或 等于预设阈值,则生成所述第一交易对应的区块信息;If it is determined that the number of nodes that reach a consensus on the first transaction in the blockchain system is greater than or equal to a preset threshold, generating block information corresponding to the first transaction;
根据所述第一交易的区块信息更新所述第一预设数据库和/或所述预设内存空间。Update the first preset database and/or the preset memory space according to the block information of the first transaction.
可选地,所述处理模块403生成所述第一交易对应的区块信息之后,还用于:Optionally, after the processing module 403 generates the block information corresponding to the first transaction, it is further used to:
向所述客户端设备发送所述第一交易对应的区块信息,所述第一交易对应的区块信息用于所述客户端设备对所述第一交易进行修正。Sending the block information corresponding to the first transaction to the client device, where the block information corresponding to the first transaction is used by the client device to correct the first transaction.
可选地,所述第一预设数据库中存储有第一校验值,所述第一校验值为所述第一节点使用预设校验算法对所述第一预设数据库中存储的所述多个历史交易进行校验得到的;Optionally, a first check value is stored in the first preset database, and the first check value is a check value stored in the first preset database by the first node using a preset check algorithm Obtained by verifying the multiple historical transactions;
所述处理模块403具体用于:The processing module 403 is specifically configured to:
生成所述第一交易对应的初始区块信息;Generating initial block information corresponding to the first transaction;
使用所述预设校验算法对所述第一校验值和所述第一交易进行校验,得到第二校验值;Verifying the first verification value and the first transaction using the preset verification algorithm to obtain a second verification value;
将所述第二校验值添加到所述初始区块信息中,得到所述第一交易对应的区块信息。The second check value is added to the initial block information to obtain block information corresponding to the first transaction.
可选地,所述处理模块403用于:Optionally, the processing module 403 is used to:
使用所述第一交易的标识训练所述第一预设过滤模型,得到第二预设过滤模型,并将预设内存空间和/或所述第一预设数据库中的所述第一预设过滤模型更新为所述第二预设过滤模型;Use the identifier of the first transaction to train the first preset filter model to obtain a second preset filter model, and use the preset memory space and/or the first preset in the first preset database The filtering model is updated to the second preset filtering model;
将所述第一交易添加到所述第一预设数据库中,并使用所述第二校验值更新所述预设内存空间和/或所述第一预设数据库中的所述第一校验值。Add the first transaction to the first preset database, and use the second check value to update the preset memory space and/or the first calibration in the first preset database Value.
图5为本发明实施例提供的一种基于区块链系统的交易处理装置的结构示意图,包括:Figure 5 is a schematic structural diagram of a transaction processing device based on a blockchain system provided by an embodiment of the present invention, including:
配置模块501,用于配置第一交易的标识和冲突处理指令;The configuration module 501 is used to configure the identification of the first transaction and the conflict processing instruction;
收发模块502,用于向区块链系统中的第一节点发送交易请求,所述交易请求包括所述第一交易的标识和所述冲突处理指令;以及,接收所述第一节 点发送的容错合约的地址;The transceiver module 502 is configured to send a transaction request to the first node in the blockchain system, the transaction request including the identifier of the first transaction and the conflict processing instruction; and, to receive the fault tolerance sent by the first node The address of the contract;
修正模块503,用于根据所述容错合约的地址调用容错处理模块对所述第一交易进行修正。The correction module 503 is configured to call the fault-tolerant processing module to correct the first transaction according to the address of the fault-tolerant contract.
可选地,所述收发模块502还用于:接收所述第一节点发送的所述第一交易对应的区块信息;Optionally, the transceiver module 502 is further configured to: receive block information corresponding to the first transaction sent by the first node;
所述修正模块503还用于:解析所述第一交易对应的区块信息,获取所述第一交易的标识;若确定所述客户端设备的第二预设数据库中存在标识与所述第一交易的标识匹配的历史交易,则使用所述容错处理模块按照预设处理规则对所述第一交易进行修正;所述第二预设数据库中存储有所述客户端设备处理的多个历史交易。The modification module 503 is further configured to: parse the block information corresponding to the first transaction to obtain the identifier of the first transaction; if it is determined that the identifier and the first transaction exist in the second preset database of the client device For a historical transaction that matches the transaction identifier, the fault-tolerant processing module is used to correct the first transaction in accordance with preset processing rules; the second preset database stores multiple histories processed by the client device transaction.
可选地,所述预设处理规则包括输出日志记录、输出第二预设数据库的交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。Optionally, the preset processing rules include any one or more of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions.
从上述内容可以看出:本发明的上述实施例中,区块链系统中的第一节点接收客户端设备发送的交易请求,交易请求包括第一交易的标识和冲突处理指令,冲突处理指令包括第一交易与历史交易存在冲突时对第一交易的处理方式,和/或,第一交易与历史交易不存在冲突时对第一交易的处理方式;进一步地,第一节点根据第一交易的标识,确定第一交易的冲突结果,并根据第一交易的冲突结果和冲突处理指令,对第一交易进行处理;其中,第一交易的冲突结果用于指示第一交易与历史交易是否存在冲突。本发明实施例中,通过设置交易的标识,可以采用对比交易的标识的方式对第一交易进行冲突检测,而无需对比交易数据,从而可以使得对交易进行冲突检测的过程更为快速,提高区块链系统中交易处理的效率;且,由于冲突处理指令由客户端设备进行设置,因此可以基于不同的业务场景和客户端设备的要求设置不同的冲突处理指令,也就是说,上述技术方案中的交易处理方法更加符合实际情况。It can be seen from the foregoing that: in the foregoing embodiment of the present invention, the first node in the blockchain system receives the transaction request sent by the client device, the transaction request includes the identification of the first transaction and the conflict processing instruction, and the conflict processing instruction includes The method of processing the first transaction when there is a conflict between the first transaction and the historical transaction, and/or the method of processing the first transaction when there is no conflict between the first transaction and the historical transaction; further, the first node according to the first transaction Identification, to determine the conflict result of the first transaction, and process the first transaction according to the conflict result of the first transaction and the conflict processing instruction; wherein the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction . In the embodiment of the present invention, by setting the transaction identifier, the conflict detection of the first transaction can be performed by comparing the transaction identifier without comparing transaction data, thereby making the process of conflict detection for the transaction faster and improving The efficiency of transaction processing in the blockchain system; and, because the conflict processing instructions are set by the client device, different conflict processing instructions can be set based on different business scenarios and the requirements of the client device, that is, in the above technical solution The transaction processing method is more in line with the actual situation.
基于相同的技术构思,本发明实施例提供了一种终端设备,如图6所示,包括至少一个处理器1101,以及与至少一个处理器连接的存储器1102,本发 明实施例中不限定处理器1101与存储器1102之间的具体连接介质,图6中处理器1101和存储器1102之间通过总线连接为例。总线可以分为地址总线、数据总线、控制总线等。Based on the same technical concept, an embodiment of the present invention provides a terminal device, as shown in FIG. 6, including at least one processor 1101 and a memory 1102 connected to the at least one processor. The embodiment of the present invention does not limit the processor. For the specific connection medium between 1101 and memory 1102, the connection between processor 1101 and memory 1102 in FIG. 6 is taken as an example. The bus can be divided into address bus, data bus, control bus, etc.
在本发明实施例中,存储器1102存储有可被至少一个处理器1101执行的指令,至少一个处理器1101通过执行存储器1102存储的指令,可以执行前述的基于区块链系统的交易处理方法中所包括的步骤。In the embodiment of the present invention, the memory 1102 stores instructions that can be executed by at least one processor 1101. By executing the instructions stored in the memory 1102, the at least one processor 1101 can execute the aforementioned transaction processing methods based on the blockchain system. Steps included.
其中,处理器1101是终端设备的控制中心,可以利用各种接口和线路连接终端设备的各个部分,通过运行或执行存储在存储器1102内的指令以及调用存储在存储器1102内的数据,从而实现数据处理。可选的,处理器1101可包括一个或多个处理单元,处理器1101可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理运维人员下发的指令。可以理解的是,上述调制解调处理器也可以不集成到处理器1101中。在一些实施例中,处理器1101和存储器1102可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。Among them, the processor 1101 is the control center of the terminal device, which can use various interfaces and lines to connect various parts of the terminal device, and realize data by running or executing instructions stored in the memory 1102 and calling data stored in the memory 1102. deal with. Optionally, the processor 1101 may include one or more processing units, and the processor 1101 may integrate an application processor and a modem processor. The application processor mainly processes an operating system, a user interface, and an application program. The adjustment processor mainly processes instructions issued by operation and maintenance personnel. It is understandable that the foregoing modem processor may not be integrated into the processor 1101. In some embodiments, the processor 1101 and the memory 1102 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
处理器1101可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本发明实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合基于区块链系统的交易处理方法的实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 1101 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiment of the transaction processing method based on the blockchain system can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
存储器1102作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器1102可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only  Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器1102是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本发明实施例中的存储器1102还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。As a non-volatile computer-readable storage medium, the memory 1102 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory 1102 may include at least one type of storage medium, for example, it may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc. The memory 1102 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 1102 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
基于相同的技术构思,本发明实施例提供了一种后端设备,如图7所示,包括至少一个处理器1201,以及与至少一个处理器连接的存储器1202,本发明实施例中不限定处理器1201与存储器1202之间的具体连接介质,图7中处理器1201和存储器1202之间通过总线连接为例。总线可以分为地址总线、数据总线、控制总线等。Based on the same technical concept, an embodiment of the present invention provides a back-end device. As shown in FIG. 7, it includes at least one processor 1201 and a memory 1202 connected to the at least one processor. The embodiment of the present invention does not limit the processing. For the specific connection medium between the processor 1201 and the memory 1202, the connection between the processor 1201 and the memory 1202 in FIG. 7 is taken as an example. The bus can be divided into address bus, data bus, control bus, etc.
在本发明实施例中,存储器1202存储有可被至少一个处理器1201执行的指令,至少一个处理器1201通过执行存储器1202存储的指令,可以执行前述的基于区块链系统的交易处理方法中所包括的步骤。In the embodiment of the present invention, the memory 1202 stores instructions that can be executed by at least one processor 1201. By executing the instructions stored in the memory 1202, the at least one processor 1201 can execute the aforementioned transaction processing methods based on the blockchain system. Steps included.
其中,处理器1201是后端设备的控制中心,可以利用各种接口和线路连接后端设备的各个部分,通过运行或执行存储在存储器1202内的指令以及调用存储在存储器1202内的数据,从而实现数据处理。可选的,处理器1201可包括一个或多个处理单元,处理器1201可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、应用程序等,调制解调处理器主要对接收到的指令进行解析以及对接收到的结果进行解析。可以理解的是,上述调制解调处理器也可以不集成到处理器1201中。在一些实施例中,处理器1201和存储器1202可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。Among them, the processor 1201 is the control center of the back-end equipment, which can use various interfaces and lines to connect to various parts of the back-end equipment, and by running or executing instructions stored in the memory 1202 and calling data stored in the memory 1202, Realize data processing. Optionally, the processor 1201 may include one or more processing units, and the processor 1201 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, application programs, etc., and the modem processor Mainly analyze the received instructions and analyze the received results. It can be understood that the foregoing modem processor may not be integrated into the processor 1201. In some embodiments, the processor 1201 and the memory 1202 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
处理器1201可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本发明实施例中公开的各方法、步骤及逻辑框图。 通用处理器可以是微处理器或者任何常规的处理器等。结合基于区块链系统的交易处理方法的实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 1201 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiment of the transaction processing method based on the blockchain system can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
存储器1202作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器1202可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器1202是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本发明实施例中的存储器1202还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。The memory 1202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory 1202 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc. The memory 1202 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 1202 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.

Claims (26)

  1. 一种基于区块链系统的交易处理方法,其特征在于,所述方法包括:A transaction processing method based on a blockchain system, characterized in that the method includes:
    区块链系统中的第一节点接收客户端设备发送的交易请求,所述交易请求包括第一交易的标识和冲突处理指令;所述冲突处理指令包括所述第一交易与历史交易存在冲突时对所述第一交易的处理方式,和/或,所述第一交易与历史交易不存在冲突时对所述第一交易的处理方式;The first node in the blockchain system receives the transaction request sent by the client device, the transaction request includes the identification of the first transaction and the conflict processing instruction; the conflict processing instruction includes when the first transaction conflicts with the historical transaction The processing method for the first transaction, and/or the processing method for the first transaction when there is no conflict between the first transaction and the historical transaction;
    所述第一节点根据所述第一交易的标识,确定所述第一交易的冲突结果,所述第一交易的冲突结果用于指示所述第一交易与历史交易是否存在冲突;The first node determines the conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and the historical transaction;
    所述第一节点根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理。The first node processes the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
  2. 根据权利要求1所述的方法,其特征在于,所述交易请求还包括第一交易的合约地址;所述第一节点根据所述第一交易的标识,确定所述第一交易的冲突结果,包括:The method according to claim 1, wherein the transaction request further includes the contract address of the first transaction; the first node determines the conflict result of the first transaction according to the identifier of the first transaction, include:
    所述第一节点根据所述第一交易的标识与所述第一交易的合约地址,确定所述第一交易的键值;The first node determines the key value of the first transaction according to the identifier of the first transaction and the contract address of the first transaction;
    所述第一节点从第一预设数据库中获取目标历史交易的标识,并将所述目标历史交易的标识存储到预设内存空间;所述第一预设数据库包括多个历史交易的标识和所述多个历史交易的键值,所述目标历史交易为所述第一预设数据库中键值与所述第一交易的键值匹配的历史交易;The first node obtains an identifier of a target historical transaction from a first preset database, and stores the identifier of the target historical transaction in a preset memory space; the first preset database includes a plurality of historical transaction identifiers and Key values of the multiple historical transactions, the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database;
    所述第一节点若确定所述预设内存空间中存在与所述第一交易的标识匹配的目标历史交易,则确定所述第一交易与历史交易存在冲突。If the first node determines that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, it determines that there is a conflict between the first transaction and the historical transaction.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method of claim 2, wherein the method further comprises:
    所述第一节点若确定预设内存空间中不存在与所述第一交易的标识匹配的目标历史交易,则将所述第一交易的标识输入到第一预设过滤模型;所述第一预设过滤模型为使用所述多个历史交易的交易信息训练得到的,每个历史交易的交易信息包括所述每个历史交易的标识、键值、交易数据、冲突处 理指令和冲突次数;If the first node determines that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, input the identifier of the first transaction into the first preset filtering model; The preset filtering model is obtained by training using the transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identifier, key value, transaction data, conflict processing instruction and the number of conflicts of each historical transaction;
    若所述第一预设过滤模型的输出结果为所述第一交易与历史交易不存在冲突,则所述第一节点确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that the first transaction does not conflict with the historical transaction, the first node determines that the first transaction does not conflict with the historical transaction.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method according to claim 3, wherein the method further comprises:
    若所述第一预设过滤模型的输出结果为所述第一交易与历史交易存在冲突,则所述第一节点将所述第一交易的标识与所述第一预设数据库中的多个历史交易的标识进行对比,若确定所述第一预设数据库中存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易存在冲突;若确定所述第一预设数据库中不存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that there is a conflict between the first transaction and the historical transaction, the first node compares the identifier of the first transaction with a plurality of items in the first preset database The identifiers of historical transactions are compared, and if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction conflicts with the historical transaction; If there is no historical transaction matching the identifier of the first transaction in the preset database, it is determined that there is no conflict between the first transaction and the historical transaction.
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述第一交易与历史交易不存在冲突时的冲突处理指令包括执行所述第一交易;所述第一交易与历史交易存在冲突时的冲突处理指令包括以下任意一项:拒绝执行所述第一交易、执行所述第一交易、将所述第一交易重定向到容错合约;The method according to any one of claims 1 to 4, wherein the conflict processing instruction when there is no conflict between the first transaction and the historical transaction comprises executing the first transaction; the first transaction and the historical transaction The conflict handling instruction when there is a conflict in the transaction includes any one of the following: refusing to execute the first transaction, executing the first transaction, and redirecting the first transaction to a fault-tolerant contract;
    所述第一节点根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理,包括:The first node to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction includes:
    若所述第一交易与历史交易不存在冲突,且所述冲突处理指令为所述第一交易与历史交易不存在冲突时执行所述第一交易,或者,若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时执行所述第一交易,则所述第一节点执行所述第一交易;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约,则所述第一节点执行所述第一交易,并获取所述冲突处理指令中包括的容错合约的地址,向所述客户端设备发送所述容错合约的地址;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时拒绝执行所述第一交易,则所述第一节点向所述客户端设备发送冲突指示值,所述冲突指示值用于指示所述第一交易与所述历史交易存在冲突。If there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is to execute the first transaction when there is no conflict between the first transaction and the historical transaction, or if the first transaction and the historical transaction If there is a conflict, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, the first node executes the first transaction; if the first transaction and the historical transaction are If there is a conflict, and the conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a conflict between the first transaction and the historical transaction, the first node executes the first transaction and obtains the The address of the fault-tolerant contract included in the conflict processing instruction sends the address of the fault-tolerant contract to the client device; if there is a conflict between the first transaction and the historical transaction, and the conflict processing instruction is the first transaction and When there is a conflict in the historical transaction and refuse to execute the first transaction, the first node sends a conflict indicator value to the client device, and the conflict indicator value is used to indicate that the first transaction conflicts with the historical transaction .
  6. 根据权利要求5所述的方法,其特征在于,所述第一节点执行所述第一交易,包括:The method according to claim 5, wherein the execution of the first transaction by the first node comprises:
    所述第一节点若确定所述区块链系统中对所述第一交易达成共识的节点的数量大于或等于预设阈值,则生成所述第一交易对应的区块信息;If the first node determines that the number of nodes that have reached a consensus on the first transaction in the blockchain system is greater than or equal to a preset threshold, generate block information corresponding to the first transaction;
    所述第一节点根据所述第一交易的区块信息更新所述第一预设数据库和/或所述预设内存空间。The first node updates the first preset database and/or the preset memory space according to the block information of the first transaction.
  7. 根据权利要求6所述的方法,其特征在于,所述第一节点生成所述第一交易对应的区块信息之后,还包括:The method according to claim 6, wherein after the first node generates the block information corresponding to the first transaction, the method further comprises:
    所述第一节点向所述客户端设备发送所述第一交易对应的区块信息,所述第一交易对应的区块信息用于所述客户端设备对所述第一交易进行修正。The first node sends the block information corresponding to the first transaction to the client device, and the block information corresponding to the first transaction is used by the client device to correct the first transaction.
  8. 根据权利要求6或7所述的方法,其特征在于,所述第一预设数据库中存储有第一校验值,所述第一校验值为所述第一节点使用预设校验算法对所述第一预设数据库中存储的所述多个历史交易进行校验得到的;The method according to claim 6 or 7, wherein a first check value is stored in the first preset database, and the first check value is that the first node uses a preset check algorithm Obtained by verifying the multiple historical transactions stored in the first preset database;
    所述第一节点生成所述第一交易对应的区块信息,包括:The generation of block information corresponding to the first transaction by the first node includes:
    所述第一节点生成所述第一交易对应的初始区块信息;Generating the initial block information corresponding to the first transaction by the first node;
    所述第一节点使用所述预设校验算法对所述第一校验值和所述第一交易进行校验,得到第二校验值;The first node uses the preset check algorithm to check the first check value and the first transaction to obtain a second check value;
    所述第一节点将所述第二校验值添加到所述初始区块信息中,得到所述第一交易对应的区块信息。The first node adds the second check value to the initial block information to obtain block information corresponding to the first transaction.
  9. 根据权利要求8所述的方法,其特征在于,所述第一节点根据所述第一交易的交易信息更新所述第一预设数据库和/或所述预设内存空间,包括:The method according to claim 8, wherein the first node updating the first preset database and/or the preset memory space according to transaction information of the first transaction comprises:
    所述第一节点使用所述第一交易的标识训练所述第一预设过滤模型,得到第二预设过滤模型,并将预设内存空间和/或所述第一预设数据库中的所述第一预设过滤模型更新为所述第二预设过滤模型;The first node uses the identifier of the first transaction to train the first preset filtering model to obtain a second preset filtering model, and to set the preset memory space and/or all the data in the first preset database The first preset filtering model is updated to the second preset filtering model;
    所述第一节点将所述第一交易添加到所述第一预设数据库中,并使用所述第二校验值更新所述预设内存空间和/或所述第一预设数据库中的所述第一校验值。The first node adds the first transaction to the first preset database, and uses the second check value to update the preset memory space and/or the first preset database The first check value.
  10. 一种基于区块链系统的交易处理方法,其特征在于,所述方法包括:A transaction processing method based on a blockchain system, characterized in that the method includes:
    客户端设备配置第一交易的标识和冲突处理指令;The client device configures the identification of the first transaction and the conflict processing instruction;
    所述客户端设备向区块链系统中的第一节点发送交易请求,所述交易请求包括所述第一交易的标识和所述冲突处理指令;Sending, by the client device, a transaction request to a first node in a blockchain system, the transaction request including the identifier of the first transaction and the conflict processing instruction;
    所述客户端设备接收所述第一节点发送的容错合约的地址,并根据所述容错合约的地址调用容错处理模块对所述第一交易进行修正。The client device receives the address of the fault-tolerant contract sent by the first node, and calls the fault-tolerant processing module according to the address of the fault-tolerant contract to correct the first transaction.
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:The method according to claim 10, wherein the method further comprises:
    所述客户端设备接收所述第一节点发送的所述第一交易对应的区块信息;Receiving, by the client device, block information corresponding to the first transaction sent by the first node;
    所述客户端设备解析所述第一交易对应的区块信息,获取所述第一交易的标识;The client device parses the block information corresponding to the first transaction to obtain the identifier of the first transaction;
    所述客户端设备若确定所述客户端设备的第二预设数据库中存在标识与所述第一交易的标识匹配的历史交易,则使用所述容错处理模块按照预设处理规则对所述第一交易进行修正;所述第二预设数据库中存储有所述客户端设备处理的多个历史交易。If the client device determines that there is a historical transaction whose identifier matches the identifier of the first transaction in the second preset database of the client device, it uses the fault-tolerant processing module to perform processing on the first transaction according to preset processing rules. A transaction is corrected; the second preset database stores multiple historical transactions processed by the client device.
  12. 根据权利要求11所述的方法,其特征在于,所述预设处理规则包括输出日志记录、输出第二预设数据库的交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。The method according to claim 11, wherein the preset processing rules include any one or any of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions. Multiple.
  13. 一种基于区块链系统的交易处理装置,其特征在于,所述装置包括:A transaction processing device based on a blockchain system, characterized in that the device includes:
    收发模块,用于接收客户端设备发送的交易请求,所述交易请求包括第一交易的标识和冲突处理指令;所述冲突处理指令包括所述第一交易与历史交易存在冲突时对所述第一交易的处理方式,和/或,所述第一交易与历史交易不存在冲突时对所述第一交易的处理方式;The transceiver module is configured to receive a transaction request sent by a client device, the transaction request including the identification of the first transaction and a conflict processing instruction; the conflict processing instruction includes a conflict between the first transaction and the historical transaction, the first transaction A transaction processing method, and/or the processing method of the first transaction when there is no conflict between the first transaction and the historical transaction;
    冲突检测模块,用于根据所述第一交易的标识,确定所述第一交易的冲突结果,所述第一交易的冲突结果用于指示所述第一交易与历史交易是否存在冲突;A conflict detection module, configured to determine a conflict result of the first transaction according to the identifier of the first transaction, and the conflict result of the first transaction is used to indicate whether there is a conflict between the first transaction and a historical transaction;
    处理模块,用于根据所述第一交易的冲突结果和所述冲突处理指令,对所述第一交易进行处理。The processing module is configured to process the first transaction according to the conflict result of the first transaction and the conflict processing instruction.
  14. 根据权利要求13所述的装置,其特征在于,所述交易请求还包括第一交易的合约地址;所述冲突检测模块用于:The device according to claim 13, wherein the transaction request further includes the contract address of the first transaction; the conflict detection module is configured to:
    根据所述第一交易的标识与所述第一交易的合约地址,确定所述第一交易的键值;Determine the key value of the first transaction according to the identifier of the first transaction and the contract address of the first transaction;
    从第一预设数据库中获取目标历史交易的标识,并将所述目标历史交易的标识存储到预设内存空间;所述第一预设数据库包括多个历史交易的标识和所述多个历史交易的键值,所述目标历史交易为所述第一预设数据库中键值与所述第一交易的键值匹配的历史交易;Obtain the identifier of the target historical transaction from the first preset database, and store the identifier of the target historical transaction in a preset memory space; the first preset database includes the identifiers of multiple historical transactions and the multiple histories A key value of the transaction, where the target historical transaction is a historical transaction whose key value matches the key value of the first transaction in the first preset database;
    若确定所述预设内存空间中存在与所述第一交易的标识匹配的目标历史交易,则确定所述第一交易与历史交易存在冲突。If it is determined that there is a target historical transaction matching the identifier of the first transaction in the preset memory space, it is determined that the first transaction conflicts with the historical transaction.
  15. 根据权利要求13所述的装置,其特征在于,所述冲突检测模块还用于:The device according to claim 13, wherein the conflict detection module is further configured to:
    若确定预设内存空间中不存在与所述第一交易的标识匹配的目标历史交易,则将所述第一交易的标识输入到第一预设过滤模型;所述第一预设过滤模型为使用所述多个历史交易的交易信息训练得到的,每个历史交易的交易信息包括所述每个历史交易的标识、键值、交易数据、冲突处理指令和冲突次数;If it is determined that there is no target historical transaction matching the identifier of the first transaction in the preset memory space, then the identifier of the first transaction is input into a first preset filtering model; the first preset filtering model is It is obtained by training using the transaction information of the multiple historical transactions, and the transaction information of each historical transaction includes the identification, key value, transaction data, conflict processing instruction and the number of conflicts of each historical transaction;
    若所述第一预设过滤模型的输出结果为所述第一交易与历史交易不存在冲突,则确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that there is no conflict between the first transaction and the historical transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
  16. 根据权利要求15所述的装置,其特征在于,所述冲突检测模块还用于:The device according to claim 15, wherein the conflict detection module is further configured to:
    若所述第一预设过滤模型的输出结果为所述第一交易与历史交易存在冲突,则将所述第一交易的标识与所述第一预设数据库中的多个历史交易的标识进行对比,若确定所述第一预设数据库中存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易存在冲突;若确定所述第一预设数据库中不存在与所述第一交易的标识匹配的历史交易,则确定所述第一交易与历史交易不存在冲突。If the output result of the first preset filtering model is that there is a conflict between the first transaction and the historical transaction, the identification of the first transaction is performed with the identification of multiple historical transactions in the first preset database In contrast, if it is determined that there is a historical transaction matching the identifier of the first transaction in the first preset database, it is determined that the first transaction conflicts with the historical transaction; if it is determined that there is no historical transaction in the first preset database If there is a historical transaction matching the identifier of the first transaction, it is determined that there is no conflict between the first transaction and the historical transaction.
  17. 根据权利要求13至16中任一项所述的装置,其特征在于,所述第一交易与历史交易不存在冲突时的冲突处理指令包括执行所述第一交易;所述第一交易与历史交易存在冲突时的冲突处理指令包括以下任意一项:拒绝执行所述第一交易、执行所述第一交易、将所述第一交易重定向到容错合约;The device according to any one of claims 13 to 16, wherein the conflict processing instruction when the first transaction does not conflict with the historical transaction comprises executing the first transaction; the first transaction and the historical transaction The conflict handling instruction when there is a conflict in the transaction includes any one of the following: refusing to execute the first transaction, executing the first transaction, and redirecting the first transaction to a fault-tolerant contract;
    所述处理模块用于:The processing module is used for:
    若所述第一交易与历史交易不存在冲突,且所述冲突处理指令为所述第一交易与历史交易不存在冲突时执行所述第一交易,或者,若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时执行所述第一交易,则执行所述第一交易;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时将所述第一交易重定向到容错合约,则执行所述第一交易,并获取所述冲突处理指令中包括的容错合约的地址,向所述客户端设备发送所述容错合约的地址;若所述第一交易与历史交易存在冲突,且所述冲突处理指令为所述第一交易与历史交易存在冲突时拒绝执行所述第一交易,则向所述客户端设备发送冲突指示值,所述冲突指示值用于指示所述第一交易与所述历史交易存在冲突。If there is no conflict between the first transaction and the historical transaction, and the conflict processing instruction is to execute the first transaction when there is no conflict between the first transaction and the historical transaction, or if the first transaction and the historical transaction There is a conflict, and the conflict processing instruction is to execute the first transaction when there is a conflict between the first transaction and the historical transaction, then the first transaction is executed; if the first transaction conflicts with the historical transaction, and all The conflict processing instruction is to redirect the first transaction to a fault-tolerant contract when there is a conflict between the first transaction and the historical transaction, then execute the first transaction, and obtain the address of the fault-tolerant contract included in the conflict processing instruction , Sending the address of the fault-tolerant contract to the client device; if the first transaction conflicts with the historical transaction, and the conflict processing instruction is that the first transaction conflicts with the historical transaction, the first transaction is rejected A transaction, a conflict indicator value is sent to the client device, and the conflict indicator value is used to indicate that the first transaction conflicts with the historical transaction.
  18. 根据权利要求17所述的装置,其特征在于,所述处理模块用于:The device according to claim 17, wherein the processing module is configured to:
    若确定所述区块链系统中对所述第一交易达成共识的节点的数量大于或等于预设阈值,则生成所述第一交易对应的区块信息;If it is determined that the number of nodes that reach a consensus on the first transaction in the blockchain system is greater than or equal to a preset threshold, generating block information corresponding to the first transaction;
    根据所述第一交易的区块信息更新所述第一预设数据库和/或所述预设内存空间。Update the first preset database and/or the preset memory space according to the block information of the first transaction.
  19. 根据权利要求18所述的装置,其特征在于,所述处理模块生成所述第一交易对应的区块信息之后,还用于:The device according to claim 18, wherein after the processing module generates the block information corresponding to the first transaction, it is further used for:
    向所述客户端设备发送所述第一交易对应的区块信息,所述第一交易对应的区块信息用于所述客户端设备对所述第一交易进行修正。Sending the block information corresponding to the first transaction to the client device, where the block information corresponding to the first transaction is used by the client device to correct the first transaction.
  20. 根据权利要求18或19所述的装置,其特征在于,所述第一预设数据库中存储有第一校验值,所述第一校验值为所述第一节点使用预设校验算法 对所述第一预设数据库中存储的所述多个历史交易进行校验得到的;The device according to claim 18 or 19, wherein a first check value is stored in the first preset database, and the first check value is that the first node uses a preset check algorithm Obtained by verifying the multiple historical transactions stored in the first preset database;
    所述处理模块具体用于:The processing module is specifically used for:
    生成所述第一交易对应的初始区块信息;Generating initial block information corresponding to the first transaction;
    使用所述预设校验算法对所述第一校验值和所述第一交易进行校验,得到第二校验值;Verifying the first verification value and the first transaction using the preset verification algorithm to obtain a second verification value;
    将所述第二校验值添加到所述初始区块信息中,得到所述第一交易对应的区块信息。The second check value is added to the initial block information to obtain block information corresponding to the first transaction.
  21. 根据权利要求20所述的装置,其特征在于,所述处理模块用于:The device according to claim 20, wherein the processing module is configured to:
    使用所述第一交易的标识训练所述第一预设过滤模型,得到第二预设过滤模型,并将预设内存空间和/或所述第一预设数据库中的所述第一预设过滤模型更新为所述第二预设过滤模型;Use the identifier of the first transaction to train the first preset filter model to obtain a second preset filter model, and use the preset memory space and/or the first preset in the first preset database The filtering model is updated to the second preset filtering model;
    将所述第一交易添加到所述第一预设数据库中,并使用所述第二校验值更新所述预设内存空间和/或所述第一预设数据库中的所述第一校验值。Add the first transaction to the first preset database, and use the second check value to update the preset memory space and/or the first calibration in the first preset database Value.
  22. 一种基于区块链系统的交易处理装置,其特征在于,所述装置包括:A transaction processing device based on a blockchain system, characterized in that the device includes:
    配置模块,用于配置第一交易的标识和冲突处理指令;The configuration module is used to configure the identification of the first transaction and conflict handling instructions;
    收发模块,用于向区块链系统中的第一节点发送交易请求,所述交易请求包括所述第一交易的标识和所述冲突处理指令;以及,接收所述第一节点发送的容错合约的地址;The transceiver module is configured to send a transaction request to the first node in the blockchain system, the transaction request including the identifier of the first transaction and the conflict processing instruction; and to receive the fault-tolerant contract sent by the first node the address of;
    修正模块,用于根据所述容错合约的地址调用容错处理模块对所述第一交易进行修正。The correction module is used to call the fault-tolerant processing module to correct the first transaction according to the address of the fault-tolerant contract.
  23. 根据权利要求22所述的装置,其特征在于,The device of claim 22, wherein:
    所述收发模块还用于:接收所述第一节点发送的所述第一交易对应的区块信息;The transceiver module is further configured to: receive block information corresponding to the first transaction sent by the first node;
    所述修正模块还用于:解析所述第一交易对应的区块信息,获取所述第一交易的标识;若确定所述客户端设备的第二预设数据库中存在标识与所述第一交易的标识匹配的历史交易,则使用所述容错处理模块按照预设处理规则对所述第一交易进行修正;所述第二预设数据库中存储有所述客户端设备 处理的多个历史交易。The correction module is further configured to: parse the block information corresponding to the first transaction to obtain the identifier of the first transaction; if it is determined that the identifier and the first transaction exist in the second preset database of the client device For historical transactions that match the transaction identifier, use the fault-tolerant processing module to correct the first transaction in accordance with preset processing rules; the second preset database stores multiple historical transactions processed by the client device .
  24. 根据权利要求23所述的装置,其特征在于,所述预设处理规则包括输出日志记录、输出第二预设数据库的交易记录、无效交易、撤销交易、冻结后续交易中的任意一项或任意多项。The device according to claim 23, wherein the preset processing rules include any one or any of output log records, output transaction records of the second preset database, invalid transactions, cancel transactions, and freeze subsequent transactions. Multiple.
  25. 一种计算机可读存储介质,其特征在于,包括指令,当其在计算机的处理器上运行时,使得计算机的处理器执行如权利要求1至12任一项所述的方法。A computer-readable storage medium, characterized by comprising instructions, which when run on a processor of a computer, causes the processor of the computer to execute the method according to any one of claims 1 to 12.
  26. 一种计算机程序产品,其特征在于,当其在计算机的处理器上运行时,使得计算机的处理器执行如权利要求1至12任一项所述的方法。A computer program product, characterized in that, when it runs on a processor of a computer, it causes the processor of the computer to execute the method according to any one of claims 1 to 12.
PCT/CN2020/080520 2019-04-28 2020-03-20 Blockchain system-based transaction processing method and apparatus WO2020220860A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910350093.3 2019-04-28
CN201910350093.3A CN110070445B (en) 2019-04-28 2019-04-28 Transaction processing method and device based on blockchain system

Publications (1)

Publication Number Publication Date
WO2020220860A1 true WO2020220860A1 (en) 2020-11-05

Family

ID=67369298

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080520 WO2020220860A1 (en) 2019-04-28 2020-03-20 Blockchain system-based transaction processing method and apparatus

Country Status (2)

Country Link
CN (1) CN110070445B (en)
WO (1) WO2020220860A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338455A (en) * 2022-03-16 2022-04-12 北京微芯感知科技有限公司 Multi-mechanism distributed collision detection system and method

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110070445B (en) * 2019-04-28 2024-03-01 深圳前海微众银行股份有限公司 Transaction processing method and device based on blockchain system
CN110602051B (en) * 2019-08-15 2022-03-29 深圳壹账通智能科技有限公司 Information processing method based on consensus protocol and related device
CN110489234A (en) * 2019-08-16 2019-11-22 中国银行股份有限公司 Message processing method, device, equipment and the readable storage medium storing program for executing of block link layer
CN112258184B (en) * 2020-10-28 2023-08-01 成都质数斯达克科技有限公司 Method, apparatus, electronic device and readable storage medium for freezing blockchain network
CN113051622B (en) * 2021-03-11 2023-05-12 杭州趣链科技有限公司 Index construction method, device, equipment and storage medium
CN114900311A (en) * 2022-04-06 2022-08-12 平安国际智慧城市科技股份有限公司 Monitoring data management method, device, equipment and storage medium
CN115309515B (en) * 2022-10-10 2023-01-31 北京理工大学 Cross-chain transaction processing method, device and equipment based on block chain
CN115796874B (en) * 2023-01-09 2023-05-09 杭州安节科技有限公司 Concurrent execution method for blockchain transaction at operation level

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195293A1 (en) * 2001-01-29 2014-07-10 International Business Machines Corporation Workflow system and method with skip function
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN109598504A (en) * 2018-10-25 2019-04-09 阿里巴巴集团控股有限公司 Transaction processing method and device, electronic equipment based on block chain
CN110070445A (en) * 2019-04-28 2019-07-30 深圳前海微众银行股份有限公司 A kind of transaction processing method and device based on block catenary system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106797389A (en) * 2016-11-18 2017-05-31 深圳前海达闼云端智能科技有限公司 Block chain network, article trading method, device and node device
CN107704269A (en) * 2017-10-16 2018-02-16 中国银行股份有限公司 A kind of method and system based on block chain generation block
CN108711085A (en) * 2018-05-09 2018-10-26 平安普惠企业管理有限公司 A kind of response method and its equipment of transaction request
CN108846753B (en) * 2018-06-06 2021-11-09 北京京东尚科信息技术有限公司 Method and apparatus for processing data
CN108694657B (en) * 2018-07-13 2023-04-18 平安科技(深圳)有限公司 Client identification apparatus, method and computer-readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195293A1 (en) * 2001-01-29 2014-07-10 International Business Machines Corporation Workflow system and method with skip function
CN109598504A (en) * 2018-10-25 2019-04-09 阿里巴巴集团控股有限公司 Transaction processing method and device, electronic equipment based on block chain
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN110070445A (en) * 2019-04-28 2019-07-30 深圳前海微众银行股份有限公司 A kind of transaction processing method and device based on block catenary system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338455A (en) * 2022-03-16 2022-04-12 北京微芯感知科技有限公司 Multi-mechanism distributed collision detection system and method
CN114338455B (en) * 2022-03-16 2022-06-17 北京微芯感知科技有限公司 Multi-mechanism distributed collision detection system and method

Also Published As

Publication number Publication date
CN110070445A (en) 2019-07-30
CN110070445B (en) 2024-03-01

Similar Documents

Publication Publication Date Title
WO2020220860A1 (en) Blockchain system-based transaction processing method and apparatus
CN113329031B (en) Method and device for generating state tree of block
WO2021032138A1 (en) Consensus method and device based on blockchain system, and system
CN110288479B (en) Method and related equipment for consensus of block chain data
CN107038182B (en) Method and device for checking completeness of sub-table data
CN109391645B (en) Block chain lightweight processing method, block chain node and storage medium
CN111382164B (en) Service processing method based on block chain network
CN107147724A (en) A kind of information push method, server and computer-readable recording medium
CN110235162B (en) Block chain system data processing method and block generation method
CN110570311B (en) Block chain consensus method, device and equipment
WO2022121612A1 (en) Information processing method and apparatus for blockchain network, and device and storage medium
CN112597153A (en) Data storage method and device based on block chain and storage medium
WO2023040453A1 (en) Transaction information processing method and apparatus
CN112671908A (en) Network management method and device, electronic equipment and readable storage medium
CN115988001A (en) Consensus voting processing method, device, equipment and medium for block chain system
CN107040509B (en) message sending method and device
CN106254373B (en) Digital certificate synchronization method, digital signature server and digital certificate synchronization system
WO2012088761A1 (en) Data analysis-based security information exchange monitoring system and method
CN111737351A (en) Transaction management method and device for distributed management system
CN113364806B (en) Service interface migration verification method and device
CN112671825B (en) Kafka message processing method and system
CN112488836B (en) Transaction transmitting method, device, electronic equipment and readable storage medium
CN112637267B (en) Service processing method, device, electronic equipment and readable storage medium
CN110096555B (en) Table matching processing method and device for distributed system
US20230185969A1 (en) Consensus method for a distributed database

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

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 24/02/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20798325

Country of ref document: EP

Kind code of ref document: A1