Transaction processing method and device of block chain network, product, equipment and medium

By introducing the architecture of the first and second network layers into the blockchain network and using execution commitment information for pre-confirmation and challenge mechanisms, the problem of low transaction pre-confirmation efficiency is solved, and fast and reliable transaction pre-confirmation and resource compensation are achieved.

CN120655419APending Publication Date: 2025-09-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410303057.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-15
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In blockchain networks, the pre-confirmation of transactions in existing technologies is inefficient and time-consuming, and it is impossible to determine in a timely manner whether the transaction has been successfully executed.

Method used

By introducing the architecture of the first and second network layers, and by generating and verifying execution commitment information, the transaction client can immediately pre-confirm the transaction after executing it on the second network layer, and challenge the first network layer to achieve resource transfer processing if the pre-confirmation fails.

Benefits of technology

It improves the efficiency of transaction pre-confirmation, ensures the reliability of pre-confirmation, and enables timely resource compensation when pre-confirmation fails.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120655419A_ABST
    Figure CN120655419A_ABST
Patent Text Reader

Abstract

The invention discloses a transaction processing method and device of a block chain network, a product, equipment and a medium, a second network layer in the block chain network executes a transaction of a transaction client, a first network layer verifies the transaction executed by the second network layer, and the method comprises the following steps: the transaction client sends a target transaction to the second network layer, causing the second network layer to perform the target transaction; receiving execution commitment information returned by the second network layer; the execution commitment information declarates that the target transaction has been successfully executed in the second network layer; pre-confirming an execution result of the target transaction based on the execution commitment information; and if the pre-confirmed result indicates that the execution result of the target transaction is execution failure, initiating a challenge to a second network layer to the first network layer based on the execution commitment information, so that the first network layer executes resource transfer processing of the second network layer for the transaction client. By adopting the method and the device, the pre-confirmation efficiency of the target transaction can be improved, and the pre-confirmation reliability of the target transaction can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of blockchain, and in particular to a transaction processing method, device, product, equipment and medium for a blockchain network. Background Art

[0002] In a blockchain network, when a blockchain node device receives a blockchain transaction submitted by a user, it can execute the blockchain transaction. After accumulating a specified number of executed blockchain transactions, it can construct a transaction batch through the specified number of blockchain transactions and submit the transaction batch to the blockchain network for consensus and chain-up.

[0003] Once the transaction batch is submitted to the blockchain network, users can pre-confirm the transactions in that batch. However, during this process, users must wait for the entire transaction batch before their submitted blockchain transactions can be pre-confirmed. This method of pre-confirming transactions is inefficient and time-consuming. Summary of the Invention

[0004] The present application provides a transaction processing method, apparatus, product, equipment and medium for a blockchain network, which can improve the efficiency of pre-confirming transactions, reduce the time spent on pre-confirming transactions, and ensure the reliability of pre-confirming transactions.

[0005] On one hand, the present application provides a transaction processing method for a blockchain network, wherein the blockchain network includes a first network layer and a second network layer, wherein the second network layer is used to execute transactions initiated by a transaction client, and the first network layer is used to verify transactions executed by the second network layer. The method is applied to the transaction client; the method includes:

[0006] Generate a target transaction and send the target transaction to the second network layer, so that the second network layer executes the target transaction;

[0007] Receive the execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer;

[0008] Pre-confirm the execution results of the target transaction based on the execution commitment information;

[0009] If the pre-confirmation result indicates that the execution result of the target transaction is execution failure, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

[0010] On one hand, the present application provides a transaction processing device for a blockchain network, wherein the blockchain network includes a first network layer and a second network layer, wherein the second network layer is used to execute transactions initiated by a transaction client, and the first network layer is used to verify transactions executed by the second network layer. The device is applied to the transaction client; the device includes:

[0011] a generation module, configured to generate a target transaction and send the target transaction to the second network layer so that the second network layer executes the target transaction;

[0012] A receiving module, configured to receive the execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer;

[0013] A pre-confirmation module is used to pre-confirm the execution result of the target transaction based on the execution commitment information;

[0014] The initiating module is used to initiate a challenge to the second network layer to the first network layer based on the execution commitment information if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

[0015] Optionally, a transaction sequencer is configured in the second network layer. The second network layer executes transactions initiated by the transaction client based on the transaction sequencer. The transaction sequencer has a transaction key pair, and the transaction key pair includes a transaction private key and a transaction public key.

[0016] Among them, a transaction verification contract is deployed in the first network layer, and the second network layer is used to send the transaction public key of the transaction sequencer to the transaction verification contract, so that the transaction verification contract stores the transaction public key of the transaction sequencer.

[0017] Optionally, the execution commitment information encapsulates execution attribute information related to executing the target transaction, as well as signature data of the execution attribute information;

[0018] The signature data is obtained by the second network layer using the transaction private key of the transaction sequencer to sign the execution attribute information.

[0019] Optionally, the pre-confirmation module pre-confirms the execution result of the target transaction based on the execution commitment information, including:

[0020] Performing a correctness check on the execution commitment information and obtaining the test result of the execution commitment information;

[0021] Pre-confirm the execution results of the target transaction based on the detection results.

[0022] Optionally, the pre-confirmation module performs a correctness check on the execution commitment information to obtain a check result of the execution commitment information, including:

[0023] Obtain the transaction public key of the transaction sequencer from the first network layer;

[0024] Use the acquired transaction public key to decrypt the signature data in the execution commitment information to obtain the decrypted hash value;

[0025] Performing hash calculation on the execution attribute information in the execution commitment information to generate a hash value of the execution attribute information;

[0026] If the generated hash value is consistent with the decrypted hash value, the signature data in the execution commitment information is determined to be correct.

[0027] Optionally, the pre-confirmation module is also used to:

[0028] If the generated hash value is inconsistent with the decrypted hash value, it is determined that the signature data in the execution commitment information is not correct;

[0029] Generate a test result that the execution commitment information is not correct;

[0030] The pre-confirmation module pre-confirms the execution result of the target transaction based on the detection results, including:

[0031] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0032] Optionally, the execution attribute information includes a transaction hash value of the target transaction; the pre-confirmation module performs a correctness check on the execution commitment information to obtain a check result of the execution commitment information, including:

[0033] Perform hash calculation on the initiated target transaction to generate the hash value of the target transaction;

[0034] Compare the generated hash value with the transaction hash value in the execution attribute information;

[0035] If the generated hash value is consistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is correct.

[0036] Optionally, the pre-confirmation module is also used to:

[0037] If the generated hash value is inconsistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is not correct;

[0038] Generate a test result that the execution commitment information is not correct;

[0039] The pre-confirmation module pre-confirms the execution result of the target transaction based on the detection results, including:

[0040] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0041] Optionally, the execution attribute information includes a transaction sequence number when the target transaction is executed in the second network layer; the pre-confirmation module performs a correctness check on the execution commitment information to obtain a test result of the execution commitment information, including:

[0042] Query the first network layer for the maximum transaction sequence number of the currently submitted transaction;

[0043] Calculate the difference between the maximum transaction sequence number and the transaction sequence number in the execution attribute information;

[0044] If the sequence number difference is less than or equal to the preset difference threshold, it is determined that the transaction sequence number in the execution attribute information is correct.

[0045] Optionally, the pre-confirmation module is also used to:

[0046] If the sequence number difference is greater than the difference threshold, it is determined that the transaction sequence number in the execution attribute information is incorrect;

[0047] Generate a test result that the execution commitment information is not correct;

[0048] The pre-confirmation module pre-confirms the execution result of the target transaction based on the detection results, including:

[0049] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0050] Optionally, the execution commitment information encapsulates a target account address and a transaction sequence number of the target transaction when it is executed in the second network layer. The target account address is an account address used to execute resource transfer processing for the transaction client in the second network layer. The method in which the initiating module initiates a challenge to the second network layer to the first network layer based on the execution commitment information includes:

[0051] Query the first network layer for the transaction to which the transaction sequence number in the execution commitment information belongs;

[0052] Obtaining transaction query information returned by the first network layer for the queried exchange;

[0053] Based on the transaction query information and execution commitment information, the first network layer initiates a challenge to the second network layer;

[0054] The first network layer is used to execute resource transfer processing of the second network layer for the transaction client based on the target account address.

[0055] Optionally, the execution commitment information encapsulates the transaction hash value of the target transaction, and the transaction query information includes the transaction hash value of the queried transaction;

[0056] The initiating module initiates a challenge to the second network layer from the first network layer based on the transaction query information and execution commitment information, including:

[0057] Compare the transaction hash value in the transaction query information with the transaction hash value in the execution commitment information;

[0058] If the transaction hash value in the transaction query information is inconsistent with the transaction hash value in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0059] Optionally, the execution commitment information encapsulates the transaction status of the target transaction, and the transaction query information includes the transaction status of the queried transaction;

[0060] The initiating module initiates a challenge to the second network layer from the first network layer based on the transaction query information and execution commitment information, including:

[0061] Compare the transaction status in the transaction query information with the transaction status in the execution commitment information;

[0062] If the transaction status in the transaction query information is inconsistent with the transaction status in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0063] Optionally, the execution commitment information encapsulates the execution attribute information of the target transaction and the signature data of the second network layer on the execution attribute information. The execution attribute information includes the transaction hash value, transaction sequence number, and transaction status of the target transaction.

[0064] The first network layer has a transaction verification contract deployed. The transaction client initiates a challenge to the second network layer by sending it to the transaction verification contract. The second network layer has staked resources in the transaction verification contract.

[0065] The transaction verification contract is used to verify the signature data in the execution commitment information when receiving a challenge initiated to the second network layer. After the signature data is successfully verified, it is used to query the transaction hash value and transaction status of the transaction to which the transaction sequence number in the execution attribute information belongs. It is also used to transfer the pledged resources to the target account address when it detects that the queried transaction hash value is inconsistent with the transaction hash value in the execution attribute information, or the queried transaction status is inconsistent with the transaction status in the execution attribute information;

