Transaction processing method and device, computer equipment and storage medium

By extracting and cacheing transaction parameters to the contract execution program when the blockchain node program receives a transaction request, and only transmitting parameter identification when the execution conditions are met, the problem of low execution efficiency of smart contracts is solved and a more efficient network transmission and execution process is achieved.

CN119885248APending Publication Date: 2025-04-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311373756.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-23
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, smart contract execution efficiency is low, mainly because the blockchain node program needs to directly send transaction parameters to the contract execution program for processing, resulting in an increase in network transmission time.

Method used

After the blockchain node program receives the transaction request, it extracts the transaction parameters from the transaction request and sends them to the contract execution program for cache. When determining that the transaction request meets the execution conditions, the blockchain node program maps the transaction parameters as parameter identifiers and sends the identifier to the contract execution program to instruct it to execute the corresponding smart contract.

Benefits of technology

By cache transaction parameters to the contract execution program in advance and transmitting parameter identifiers only when necessary, the duration of network transmission is significantly reduced and the execution efficiency of smart contracts is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885248A_ABST
    Figure CN119885248A_ABST
Patent Text Reader

Abstract

The invention relates to a transaction processing method and device, computer equipment, a storage medium and a computer program product. The embodiment of the invention can be applied to various scenes such as cloud technology, artificial intelligence, intelligent traffic, auxiliary driving and the like. The method comprises the following steps: after a block chain node program receives a transaction request, extracting transaction parameters from the transaction request, and sending the transaction parameters to a contract execution program isolated from the block chain node program; when the blockchain node program determines that the transaction request satisfies an execution condition, mapping the transaction parameter to a second parameter identifier, generating a contract execution request based on the second parameter identifier, and sending the contract execution request to a contract execution program to instruct the contract execution program to analyze the contract execution request to obtain the second parameter identifier, and based on the second parameter identifier, extracting a transaction parameter from the cache, and executing the smart contract based on the transaction parameter to obtain an execution result corresponding to the transaction request. And the intelligent contract execution efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a transaction processing method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] The blockchain network includes multiple blockchain nodes. Each blockchain node corresponds to a blockchain node program and a contract execution program. The contract execution program usually runs on a blockchain virtual machine. The blockchain virtual machine is divided into built-in and external types. The external blockchain virtual machine and the blockchain node program communicate through the network.

[0003] In traditional technology, when the blockchain node program determines that the transaction request meets the execution conditions, it sends the transaction parameters carried by the transaction request to the contract execution program, so that the contract execution program uses the transaction parameters as input parameters, executes the corresponding smart contract, and generates the execution result corresponding to the transaction request. However, this method has low efficiency in smart contract execution. Summary of the invention

[0004] Based on this, it is necessary to provide a transaction processing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the efficiency of smart contract execution in response to the above-mentioned technical problems.

[0005] In a first aspect, the present application provides a transaction processing method. The method comprises:

[0006] After the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, and the transaction parameters are sent to a contract execution program that is isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program;

[0007] When the blockchain node program determines that the transaction request meets the execution conditions, the transaction parameters are mapped to the second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program to instruct the contract execution program to parse the contract execution request and obtain the second parameter identifier. The second parameter identifier is compared with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameters are extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request.

[0008] In a second aspect, the present application provides a transaction processing method. The method comprises:

[0009] Receiving transaction parameters sent by a blockchain node program that is isolated from the contract execution program, where the transaction parameters are extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request;

[0010] Map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program;

[0011] Receiving a contract execution request sent by a blockchain node program, where the contract execution request is generated based on the second parameter identifier by mapping the transaction parameter to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution condition;

[0012] The contract execution request is parsed to obtain a second parameter identifier, and the second parameter identifier is compared with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameters are extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request.

[0013] In a third aspect, the present application also provides a transaction processing device. The device includes:

[0014] A pre-sending module is used to extract transaction parameters from the transaction request after the blockchain node program receives the transaction request, and send the transaction parameters to a contract execution program isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program;

[0015] The execution module is used to map the transaction parameters to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution conditions, generate a contract execution request based on the second parameter identifier, and send the contract execution request to the contract execution program to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and extract the transaction parameters from the cache when the comparison is successful, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

[0016] In a fourth aspect, the present application also provides a transaction processing device. The device includes:

[0017] A receiving module, used to receive transaction parameters sent by a blockchain node program that is isolated from the contract execution program, where the transaction parameters are extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request;

[0018] A mapping module, used to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program;

[0019] The receiving module is also used to receive a contract execution request sent by the blockchain node program, where the contract execution request is generated based on the second parameter identifier by mapping the transaction parameter to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution condition;

[0020] The execution module is used to parse the contract execution request, obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

[0021] In a fifth aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the transaction processing method provided in the first aspect or the second aspect is implemented.

[0022] In a sixth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the transaction processing method provided in the first aspect or the second aspect is implemented.

[0023] In a seventh aspect, the present application further provides a computer program product, including a computer program, which implements the transaction processing method provided in the first aspect or the second aspect when executed by a processor.

[0024] The above-mentioned transaction processing method, device, computer equipment, storage medium and computer program product, after the blockchain node program receives the transaction request, extracts the transaction parameters from the transaction request, and sends the transaction parameters to the contract execution program isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program; when the blockchain node program determines that the transaction request meets the execution conditions, the transaction parameters are mapped to the second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program, so as to instruct the contract execution program to parse the contract execution request, obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request. The blockchain node program and the contract execution program are isolated from each other and communicate through the network. After receiving the transaction request, the above method directly sends the transaction parameters to the contract execution program for caching. When it is determined that the transaction request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time for network transmission of transaction parameters and improves the execution efficiency of smart contracts. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 An application environment diagram of a transaction processing method in an embodiment;

[0026] Figure 2 A flowchart of a transaction processing method in one embodiment;

[0027] Figure 3 A schematic diagram of sending transaction parameters in advance in one embodiment;

[0028] Figure 4 A schematic diagram of sending transaction parameters in advance in another embodiment;

[0029] Figure 5 is a schematic diagram of an index information set in one embodiment;

[0030] Figure 6 A schematic diagram of maintaining an index information set in one embodiment;

[0031] Figure 7 A schematic diagram of pre-sending index information in one embodiment;

[0032] Figure 8 A schematic diagram of batch acquiring index information sets in one embodiment;

[0033] Fig. 9 A flowchart of a transaction processing method in another embodiment;

[0034] Fig.10 A schematic diagram of a smart contract execution process in one embodiment;

[0035] Fig.11 is a structural block diagram of a transaction processing device in one embodiment;

[0036] Fig.12 is a structural block diagram of a transaction processing device in another embodiment;

[0037] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0039] The transaction processing method provided in the embodiment of the present application can be applied to Figure 1 The blockchain network shown. Figure 1 The blockchain network shown includes 4 blockchain nodes. It can be understood that Figure 1 The number of blockchain nodes is only an example, and the number of blockchain nodes in the blockchain network can be flexibly configured according to actual needs. Each blockchain node corresponds to a blockchain node program and a contract execution program. The contract execution program usually runs on a blockchain virtual machine. The blockchain virtual machine can be embedded in the blockchain node program and share memory with the blockchain node program. This blockchain virtual machine is called a built-in virtual machine; or, the blockchain virtual machine and the blockchain node program can be deployed independently, and the blockchain virtual machine and the blockchain node program communicate through the network. This blockchain virtual machine is called an external virtual machine. For an external virtual machine, the blockchain virtual machine and the blockchain node program can be two processes on the same server, or the blockchain virtual machine and the blockchain node program can be deployed on different servers respectively. The embodiments of this application do not limit this.

[0040] For an external virtual machine, the performance of the smart contract execution process can be improved by the transaction processing method provided in the embodiment of the present application. After the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, and the transaction parameters are sent to the contract execution program isolated from the blockchain node program to instruct the contract execution program to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program; when the blockchain node program determines that the transaction request meets the execution conditions, the transaction parameters are mapped to the second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program to instruct the contract execution program to parse the contract execution request, obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request. After receiving the transaction request, the above method directly sends the transaction parameters to the contract execution program for caching. When it is determined that the transaction request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time it takes to transmit the transaction parameters over the network and improves the execution efficiency of the smart contract.

[0041] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0042] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation management. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the correspondence between the user's real identity and the blockchain address (authority management), etc., and, under authorization, supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first adapts the interface for parsing and authentication (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation management module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network management, and node equipment health status management.

[0043] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0044] The transaction request may be sent by a terminal, including but not limited to a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle terminal, an aircraft, etc. The embodiments of the present invention may be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. The above-mentioned server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0045] In some embodiments, Figure 2 As shown, a transaction processing method is provided, which is described by taking the method applied to a blockchain node program as an example, and includes the following steps:

[0046] Step 202, after the blockchain node program receives the transaction request, it extracts the transaction parameters from the transaction request and sends the transaction parameters to the contract execution program isolated from the blockchain node program to instruct the contract execution program to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program.

[0047] Among them, the object can perform a transaction operation on the terminal. In response to the transaction operation, the terminal can generate a corresponding transaction request, select a blockchain node in the blockchain network, and send the transaction request to the blockchain node program corresponding to the blockchain node.

[0048] By way of example, the transaction operation may be a resource transfer operation, a resource query operation, a virtual resource purchase operation, etc., which is not limited in the embodiments of the present application.

[0049] Among them, after receiving the transaction request, the blockchain node program first performs security verification on the transaction request. After the security verification is passed, the transaction parameters are extracted from the transaction request. If the parameter length of the transaction parameter is greater than the preset length threshold, the transaction parameter is sent to the contract execution program isolated from the blockchain node program. If the parameter length of the transaction parameter is less than or equal to the preset length threshold, then when it is determined that the transaction request meets the execution conditions, the transaction parameter is sent to the contract execution program isolated from the blockchain node program.

[0050] Among them, the blockchain node program and the contract execution program are isolated from each other, which means that the contract execution program runs on the blockchain virtual machine, and the blockchain virtual machine is an external virtual machine, that is, the blockchain node program and the blockchain virtual machine are deployed independently, and the blockchain node program and the contract execution program communicate through the network.

[0051] In the specific implementation, security verification can include basic structure verification, signature verification, permission verification, anti-duplicate verification, etc. Each transaction request carries a request identifier, which is unique in the blockchain network. After the security verification is passed, the transaction request can be placed in the transaction pool corresponding to the blockchain node program. Each blockchain node program in the blockchain network has a corresponding transaction pool.

[0052] In a specific implementation, when the parameter length of a transaction parameter is greater than a preset length threshold, the blockchain node program may first serialize the transaction parameter to obtain a parameter serialization result, and then send the serialization result to a contract execution program that is isolated from the blockchain node program.

[0053] After receiving the transaction parameters, the contract execution program can perform a hash operation on the transaction parameters and use the obtained hash value as the first parameter identifier of the transaction parameters. The contract execution program can establish a corresponding relationship between the first parameter identifier and the transaction parameters and put the transaction parameters into the cache corresponding to the contract execution program.

[0054] In a specific implementation, the contract execution program may use the first parameter identifier as the key K and the transaction parameter as the value V, form a key-value pair with the first parameter identifier and the transaction parameter, and put the key-value pair into the cache corresponding to the contract execution program.

[0055] Among them, when the contract execution program receives the parameter serialization result, the contract execution program can first deserialize the parameter serialization result to obtain the transaction parameters, and then form a key-value pair with the first parameter identifier and the transaction parameters, and put the key-value pair into the cache corresponding to the contract execution program.

[0056] For example, see Figure 3 As shown, after the blockchain node program receives the transaction request, it performs security verification on the transaction request. After the security verification passes, the transaction request is placed in the transaction pool, and the transaction parameters are extracted from the transaction request and sent to the contract execution program.

[0057] Step 204, when the blockchain node program determines that the transaction request meets the execution conditions, the transaction parameters are mapped to the second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, and compare the second parameter identifier with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameters are extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request.

[0058] Among them, the blockchain node program can determine whether the transaction request meets the execution conditions based on the rotation of the main node, the execution batch to which the transaction request belongs, and the consensus-to-be-consensus transaction data from other blockchain node programs in the blockchain network.

[0059] Among them, when the blockchain node program determines that the transaction request meets the execution conditions, it can parse the transaction request to obtain the transaction parameters and the smart contract identifier, and determine whether the parameter length of the transaction parameter is greater than the preset length threshold value. If it is greater than the preset length threshold value, the transaction parameter is hashed, and the obtained hash value is used as the second parameter identifier of the transaction parameter. Then, on the one hand, the second parameter identifier is used as the key K, the transaction parameter is used as the value V, and the second parameter identifier and the transaction parameter are composed of a key-value pair, and the key-value pair is placed in the cache corresponding to the blockchain node program; on the other hand, a contract execution request is created based on the second parameter identifier and the smart contract identifier. When the parameter length of the transaction parameter is less than or equal to the preset length threshold value, a contract execution request is directly created based on the transaction parameter and the smart contract identifier.

[0060] Exemplarily, the smart contract identifier includes the smart contract name and the smart contract version number.

[0061] Among them, after creating a contract execution request, the blockchain node program can first serialize the contract execution request to obtain a request serialization result, and send the request serialization result to a contract execution program that is isolated from the blockchain node program. After receiving the request serialization result, the contract execution program deserializes the request serialization result to obtain a contract execution request.

[0062] Among them, when the parameter length of the transaction parameter is greater than the preset length threshold, the blockchain node program creates a contract execution request based on the second parameter identifier and the smart contract identifier, and sends the contract execution request to the contract execution program. After receiving the contract execution request, the contract execution program parses the contract execution request to obtain the second parameter identifier and the smart contract identifier, and compares the second parameter identifier with the first parameter identifier in each established corresponding relationship. If the second parameter identifier is successfully compared with a first parameter identifier, the transaction parameter corresponding to the first parameter identifier is extracted from the cache corresponding to the contract execution program; based on the smart contract identifier, the smart contract to be executed is determined, and the extracted transaction parameters are used as input parameters to execute the smart contract, so as to obtain the execution result corresponding to the transaction request.

[0063] Among them, when the parameter length of the transaction parameter is less than or equal to the preset length threshold, the blockchain node program directly creates a contract execution request based on the transaction parameters and the smart contract identifier, and sends the contract execution request to the contract execution program. After the contract execution program receives the contract execution request, it parses the contract execution request and can directly obtain the transaction parameters and the smart contract identifier. At this time, the contract execution program determines the smart contract to be executed based on the smart contract identifier, and executes the smart contract with the transaction parameters as input parameters, so as to obtain the execution result corresponding to the transaction request.

[0064] It should be noted that the above-mentioned step of judging the parameter length of the transaction parameters can be deleted, that is, after the blockchain node program extracts the transaction parameters from the transaction request, regardless of whether the parameter length of the transaction parameters is greater than the preset length threshold value, the transaction parameters can be sent to the contract execution program isolated from the blockchain node program; when the blockchain node program determines that the transaction request meets the execution conditions, regardless of whether the parameter length of the transaction parameters is greater than the preset length threshold value, the transaction parameters can be mapped to the second parameter identifier and subsequent steps can be executed.

[0065] In the above embodiment, after the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, and the transaction parameters are sent to a contract execution program isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program; when the blockchain node program determines that the transaction request meets the execution conditions, the transaction parameters are mapped to a second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program, so as to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request. The blockchain node program and the contract execution program are isolated from each other and communicate through the network. After receiving the transaction request, the above method directly sends the transaction parameters to the contract execution program for caching. When it is determined that the transaction request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time for network transmission of transaction parameters and improves the execution efficiency of smart contracts.

[0066] In some embodiments, transaction parameters are extracted from a transaction request and sent to a contract execution program that is isolated from a blockchain node program, including: performing security verification on the transaction request, extracting the transaction parameters from the transaction request after the security verification is passed, and obtaining the parameter length of the transaction parameters; when the parameter length is greater than a preset length threshold, sending the transaction parameters to a contract execution program that is isolated from the blockchain node program.

[0067] The security verification of the transaction request includes basic structure verification, signature verification, authority verification and anti-duplicate verification of the transaction request. If all these verifications are passed, it is determined that the security verification is passed.

[0068] Among them, when the security verification is passed, the blockchain node program extracts the transaction parameters from the transaction request, obtains the parameter length of the transaction parameters, compares the parameter length of the transaction parameters with the preset length threshold value, and when the parameter length of the transaction parameters is greater than the preset length threshold value, sends the transaction parameters to the contract execution program isolated from the blockchain node program; when the parameter length of the transaction parameters is less than or equal to the preset length threshold value, the blockchain node program determines that the transaction request meets the execution conditions, and then sends the transaction parameters to the contract execution program isolated from the blockchain node program.

[0069] Among them, after the security verification is passed, the transaction request can be placed in the transaction pool corresponding to the blockchain node program.

[0070] In the above embodiment, after the blockchain node program receives the transaction request, it first performs security verification on the transaction request to prevent the transaction request that does not comply with the regulations from being executed, thereby improving data security. After the security verification is passed, the transaction parameters are extracted from the transaction request, and the parameter length of the transaction parameters is obtained; when the parameter length is greater than the preset length threshold, the transaction parameters are sent to the contract execution program that is isolated from the blockchain node program. In this way, when it is determined that the transaction request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program, which greatly reduces the time it takes to transmit the input parameters over the network and improves the execution efficiency of the smart contract.