[0066] Among them, the transaction queried by the transaction verification contract based on the transaction sequence number in the execution attribute information must be a transaction that has been successfully verified in the first network layer.

[0067] In one aspect, the present application provides a computer device including a memory and a processor, wherein the memory stores a computer program. When the computer program is executed by the processor, the processor executes the method in one aspect of the present application.

[0068] In one aspect, the present application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the method in the above aspect.

[0069] According to one aspect of the present application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in various optional embodiments such as the above-mentioned aspect.

[0070] The blockchain network in the present application may include a first network layer and a second network layer. The second network layer is used to execute transactions initiated by the transaction client, and the first network layer is used to verify transactions executed by the second network layer. Therefore, the transaction client can generate a target transaction and send the target transaction to the second network layer, so that the second network layer executes the target transaction; it can also receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer; the transaction client can pre-confirm the execution result of the target transaction based on the execution commitment information; if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, the transaction client can initiate a challenge to the second network layer to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client. It can be seen that after the method proposed in the present application executes the target transaction on the second network layer, the transaction client can receive the execution commitment information returned by the second network layer. The transaction client can immediately pre-confirm the target transaction through the execution commitment information, thereby improving the efficiency of pre-confirmation of the target transaction. Moreover, when the result of the pre-confirmation of the target transaction is an execution failure, the second network layer can also be punished. For example, the execution commitment information provided by the second network layer can be used to initiate a challenge to the second network layer to the first network layer, so that the first network layer can execute the resource transfer processing of the second network layer for the transaction client. Therefore, this also ensures the reliability of the pre-confirmation of the target transaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0072] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;

[0073] Figure 2 This is a schematic diagram of a scenario for pre-confirming a transaction provided by an embodiment of the present application;

[0074] Figure 3 This is a flowchart of a transaction processing method for a blockchain network provided in an embodiment of the present application;

[0075] Figure 4 This is a schematic diagram of a scenario for generating execution commitment information provided by an embodiment of the present application;

[0076] Figure 5 This is a schematic diagram of a scenario in which a challenge mechanism is applied according to an embodiment of the present application;

[0077] Figure 6 This is a flow chart of a sequencer registration process provided by an embodiment of the present application;

[0078] Figure 7 This is a flow chart of a method for pre-confirming a transaction provided by an embodiment of the present application;

[0079] Figure 8 This is a flowchart of a method for initiating a challenge by executing a commitment message provided in an embodiment of the present application;

[0080] Figure 9 This is a schematic diagram of the structure of a transaction processing device for a blockchain network provided in an embodiment of the present application;

[0081] Figure 10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0082] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in this application. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.

[0083] This application relates to blockchain-related technologies. Blockchain is a novel application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (for anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0084] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operations. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, it 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 performs interface adaptation analysis and authentication processing (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus Management), and after encryption, it is transmitted completely and consistently to the shared ledger (network communication) and recorded and stored; the smart contract module is responsible for the registration, issuance, triggering and execution of contracts. 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 to complete the contract logic. At the same time, it also provides the function of contract upgrade and cancellation; the operation module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product operation during the product release process, such as alarm, network status monitoring, node equipment health status monitoring, etc.

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

[0086] This application mainly describes how to implement the execution of blockchain transactions and related pre-confirmation in a second-layer blockchain network.

[0087] First of all, it should be noted that all data collected in this application (such as target transactions, execution commitment information, transaction key pairs of transaction sequencers and other related data) are collected with the consent and authorization of the object to which the data belongs (such as users, institutions or enterprises), and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions.

[0088] Here, the relevant technical concepts involved in this application are explained:

[0089] Smart contract: refers to a computer program that can automatically execute contract terms, with features such as event-driven, value transfer, and automatic execution.

[0090] Blockchain Layer 2: The Layer 1 network is the underlying blockchain, while the Layer 2 network is built on top of the Layer 1 network. Transactions on the Layer 2 network do not require complex decentralized consensus, significantly reducing transaction costs. Layer 2 transactions only require batch submission of the necessary compressed transaction data and status to the Layer 1 network. Combined with validity proofs or challenge mechanisms, the Layer 1 network ensures the correctness of transactions executed on the Layer 2 network. This reduces transaction costs while maintaining the same security as the Layer 1 network.

[0091] Sequencer (also known as transaction sequencer): In the second-layer network of the blockchain, transactions are collected and executed by the sequencer. After collecting and executing enough transactions, the sequencer can construct a transaction batch and then submit the transaction batch and the corresponding transaction status to the first-layer network.

[0092] See Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a transaction client and a blockchain network. The blockchain network may include a first network layer and a second network layer. The transaction client may initiate a transaction to the second network layer. The second network layer may execute the transaction initiated by the transaction client. The second network layer may construct a transaction batch through a number of accumulated executed transactions and may submit the transaction batch to the first network layer, so that the first network layer may verify (also understood as confirm) the transactions executed by the second network layer.

[0093] For example, a transaction client can initiate a target transaction to the second network layer. After receiving and executing the target transaction, the second network layer can return an execution commitment message to the transaction client. This execution commitment message can be a statement from the second network layer to the transaction client declaring the target transaction successfully executed. Therefore, the transaction client can use the execution commitment message returned by the second network layer to pre-confirm the target transaction, that is, pre-confirm the execution result of the target transaction. Specifically, the transaction client's pre-confirmation of the target transaction can mean pre-confirming that the target transaction has been successfully executed by the second network layer, or pre-confirming that the target transaction has not been successfully executed by the second network layer. Final confirmation of whether the target transaction has been successfully executed by the second network layer can be achieved in the first network layer. For example, once the target transaction is successfully verified in the first network layer and consensus is uploaded to the blockchain, it can be indicated that the target transaction has completed final confirmation in the first network layer, that is, final confirmation that the target transaction has indeed been successfully executed. Typically, the transaction client only needs to pre-confirm the target transaction to confirm whether the target transaction has been successfully executed, without having to wait until the target transaction has completed final confirmation in the first network layer to confirm whether the target transaction has been successfully executed.

[0094] Among them, the transaction client can be a client in the terminal device, the first network layer and the second network layer can both include several blockchain nodes, and a blockchain node can be composed of one or more servers.

[0095] Optionally, the servers that constitute blockchain nodes can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (content delivery network), and big data and artificial intelligence platforms. The terminal devices belonging to the transaction client can be smart terminals such as smartphones, tablets, laptops, desktop computers, smart TVs, in-vehicle terminals, and smart home devices.

[0096] Please also see Figure 2 , Figure 2 This is a schematic diagram of a scenario for pre-confirming a transaction provided by an embodiment of the present application. Figure 2As shown, if the transaction client pre-confirms that the execution result of the target transaction is a failure through the execution commitment information returned by the second network layer, the transaction client can use the execution commitment information as a credential to initiate a challenge to the second network layer to the first network layer. When the first network layer determines that the execution commitment information was issued by the second network layer and that there is indeed an abnormality in the execution of the target transaction (which can be understood as the transaction client successfully challenging the second network layer), the first network layer can have the second network layer compensate the transaction client (actually, the user to whom the transaction client belongs), such as transferring the resources pledged by the second network layer in the first network layer to the corresponding account address provided by the transaction client. This specific process can also be found in the relevant descriptions of the following embodiments.

[0097] By adopting the method provided in this application, after the transaction is executed by the second network layer, the transaction client can immediately pre-confirm the transaction through the execution commitment information for the transaction returned by the second network layer, thereby improving the efficiency of pre-confirming the transaction.

[0098] See Figure 3 , Figure 3 This is a flowchart of a transaction processing method for a blockchain network provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be a transaction client, which can be any user client that can initiate a transaction to be executed in the blockchain network. The transaction initiated by the transaction client can be submitted to the blockchain network for execution. Figure 3 As shown, the method may include:

[0099] Step S101: Generate a target transaction and send the target transaction to the second network layer so that the second network layer executes the target transaction.

[0100] Optionally, the blockchain network in this application may be a two-layer blockchain network, that is, the blockchain network in this application may include a two-layer network, which may include a first network layer and a second network layer. The first network layer may include a number of blockchain nodes, and the blockchain nodes in the first network layer may be used to execute services in the first network layer. The second network layer may also include a number of blockchain nodes, and the blockchain nodes in the second network layer may be used to execute services in the second network layer. A blockchain node may be a computer device or a cluster of multiple computer devices. Therefore, it is understood that in the following process, the operations performed by the first network layer may be performed by the blockchain nodes in the first network layer, and the operations performed by the second network layer may be performed by the blockchain nodes in the second network layer.

[0101] The second network layer can be used to execute transactions initiated by the transaction client. The second network layer can submit executed transaction batches to the first network layer. The first network layer can be used to verify the transactions executed by the second network layer (i.e., submitted transactions) and can also perform consensus on the transactions and upload them to the blockchain. The second network layer can be the aforementioned second-layer network, and the first network layer can be the aforementioned first-layer network.

[0102] For example, after executing a set threshold number of transactions (such as 100) in total, the second network layer can form a transaction batch (including each executed transaction itself and the transaction status of each transaction) through the transactions executed within the threshold number, and can submit the transaction batch to the first network layer so that the first network layer can verify (i.e., confirm) each transaction in the transaction batch.

[0103] Among them, when the second network layer submits a transaction batch to the first network layer, it can also be submitted in the form of a transaction. For example, the second network layer can generate a batch submission transaction based on the transaction batch. The batch submission transaction includes the transaction batch. The second network layer can send the batch submission transaction to the first network layer. The first network layer can verify the transactions in the transaction batch through the batch submission transaction.

[0104] Furthermore, after successfully verifying all transactions in the transaction batch, the first network layer can package the transactions in the transaction batch into a block, and can execute the consensus chain process for the block in the blockchain network.

[0105] Optionally, the method for the first network layer to verify the transaction can be set according to the actual application scenario. For example, the first network layer can verify the transaction through a challenge mechanism, or through supervision and reporting, etc.

[0106] Furthermore, the second network layer can be configured with a transaction sequencer, which can be configured on a blockchain node within the second network layer. The second network layer can execute transactions initiated by transaction clients based on the transaction sequencer. In fact, operations performed by the second network layer can also be performed by the transaction sequencer configured within the second network layer. The transaction sequencer can have a transaction key pair, which can include a private transaction key and a public transaction key of the transaction sequencer. Data encrypted using the private transaction key can be decrypted using the public transaction key.

[0107] The transaction sequencer's transaction key pair may be generated by the transaction sequencer itself. The transaction sequencer may submit the transaction public key in the generated transaction key pair to the first network layer for identity registration at the first network layer. The first network layer may store the transaction public key of the transaction sequencer and use the stored transaction public key to verify transactions executed by the transaction sequencer. The operations performed by the transaction sequencer may also be operations performed by the second network layer.

[0108] Optionally, a transaction verification contract can be deployed in the first network layer. This transaction verification contract can be used to verify the execution commitment information subsequently returned to the transaction client by the second network layer, allowing the second network layer to compensate the transaction client. When the transaction sequencer registers with the first network layer, the second network layer (or the transaction sequencer itself) can send the transaction sequencer's public transaction key to the transaction verification contract, allowing the transaction verification contract to store the transaction sequencer's public transaction key. In other words, the transaction verification contract can store the transaction sequencer's public transaction key.

[0109] The trading client can generate (i.e., initiate) a target transaction. A target transaction can be any transaction that needs to be executed on the blockchain network. For example, a user can initiate a target transaction by clicking the Initiate Transaction button in the trading client.

[0110] For example, the target transaction may be a resource transfer transaction, such as one that transfers resources from a user of the transaction client to one or more other users. Another example may be an asset purchase transaction, such as one that allows a user of the transaction client to transfer several general resources to another user in order to purchase a specific electronic asset from the other user. The specific nature of the target transaction can be determined based on the actual application scenario and is not limited in this application.

[0111] The transaction client may send the generated target transaction to the second network layer, so that the second network layer may execute the target transaction through the transaction sequencer.

[0112] Step S102: Receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer.

[0113] Optionally, the transaction client may receive execution commitment information returned by the second network layer. The execution commitment information may be commitment information generated by the second network layer for the target transaction after executing the target transaction. The execution commitment information is used by the second network layer to declare to the transaction client that the target transaction has been successfully executed in the second network layer. It can be understood that the execution commitment information may be a certificate for the second network layer to execute the target transaction.

[0114] The execution commitment information may encapsulate execution attribute information related to the target transaction, as well as signature data of the execution attribute information. The signature data may be obtained by the second network layer using the transaction sequencer's private transaction key to sign the execution attribute information. For example, the signature data may be obtained by the second network layer encrypting the hash value of the execution attribute information using the transaction sequencer's private transaction key.

[0115] Optionally, the execution attribute information may include at least one of the following: a transaction hash value of the target transaction, a transaction sequence number when the target transaction is executed in the second network layer, a transaction status after the target transaction is executed, and a target account address.

[0116] The transaction sequence number of the target transaction may indicate the transaction number of the target transaction executed in the second network layer. For example, the transaction sequence number of the first transaction executed in the second network layer may be 1, the transaction sequence number of the second transaction executed in the second network layer may be 2, and so on.

[0117] The transaction hash value of the target transaction can be obtained by hashing the target transaction. The transaction status of the target transaction can be the status of the relevant account after the target transaction is executed. For example, the target transaction is initiated by the target object (which can be the user of the transaction client). The target transaction can be to transfer 100 blocks from the target object's account address to another account address. If the target object's account address has a total of 500 blocks before the target transaction is executed, then after the target transaction is executed, the transaction status of the target transaction can be used to indicate that the balance in the target object's account address has changed from 500 to 400.

[0118] The target account address can be the account address used by the first network layer to execute the second network layer's resource transfer processing for the transaction client when the second network layer commits a malicious act (e.g., when the execution commitment information returned by the second network layer is incorrect). In other words, the target account address is the account address used by the transaction client's user to receive transaction compensation from the second network layer. When the transaction client sends the generated target transaction to the second network layer, it can also send the target account address to the second network layer.

[0119] See Figure 4 , Figure 4 This is a schematic diagram of a scenario for generating execution commitment information provided by an embodiment of the present application. After receiving the target transaction, the second network layer can obtain the transaction hash value of the target transaction (which can be obtained by hashing the target transaction), the transaction sequence number of the target transaction (which can be obtained by adding 1 to the maximum transaction sequence number currently in the second network layer), the transaction status of the target transaction (which can be generated after executing the target transaction), and the target account address.

[0120] Therefore, the transaction hash value of the target transaction, the transaction serial number of the target transaction, the transaction status of the target transaction and the target account address can constitute the execution attribute information related to the target transaction. The second network layer can use the transaction private key of the transaction sequencer to sign the execution attribute information to generate the signature data of the execution attribute information.

[0121] The second network layer can encapsulate the execution attribute information and the signature data of the execution attribute information together to obtain the execution commitment information of the target transaction.

[0122] Step S103: Pre-confirm the execution result of the target transaction based on the execution commitment information.

[0123] Optionally, the transaction client may pre-confirm the execution result of the target transaction through the execution commitment information returned through the second network layer, as described below.

[0124] The transaction client can perform a correctness check on the execution commitment information and obtain a test result. This test result can be used to indicate whether the execution commitment information is correct or not. Furthermore, the transaction client can use this test result to pre-confirm the execution result of the target transaction. Pre-confirmation of the execution result of the target transaction can be used to pre-confirm whether the target transaction was successfully executed or failed in the second network layer.

[0125] Among them, if the detection result is that the execution commitment information is not correct, the result of the transaction client's pre-confirmation of the target transaction may be that the execution result of the target transaction is a failure to execute the target transaction; if the detection result is that the execution commitment information is correct, the result of the transaction client's pre-confirmation of the target transaction may be that the execution result of the target transaction is a successful execution of the target transaction.

[0126] In a feasible implementation, the process of the transaction client performing a correctness check on the execution commitment information to obtain the test result of the execution commitment information may include the following aspects:

[0127] ① The transaction client can verify whether the signature data in the execution commitment information is legal (i.e., correct). This process may include: the transaction client can obtain the transaction public key of the transaction sequencer from the first network layer, and the transaction client can use the obtained transaction public key to decrypt the signature data in the execution commitment information to obtain a decrypted hash value.

[0128] The transaction client can also perform a hash calculation on the execution attribute information in the execution commitment information to generate a hash value of the execution attribute information. The transaction client can compare the generated hash value with the above-mentioned decrypted hash value. If the generated hash value is consistent with the decrypted hash value (i.e., the same), it can be determined that the signature data in the execution commitment information is correct (i.e., legal), which means that the signature data in the execution commitment information is signed by the first network layer through the transaction private key of the transaction sequencer.

[0129] If the generated hash value is inconsistent with the decrypted hash value (i.e., different), then it can be determined that the signature data in the execution commitment information is incorrect (i.e., not legal), indicating that the signature data in the execution commitment information was not signed by the first network layer using the transaction private key of the transaction sequencer. At this time, a detection result indicating that the execution commitment information is incorrect can be generated, i.e., the detection result of the execution commitment information is incorrect. Furthermore, at this time, the execution result of the target transaction can be pre-confirmed as execution failure based on the detection result of the execution commitment information being incorrect, i.e., the result of the pre-confirmation of the target transaction is that the target transaction has failed to execute.

[0130] ② The execution attribute information may also include the transaction hash value of the target transaction. The transaction client may also verify the legality (i.e., correctness) of the transaction hash value in the execution attribute information in the execution commitment information. This process may include: the transaction client may perform hash calculation on the target transaction initiated by itself, and may generate a hash value of the target transaction. The transaction client may compare the generated hash value with the transaction hash value in the execution attribute information.

[0131] If the generated hash value is consistent with (i.e., the same as) the transaction hash value in the execution attribute information, the transaction client can determine that the transaction hash value in the execution attribute information is correct (i.e., legal), that is, the transaction hash value in the execution attribute information is correct.

[0132] Conversely, if the generated hash value is inconsistent (i.e., different) from the transaction hash value in the execution attribute information, the transaction client can determine that the transaction hash value in the execution attribute information is incorrect (i.e., not legal), that is, the transaction hash value in the execution attribute information is incorrect. In this case, the transaction client can also generate a detection result that the execution commitment information is incorrect, that is, the detection result of the execution commitment information is incorrect. Moreover, at this time, the execution result of the target transaction can also be pre-confirmed as execution failure based on the detection result of the execution commitment information being incorrect, that is, the result of the pre-confirmation of the target transaction is the failure of the target transaction execution.

[0133] ③ The execution attribute information may include the transaction sequence number when the target transaction is executed in the second network layer. The transaction client may also verify the legitimacy (also understood as correctness) of the transaction sequence number in the execution attribute information in the execution commitment information. The process is described as follows.

[0134] The transaction client needs to ensure that the difference between the transaction sequence number in the execution commitment information and the transaction sequence number of the latest transaction currently submitted in the first network layer (that is, the maximum transaction sequence number of the transactions currently submitted in the first network layer) is within a controllable range (that is, within a limited range) to ensure that the corresponding transaction confirmed by the first network layer (that is, the transaction successfully verified by the first network layer) can be queried from the first network layer in a short time through the transaction sequence number, so as to finally confirm whether the transaction sequencer of the second network layer is malicious, that is, to finally confirm whether the second network layer has actually successfully executed the target transaction.

[0135] Therefore, the trading client can query the first network layer for the maximum transaction sequence number of the currently submitted transaction (such as when the execution commitment information is received), and the trading client can calculate the sequence number difference between the maximum transaction sequence number and the transaction sequence number in the execution attribute information. For example, the sequence number difference can be the difference obtained by subtracting the transaction sequence number in the execution attribute information from the maximum transaction sequence number.