[0071] In some embodiments, sending transaction parameters to a contract execution program that is isolated from a blockchain node program includes: serializing the transaction parameters to obtain a parameter serialization result, sending the serialization result to a contract execution program that is isolated from the blockchain node program to instruct the contract execution program to deserialize the parameter serialization result to obtain the transaction parameters, mapping the transaction parameters to a first parameter identifier, establishing a corresponding relationship between the first parameter identifier and the transaction parameters, placing the transaction parameters into a cache corresponding to the contract execution program, and setting a timer for the transaction parameters placed in the cache, the timer being used to time the cache time of the transaction parameters placed in the cache, and the contract execution program being used to clear the transaction parameters placed in the cache when the timing duration of the timer reaches a preset timeout duration.

[0072] Among them, after the blockchain node program extracts the transaction parameters from the transaction request, it can serialize the transaction parameters to obtain a binary message, that is, the parameter serialization result, and send the serialization result to the contract execution program isolated from the blockchain node program. The contract execution program deserializes the parameter serialization result to obtain the transaction parameters.

[0073] Among them, after the contract execution program obtains the transaction parameters, it can perform a hash operation on the transaction parameters, use the obtained hash value as the first parameter identifier of the transaction parameters, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program.

[0074] Among them, the contract execution program can set a timer for the transaction parameters placed in the cache. The timer is used to count the cache time of the transaction parameters placed in the cache. When the timing duration of the timer reaches the preset timeout duration, the contract execution program can clear the transaction parameters placed in the cache.

[0075] Exemplarily, after obtaining the first parameter identifier, the contract execution program may use the first parameter identifier as the key K and the transaction parameter as the value V, form a key-value pair with the first parameter identifier and the transaction parameter, and put the key-value pair into the cache corresponding to the contract execution program. When the timer reaches the preset timeout duration, the key-value pair is cleared from the cache.

[0076] For example, see Figure 4 As shown, after receiving the transaction request, the blockchain node program performs security verification on the transaction request. If the security verification fails, the transaction request is discarded. If the security verification passes, the transaction request is placed in the transaction pool, and the length of the transaction parameters is determined. If it is greater than the preset length threshold, the transaction parameters are serialized to obtain a binary message, i.e., the parameter serialization result, and the binary message is sent to the contract execution program. The contract execution program deserializes the binary message to obtain the transaction parameters, performs a hash operation on the transaction parameters to obtain a first parameter identifier, generates a key-value pair based on the first parameter identifier and the transaction parameters, places the key-value pair in the cache corresponding to the contract execution program, and sets a timer. When the timing duration of the timer reaches the preset timeout duration, the key-value pair placed in the cache is cleared.

[0077] In the above embodiment, after the contract execution program places the transaction parameters into the cache corresponding to the contract execution program, a timer is set for the transaction parameters placed in the cache. When the timing duration of the timer reaches the preset timeout duration, the transaction parameters placed in the cache are cleared to prevent the transaction parameters from continuously occupying the cache when the transaction request does not meet the execution conditions for a long time, thereby improving the utilization rate of the cache corresponding to the contract execution program.

[0078] In some embodiments, the transaction processing method provided by the embodiments of the present application also includes: when the blockchain node corresponding to the blockchain node program and the contract execution program is the main node, and the transaction request belongs to a request in a batch to be executed, determining that the transaction request meets the execution conditions; or, when the blockchain node program receives consensus transaction data sent by other blockchain node programs in the blockchain network, and the consensus transaction data contains the transaction request, determining that the transaction request meets the execution conditions.

[0079] The blockchain network includes multiple blockchain nodes, each of which corresponds to a blockchain node program and a contract execution program. Multiple blockchain nodes take turns to be the master node. For example, the blockchain network includes 4 blockchain nodes, namely blockchain node A, blockchain node B, blockchain node C, blockchain node D and blockchain node E, which can take turns to be the master node in the order from A to E.

[0080] Among them, when a blockchain node in the blockchain network becomes the master node, the blockchain node program corresponding to the blockchain node can extract a batch of transaction requests from the transaction pool as a batch to be executed, and for each request in the batch to be executed, create a contract execution request based on the request, and send the contract execution request to the contract execution program. The contract execution program generates an execution result corresponding to the request based on the contract execution request. After obtaining the execution results corresponding to each request in the batch to be executed, the blockchain node program can generate the transaction data to be agreed upon based on the request identifier and execution result of each request, and broadcast the transaction data to be agreed upon to other blockchain node programs in the blockchain network. Taking blockchain node program A in other blockchain node programs as an example, blockchain node program A extracts each request identifier from the transaction data to be agreed upon, extracts the corresponding transaction request from the transaction pool based on the request identifier for each extracted request identifier, creates a contract execution request based on the transaction request, and sends the contract execution request to the corresponding contract execution program. The contract execution program generates the execution result corresponding to the request based on the contract execution request, and blockchain node program A compares the execution result with the execution result corresponding to the request identifier in the transaction data to be agreed upon. If they are consistent, the transaction request corresponding to the request identifier is voted in favor of. When the proportion of votes in favor of other blockchain node programs exceeds the preset threshold, each blockchain node program in the blockchain network will upload the transaction data to be agreed upon. And according to the preset rotation order, the master node rotation notification is sent to the blockchain node program corresponding to the next blockchain node, and the next blockchain node becomes the master node.

[0081] Therefore, when the blockchain node program determines whether a transaction request meets the execution conditions, it can first determine whether the blockchain node corresponding to the blockchain node program is the main node, and whether the transaction request is in the batch to be executed. If the judgment results are both yes, it is determined that the transaction request meets the execution conditions.

[0082] When determining whether a transaction request meets the execution conditions, the blockchain node program can also determine whether the consensus-pending transaction data from other blockchain node programs in the blockchain network contains the request identifier of the transaction request. If so, it is determined that the transaction request meets the execution conditions.

[0083] Among them, after the blockchain node program receives the transaction request, it can broadcast the transaction request to other blockchain node programs in the blockchain network. After other blockchain node programs receive the transaction request, they can put the transaction request into the corresponding transaction pool.

[0084] In the above embodiment, a specific method for determining whether a transaction request meets the execution conditions is provided. Specifically, when the blockchain node corresponding to the blockchain node program and the contract execution program is the main node and the transaction request belongs to the request in the batch to be executed, it is determined that the transaction request meets the execution conditions; or, when the blockchain node program receives the transaction data to be agreed upon sent by other blockchain node programs in the blockchain network, and the transaction data to be agreed upon contains the request identifier of the transaction request, it is determined that the transaction request meets the execution conditions. When determining that the transaction request meets the execution conditions, it is only necessary to send the mapped parameter identifier to the contract execution program, which greatly reduces the time for the network to transmit the input parameters and improves the execution efficiency of the smart contract.

[0085] In some embodiments, mapping the transaction parameter to the second parameter identifier includes: determining whether the parameter length of the transaction parameter is greater than a preset length threshold; if the transaction parameter is greater than the preset length threshold, mapping the transaction parameter to the second parameter identifier.

[0086] Among them, when the blockchain node program determines that the transaction request meets the execution conditions, it can parse the transaction request to obtain the transaction parameters and the smart contract identifier, and determine whether the parameter length of the transaction parameters is greater than the preset length threshold value. If it is greater than the preset length threshold value, the transaction parameters are hashed, and the obtained hash value is used as the second parameter identifier of the transaction parameters. A contract execution request is created based on the second parameter identifier and the smart contract identifier. If the parameter length of the transaction parameters is less than or equal to the preset length threshold value, a contract execution request is directly created based on the transaction parameters and the smart contract identifier.

[0087] Among them, after obtaining the second parameter identifier of the transaction parameter, the second parameter identifier can be used as the key K, the transaction parameter can be used as the value V, the second parameter identifier and the transaction parameter can be combined into a key-value pair, and the key-value pair can be put into the cache corresponding to the blockchain node program.

[0088] In the above embodiment, the blockchain node program first determines whether the parameter length of the transaction parameter is greater than the preset length threshold value. If it is greater than the preset length threshold value, the transaction parameter is mapped to a second parameter identifier, a contract execution request is created based on the second parameter identifier and the smart contract identifier, and the contract execution request is sent to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time it takes to transmit the input parameter over the network and improves the execution efficiency of the smart contract.

[0089] In some embodiments, a contract execution request is generated based on a second parameter identifier and the contract execution request is sent to a contract execution program, including: extracting a smart contract identifier from a transaction request, creating a contract execution request based on the smart contract identifier and the second parameter identifier; serializing the contract execution request to obtain a request serialization result, and sending the request serialization result to the contract execution program to instruct the contract execution program to deserialize the request serialization result to obtain a contract execution request.

[0090] Among them, when the blockchain node program determines that the transaction request meets the execution conditions, the transaction request can be parsed to obtain transaction parameters and smart contract identifiers, the transaction parameters can be hashed, and the obtained hash value can be used as the second parameter identifier of the transaction parameters. A contract execution request is created based on the second parameter identifier and the smart contract identifier, and the contract execution request is serialized to obtain a binary message, i.e., the request serialization result, and the request serialization result is sent to the contract execution program.

[0091] Among them, after receiving the request serialization result, the contract execution program deserializes the request serialization result to obtain the contract execution request, parses the contract execution request, obtains the second parameter identifier and the smart contract identifier, and compares the second parameter identifier with the first parameter identifier in each established corresponding relationship. Then, the transaction parameters corresponding to the first parameter identifier with successful comparison are extracted from the cache corresponding to the contract execution program; based on the smart contract identifier, the smart contract to be executed is determined, and the extracted transaction parameters are used as input parameters to execute the smart contract, so as to obtain the execution result corresponding to the transaction request.

[0092] In the above embodiment, after the blockchain node program creates a contract execution request, the contract execution request is serialized and the request serialization result is sent to the contract execution program. Since the blockchain node program and the contract execution program communicate through the network, the request serialization result obtained by serializing the contract execution request meets the network communication format, thereby ensuring normal communication between the blockchain node program and the contract execution program.

[0093] In some embodiments, the transaction processing method provided by the embodiments of the present application also includes: extracting a smart contract identifier from a transaction request, searching for a corresponding index information set based on the extracted smart contract identifier, the index information set containing the index information required to be used when executing the smart contract indicated by the smart contract identifier predicted by the blockchain node program; extracting the storage data corresponding to each index information contained in the index information set from the database, and sending the storage data corresponding to each index information to the contract execution program to instruct the contract execution program to execute the corresponding smart contract based on the transaction parameters extracted from the cache and the received storage data, and obtain the execution result corresponding to the transaction request.

[0094] Among them, in the process of executing the corresponding smart contract, the contract execution program may need to read the storage data of a certain index information, for example, it may need to read the Value corresponding to Key1. The contract execution program needs the transfer of the blockchain node program to operate the database. Specifically, the contract execution program needs to send an access request for Key1 of the smart contract to the blockchain node program. After receiving the request, the blockchain node program reads the Value corresponding to Key1 from the database, and then returns the Value corresponding to Key1 to the contract execution program. However, in the process of executing the corresponding smart contract, the contract execution program may need to read a lot of storage data. Frequently operating the database through the transfer of the blockchain node program has a great impact on the execution speed of the smart contract. Therefore, the embodiment of the present application proposes that the blockchain node program can maintain the index information set corresponding to each smart contract identifier. The index information set contains the index information that the blockchain node program predicts will be used when executing the smart contract.

[0095] For example, see Figure 5 As shown in the figure, the blockchain network includes two smart contracts, namely save and transfer. The index information set corresponding to save contains four index information, namely key_save_1, key_save_2, key_save_3, and key_save_4. The index information set corresponding to transfer contains four index information, namely key_trans_1, key_trans_2, key_trans_3, and key_trans_4. Figure 5The weight in represents the number of times the index information is accessed.

[0096] Among them, the index information set corresponding to each smart contract identifier can be stored in the pre-fetched data cache. The smart contract identifier is carried in the transaction request. After the blockchain node program receives the transaction request, it can extract the smart contract identifier from the transaction request and extract the index information set corresponding to the smart contract identifier from the pre-fetched data cache.

[0097] The index information may be a key, and the index information set may be a Key set.

[0098] Among them, after obtaining the index information set, the blockchain node program can extract the storage data corresponding to each index information contained in the index information set from the database, and send the storage data corresponding to each index information to the contract execution program. The contract execution program puts the storage data corresponding to each received index information into the cache corresponding to the contract execution program.

[0099] Exemplarily, the index information is Key. After obtaining the Key set, the blockchain node program can extract the value Value corresponding to each Key contained in the Key set from the database, and send each Key and the corresponding Value to the contract execution program. The contract execution program puts each Key and the corresponding Value into the cache corresponding to the contract execution program.

[0100] Among them, after the contract execution program receives the contract execution request sent by the blockchain node program, it parses the contract execution request to obtain the second parameter identifier and the smart contract identifier, and compares the second parameter identifier with the first parameter identifier in each established corresponding relationship. If the second parameter identifier is successfully compared with a first parameter identifier, the transaction parameter corresponding to the first parameter identifier is extracted from the cache corresponding to the contract execution program; based on the smart contract identifier, the smart contract to be executed is determined, and based on the extracted transaction parameters and the storage data corresponding to each received index information, the corresponding smart contract is executed to obtain the execution result corresponding to the transaction request.

[0101] In the above embodiment, the blockchain node program maintains the index information set corresponding to each smart contract identifier. The index information set includes the index information that the blockchain node program predicts will be used when executing the smart contract. After receiving the transaction request, the smart contract identifier is extracted from the transaction request, and the index information set corresponding to the smart contract identifier is found. The storage data corresponding to each index information in the index information set is sent to the contract execution program. When the contract execution program executes the corresponding smart contract, if the above storage data is to be used, it can be directly extracted from the cache corresponding to the contract execution program, without the need to operate the database through the blockchain node program, thereby shortening the execution time of the smart contract and improving the execution efficiency of the smart contract.

[0102] In some embodiments, the index information sets corresponding to each smart contract identifier can be maintained in the following manner: according to a preset index quantity threshold, an index update queue is allocated to each smart contract identifier, and the index update queue contains a data storage area that matches the index quantity threshold; for each smart contract identifier, when an access request for target index information from the current smart contract identifier is received, it is determined whether there is target index information in the index update queue corresponding to the current smart contract identifier, and if the target index information exists, the access count of the target index information is increased by a first preset value in the data storage area corresponding to the target index information to obtain an updated access count; it is determined whether there is a first index information in each index information other than the target index information in the index update queue that has an access count that is the same as the updated access count , if it exists, the target index information and the number of accesses to the target index information are transferred from the first storage area where it was originally located to the second data storage area corresponding to the first index information, and the data originally stored in each storage area between the second data storage area and the first storage area are translated; if the target index information does not exist, determine whether there is an empty storage area in the index update queue. If there is no empty area, find the second index information with the smallest number of accesses and the closest to the head of the queue from the index update queue, delete the data in the third data storage area corresponding to the second index information, and put the target index information and the number of accesses to the target index information into the third data storage area; based on the index information in the index update queue corresponding to the current smart contract identifier, construct an index information set corresponding to the current smart contract identifier.

[0103] Among them, the index quantity threshold can be flexibly set according to actual needs. For example, the index quantity threshold can be set to 4, then the index update queue corresponding to each smart contract identifier has 4 data storage areas.

[0104] Each data storage area is used to store index information and the number of times the index information is accessed.

[0105] Among them, for each smart contract identifier, when an access request for the target index information sent by the smart contract identifier of the contract execution program is received, it is determined whether the target index information exists in the index update queue corresponding to the smart contract identifier. If the target index information exists, the access count of the target index information is increased by 1 in the data storage area corresponding to the target index information to obtain the updated access count, and it is determined whether there is a first index information with the same access count as the updated access count in each index information other than the target index information in the index update queue. If so, the data in the first data storage area corresponding to the target index information and the second data storage area corresponding to the first index information are exchanged.

[0106] If there is no first index information having the same access count as the updated access count in the index update queue other than the target index information, no processing is performed.

[0107] If the target index information does not exist in the index update queue corresponding to the smart contract identifier, determine whether there is an empty storage area in the index update queue. If there is no empty area, search the index update queue for the second index information with the smallest number of accesses and closest to the head of the queue, delete the data in the third data storage area corresponding to the second index information, and place the target index information and the number of accesses to the target index information in the third data storage area.

[0108] If there is a free area, search for the free area closest to the head of the queue among all the free areas, put the target index information into the free area, and set the access count of the target index information to 1 in the free area.

[0109] After allocating an index update queue to each smart contract identifier, the blockchain node program can update the data in the index update queue in the above manner. After receiving a transaction request, the blockchain node program extracts the smart contract identifier from the transaction request, searches for the index update queue corresponding to the smart contract identifier, and uses the set of index information in each data storage area in the index update queue as the index information set corresponding to the smart contract identifier.