[0136] The transaction client can compare the sequence number difference with a preset difference threshold. If the sequence number difference is less than or equal to the preset difference threshold, the transaction sequence number in the execution attribute information can be determined to be correct (i.e., legal), indicating that the value of the transaction sequence number in the execution attribute information is within a reasonable range. The difference threshold can be reasonably set based on actual application conditions, and this application does not impose any restrictions on the specific value of the difference threshold.

[0137] Conversely, if the sequence number difference is greater than the preset difference threshold, it can be determined that the transaction sequence number in the execution attribute information is incorrect (i.e., it is not legal), indicating that the value of the transaction sequence number in the execution attribute information is not within a reasonable range. In this case, the transaction client can also generate a detection result that the execution commitment information is incorrect, that is, the detection result of the execution commitment information is that the execution commitment information is incorrect. Moreover, at this time, the execution result of the target transaction can also be pre-confirmed as execution failure based on the detection result of the execution commitment information being incorrect, that is, the result of the pre-confirmation of the target transaction is that the target transaction execution failed.

[0138] ④ The execution attribute information may include the target account address. The transaction client may also verify the correctness (i.e., legitimacy) of the target account address in the execution attribute information in the execution commitment information. That is, the transaction client may verify whether the target account address in the execution attribute information is the same as the target account address sent by itself to the second network layer. If the target account address in the execution attribute information is the same as the target account address sent by itself to the second network layer, the transaction client may determine that the target account address in the execution attribute information is correct (i.e., legitimacy), indicating that the target account address in the execution attribute information is correct.

[0139] Conversely, if the target account address in the execution attribute information is not the same as the target account address sent to the second network layer, the transaction client can determine that the target account address in the execution attribute information is incorrect (i.e., it is not legal), indicating that the target account address in the execution attribute information is incorrect. In this case, the transaction client can also generate a detection result that the execution commitment information is incorrect, that is, the detection result of the execution commitment information is incorrect. Moreover, at this time, the execution result of the target transaction can also be pre-confirmed as execution failure based on the detection result of the execution commitment information being incorrect, that is, the result of the pre-confirmation of the target transaction is that the target transaction execution failed.

[0140] If the transaction client verifies that all information in the execution commitment information (including the aforementioned signature data, transaction hash value, transaction sequence number, and target account address) is correct (i.e., verified to be legal), the transaction client can generate a test result that the execution commitment information is correct. In other words, the test result of the execution commitment information can be that the execution commitment information is correct. In this case, the transaction client can use the test result that the execution commitment information is correct to pre-confirm that the execution result of the target transaction is successful. In other words, the result of the pre-confirmation of the target transaction is that the execution result of the target transaction is successful.

[0141] Step S104: If the pre-confirmation result indicates that the execution result of the target transaction is execution failure, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

[0142] Specifically, if the result of pre-confirmation of the target transaction indicates that the execution result of the target transaction is an execution failure, the transaction client can initiate a challenge to the second network layer to the first network layer through the execution commitment information returned by the second network layer, so that the first network layer can execute the resource transfer processing of the second network layer for the transaction client (that is, realize the transaction compensation of the second network layer for the transaction client).

[0143] In addition, except when the result of the pre-confirmation of the target transaction indicates that the execution result of the target transaction is an execution failure, at any time after the second network layer returns the execution commitment information to the transaction client to confirm that it has executed the target transaction, as long as the user of the transaction client finds that there is an abnormality in the execution of the target transaction, the user of the transaction client can initiate a challenge to the second network layer to the first network layer through the execution commitment information returned by the second network layer on the transaction client (i.e., apply the challenge mechanism).

[0144] Optionally, if the transaction client fails to verify the signature data in the execution commitment information using the transaction public key obtained from the first network layer, then since there is no guarantee that the execution commitment information obtained by the transaction client is provided by the second network layer, in this case, it is also possible to initiate a challenge to the second network layer to the first network layer without using the execution commitment information.

[0145] In this case, if the target transaction is to sell a physical asset of the user of the transaction client to another user, so that the user of the transaction client (which can be a merchant) can obtain the digital asset provided by the other user (the digital asset is the asset used to purchase the digital resource), but the result of the pre-confirmation of the target transaction is that the target transaction fails to execute (because the signature data in the execution commitment information is not correct), it indicates that the user of the transaction client has not received the digital asset provided by the other user. At this time, the user of the transaction client does not need to give the physical asset to the other user, so that the user of the transaction client will not suffer any loss.

[0146] The execution commitment information may encapsulate the target account address and the transaction sequence number of the target transaction when it is executed in the second network layer. In a feasible implementation, the transaction client initiates a challenge to the second network layer from the first network layer, so that the first network layer can execute the resource transfer processing of the second network layer for the transaction client, which may include:

[0147] The transaction client can query the first network layer for the transaction to which the transaction number in the execution commitment information belongs. For example, the transaction client can send a transaction query request to the first network layer. The transaction query request can include the transaction number in the execution commitment information, which is also the transaction number of the transaction to be queried.

[0148] The transaction client can obtain the transaction query information returned by the first network layer for the queried transaction (i.e., the transaction to which the transaction number in the execution commitment information belongs). The transaction query information is the relevant information recorded in the first network layer including the queried transaction. The transaction query information may include the transaction hash value, transaction status and transaction verification result of the queried transaction.

[0149] Among them, the transaction verification result can be recorded as is_confirmed, and is_confirmed is the verification result of the transaction in the first network layer. The transaction verification result can also be called the transaction confirmation result. If the is_confirmed of the transaction is 1 (which can be called the first value), it indicates that the transaction has been successfully verified (i.e., confirmed) in the first network layer, which also indicates that the transaction has been confirmed to be successfully executed in the first network layer. If the is_confirmed of the transaction is 0 (which can be called the second value), it indicates that the transaction has not been successfully verified (i.e., not confirmed) in the first network layer, which also indicates that the transaction has not been confirmed to be successfully executed in the first network layer. In this application, the transaction client needs to ensure that the value of the transaction verification result is_confirmed in the transaction query information returned by the first network layer for the queried exchange is 1. Only when the value of the transaction verification result is_confirmed is 1, the transaction hash value and transaction status in the transaction query information are truly available, because the transaction to which the transaction hash value and transaction status belong has been successfully verified (i.e., confirmed) in the first network layer.

[0150] Optionally, if the value of the transaction verification result is_confirmed in the first network layer of the transaction to which the queried transaction sequence number belongs is not 1, it indicates that the transaction has not been confirmed in the first network layer, and the transaction hash value and transaction status of the transaction have not been truly recorded in the first network layer. At this time, the transaction client can wait for the transaction to which the transaction sequence number in the execution attribute information belongs to be confirmed in the first network layer (that is, after successful verification), and then re-initiate a challenge to the first network layer for the second network layer.

[0151] The transaction client can initiate a challenge to the second network layer from the first network layer through the transaction query information and execution commitment information. The first network layer can execute the resource transfer processing of the second network layer for the transaction client through the target account address in the transaction execution commitment information, as described below.

[0152] The execution commitment information encapsulates the transaction hash value of the target transaction. The transaction client can compare the transaction hash value in the transaction query information returned by the first network layer with the transaction hash value in the execution commitment information. If the transaction hash value in the transaction query information is inconsistent with the transaction hash value in the execution commitment information, the transaction client can consider that the second network layer is malicious. The transaction client can initiate a challenge to the second network layer to the first network layer through the execution commitment information. For example, the transaction client can send the execution commitment information provided by the second network layer to the first network layer, so as to initiate a challenge to the second network layer to the first network layer through the execution commitment information.

[0153] This process mainly takes into account the malicious situation (i.e., malicious scenario) in which the transaction hash value corresponding to the transaction number in the execution commitment information (such as the transaction hash value of the transaction to which the transaction number belongs) is not the transaction hash value of the actual transaction (such as the target transaction) when the second network layer submits the corresponding transaction batch to the first network layer.

[0154] Furthermore, the execution commitment information also encapsulates the transaction status of the target transaction. The transaction client can compare the transaction status in the transaction query information returned by the first network layer with the transaction status in the execution commitment information. If the transaction status in the transaction query information is inconsistent with the transaction status in the execution commitment information, the transaction client may also believe that the second network layer is malicious. The transaction client may initiate a challenge to the second network layer from the first network layer through the execution commitment information. For example, the transaction client may send the execution commitment information provided by the second network layer to the first network layer, so as to initiate a challenge to the second network layer from the first network layer through the execution commitment information.

[0155] This process mainly takes into account the malicious situation (i.e., malicious scenario) in which the transaction status in the execution commitment information is not the actual transaction status of the actual transaction (such as the target transaction) when the second network layer submits the corresponding transaction batch to the first network layer.

[0156] Since the execution commitment information may encapsulate the execution attribute information of the target transaction and the signature data of the second network layer for the execution attribute information, and the execution attribute information may include the transaction hash value, transaction sequence number, and transaction status of the target transaction, when the first network layer receives the challenge initiated by the transaction client to the second network layer, the process of executing the resource transfer processing of the second network layer for the transaction client may include:

[0157] Optionally, a transaction verification contract (which may be a smart contract used to verify transactions to implement resource transfer processing) may be deployed in the first network layer. The challenge initiated by the transaction client to the second network layer may be initiated to the transaction verification contract. The second network layer may have pledged resources in the transaction verification contract. The pledged resources are resources pledged by the second network layer to the first network layer to prevent the second network layer from doing malicious things. The pledged resources may be digital resources. The specific amount of the pledged resources may be determined based on the actual application scenario. The pledged resources may be resources pledged to the first network layer when the transaction sequencer of the second network layer registers its identity with the first network layer (such as when sending the transaction public key to the first network layer). The pledged resources may be resources belonging to the object to which the transaction sequencer belongs (such as the institution or enterprise to which the transaction sequencer belongs).