[0110] For example, see Figure 6As shown in the figure, assuming that the index number threshold is 4, take the smart contract save as an example, allocate an index update queue for the smart contract save, and the index update queue contains 4 data storage areas. For the convenience of explanation, the 4 data storage areas are called area 1, area 2, area 3 and area 4 in order from the head to the tail of the queue. When the smart contract save has not been executed, the 4 data storage areas are empty. When Key1 is accessed during the first execution of the smart contract save, Key1 is placed in area 1, and the number of accesses to Key1 is set to 1; when Key2 is accessed during the second execution of the smart contract save, Key2 is placed in area 2, and the number of accesses to Key2 is set to 1; when Key1 is accessed during the third execution of the smart contract save, the number of accesses to Key1 in area 1 is increased by 1; when Key3 is accessed during the fourth execution of the smart contract save, Key3 is placed in area 3, and the number of accesses to Key3 is set to 1; when Key4 is accessed during the fifth execution of the smart contract save, Key4 is placed in area 4, and the number of accesses to Key4 is set to Set to 1; when Key5 is accessed during the sixth execution of the smart contract save, according to the principle of locality, the key that has just been operated is likely to be used faster, so it will be replaced with the farthest Key with the smallest weight, the data in area 2 will be cleared, Key5 will be placed in area 2, and the number of accesses to Key5 will be set to 1; when Key3 is accessed during the seventh execution of the smart contract save, the number of accesses to Key3 in area 3 will be increased by 1. After the increase, the number of accesses to Key3 is the same as the number of accesses to Key1. Then, according to the principle of priority of number of accesses and priority of the most recent when the number of accesses is the same, Key3 and the number of accesses to Key3 will be stored in area 1, and the Key1 and the number of accesses to Key1 originally stored in area 1 will be moved to area 2, and the Key5 and the number of accesses to Key5 originally stored in area 2 will be moved to area 3.

[0111] In the above embodiment, a specific implementation method is provided for the blockchain node program to maintain the index information set corresponding to each smart contract identifier. In this way, after the blockchain node program receives a transaction request, the corresponding storage data can be sent to the contract execution program in advance. The contract execution program can subsequently execute the corresponding smart contract based on the storage data, thereby reducing the number of times the database is operated through the blockchain node program, shortening the smart contract execution time, and improving the smart contract execution efficiency.

[0112] In some embodiments, the transaction processing method provided by the embodiments of the present application also includes: obtaining a batch to be executed from each transaction request included in the transaction pool, creating an index data cache for the batch to be executed, and creating an empty set of contract identifiers; based on each transaction request in the batch to be executed and the empty set of contract identifiers, obtaining the index information set corresponding to the smart contract identifier corresponding to each transaction request; obtaining the storage data corresponding to each index information in each index information set from the database, and putting it into the index data cache.

[0113] The number of transaction requests to be executed in a batch can be flexibly set according to actual needs. For example, the number of transaction requests to be executed in a batch can be 10. The blockchain node program can extract 10 transaction requests from the transaction pool each time as a batch to be executed. After all the transaction requests in the batch to be executed are processed, the transaction requests in the batch to be executed can be deleted from the transaction pool.

[0114] Among them, each transaction request can also carry a timestamp, and the transaction requests of the transaction pool can be arranged in the order of timestamps. The blockchain node program can extract a preset number of transaction requests in front each time as a batch to be executed. The preset number here is the number of transaction requests executed in the above batch.

[0115] Among them, after the blockchain node program obtains the batch to be executed, it can create an index data cache for the batch to be executed and create an empty contract identifier set; the index data cache is used to store the storage data corresponding to the index information, and the empty contract identifier set is used to store the smart contract identifier. Based on each transaction request in the batch to be executed and the empty contract identifier set, the blockchain node program can obtain the index information set corresponding to the smart contract identifier corresponding to each transaction request, and obtain the storage data corresponding to each index information in each index information set from the database, and put it into the index data cache.

[0116] For example, see Figure 7 As shown, the batch to be executed includes transaction request Tx1 and transaction request Tx2. The blockchain node program can parse the transaction request Tx1 to obtain the smart contract identifier carried by the transaction request Tx1. The index information set corresponding to the smart contract identifier is Key set 1, and the index information set corresponding to the smart contract identifier in the transaction request Tx2 is Key set 2. The blockchain node program can send the Value corresponding to each key in Key set 1 and the Value corresponding to each key in Key set 2 to the contract execution program in advance for caching.

[0117] In the above embodiment, a method for batch acquiring storage data corresponding to multiple transaction requests is provided. The blockchain node program can send the batch acquired storage data to the contract execution program. When the blockchain node corresponding to the blockchain node program becomes the master node, the blockchain node program can send batch contract execution requests to the contract execution program. The contract execution program can process the batch contract execution requests in parallel, thereby improving the processing efficiency of the contract execution requests.

[0118] In some embodiments, based on each transaction request in the batch to be executed and an empty set of contract identifiers, an index information set corresponding to each smart contract identifier in the contract identifier set is obtained; the storage data corresponding to each index information in each index information set is obtained from the database and placed in the index data cache, including: for each transaction request in the batch to be executed, the smart contract identifier is extracted from the current transaction request, and it is determined whether the extracted smart contract identifier is in the empty set of contract identifiers; if it is not in the contract identifier set, the corresponding index information set is searched based on the extracted smart contract identifier, and the storage data corresponding to each index information contained in the index information set is extracted from the database, and the storage data corresponding to each index information is placed in the index data cache, and the extracted smart contract identifier is placed in the empty set of contract identifiers.

[0119] Among them, for each transaction request in the batch to be executed, the transaction request can be parsed to obtain the smart contract identifier carried by the transaction request, and it is determined whether the smart contract identifier is in the empty set of contract identifiers. If it is in the empty set of contract identifiers, the next transaction request is directly processed. If it is not in the empty set of contract identifiers, the index information set corresponding to the smart contract identifier is found, and the storage data corresponding to each index information contained in the index information set is extracted from the database, the storage data corresponding to each index information is placed in the index data cache, and the smart contract identifier is placed in the empty set of contract identifiers.

[0120] For example, see Figure 8As shown, the blockchain node program can create an index data cache and an empty contract identifier set Cs for the batch to be executed, initialize the transaction request set Txs in the batch to be executed, set i=0, obtain the transaction request Tx=Txs[i] from Txs, parse the transaction request Tx, obtain the smart contract identifier CN, and determine whether CN exists in Cs. If not, obtain the Key set corresponding to CN from all maintained Key sets, traverse the Key set, obtain the Value corresponding to each Key from the database, put the Key and Value into the index data cache, put CN into Cs, and then execute i++. If i is greater than or equal to the number of transaction requests in Txs, execute the transaction set Txs according to the scheduling algorithm. If i is less than the number of transaction requests in Txs, return to the step of obtaining the transaction request Tx=Txs[i] from Txs. In the above judgment, if CN exists in Cs, i++ is executed directly.

[0121] In the above embodiment, since there may be multiple transaction requests carrying the same smart contract identifier, and the index information set corresponding to the same smart contract identifier is the same, since the index information set is the same, the index information in the index information set is also the same, and the storage data extracted from the database is also the same, therefore, for the same smart contract identifier, it is sufficient to extract the storage data only once. In order to achieve this goal, an empty contract identifier set is set in the embodiment of the present application, and the processed smart contract identifier is placed in the empty contract identifier set. When processing a transaction request, it is first determined whether the smart contract identifier carried by the transaction request is in the empty contract identifier set. If so, it indicates that the storage data corresponding to the smart contract identifier has been obtained. If not, the step of obtaining the storage data is executed, which can reduce the number of accesses to the database and improve database performance.

[0122] In some embodiments, the transaction request is a resource transfer request. After the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, including: after the blockchain node program receives the resource transfer request, the resource transferee identifier and the resource transfer value are extracted from the resource transfer request; based on the extracted transaction parameters, the corresponding smart contract is executed to obtain the execution result corresponding to the transaction request, including: based on the resource transferee identifier and the resource transfer value, the corresponding smart contract is executed to obtain the remaining resource value of the resource transferor.

[0123] Among them, the transaction processing method provided by the embodiment of the present application can be applied in a resource transfer scenario. The object can perform a resource transfer operation on the terminal. In response to the resource transfer operation, the terminal can generate a corresponding resource transfer request, and select a blockchain node in the blockchain network, and send the resource transfer request to the blockchain node program corresponding to the blockchain node.

[0124] The resource transfer request carries the smart contract identifier and transaction parameters, and the transaction parameters include the resource transferee identifier and the resource transfer value. After receiving the resource transfer request, the blockchain node program extracts the resource transferee identifier and the resource transfer value from the resource transfer request, and sends the resource transferee identifier and the resource transfer value to the contract execution program isolated from the blockchain node program. The contract execution program maps the resource transferee identifier and the resource transfer value to the first parameter identifier, establishes a corresponding relationship between the first parameter identifier and the resource transferee identifier and the resource transfer value, and puts the resource transferee identifier and the resource transfer value into the cache corresponding to the contract execution program.