[0158] When the transaction verification contract receives a challenge initiated by the transaction client to the second network layer, it can verify the signature data in the execution commitment information. For example, the transaction verification contract uses the recorded transaction public key to verify the signature data. The verification process is the same as the process of verifying the signature data by the above-mentioned transaction client.

[0159] After the transaction verification contract successfully verifies the signature data in the execution commitment information, it can query the transaction hash value and transaction status of the transaction to which the transaction number in the execution attribute information (in the execution commitment information) belongs in the first network layer. The queried transaction hash value and transaction status are truly recorded in the first network layer, and the transaction verification contract needs to ensure that the transaction to which the queried transaction number belongs is a successfully verified (i.e., confirmed) transaction in the first network layer. That is, the transaction verification result is_confirmed of the transaction to which the queried transaction number belongs in the first network layer needs to be 1. At this time, the relevant information of the transaction to which the queried transaction number belongs in the first network layer (such as transaction hash value and transaction status) is truly available.

[0160] If the transaction hash value queried by the transaction verification contract is inconsistent with the transaction hash value in the execution attribute information, or the queried transaction status is inconsistent with the transaction status in the execution attribute information, it indicates that the second network layer has done something malicious, and the transaction hash value or transaction status in the execution commitment information returned by the second network layer to the transaction client is abnormal. Therefore, when the transaction verification contract detects that the queried transaction hash value is inconsistent with the transaction hash value in the execution attribute information, or when the queried transaction status is inconsistent with the transaction status in the execution attribute information, the pledged resources of the second network layer in the transaction verification contract can be transferred to the target account address, thereby compensating the pledged resources of the second network layer to the user to whom the transaction client belongs.

[0161] Furthermore, if the transaction verification result is_confirmed of the transaction queried by the transaction verification contract based on the transaction serial number in the execution attribute information in the first network layer has a value of 0, but the transaction has been verified in the first network layer, but the verification result of the transaction is verification failure (i.e., unsuccessful confirmation), this situation also indicates that the transaction is indeed problematic (it can be understood that the transaction failed to execute). Since the transaction verification contract has successfully verified the signature data in the execution commitment information, that is, it has been verified that the execution commitment information provided by the transaction client is indeed provided by the second network layer, then the transaction verification contract can also transfer the pledged resources of the second network layer in the transaction verification contract to the target account address, thereby compensating the pledged resources of the second network layer to the user to whom the transaction client belongs.

[0162] See Figure 5 , Figure 5 This is a schematic diagram of a scenario in which an application challenge mechanism is applied in an embodiment of the present application. Figure 5 As shown, the transaction client can send the execution commitment information to the transaction verification contract to initiate a challenge to the second network layer. The transaction verification contract can detect the execution commitment information sent by the transaction client. If it is detected that the execution commitment information is indeed generated by the second network layer and that the execution commitment information is indeed abnormal, it indicates that the transaction client's challenge to the second network layer is successful. The transaction verification contract can transfer the pledged resources of the second network layer to the target account address provided by the transaction client, thereby achieving transaction compensation for the user of the transaction client and implementing a penalty for malicious behavior of the second network layer (i.e., the penalty for malicious behavior of the transaction sequencer).

[0163] Through the above process of the present application, the transaction client can immediately pre-confirm the target transaction through the execution commitment information returned by the second network layer after executing the target transaction, without having to wait until the transaction batch to which the target transaction belongs is submitted to the first network layer, so that the first network layer can pre-confirm the target transaction after successfully verifying it. Therefore, the time spent on pre-confirming the target transaction is greatly reduced, and the efficiency of pre-confirming the target transaction is improved.

[0164] In addition, the execution commitment information used for pre-confirmation in the present application is guaranteed based on the challenge mechanism. When the target transaction is not executed normally on the second network layer, the transaction client can initiate a challenge to the second network layer to the first network layer through the execution commitment information, so that the user of the transaction client can obtain transaction compensation provided by the second network layer. In this case, even if there is a problem with the execution of the target transaction, the user of the transaction client will not suffer any transaction loss after obtaining the transaction compensation provided by the second network layer. Therefore, the reliability of the pre-confirmation of the target transaction by the present application can also be guaranteed by combining the execution commitment information of the present application with the challenge mechanism.

[0165] The blockchain network in the present application may include a first network layer and a second network layer. The second network layer is used to execute transactions initiated by the transaction client, and the first network layer is used to verify transactions executed by the second network layer. Therefore, the transaction client can generate a target transaction and send the target transaction to the second network layer, so that the second network layer executes the target transaction; it can also receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer; the transaction client can pre-confirm the execution result of the target transaction based on the execution commitment information; if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, the transaction client can initiate a challenge to the second network layer to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client. It can be seen that after the method proposed in the present application executes the target transaction on the second network layer, the transaction client can receive the execution commitment information returned by the second network layer. The transaction client can immediately pre-confirm the target transaction through the execution commitment information, thereby improving the efficiency of pre-confirmation of the target transaction. Moreover, when the result of the pre-confirmation of the target transaction is an execution failure, the second network layer can also be punished. For example, the execution commitment information provided by the second network layer can be used to initiate a challenge to the second network layer to the first network layer, so that the first network layer can execute the resource transfer processing of the second network layer for the transaction client. Therefore, this also ensures the reliability of the pre-confirmation of the target transaction.

[0166] See Figure 6 , Figure 6 This is a flow chart of a sequencer registration process provided by an embodiment of the present application. Figure 6 As shown, the second-layer network sequencer is the transaction sequencer in the second network layer, and the first-layer network smart contract is the transaction verification contract in the first network layer. The process may include:

[0167] Step S201: The Layer 2 network sequencer can generate a pair of public and private keys for identifying itself.<pk,sk> , this pair of public and private keys is the above-mentioned transaction key pair, pk represents the above-mentioned transaction public key, and sk represents the above-mentioned transaction private key.

[0168] In step S202, the Layer 2 sequencer can submit the generated public key pk to the Layer 1 smart contract, so that the Layer 1 smart contract can store the public key pk. The Layer 2 sequencer can then register with the Layer 1 smart contract using the public key pk. The Layer 2 sequencer's public key pk can then be used to represent its identity. Furthermore, the Layer 2 sequencer can submit a deposit stake to the Layer 1 smart contract. The deposit stake can be the aforementioned pledged resources of the Layer 2 sequencer with the Layer 1 smart contract.

[0169] In step S203, the first-layer network smart contract registers the identity of the second-layer network sequencer through the public key pk and, upon receiving the deposit stake submitted by the second-layer network sequencer, returns a prompt message indicating that the registration is successful to inform the second-layer network sequencer that the registration is successful.

[0170] Through the above process, the rapid registration of the transaction sequencer is achieved, and the object to which the transaction sequencer belongs (such as an enterprise or institution) can be required to be a secure object within the specified range that can register the sequencer, thereby ensuring the security of the sequencer registration.

[0171] See Figure 7 , Figure 7 This is a flow chart of a method for pre-confirming a transaction provided by an embodiment of the present application. Figure 7 As shown, the second-layer network user may refer to a transaction client (or may also be understood as the user to which the transaction client belongs), the second-layer network sequencer is the transaction sequencer in the second network layer, and the first-layer network smart contract is the transaction verification contract in the first network layer. The method may include:

[0172] In step S301, the Layer 2 network user may request the Layer 2 network sequencer to execute a transaction tx, where the transaction tx may represent the target transaction. The Layer 2 network user may also pass a refund_address to the Layer 2 network sequencer, where the refund_address may be the target account address.

[0173] In step S302, the layer 2 network sequencer may execute the transaction tx. If the transaction tx is a transfer transaction, the corresponding transfer processing may be performed according to the instructions of the transfer transaction.

[0174] In step S303, the layer 2 network sequencer may perform a hash calculation on the transaction, i.e., hash(tx), to generate a transaction hash value tx_id of the transaction tx.

[0175] In step S304, the layer 2 network sequencer may obtain the global sequence number index of the transaction tx execution. The global sequence number index is the transaction sequence number when the transaction tx is executed at the layer 2 network sequencer.

[0176] In step S305, the layer 2 network sequencer may obtain the state root state_root in the layer 2 network (i.e., the second network layer) after the transaction tx is executed. The state root state_root may be the transaction state after the transaction tx is executed.

[0177] Step S306: The Layer 2 network sequencer can use the private key sk (i.e. the above transaction private key) to<tx_id,index,state_root,refund_address> Perform signature processing to generate sign,<tx_id,index,state_root,refund_address> For the above-mentioned execution attribute information, the sign is the signature data of the execution attribute information.

[0178] Step S307: After the transaction tx is successfully executed, the Layer 2 network sequencer can return a commitment to the Layer 2 network user.<tx_id,index,state_root,refund_address> , sign>, the commitment is the above-mentioned execution commitment information.

[0179] In step S308, the Layer 2 network user can query the Layer 1 network smart contract and obtain the public key pk (i.e., the transaction public key) of the sequencer (i.e., the Layer 2 network sequencer).

[0180] In step S309, the first-layer network smart contract can return the public key pk of the sequencer to the second-layer network user.

[0181] In step S310, the Layer 2 network user can use the public key pk returned by the Layer 1 network smart contract to verify the commitment, that is, to verify whether the commitment is signed by the Layer 2 network sequencer. Specifically, the signature data sign in the commitment can be verified using the public key pk, and the signature verification of the signature data sign in the commitment must be successful.

[0182] In step S311, the Layer 2 user can also verify the correspondence between the tx_id in the commitment and the calculated tx_id, that is, verify whether the tx_id in the commitment is the transaction hash value calculated by the Layer 2 user for the transaction tx, and ensure that the tx_id in the commitment is the same as the transaction hash value calculated by the Layer 2 user for the transaction tx.