[0125] When the blockchain node program determines that the transaction request meets the execution conditions, the resource transferor identifier and the resource transfer value are mapped to the second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program. The contract execution program parses the contract execution request to obtain the second parameter identifier, and compares the second parameter identifier with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the resource transferor identifier and the resource transfer value are extracted from the cache, and the corresponding smart contract is executed based on the resource transferor identifier and the resource transfer value to obtain the remaining resource value of the resource transferor.

[0126] In the above embodiment, an implementation process of applying the transaction processing method provided by the present application to the scenario of resource transfer is provided. After receiving a resource transfer request, the above method directly sends the transaction parameters to the contract execution program for caching. When it is determined that the resource transfer request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time it takes to transmit the input parameters over the network and improves the execution efficiency of the smart contract.

[0127] It should be noted that the application scenarios provided above are only used to illustrate the transaction processing method of this application, and the application of the transaction processing method provided by this application is not limited to the application scenarios provided above. For example, it can also be applied in resource query scenarios, virtual resource purchase scenarios, etc., and the embodiments of this application do not limit this.

[0128] In some embodiments, Fig. 9 As shown, a transaction processing method is provided, which is described by taking the method applied to a contract execution program as an example, and includes the following steps:

[0129] Step 902, receiving transaction parameters sent by a blockchain node program that is isolated from the contract execution program, where the transaction parameters are extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request.

[0130] Among them, after receiving the transaction request, the blockchain node program first performs security verification on the transaction request. After the security verification passes, the transaction parameters are extracted from the transaction request and sent to the contract execution program. For detailed process, please refer to the description of the above embodiment.

[0131] Step 904, map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program.

[0132] After receiving the transaction parameters, the contract execution program may perform a hash operation on the transaction parameters and use the obtained hash value as the first parameter identifier of the transaction parameters. The contract execution program may establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program. For the detailed process, please refer to the description of the above embodiment.

[0133] Step 906, receiving a contract execution request sent by the blockchain node program, where the contract execution request is generated based on the second parameter identifier by mapping the transaction parameters to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution conditions.

[0134] Step 908, parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

[0135] When the blockchain node program determines that the transaction request meets the execution conditions, it can perform a hash operation on the transaction parameters, use the obtained hash value as the second parameter identifier of the transaction parameters, create a contract execution request based on the second parameter identifier and the smart contract identifier, and send the contract execution request to the blockchain node program. For detailed process, please refer to the description of the above embodiment.

[0136] In the above embodiment, a transaction parameter sent by a blockchain node program isolated from a contract execution program is received, and the transaction parameter is extracted by the blockchain node program from the transaction request after the blockchain node program receives the transaction request; the transaction parameter is mapped to a first parameter identifier, a corresponding relationship between the first parameter identifier and the transaction parameter is established, and the transaction parameter is placed in a cache corresponding to the contract execution program; a contract execution request sent by the blockchain node program is received, and the contract execution request is generated based on the second parameter identifier when the blockchain node program determines that the transaction request meets the execution conditions; the contract execution request is parsed to obtain the second parameter identifier, and the second parameter identifier is compared with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameter is extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request. The blockchain node program and the contract execution program are isolated from each other and communicate through the network. After receiving the transaction request, the above method directly sends the transaction parameters to the contract execution program for caching. When it is determined that the transaction request meets the execution conditions, the blockchain node program only needs to send the mapped parameter identifier to the contract execution program. The data volume of the parameter identifier is much smaller than the transaction parameter, which greatly reduces the time it takes to transmit the input parameters over the network and improves the execution efficiency of the smart contract.

[0137] In some embodiments, the transaction processing method provided by the embodiments of the present application further includes: setting a timer for the transaction parameters placed in the cache, the timer being used to time the cache time of the transaction parameters placed in the cache; when the timing duration of the timer reaches a preset timeout duration, the transaction parameters placed in the cache are cleared.

[0138] As described above, after the contract execution program obtains the transaction parameters, it can perform a hash operation on the transaction parameters, use the obtained hash value as the first parameter identifier of the transaction parameters, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into the cache corresponding to the contract execution program. The contract execution program can set a timer for the transaction parameters placed in the cache. The timer is used to time the cache time of the transaction parameters placed in the cache. When the timer reaches the preset timeout period, the contract execution program can clear the transaction parameters placed in the cache.

[0139] In the above embodiment, the contract execution program sets a timer for the transaction parameters placed in the cache. When the timer reaches a preset timeout period, the transaction parameters placed in the cache are cleared to prevent the transaction parameters from continuously occupying the cache when the transaction request does not meet the execution conditions for a long time, thereby improving the utilization rate of the cache corresponding to the contract execution program.

[0140] In some embodiments, the transaction processing method provided by the embodiments of the present application also includes: in the case where the transaction parameters do not exist in the cache, generating a parameter acquisition request based on the second parameter identifier, and sending the parameter acquisition request to the blockchain node program to instruct the blockchain node program to parse the parameter acquisition request to obtain the second parameter identifier, and based on the second parameter identifier, extracting the transaction parameters from the cache corresponding to the blockchain node program, creating a parameter response request based on the transaction parameters, and serializing the parameter response request to obtain a response serialization result; receiving the response serialization result sent by the blockchain node program, deserializing the response serialization result to obtain a parameter response request, parsing the parameter response request, and obtaining the transaction parameters.

[0141] Among them, after receiving the contract execution request, the contract execution program parses the contract execution request to obtain the second parameter identifier and the smart contract identifier, and compares the second parameter identifier with the first parameter identifier in each established corresponding relationship. If the comparison between the second parameter identifier and all the first parameter identifiers fails, or the second parameter identifier is successfully compared with a first parameter identifier, but the transaction parameter corresponding to the first parameter identifier does not exist in the cache corresponding to the contract execution program, a parameter acquisition request is generated based on the second parameter identifier, and the parameter acquisition request is sent to the blockchain node program.

[0142] As described in the above embodiment, when the blockchain node program determines that the transaction request meets the execution conditions, it can parse the transaction request to obtain the transaction parameters and the smart contract identifier, perform a hash operation on the transaction parameters, use the obtained hash value as the second parameter identifier of the transaction parameters, use the second parameter identifier as the key K, use the transaction parameters as the value V, and form a key-value pair with the second parameter identifier and the transaction parameters, and put the key-value pair into the cache corresponding to the blockchain node program. After receiving the parameter acquisition request, the blockchain node program can parse the parameter acquisition request to obtain the second parameter identifier, extract the transaction parameters from the cache based on the second parameter identifier, create a parameter response request based on the transaction parameters, and serialize the parameter response request to obtain a response serialization result; send the response serialization result to the contract execution program.

[0143] Among them, after the contract execution program receives the response serialization result, it deserializes the response serialization result to obtain a parameter response request. By parsing the parameter response request, the transaction parameters can be obtained. Based on the transaction parameters, the corresponding smart contract is executed to obtain the execution result corresponding to the transaction request.

[0144] For example, see Fig.10As shown, when the blockchain node program determines that the transaction request meets the execution conditions, the transaction request is parsed to obtain the transaction parameters and the smart contract identifier, and it is determined whether the parameter length of the transaction parameter is greater than the preset length threshold value. If it is greater than the preset length threshold value, the transaction parameter is hashed to obtain the second parameter identifier of the transaction parameter, and the second parameter identifier is used as the key K, and the transaction parameter is used as the value V. The second parameter identifier and the transaction parameter form a key-value pair, and the key-value pair is placed in the cache corresponding to the blockchain node program. A contract execution request is created based on the second parameter identifier and the smart contract identifier. When the parameter length of the transaction parameter is less than or equal to the preset length threshold value, a contract execution request is created directly based on the transaction parameter and the smart contract identifier. The contract execution request is serialized to obtain a binary message, that is, the request serialization result, and the request serialization result is sent to the contract execution program. The contract execution program deserializes the request serialization result to obtain the contract execution request, parses the contract execution request, and obtains the transaction parameters from the local cache based on the second parameter identifier when the second parameter identifier is obtained through the parsing. If the transaction parameters exist, the corresponding smart contract is executed based on the transaction parameters to obtain the execution result corresponding to the transaction request; if the transaction parameters do not exist, a parameter acquisition request is generated based on the second parameter identifier, and the parameter acquisition request is sent to the blockchain node program. After receiving the parameter acquisition request, the blockchain node program obtains the transaction parameters corresponding to the second parameter identifier from the cache, creates a parameter response request based on the transaction parameters, and serializes the parameter response request to obtain the response serialization result; the response serialization result is sent to the contract execution program, and the contract execution program obtains the transaction parameters based on the response serialization result, and executes the corresponding smart contract based on the transaction parameters to obtain the execution result corresponding to the transaction request. After parsing the contract execution request, if the transaction parameters can be directly obtained, the corresponding smart contract is directly executed based on the transaction parameters to obtain the execution result corresponding to the transaction request.

[0145] In the above embodiment, after the blockchain node program maps the transaction parameters to the second parameter identifier, the second parameter identifier and the transaction parameters can be combined into a key-value pair, and the key-value pair can be placed in the cache corresponding to the blockchain node program. When the contract execution program cannot obtain the transaction parameters according to the second parameter identifier, it can obtain them by sending a parameter acquisition request to the blockchain node program, thereby ensuring the smooth execution of the smart contract.

[0146] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0147] Based on the same inventive concept, the embodiment of the present application also provides a transaction processing device for implementing the transaction processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more transaction processing device embodiments provided below can refer to the limitations on the transaction processing method above, and will not be repeated here.

[0148] In one embodiment, Fig.11 As shown, a transaction processing device is provided, comprising:

[0149] A pre-sending module is used to extract transaction parameters from the transaction request after the blockchain node program receives the transaction request, and send the transaction parameters to a contract execution program isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program;

[0150] The execution module is used to map the transaction parameters to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution conditions, generate a contract execution request based on the second parameter identifier, and send the contract execution request to the contract execution program to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and extract the transaction parameters from the cache when the comparison is successful, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

[0151] In some embodiments, the pre-sending module is specifically used to perform security verification on the transaction request. After the security verification is passed, the transaction parameters are extracted from the transaction request and the parameter length of the transaction parameters is obtained; when the parameter length is greater than a preset length threshold, the transaction parameters are sent to a contract execution program that is isolated from the blockchain node program.

[0152] In some embodiments, the pre-sending module is specifically used to serialize the transaction parameters to obtain the parameter serialization results, and send the serialization results to the contract execution program isolated from the blockchain node program to instruct the contract execution program to deserialize the parameter serialization results to obtain the transaction parameters, map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, put the transaction parameters into the cache corresponding to the contract execution program, and set a timer for the transaction parameters placed in the cache, the timer is used to time the cache time of the transaction parameters placed in the cache, and the contract execution program is used to clear the transaction parameters placed in the cache when the timing duration of the timer reaches a preset timeout duration.

[0153] In some embodiments, the execution module is also used to determine that the transaction request meets the execution conditions when the blockchain node corresponding to the blockchain node program and the contract execution program is the main node and the transaction request belongs to the request in the batch to be executed; or, when the blockchain node program receives the transaction data to be agreed upon sent by other blockchain node programs in the blockchain network, and the transaction data to be agreed upon contains the request identifier of the transaction request, determine that the transaction request meets the execution conditions.

[0154] In some embodiments, the execution module is specifically used to determine whether the parameter length of the transaction parameter is greater than a preset length threshold; if the transaction parameter is greater than the preset length threshold, the transaction parameter is mapped to a second parameter identifier.

[0155] In some embodiments, the execution module is specifically used to extract the smart contract identifier from the transaction request, and create a contract execution request based on the smart contract identifier and the second parameter identifier; serialize the contract execution request to obtain a request serialization result, and send the request serialization result to the contract execution program to instruct the contract execution program to deserialize the request serialization result to obtain a contract execution request.

[0156] In some embodiments, the pre-sending module is also used to extract the smart contract identifier from the transaction request, and search for the corresponding index information set based on the extracted smart contract identifier, the index information set containing the index information required for execution of the smart contract indicated by the smart contract identifier predicted by the blockchain node program; extract the storage data corresponding to each index information contained in the index information set from the database, and send the storage data corresponding to each index information to the contract execution program to instruct the contract execution program to execute the corresponding smart contract based on the transaction parameters extracted from the cache and the received storage data, so as to obtain the execution result corresponding to the transaction request.

[0157] In some embodiments, the pre-sending module is further used to allocate an index update queue to each smart contract identifier according to a preset index quantity threshold, and the index update queue includes a data storage area that matches the index quantity threshold; for each smart contract identifier, when receiving an access request for target index information from the current smart contract identifier, determine whether there is target index information in the index update queue corresponding to the current smart contract identifier, and if the target index information exists, increase the access count of the target index information by a first preset value in the data storage area corresponding to the target index information to obtain an updated access count; determine whether there is first index information with the same access count as the updated access count in each index information other than the target index information in the index update queue, and if so, increase the access count of the target index information by a first preset value in the data storage area corresponding to the target index information. The access count of the target index information and the target index information is transferred from the first storage area where it was originally located to the second data storage area corresponding to the first index information, and the data originally stored in each storage area between the second data storage area and the first storage area is translated; in the absence of the target index information, determine whether there is a free storage area in the index update queue. If there is no free area, find the second index information with the smallest access count and the closest to the head of the queue from the index update queue, delete the data in the third data storage area corresponding to the second index information, and put the target index information and the access count of the target index information into the third data storage area; based on the index information in the index update queue corresponding to the current smart contract identifier, construct an index information set corresponding to the current smart contract identifier.

[0158] In some embodiments, the pre-sending module is also used to obtain batches to be executed from each transaction request included in the transaction pool, create an index data cache for the batches to be executed, and create an empty set of contract identifiers; based on each transaction request in the batches to be executed and the empty set of contract identifiers, obtain the index information set corresponding to the smart contract identifier corresponding to each transaction request; obtain the storage data corresponding to each index information in each index information set from the database, and put it into the index data cache.

[0159] In some embodiments, the pre-sending module is also used to extract the smart contract identifier from the current transaction request for each transaction request in the batch to be executed, and determine whether the extracted smart contract identifier is in the empty set of contract identifiers; if it is not in the contract identifier set, search for the corresponding index information set based on the extracted smart contract identifier, extract the storage data corresponding to each index information contained in the index information set from the database, put the storage data corresponding to each index information into the index data cache, and put the extracted smart contract identifier into the empty set of contract identifiers.

[0160] In some embodiments, the transaction request is a resource transfer request, and the pre-sending module is further used to extract the resource transferee identifier and the resource transfer value from the resource transfer request after the blockchain node program receives the resource transfer request; the execution module is further used to execute the corresponding smart contract based on the resource transferee identifier and the resource transfer value to obtain the remaining resource value of the resource transferor.

[0161] In one embodiment, Fig.12 As shown, a transaction processing device is provided, comprising:

[0162] A receiving module, used to receive transaction parameters sent by a blockchain node program that is isolated from the contract execution program, where the transaction parameters are extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request;

[0163] A mapping module, used to map the transaction parameters to the first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program;

[0164] The receiving module is also used to receive a contract execution request sent by the blockchain node program, where the contract execution request is generated based on the second parameter identifier by mapping the transaction parameter to the second parameter identifier when the blockchain node program determines that the transaction request meets the execution condition;

[0165] The execution module is used to parse the contract execution request, obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

[0166] In some embodiments, the mapping module is also used to set a timer for the transaction parameters placed in the cache, and the timer is used to count the cache time of the transaction parameters placed in the cache; when the timing duration of the timer reaches a preset timeout duration, the transaction parameters placed in the cache are cleared.

[0167] In some embodiments, the execution module is also used to generate a parameter acquisition request based on the second parameter identifier when the transaction parameters do not exist in the cache, and send the parameter acquisition request to the blockchain node program to instruct the blockchain node program to parse the parameter acquisition request to obtain the second parameter identifier, and based on the second parameter identifier, extract the transaction parameters from the cache corresponding to the blockchain node program, create a parameter response request based on the transaction parameters, and serialize the parameter response request to obtain a response serialization result; receive the response serialization result sent by the blockchain node program, deserialize the response serialization result to obtain a parameter response request, parse the parameter response request to obtain the transaction parameters.

[0168] Each module in the above transaction processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0169] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store transaction requests and index information sets. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a transaction processing method is implemented.

[0170] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0171] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0172] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0173] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0174] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A transaction processing method, characterized in that: The method comprises: After the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, and the transaction parameters are sent to a contract execution program that is isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program; When the blockchain node program determines that the transaction request satisfies the execution condition, the transaction parameter is mapped to a second parameter identifier, a contract execution request is generated based on the second parameter identifier, and the contract execution request is sent to the contract execution program to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, and compare the second parameter identifier with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameter is extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameter to obtain the execution result corresponding to the transaction request.

2. The method according to claim 1, characterized in that The step of extracting transaction parameters from the transaction request and sending the transaction parameters to a contract execution program that is isolated from the blockchain node program comprises: Performing security verification on the transaction request, extracting transaction parameters from the transaction request after the security verification passes, and obtaining parameter lengths of the transaction parameters; When the parameter length is greater than a preset length threshold, the transaction parameter is sent to a contract execution program that is isolated from the blockchain node program.