[0183] In step S312, the Layer 2 network user may also verify whether the refund_address in the commitment is equal to the incoming refund_address (i.e., the target account address sent to the Layer 2 network sequencer), and needs to ensure that the refund_address in the commitment is equal to the incoming refund_address.

[0184] In step S313, the second-layer network user can obtain the latest global serial number currently submitted to the first-layer network smart contract (i.e., the maximum transaction serial number currently submitted to the first-layer network smart contract) from the first-layer network smart contract.

[0185] In step S314, the first-layer network smart contract can query the latest global sequence number currently submitted and return the latest global sequence number to the second-layer network user.

[0186] In step S315, the second-layer network user can verify whether the difference between the global sequence number index in the commitment and the latest global sequence number returned by the first-layer network smart contract is less than or equal to the limit. The limit can be the above-mentioned difference threshold. The verification of this process needs to ensure that the difference between the global sequence number index in the commitment and the latest global sequence number returned by the first-layer network smart contract is less than or equal to the limit. That is, this application needs to ensure that the interval between the global sequence number index in the commitment and the current latest global sequence number submitted to the first-layer network sequencer is within the limit range.

[0187] In step S316, the Layer 2 network user can understand the transaction execution status through the state_root in the commitment. That is, they can determine whether the state_root obtained after executing the transaction tx meets expectations. For example, they can determine whether the change in the account balance of the Layer 2 network user indicated in the state_root meets expectations. This process needs to ensure that the state_root obtained after executing the transaction tx meets expectations.

[0188] Through these layers of verification and assurance, Layer 2 users can finally pre-confirm transactions, guaranteeing that the sequencer has successfully executed the transaction. If anomalies are subsequently discovered in the execution of the transaction, a commitment can be made to challenge the Layer 2 sequencer, prompting it to compensate. If verification at any step in the above process cannot be guaranteed, the Layer 2 user's pre-confirmation of the transaction will result in the transaction failing to execute.

[0189] Through the above process of this application, the second-layer network user can quickly pre-confirm the transaction tx through the commitment returned by the second-layer network sequencer, and ensure the reliability of the pre-confirmation result of the transaction tx.

[0190] See Figure 8 , Figure 8 This is a flow chart of a method for initiating a challenge by executing a commitment message provided in an embodiment of the present application. Figure 8 As shown, similarly, the second-layer network user here may refer to a transaction client (or may also be understood as a user to which the transaction client belongs), the second-layer network sequencer may be the transaction sequencer in the second network layer, and the first-layer network smart contract may be the transaction verification contract in the first network layer. The method may include:

[0191] In step S401, a Layer 2 network user may query the Layer 2 network sequencer for a transaction whose global sequence number is index in the commitment.

[0192] In step S402, the Layer 2 network sequencer may query the transaction whose global sequence number is the index in the commitment and return the relevant transaction information of the queried transaction to the Layer 2 network user. The queried relevant transaction information may include<tx_id,state_root,is_confirmed> The relevant transaction information of the query can be the above-mentioned transaction query information. The tx_id in the transaction query information is the transaction hash value of the queried transaction, the state_root in the transaction query information is the transaction status of the queried transaction, and the is_confirmed in the transaction query information is the transaction verification result of the queried transaction in the first network layer (i.e., the first network layer).

[0193] In step S403, the Layer 2 network user determines whether the is_confirmed field in the transaction query information returned by the Layer 2 network sequencer is true (e.g., whether the value is 1). The user must ensure that the is_confirmed field in the transaction query information is true, i.e., that the queried transaction has been successfully verified in the Layer 1 network. Only then is the other transaction information in the transaction query information truly usable.

[0194] In step S404, if the Layer 2 user detects that the returned tx_id (i.e., the tx_id in the returned transaction query information) is not equal to the tx_id in the commitment, or detects that the returned state_root (i.e., the state_root in the returned transaction query information) is not equal to the state_root in the commitment, indicating that there is an anomaly in the commitment, the Layer 2 user can initiate a challenge to the Layer 2 sequencer to the Layer 1 smart contract, and can submit the commitment provided by the Layer 2 sequencer to the Layer 1 smart contract.

[0195] In step S405, the first-layer network smart contract can query the public key pk of the second-layer network sequencer recorded by itself.

[0196] In step S406, the first-layer network smart contract can use the queried public key pk to verify the signature data sign in the commitment submitted by the second-layer network user, that is, to verify the signature data sign. It is necessary to ensure that the signature data sign is successfully verified to determine that the commitment is given by the second-layer network sequencer.

[0197] Step S407, the first layer network smart contract can query the transaction with the global serial number of the index in the commitment and obtain the transaction index of the query.<tx_id,state_root,is_confirmed> .

[0198] In step S408, the Layer 1 smart contract needs to confirm that the is_confirmed of the queried transaction is true, that is, it needs to ensure that the queried transaction has been successfully verified in the Layer 1 network. Only then is the other transaction information of the queried transaction truly available.

[0199] In step S409, the Layer 1 smart contract confirms that the queried tx_id (i.e., the tx_id of the queried transaction) is not equal to the tx_id in the commitment, or confirms that the queried state_root (i.e., the state_root of the queried transaction) is not equal to the state_root in the commitment, indicating that the commitment is indeed abnormal.

[0200] In step S410, the Layer 2 smart contract determines that the Layer 2 user has successfully challenged the Layer 2 sequencer. The Layer 2 smart contract can confiscate the Layer 2 sequencer's deposit stake (i.e., pledged resources) to compensate the user. That is, the Layer 2 sequencer's deposit stake can be transferred to the target account address provided by the Layer 2 user, that is, a transfer is made to the Layer 2 user.

[0201] Through the above process of this application, it is possible for a second-layer network user to initiate a challenge to the second-layer network sequencer through the commitment given by the second-layer network sequencer. By applying this challenge mechanism, the reliability of pre-confirming transactions using commitments can be guaranteed.

[0202] See Figure 9 , Figure 9 This is a schematic diagram of the structure of a transaction processing device of a blockchain network provided by an embodiment of the present application. Figure 9 As shown, the transaction processing device 90 of the blockchain network may include: a generation module 901, a receiving module 902, a pre-confirmation module 903 and an initiating module 904.

[0203] A generating module 901 is configured to generate a target transaction and send the target transaction to the second network layer so that the second network layer executes the target transaction;

[0204] Receiving module 902, configured to receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer;

[0205] A pre-confirmation module 903 is used to pre-confirm the execution result of the target transaction based on the execution commitment information;

[0206] The initiating module 904 is used to initiate a challenge to the second network layer to the first network layer based on the execution commitment information if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

[0207] Optionally, a transaction sequencer is configured in the second network layer. The second network layer executes transactions initiated by the transaction client based on the transaction sequencer. The transaction sequencer has a transaction key pair, and the transaction key pair includes a transaction private key and a transaction public key.

[0208] Among them, a transaction verification contract is deployed in the first network layer, and the second network layer is used to send the transaction public key of the transaction sequencer to the transaction verification contract, so that the transaction verification contract stores the transaction public key of the transaction sequencer.

[0209] Optionally, the execution commitment information encapsulates execution attribute information related to executing the target transaction, as well as signature data of the execution attribute information;

[0210] The signature data is obtained by the second network layer using the transaction private key of the transaction sequencer to sign the execution attribute information.

[0211] Optionally, the pre-confirmation module 903 pre-confirms the execution result of the target transaction based on the execution commitment information, including:

[0212] Performing a correctness check on the execution commitment information and obtaining the test result of the execution commitment information;

[0213] Pre-confirm the execution results of the target transaction based on the detection results.

[0214] Optionally, the pre-confirmation module 903 performs a correctness check on the execution commitment information to obtain a check result of the execution commitment information, including:

[0215] Obtain the transaction public key of the transaction sequencer from the first network layer;

[0216] Use the acquired transaction public key to decrypt the signature data in the execution commitment information to obtain the decrypted hash value;

[0217] Performing hash calculation on the execution attribute information in the execution commitment information to generate a hash value of the execution attribute information;

[0218] If the generated hash value is consistent with the decrypted hash value, the signature data in the execution commitment information is determined to be correct.

[0219] Optionally, the pre-confirmation module 903 is further configured to:

[0220] If the generated hash value is inconsistent with the decrypted hash value, it is determined that the signature data in the execution commitment information is not correct;

[0221] Generate a test result that the execution commitment information is not correct;

[0222] The pre-confirmation module 903 pre-confirms the execution result of the target transaction based on the detection result, including:

[0223] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0224] Optionally, the execution attribute information includes a transaction hash value of the target transaction. The pre-confirmation module 903 performs a correctness check on the execution commitment information to obtain a check result of the execution commitment information, including:

[0225] Perform hash calculation on the initiated target transaction to generate the hash value of the target transaction;

[0226] Compare the generated hash value with the transaction hash value in the execution attribute information;

[0227] If the generated hash value is consistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is correct.

[0228] Optionally, the pre-confirmation module 903 is further configured to:

[0229] If the generated hash value is inconsistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is not correct;

[0230] Generate a test result that the execution commitment information is not correct;

[0231] The pre-confirmation module 903 pre-confirms the execution result of the target transaction based on the detection result, including:

[0232] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0233] Optionally, the execution attribute information includes a transaction sequence number when the target transaction is executed in the second network layer. The pre-confirmation module 903 performs a correctness check on the execution commitment information to obtain a test result of the execution commitment information, including:

[0234] Query the first network layer for the maximum transaction sequence number of the currently submitted transaction;

[0235] Calculate the difference between the maximum transaction sequence number and the transaction sequence number in the execution attribute information;

[0236] If the sequence number difference is less than or equal to the preset difference threshold, it is determined that the transaction sequence number in the execution attribute information is correct.

[0237] Optionally, the pre-confirmation module 903 is further configured to:

[0238] If the sequence number difference is greater than the difference threshold, it is determined that the transaction sequence number in the execution attribute information is incorrect;

[0239] Generate a test result that the execution commitment information is not correct;

[0240] The pre-confirmation module 903 pre-confirms the execution result of the target transaction based on the detection result, including:

[0241] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0242] Optionally, the execution commitment information encapsulates a target account address and a transaction sequence number of the target transaction when it is executed in the second network layer. The target account address is an account address used to perform resource transfer processing for the transaction client in the second network layer. The initiating module 904 initiates a challenge to the second network layer to the first network layer based on the execution commitment information, including:

[0243] Query the first network layer for the transaction to which the transaction sequence number in the execution commitment information belongs;

[0244] Obtaining transaction query information returned by the first network layer for the queried exchange;

[0245] Based on the transaction query information and execution commitment information, the first network layer initiates a challenge to the second network layer;

[0246] The first network layer is used to execute resource transfer processing of the second network layer for the transaction client based on the target account address.

[0247] Optionally, the execution commitment information encapsulates the transaction hash value of the target transaction, and the transaction query information includes the transaction hash value of the queried transaction;

[0248] The initiating module 904 initiates a challenge to the second network layer to the first network layer based on the transaction query information and the execution commitment information, including:

[0249] Compare the transaction hash value in the transaction query information with the transaction hash value in the execution commitment information;

[0250] If the transaction hash value in the transaction query information is inconsistent with the transaction hash value in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0251] Optionally, the execution commitment information encapsulates the transaction status of the target transaction, and the transaction query information includes the transaction status of the queried transaction;

[0252] The initiating module 904 initiates a challenge to the second network layer to the first network layer based on the transaction query information and the execution commitment information, including:

[0253] Compare the transaction status in the transaction query information with the transaction status in the execution commitment information;

[0254] If the transaction status in the transaction query information is inconsistent with the transaction status in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0255] Optionally, the execution commitment information encapsulates the execution attribute information of the target transaction and the signature data of the second network layer on the execution attribute information. The execution attribute information includes the transaction hash value, transaction sequence number, and transaction status of the target transaction.

[0256] The first network layer has a transaction verification contract deployed. The transaction client initiates a challenge to the second network layer by sending it to the transaction verification contract. The second network layer has staked resources in the transaction verification contract.

[0257] The transaction verification contract is used to verify the signature data in the execution commitment information when receiving a challenge initiated to the second network layer. After the signature data is successfully verified, it is used to query the transaction hash value and transaction status of the transaction to which the transaction sequence number in the execution attribute information belongs. It is also used to transfer the pledged resources to the target account address when it detects that the queried transaction hash value is inconsistent with the transaction hash value in the execution attribute information, or the queried transaction status is inconsistent with the transaction status in the execution attribute information;

[0258] Among them, the transaction queried by the transaction verification contract based on the transaction sequence number in the execution attribute information must be a transaction that has been successfully verified in the first network layer.

[0259] According to one embodiment of the present application, Figure 3The steps involved in the transaction processing method of the blockchain network shown can be represented by Figure 9 The various modules in the transaction processing device 90 of the blockchain network shown are executed. For example, Figure 3 The step S101 shown in FIG. Figure 9 The generation module 901 in is executed, Figure 3 The step S102 shown in FIG. Figure 9 The receiving module 902 is executed; Figure 3 The step S103 shown in FIG. Figure 9 The pre-confirmation module 903 is executed. Figure 3 The step S104 shown in FIG. Figure 9 The initiating module 904 in is executed.

[0260] The blockchain network in the present application may include a first network layer and a second network layer. The second network layer is used to execute transactions initiated by the transaction client, and the first network layer is used to verify transactions executed by the second network layer. Therefore, the transaction client can generate a target transaction and send the target transaction to the second network layer, so that the second network layer executes the target transaction; it can also receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer; the transaction client can pre-confirm the execution result of the target transaction based on the execution commitment information; if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, the transaction client can initiate a challenge to the second network layer to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client. It can be seen that after the device proposed in the present application executes the target transaction on the second network layer, the transaction client can receive the execution commitment information returned by the second network layer. The transaction client can immediately pre-confirm the target transaction through the execution commitment information, thereby improving the efficiency of pre-confirming the target transaction. Moreover, when the result of the pre-confirmation of the target transaction is an execution failure, the second network layer can also be punished. For example, the execution commitment information provided by the second network layer can be used to initiate a challenge to the second network layer to the first network layer, so that the first network layer can execute the resource transfer processing of the second network layer for the transaction client. Therefore, this also ensures the reliability of the pre-confirmation of the target transaction.

[0261] According to one embodiment of the present application, Figure 9The various modules in the transaction processing device 90 of the blockchain network shown can be individually or all combined into one or several units to constitute, or one (some) of the units can be further divided into multiple functionally smaller sub-units to achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In actual applications, the functions of a module can also be implemented by multiple units, or the functions of multiple modules can be implemented by one unit. In other embodiments of the present application, the transaction processing device 90 of the blockchain network can also include other units. In actual applications, these functions can also be implemented with the assistance of other units and can be implemented by collaboration of multiple units.

[0262] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0263] According to one embodiment of the present application, a computer program capable of executing the steps involved in the corresponding methods shown in the various embodiments of the present application can be run on a general-purpose computer device (the computer device may include processing elements and storage elements such as a central processing unit (CPU), a random access memory medium (RAM), and a read-only memory medium (ROM)) to construct the following. Figure 9 The transaction processing device 90 of the blockchain network shown in . The above-mentioned computer program can be recorded on a computer-readable recording medium, and can be loaded into the above-mentioned computer device through the computer-readable recording medium and run therein.

[0264] See Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 10As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, in some embodiments, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally be at least one storage device located away from the aforementioned processor 1001. As Figure 10 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0265] Figure 10 The computer device 1000 shown can be applied to a trading client. Figure 10 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0266] Generate a target transaction and send it to the second network layer, so that the second network layer can execute the target transaction. The blockchain network includes the first network layer and the second network layer. The second network layer is used to execute transactions initiated by the transaction client, and the first network layer is used to verify transactions executed by the second network layer.

[0267] Receive the execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer;

[0268] Pre-confirm the execution results of the target transaction based on the execution commitment information;

[0269] If the pre-confirmation result indicates that the execution result of the target transaction is execution failure, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

[0270] In one feasible embodiment, a transaction sequencer is configured in the second network layer, and the second network layer executes the transaction initiated by the transaction client based on the transaction sequencer. The transaction sequencer has a transaction key pair, and the transaction key pair includes a transaction private key and a transaction public key.

[0271] Among them, a transaction verification contract is deployed in the first network layer, and the second network layer is used to send the transaction public key of the transaction sequencer to the transaction verification contract, so that the transaction verification contract stores the transaction public key of the transaction sequencer.

[0272] In a feasible implementation, the execution commitment information encapsulates execution attribute information related to executing the target transaction and signature data of the execution attribute information;

[0273] The signature data is obtained by the second network layer using the transaction private key of the transaction sequencer to sign the execution attribute information.

[0274] In a feasible implementation, the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0275] Performing a correctness check on the execution commitment information and obtaining the test result of the execution commitment information;

[0276] Pre-confirm the execution results of the target transaction based on the detection results.

[0277] In a feasible implementation, the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0278] Obtain the transaction public key of the transaction sequencer from the first network layer;

[0279] Use the acquired transaction public key to decrypt the signature data in the execution commitment information to obtain the decrypted hash value;

[0280] Performing hash calculation on the execution attribute information in the execution commitment information to generate a hash value of the execution attribute information;

[0281] If the generated hash value is consistent with the decrypted hash value, the signature data in the execution commitment information is determined to be correct.

[0282] In a feasible implementation, the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0283] If the generated hash value is inconsistent with the decrypted hash value, it is determined that the signature data in the execution commitment information is not correct;

[0284] Generate a test result that the execution commitment information is not correct;

[0285] The processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0286] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0287] In a feasible implementation, the execution attribute information includes a transaction hash value of the target transaction; the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0288] Perform hash calculation on the initiated target transaction to generate the hash value of the target transaction;

[0289] Compare the generated hash value with the transaction hash value in the execution attribute information;

[0290] If the generated hash value is consistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is correct.

[0291] In a feasible implementation, the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0292] If the generated hash value is inconsistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is not correct;

[0293] Generate a test result that the execution commitment information is not correct;

[0294] The processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0295] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0296] In a feasible implementation, the execution attribute information includes a transaction sequence number when the target transaction is executed in the second network layer; the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0297] Query the first network layer for the maximum transaction sequence number of the currently submitted transaction;

[0298] Calculate the difference between the maximum transaction sequence number and the transaction sequence number in the execution attribute information;

[0299] If the sequence number difference is less than or equal to the preset difference threshold, it is determined that the transaction sequence number in the execution attribute information is correct.

[0300] In a feasible implementation, the processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0301] If the sequence number difference is greater than the difference threshold, it is determined that the transaction sequence number in the execution attribute information is incorrect;

[0302] Generate a test result that the execution commitment information is not correct;

[0303] The processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0304] Based on the detection result that the execution commitment information is not correct, the execution result of the pre-confirmed target transaction is execution failure.

[0305] In one feasible implementation, the execution commitment information encapsulates the target account address and the transaction sequence number of the target transaction when it is executed in the second network layer. The target account address is the account address used to perform resource transfer processing for the transaction client in the second network layer. The processor 1001 can also be used to call the device control application stored in the memory 1005 to implement:

[0306] Query the first network layer for the transaction to which the transaction sequence number in the execution commitment information belongs;

[0307] Obtaining transaction query information returned by the first network layer for the queried exchange;

[0308] Based on the transaction query information and execution commitment information, the first network layer initiates a challenge to the second network layer;

[0309] The first network layer is used to execute resource transfer processing of the second network layer for the transaction client based on the target account address.

[0310] In a feasible implementation, the execution commitment information encapsulates the transaction hash value of the target transaction, and the transaction query information includes the transaction hash value of the queried transaction;