3. The method according to claim 1, characterized in that The sending of the transaction parameters to a contract execution program that is isolated from the blockchain node program comprises: The transaction parameters are serialized to obtain parameter serialization results, and the serialization results are sent to a contract execution program that is isolated from the blockchain node program to instruct the contract execution program to deserialize the parameter serialization results to obtain the transaction parameters, map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, put the transaction parameters into a cache corresponding to the contract execution program, and set a timer for the transaction parameters put into the cache, the timer is used to time the cache time of the transaction parameters put into the cache, and the contract execution program is used to clear the transaction parameters put into the cache when the timing duration of the timer reaches a preset timeout duration.

4. The method according to claim 1, characterized in that: The method further comprises: When the blockchain node corresponding to the blockchain node program and the contract execution program is a master node and the transaction request belongs to a request in a batch to be executed, determining that the transaction request satisfies the execution condition; or, When the blockchain node program receives the transaction data to be agreed upon sent by other blockchain node programs in the blockchain network, and the transaction data to be agreed upon includes the request identifier of the transaction request, it is determined that the transaction request satisfies the execution condition.

5. The method according to claim 1, characterized in that Mapping the transaction parameter to a second parameter identifier includes: Determining whether the parameter length of the transaction parameter is greater than a preset length threshold; When the transaction parameter is greater than the preset length threshold, the transaction parameter is mapped to a second parameter identifier.

6. The method according to claim 1, characterized in that The generating a contract execution request based on the second parameter identifier, and sending the contract execution request to the contract execution program, comprises: Extracting a smart contract identifier from the transaction request, and creating a contract execution request based on the smart contract identifier and the second parameter identifier; The contract execution request is serialized to obtain a request serialization result, and the request serialization result is sent to the contract execution program to instruct the contract execution program to deserialize the request serialization result to obtain the contract execution request.

7. The method according to claim 1, characterized in that The method further comprises: Extracting a smart contract identifier from the transaction request, and searching for a corresponding index information set based on the extracted smart contract identifier, wherein the index information set includes index information required to be used when executing the smart contract indicated by the smart contract identifier predicted by the blockchain node program; The storage data corresponding to each index information contained in the index information set is extracted from the database, and the storage data corresponding to each index information is sent to the contract execution program to instruct the contract execution program to execute the corresponding smart contract based on the transaction parameters extracted from the cache and the received storage data, so as to obtain the execution result corresponding to the transaction request.

8. The method according to claim 7, characterized in that The method further comprises: According to a preset index quantity threshold, an index update queue is allocated to each smart contract identifier, and the index update queue contains a data storage area matching the index quantity threshold; For each smart contract identifier, upon receiving an access request for target index information from the current smart contract identifier, determining whether the target index information exists in the index update queue corresponding to the current smart contract identifier, and if the target index information exists, increasing the access count of the target index information by a first preset value in a data storage area corresponding to the target index information to obtain an updated access count; Determine whether there is a first index information with the same access count as the updated access count in each index information other than the target index information in the index update queue; if so, transfer the target index information and the access count of the target index information from the original first storage area to the second data storage area corresponding to the first index information, and perform translation processing on the data originally stored in each storage area between the second data storage area and the first storage area; In the absence of the target index information, determine whether there is an empty storage area in the index update queue. If there is no empty area, search the index update queue for the second index information with the smallest access times and closest to the head of the queue, delete the data in the third data storage area corresponding to the second index information, and put the target index information and the access times of the target index information into the third data storage area; Based on the index information in the index update queue corresponding to the current smart contract identifier, a set of index information corresponding to the current smart contract identifier is constructed.

9. The method according to claim 1, characterized in that: The method further comprises: Obtaining a batch to be executed from each transaction request included in the transaction pool, creating an index data cache for the batch to be executed, and creating an empty set of contract identifiers; Based on each transaction request in the batch to be executed and the empty set of contract identifiers, obtaining an index information set corresponding to the smart contract identifier corresponding to each transaction request; The storage data corresponding to each index information in each index information set is obtained from the database and put into the index data cache.

10. The method according to claim 9, characterized in that Based on each transaction request in the batch to be executed and the empty set of contract identifiers, obtaining an index information set corresponding to each smart contract identifier in the contract identifier set; Obtaining the storage data corresponding to each index information in each index information set from the database and putting it into the index data cache includes: For each transaction request in the batch to be executed, extract a smart contract identifier from the current transaction request, and determine whether the extracted smart contract identifier is in the empty set of contract identifiers; If it is not in the contract identification set, the corresponding index information set is searched based on the extracted smart contract identification, the storage data corresponding to each index information contained in the index information set is extracted from the database, the storage data corresponding to each index information is placed in the index data cache, and the extracted smart contract identification is placed in the contract identification empty set.

11. The method according to any one of claims 1 to 10, characterized in that: The transaction request is a resource transfer request. After the blockchain node program receives the transaction request, the transaction parameters are extracted from the transaction request, including: After the blockchain node program receives the resource transfer request, extract the resource transferee identifier and the resource transfer value from the resource transfer request; The executing the corresponding smart contract based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request includes: The corresponding smart contract is executed based on the resource transferee identifier and the resource transfer value to obtain the remaining resource value of the resource transferor.

12. A transaction processing method, characterized in that: The method comprises: Receiving a transaction parameter sent by a blockchain node program that is isolated from a contract execution program, wherein the transaction parameter is extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request; Mapping the transaction parameter to a first parameter identifier, establishing a corresponding relationship between the first parameter identifier and the transaction parameter, and placing the transaction parameter into a cache corresponding to the contract execution program; Receiving a contract execution request sent by the blockchain node program, wherein the contract execution request is generated based on the second parameter identifier by mapping the transaction parameter to a second parameter identifier when the blockchain node program determines that the transaction request meets the execution condition; The contract execution request is parsed to obtain the second parameter identifier, and the second parameter identifier is compared with the first parameter identifier in the established corresponding relationship. If the comparison is successful, the transaction parameters are extracted from the cache, and the corresponding smart contract is executed based on the extracted transaction parameters to obtain the execution result corresponding to the transaction request.

13. The method according to claim 12, characterized in that The method further comprises: A timer is set for the transaction parameters put into the cache, and the timer is used to count the cache time of the transaction parameters put into the cache; when the timing duration of the timer reaches a preset timeout duration, the transaction parameters put into the cache are cleared.

14. The method according to claim 12, characterized in that The method further comprises: In the case where the transaction parameters do not exist in the cache, a parameter acquisition request is generated based on the second parameter identifier, and the parameter acquisition request is sent to the blockchain node program to instruct the blockchain node program to parse the parameter acquisition request to obtain the second parameter identifier, and based on the second parameter identifier, the transaction parameters are extracted from the cache corresponding to the blockchain node program, a parameter response request is created based on the transaction parameters, and the parameter response request is serialized to obtain a response serialization result; Receive the response serialization result sent by the blockchain node program, deserialize the response serialization result to obtain the parameter response request, and parse the parameter response request to obtain the transaction parameter.

15. A transaction processing device, characterized in that: The device comprises: A pre-sending module, configured to extract transaction parameters from the transaction request after the blockchain node program receives the transaction request, and send the transaction parameters to a contract execution program isolated from the blockchain node program, so as to instruct the contract execution program to map the transaction parameters to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameters, and put the transaction parameters into a cache corresponding to the contract execution program; An execution module is used to map the transaction parameters to a second parameter identifier when the blockchain node program determines that the transaction request meets the execution conditions, generate a contract execution request based on the second parameter identifier, and send the contract execution request to the contract execution program to instruct the contract execution program to parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

16. A transaction processing device, characterized in that: The device comprises: A receiving module, used to receive a transaction parameter sent by a blockchain node program that is isolated from a contract execution program, wherein the transaction parameter is extracted from the transaction request by the blockchain node program after the blockchain node program receives the transaction request; A mapping module, used to map the transaction parameter to a first parameter identifier, establish a corresponding relationship between the first parameter identifier and the transaction parameter, and put the transaction parameter into a cache corresponding to the contract execution program; The receiving module is further used to receive a contract execution request sent by the blockchain node program, where the contract execution request is generated based on the second parameter identifier by mapping the transaction parameter to a second parameter identifier when the blockchain node program determines that the transaction request meets the execution condition; An execution module is used to parse the contract execution request to obtain the second parameter identifier, compare the second parameter identifier with the first parameter identifier in the established corresponding relationship, and if the comparison is successful, extract the transaction parameters from the cache, execute the corresponding smart contract based on the extracted transaction parameters, and obtain the execution result corresponding to the transaction request.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.