[0311] The processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0312] Compare the transaction hash value in the transaction query information with the transaction hash value in the execution commitment information;

[0313] If the transaction hash value in the transaction query information is inconsistent with the transaction hash value in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0314] In a feasible implementation, the execution commitment information encapsulates the transaction status of the target transaction, and the transaction query information includes the transaction status of the queried transaction;

[0315] The processor 1001 may also be configured to call a device control application stored in the memory 1005 to implement:

[0316] Compare the transaction status in the transaction query information with the transaction status in the execution commitment information;

[0317] If the transaction status in the transaction query information is inconsistent with the transaction status in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

[0318] In a feasible implementation, the execution commitment information encapsulates the execution attribute information of the target transaction and the signature data of the second network layer on the execution attribute information. The execution attribute information includes the transaction hash value, transaction sequence number, and transaction status of the target transaction.

[0319] The first network layer has a transaction verification contract deployed. The transaction client initiates a challenge to the second network layer by sending it to the transaction verification contract. The second network layer has staked resources in the transaction verification contract.

[0320] The transaction verification contract is used to verify the signature data in the execution commitment information when receiving a challenge initiated to the second network layer. After the signature data is successfully verified, it is used to query the transaction hash value and transaction status of the transaction to which the transaction sequence number in the execution attribute information belongs. It is also used to transfer the pledged resources to the target account address when it detects that the queried transaction hash value is inconsistent with the transaction hash value in the execution attribute information, or the queried transaction status is inconsistent with the transaction status in the execution attribute information;

[0321] Among them, the transaction queried by the transaction verification contract based on the transaction sequence number in the execution attribute information must be a transaction that has been successfully verified in the first network layer.

[0322] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the description of the transaction processing method of the above-mentioned blockchain network in each embodiment of the present application, and can also execute the above-mentioned Figure 9 The description of the transaction processing device 90 of the blockchain network in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0323] In addition, it should be noted that the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program. When the processor executes the computer program, it can perform the description of the transaction processing method of the blockchain network in each embodiment of the present application. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0324] As an example, the above-mentioned computer program can be deployed and executed on one computer device, or deployed and executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected by a communication network. Multiple computer devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain network.

[0325] The computer-readable storage medium may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may include both an internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0326] This application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to perform the description of the transaction processing method of the above-mentioned blockchain network in each embodiment of this application. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0327] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0328] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0329] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A transaction processing method for a blockchain network, characterized in that: The blockchain network includes a first network layer and a second network layer, the second network layer is used to execute transactions initiated by a transaction client, and the first network layer is used to verify transactions executed by the second network layer. The method is applied to the transaction client; the method includes: generating a target transaction, and sending the target transaction to the second network layer, so that the second network layer executes the target transaction; receiving execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer; Pre-confirming the execution result of the target transaction based on the execution commitment information; If the pre-confirmation result indicates that the execution result of the target transaction is execution failure, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

2. The method according to claim 1, wherein The second network layer is configured with a transaction sequencer, and the second network layer executes the transaction initiated by the transaction client based on the transaction sequencer, and the transaction sequencer has a transaction key pair, and the transaction key pair includes a transaction private key and a transaction public key; Among them, a transaction verification contract is deployed in the first network layer, and the second network layer is used to send the transaction public key of the transaction sequencer to the transaction verification contract, so that the transaction verification contract stores the transaction public key of the transaction sequencer.

3. The method according to claim 2, wherein The execution commitment information encapsulates execution attribute information related to executing the target transaction and signature data of the execution attribute information; The signature data is obtained by the second network layer using the transaction private key of the transaction sequencer to sign the execution attribute information.

4. The method according to claim 3, wherein The pre-confirming the execution result of the target transaction based on the execution commitment information includes: Performing a correctness check on the execution commitment information to obtain a check result of the execution commitment information; The execution result of the target transaction is pre-confirmed based on the detection result.

5. The method according to claim 4, wherein The correctness detection of the execution commitment information to obtain the detection result of the execution commitment information includes: Obtaining a transaction public key of the transaction sequencer from the first network layer; Decrypting the signature data in the execution commitment information using the acquired transaction public key to obtain a decrypted hash value; Performing a hash calculation on the execution attribute information in the execution commitment information to generate a hash value of the execution attribute information; If the generated hash value is consistent with the decrypted hash value, it is determined that the signature data in the execution commitment information is correct.

6. The method according to claim 5, wherein The method further comprises: If the generated hash value is inconsistent with the decrypted hash value, it is determined that the signature data in the execution commitment information is not correct; Generating a detection result that the execution commitment information is not correct; The pre-confirming the execution result of the target transaction based on the detection result includes: Based on the detection result that the execution commitment information is not correct, it is pre-confirmed that the execution result of the target transaction is an execution failure.

7. The method according to claim 4, wherein The execution attribute information includes a transaction hash value of the target transaction; and the correctness detection of the execution commitment information to obtain the detection result of the execution commitment information includes: Performing hash calculation on the initiated target transaction to generate a hash value of the target transaction; Comparing the generated hash value with the transaction hash value in the execution attribute information; If the generated hash value is consistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is correct.

8. The method according to claim 7, wherein The method further comprises: If the generated hash value is inconsistent with the transaction hash value in the execution attribute information, it is determined that the transaction hash value in the execution attribute information is incorrect; Generating a detection result that the execution commitment information is not correct; The pre-confirming the execution result of the target transaction based on the detection result includes: Based on the detection result that the execution commitment information is not correct, it is pre-confirmed that the execution result of the target transaction is an execution failure.

9. The method according to claim 4, wherein The execution attribute information includes a transaction sequence number of the target transaction when it is executed in the second network layer; and the correctness detection of the execution commitment information to obtain the detection result of the execution commitment information includes: Querying the first network layer for the maximum transaction sequence number of the currently submitted transaction; Calculating a sequence number difference between the maximum transaction sequence number and the transaction sequence number in the execution attribute information; If the sequence number difference is less than or equal to a preset difference threshold, it is determined that the transaction sequence number in the execution attribute information is correct.

10. The method according to claim 9, wherein The method further comprises: If the sequence number difference is greater than the difference threshold, it is determined that the transaction sequence number in the execution attribute information is incorrect; Generating a detection result that the execution commitment information is not correct; The pre-confirming the execution result of the target transaction based on the detection result includes: Based on the detection result that the execution commitment information is not correct, it is pre-confirmed that the execution result of the target transaction is an execution failure.

11. The method according to claim 1, wherein The execution commitment information encapsulates the target account address and the transaction sequence number of the target transaction when it is executed in the second network layer. The target account address is the account address used to perform resource transfer processing for the transaction client in the second network layer; The initiating a challenge to the second network layer from the first network layer based on the execution commitment information includes: querying the first network layer for the transaction to which the transaction sequence number in the execution commitment information belongs; Obtaining transaction query information returned by the first network layer for the queried exchange; Initiating a challenge to the second network layer via the first network layer based on the transaction query information and the execution commitment information; The first network layer is used to execute resource transfer processing of the second network layer for the transaction client based on the target account address.

12. The method according to claim 11, wherein The execution commitment information encapsulates the transaction hash value of the target transaction, and the transaction query information includes the transaction hash value of the queried transaction; The initiating a challenge to the second network layer from the first network layer based on the transaction query information and the execution commitment information includes: Comparing the transaction hash value in the transaction query information with the transaction hash value in the execution commitment information; If the transaction hash value in the transaction query information is inconsistent with the transaction hash value in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

13. The method according to claim 11, wherein The execution commitment information encapsulates the transaction status of the target transaction, and the transaction query information includes the transaction status of the queried transaction; The initiating a challenge to the second network layer from the first network layer based on the transaction query information and the execution commitment information includes: comparing the transaction status in the transaction query information with the transaction status in the execution commitment information; If the transaction status in the transaction query information is inconsistent with the transaction status in the execution commitment information, a challenge to the second network layer is initiated to the first network layer based on the execution commitment information.

14. The method according to claim 11, wherein The execution commitment information encapsulates the execution attribute information of the target transaction and the signature data of the second network layer on the execution attribute information, wherein the execution attribute information includes the transaction hash value, transaction sequence number and transaction status of the target transaction; A transaction verification contract is deployed in the first network layer, and the challenge from the transaction client to the second network layer is initiated to the transaction verification contract; the second network layer has pledged resources in the transaction verification contract; The transaction verification contract is configured to verify the signature data in the execution commitment information upon receiving a challenge initiated to the second network layer, and to query the transaction hash value and transaction status of the transaction to which the transaction sequence number in the execution attribute information belongs after successful verification of the signature data, and to transfer the pledged resources to the target account address upon detecting that the queryed transaction hash value is inconsistent with the transaction hash value in the execution attribute information, or that the queryed transaction status is inconsistent with the transaction status in the execution attribute information; The transaction queried by the transaction verification contract based on the transaction serial number in the execution attribute information must be a transaction successfully verified in the first network layer.

15. A transaction processing device for a blockchain network, characterized in that: The blockchain network includes a first network layer and a second network layer, the second network layer is used to execute transactions initiated by a transaction client, and the first network layer is used to verify transactions executed by the second network layer. The device is applied to the transaction client; the device includes: a generating module, configured to generate a target transaction and send the target transaction to the second network layer so that the second network layer executes the target transaction; a receiving module, configured to receive execution commitment information returned by the second network layer; the execution commitment information is used to declare that the target transaction has been successfully executed in the second network layer; A pre-confirmation module, configured to pre-confirm the execution result of the target transaction based on the execution commitment information; an initiating module, configured to initiate a challenge to the second network layer to the first network layer based on the execution commitment information if the pre-confirmation result indicates that the execution result of the target transaction is an execution failure, so that the first network layer executes the resource transfer processing of the second network layer for the transaction client.

16. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 14.

17. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 14.

18. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 14.

Citation Information

Cited By

  • Identity attribute authentication method and device and storage medium

    CN121792163A