Transaction on-chain method, related apparatus and medium
By utilizing the mechanism of the first relay node and the second consensus node in the blockchain hierarchical consensus system, the parent type of the transaction is determined and recorded to the inaccessible blockchain, which solves the problems of security and authenticity verification of transactions on the chain. , achieving higher security and credibility.
Patent Information
- Application Number
- PCT/CN2023/112169
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-31
- Filing Date
- 2023-08-10
- Publication Date
- 2024-10-03
AI Technical Summary
The existing blockchain hierarchical consensus system has shortcomings in the security of transaction on-chain, especially the poor security of target transaction on-chain, and the existing technology cannot meet the needs of transaction on-chain that does not want to be exposed to third parties.
By introducing the first relay node and the second consensus node into the blockchain hierarchical consensus system, the parent type of the transaction is determined, and the target transaction is recorded on the second blockchain that cannot be accessed by the outside world to generate on-chain verification. Information is verified to ensure the security and authenticity of transactions.
It improves the security of the target transaction on the chain and ensures that the transaction is not illegally accessed during the chain process. It also realizes the authenticity verification of the transaction and enhances the security and credibility of the blockchain hierarchical consensus system.
Smart Images

Figure CN2023112169_03102024_PF_FP_ABST
Abstract
Description
Transaction on-chain methods, related devices, and media
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 31, 2023, with application number 2023103616550 and application name “Transaction on-chain method, related devices and media”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of blockchain, and in particular to a method for uploading transactions to a blockchain, related devices, and media. Background Art
[0003] Existing blockchain layered consensus systems include local consensus networks and global consensus networks. Consensus nodes in local consensus networks perform on-chain operations for locally generated transactions, while the global consensus network performs on-chain operations for global transactions derived from local transactions. Local and global consensus networks operate on different blockchains, enabling hierarchical governance, allowing the global consensus network to focus on global governance.
[0004] In a layered consensus system, although data isolation is achieved between different local consensus networks, transactions are stored in plain text on the blockchain. Therefore, for target transactions that do not want to be accessed by third parties on the blockchain, existing technologies cannot meet the requirements for on-chain storage of target transactions, resulting in poor security when the target transactions are on-chain.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a transaction on-chain method, related devices and media.
[0007] According to one aspect of the present application, a transaction on-chain method is provided, which is performed by a first relay node and includes:
[0008] When the first consensus node receives a local transaction, determining the parent type of the local transaction;
[0009] In the case where the parent type is the first type, the local transaction is sent to a second consensus node, the local transaction is used to instruct the second consensus node to execute the local transaction, the local transaction is recorded in a second blockchain, first on-chain verification information of the local transaction is generated, and the first on-chain verification information of the local transaction is sent to a third consensus node, the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information, and obtain an on-chain verification result of the local transaction, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node; and
[0010] Obtain the on-chain verification result of the local transaction from the third consensus node.
[0011] According to one aspect of the present application, a transaction on-chain method is provided, which is executed by a second consensus node and includes:
[0012] receiving a local transaction from a first relay node, where the parent type of the local transaction is a first type;
[0013] Executing the local transaction and recording the local transaction in a second blockchain, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node;
[0014] Obtaining first on-chain verification information of the local transaction; and
[0015] The first on-chain verification information is sent to the third consensus node, where the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain an on-chain verification result.
[0016] According to one aspect of the present application, a transaction on-chain device is provided, comprising:
[0017] A first determining unit is configured to determine a parent type of a local transaction when the first consensus node receives the local transaction;
[0018] a first sending unit, configured to, when the parent type is the first type, send the local transaction to a second consensus node, wherein the local transaction is used to instruct the second consensus node to execute the local transaction, record the local transaction in a second blockchain, generate first on-chain verification information of the local transaction, and send the first on-chain verification information of the local transaction to a third consensus node, wherein the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information, and obtain an on-chain verification result of the local transaction, wherein the second blockchain is prohibited from being accessed by any node other than the second consensus node; and
[0019] The first acquisition unit is used to obtain the on-chain verification result of the local transaction from the third consensus node.
[0020] According to one aspect of the present application, a transaction on-chain device is provided, comprising:
[0021] A first receiving unit, configured to receive a local transaction forwarded by a first relay node, where the parent type of the local transaction is a first type;
[0022] a second on-chain unit, configured to execute the local transaction and record the local transaction on a second blockchain, wherein the second blockchain is prohibited from being accessed by any node other than the second consensus node;
[0023] A second acquiring unit is configured to acquire first on-chain verification information of the local transaction; and
[0024] The second sending unit is used to send the first on-chain verification information to a third consensus node, where the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain an on-chain verification result.
[0025] According to one aspect of the present application, an electronic device is provided, comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, and the processor implements the transaction chaining method as described above when executing the computer-readable instructions.
[0026] According to one aspect of the present application, one or more readable storage media are provided, wherein the storage media stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the transaction chaining method as described above is implemented.
[0027] According to one aspect of the present application, a computer program product is provided, which includes computer-readable instructions, and the computer-readable instructions are read and executed by one or more processors of a computer device, so that the computer device executes the transaction chaining method as described above.
[0028] The details of one or more embodiments of the present application are set forth in the accompanying drawings and description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. 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.
[0030] FIG1A is a schematic diagram of the architecture of a layered blockchain network in one embodiment;
[0031] FIG1B is a schematic diagram of the architecture of a layered blockchain network in another embodiment;
[0032] FIG1C is a schematic diagram of the architecture of a layered blockchain network according to another embodiment;
[0033] FIG2 is a schematic diagram of an embodiment of a transaction on-chain method applied in an electronic invoice scenario;
[0034] FIG3 is a flowchart of a transaction on-chain method according to an embodiment;
[0035] FIG4 shows a flow chart of step 330a in FIG3 for performing packet transmission by using a queue;
[0036] FIG5 is a schematic diagram showing a method of using queues of different subtypes to package and send packets in an embodiment of the present application;
[0037] FIG6 shows a flow chart of step 330a in FIG3 for performing packet transmission using priorities and queues;
[0038] FIG7 shows a schematic diagram of packet transmission using priorities and queues in FIG6 ;
[0039] FIG8 is a schematic diagram showing steps 330a and 330b in FIG3 performing signature verification using a digest algorithm;
[0040] FIG9 is a schematic diagram showing the first global consensus network selection using subtypes in step 330a of FIG3 ;
[0041] FIG10 shows a system architecture diagram of a situation in which a blockchain network has multiple first global consensus networks in an embodiment of the present application;
[0042] FIG11 shows a schematic diagram of generating a first tree and performing verification using the first tree in steps 330c and 330d in FIG3 ;
[0043] FIG12A shows a schematic diagram of the data structure of the first on-chain verification information in step 330c of FIG11 ;
[0044] FIG12B shows a schematic diagram of generating a first tree in an embodiment of the present application;
[0045] FIG12C shows a schematic diagram of a first bypass node of a first path of a first tree in an embodiment of the present application;
[0046] FIG13 shows a flowchart of generating a second tree and performing verification using the second tree based on steps 330c and 330d of FIG11 ;
[0047] FIG14A shows a schematic diagram of the data structure of the first on-chain verification information in step 330c of FIG13 ;
[0048] FIG14B shows a schematic diagram of generating a second tree in an embodiment of the present application;
[0049] FIG14C shows a schematic diagram of a second bypass node of a second path of a second tree in an embodiment of the present application;
[0050] FIG15 is a schematic diagram showing the data structure of the first on-chain verification information with the first signature;
[0051] FIG16 shows a schematic diagram of the data structure of the first on-chain verification information with transaction desensitization information;
[0052] FIG17 shows a schematic diagram of the data structure of the first on-chain verification information with immediacy information;
[0053] FIG18 shows a schematic diagram of the data structure of a request for on-chain verification results;
[0054] FIG19 is a flowchart of a transaction on-chain method according to another embodiment;
[0055] FIG20 is a flowchart of a transaction on-chain method according to another embodiment;
[0056] FIG21 is a multi-terminal interaction diagram of a detailed embodiment of the present application;
[0057] FIG22 is a flowchart of a transaction on-chain method executed by a second consensus node according to an embodiment;
[0058] FIG23 is a module diagram of a transaction on-chain device located at a first relay node according to an embodiment;
[0059] FIG24 is a module diagram of a transaction on-chain device located at a second consensus node according to an embodiment;
[0060] FIG25 is a terminal structure diagram of a transaction chaining method implemented in an embodiment; and
[0061] Figure 26 is a server structure diagram of an embodiment of a transaction chaining method. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0063] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:
[0064] Layered blockchains are based on peer-to-peer transmission within a blockchain network, with the consensus network and witness network separated (as shown in Figure 1A). The consensus nodes of the consensus network primarily implement the consensus algorithm. The witness network, also known as the business network, has witness nodes that perform data clearing and synchronization, and complete related specific business operations based on the witness nodes.
[0065] Clearing synchronization: After receiving the request for data synchronization from the witness node, the consensus node synchronizes the data that the witness node has permission to read to the witness node.
[0066] The layered consensus system of a layered blockchain builds on the separation of the witness network and the consensus network described above by the layered blockchain, further dividing the consensus network into a local consensus network and a global consensus network. Consensus nodes in the local consensus network perform on-chain operations for locally generated transactions (for example, transactions generated by a branch of a group), while the global consensus network performs on-chain operations for global transactions derived from local transactions (for example, group transactions derived from branch transactions). The local and global consensus networks operate on different blockchains, thus achieving hierarchical governance. This allows the global consensus network to focus on global governance without having to handle a large number of local transactions.
[0067] In a hierarchical consensus system, although data isolation is achieved between different local consensus networks, transactions are still stored in plaintext on the blockchain. Some transactions, for various reasons, do not wish to be exposed to third parties. Therefore, existing technologies are unable to meet the requirements for on-chaining these target transactions. This leads to poor security when on-chaining these transactions. Furthermore, hierarchical consensus systems are relatively large, with each local consensus network generating numerous target transactions. Having each local consensus network independently handle the security of on-chaining these target transactions presents significant overhead and difficulty. Therefore, there is an urgent need for a more universal technology that can improve the security of on-chaining target transactions.
[0068] System architecture and scenario description of the application examples
[0069] Referring to the blockchain network shown in Figure 1A, it includes a witness network and a consensus network. The consensus network refers to the network that reaches consensus on pending transactions and then uploads them to the blockchain. It includes multiple consensus nodes. "Multiple" means at least two. The witness network refers to the network that generates pending transactions and does not upload them to the blockchain, but witnesses the upload of pending transactions. It includes multiple witness nodes. Consensus nodes are blockchain nodes.
[0070] Witness nodes do not participate in on-chain consensus. Their primary function is to generate transactions to be uploaded and witness the upload of these transactions. Consensus nodes are typically full nodes. Full nodes maintain the complete data for every block on the blockchain. Since consensus nodes generate blocks for transactions and upload them to the blockchain, they naturally maintain data for all blocks on the entire blockchain. Witness nodes are typically light nodes. Light nodes maintain partial data for every block on the blockchain. For example, after a full node completes the upload, it only passes the block header of the uploaded block to a light node. When verifying the correct upload, the light node uses the digest value in the block header to perform Merkle tree verification.
[0071] The consensus node or blockchain node can be a server in the blockchain network or a user terminal connected to the blockchain network. The specific form of the consensus node or blockchain node is not limited here. The witness network and consensus network shown in Figure 1A can be in different network environments. For example, generally speaking, the witness node is deployed in the witness network on the public network, while the consensus node running the blockchain consensus protocol is deployed in the consensus network on the private network. The witness node and the consensus node can interact through the routing node, and the witness node and the consensus node can also directly transmit data without going through the routing node. Since the consensus network is in a relatively secure private cloud, the mutual access is guaranteed by the consensus mechanism, and there is no need for additional identity management and network control. However, the witness node is in the public network and may be accessed by other uncertain network terminals. Therefore, the behavior of the witness node and other possible nodes accessing the consensus network needs to be strictly controlled.
[0072] FIG1A shows a system architecture diagram including a witness network and a consensus network. Next, FIG1B is taken as an example to further illustrate the system architecture for performing layered consensus using a consensus network based on FIG1A .
[0073] Referring to the blockchain layered consensus network shown in Figure 1B, the blockchain layered consensus network refers to a blockchain network used for layered consensus on transactions. This network includes a witness network, a local consensus network, local network-level witness nodes, and a global consensus network. The witness network is the witness network shown in Figure 1A. The local consensus network is a network that reaches consensus on local transactions and uploads them to the blockchain. It comprises multiple local consensus nodes. Local transactions are transactions that affect only a local area. For example, transactions related to electronic invoice reimbursement by a group's branch are local transactions. The global consensus network is a network that reaches consensus on global transactions derived from local transactions and uploads them to the blockchain. It comprises multiple global consensus nodes. Global transactions are transactions that affect the global area. For example, transactions that aggregate electronic invoice reimbursements by a group's branches are global transactions. Local network-level witness nodes serve as the interface between local and global consensus nodes. They aggregate local transactions generated by the local consensus network into global transactions, transmit them to the global consensus network through the global consensus network portal, and witness the upload of transactions to the global consensus network. In Figure 1B, there are two local network-level witness nodes, which act as a backup. Both local network-level witness nodes operate simultaneously, performing the same actions. If one local network-level witness node fails, there will be no loss of information or interruption of the workflow.
[0074] Note that the witness nodes in the witness network do not verify the correctness of the chain in the global consensus network, but only verify the correctness of the chain in the local consensus network. When they need to verify whether the local transaction they generated is correctly uploaded to the chain by the local consensus node, they obtain the data required for verification from the local consensus node through the clearing and synchronization method described above. The local consensus node will not send all the uploaded data to them. The local network-level witness nodes only verify the correctness of the chain in the global consensus network. When they need to verify whether the global transaction deduced from the local transaction is correctly uploaded to the chain by the global consensus node, they obtain the data required for verification from the global consensus node through the clearing and synchronization method described above. The global consensus node will not send all the uploaded data to them.
[0075] The architecture of Figure 1C differs from that of Figure 1B in that it replaces the two local network-level witness nodes in Figure 1B with a first relay node, further dividing the global consensus network into a second global consensus network and a first global consensus network, with a second relay node interposed between the second and first global consensus networks. The first global consensus network is the blockchain network that processes target transactions and records them on the second blockchain. Target transactions are transactions that are not intended to be accessible or known to third parties. The second blockchain is specifically used to record blocks of transactions that are not intended to be accessible or known to third parties, and is not intended to be accessible to the outside world. Both third parties and the outside world refer to blockchain nodes other than the second consensus node. For example, third parties and the outside world include witness nodes, the first consensus node, the third consensus node, the first relay node, and the second relay node. To obtain verification information for blocks recorded on this blockchain, one can only request verification information from the blockchain nodes in the first global consensus network that record this blockchain.
[0076] Because the target transaction is one that is not intended to be accessible or known to third parties, the consent of the subject who generated it must be sought before it is uploaded to the blockchain. Specifically, when the subject generates the target transaction and sends it to the local consensus network for upload, a query box can be displayed to the subject, asking whether they agree to upload the target transaction to the blockchain. If the subject disagrees, the implementation method cannot be implemented, or only the portion of the transaction that they agree to upload will be uploaded to the blockchain.
[0077] The first consensus node in Figure 1C differs from the local consensus node in Figure 1B in that it only posts transactions of the second type to the blockchain. For the first type of local transactions, it delegates the posting of transactions to the second consensus node in the first global consensus network via the first relay node. The first type of transactions are transactions that are not intended to be accessible or known to third parties. The second type of transactions are transactions that are permitted to be accessed and known to third parties. The second type of local transactions are posted to a blockchain accessible to any external node, while the first type of local transactions are posted to a blockchain visible only within the first global consensus network, thereby improving the security of the target transaction on the blockchain.
[0078] The second global consensus network in the global consensus network of Figure 1C is similar to the global consensus network in Figure 1B and is primarily used to upload global transactions derived from local transactions to the blockchain. This second global consensus network includes multiple third consensus nodes. The first global consensus network in the global consensus network of Figure 1C is an additional network compared to Figure 1B. Its function is to upload local transactions of the first type to the blockchain. The first global consensus network includes multiple second consensus nodes. After the first global consensus network uploads local transactions of the first type to the blockchain, the uploaded blockchain is not accessible to the outside world. To allow external parties to verify whether the transaction has been uploaded correctly, the first global consensus network can generate upload verification information and send it to the second global consensus network for verification. The second global consensus network then returns the upload verification results to the local consensus network via the first relay node. The first relay node is the node that transmits the first type of transaction to the first global consensus network for upload. The second relay node is the node that sends the upload verification information generated by the first global consensus network to the second global consensus network for verification.
[0079] The embodiments of the present application can be applied in a variety of scenarios, including but not limited to electronic invoices, equity registration, securities trading, etc., such as the tax electronic invoice blockchain system scenario shown in Figure 2.
[0080] As shown in Figure 2, the tax electronic invoice blockchain system includes a business layer, a routing agent layer, and a consensus network layer.
[0081] The business layer, or witness network, comprises at least one witness node. It receives local transaction requests from the electronic tax bureau, businesses, or consumers, such as requests from the electronic tax bureau to upload electronic invoice issuance transactions, businesses to upload electronic invoice collection transactions, and consumers to upload electronic invoice issuance transactions. The business layer includes the local tax bureau's servers within the tax-dedicated network, invoicing servers in the public cloud (used for electronic invoice issuance by non-critical businesses), reimbursement servers (used for electronic invoice reimbursement by non-critical businesses), servers for key businesses (used for various electronic invoice transactions at key businesses), payment servers in the private cloud (used for invoice-related transactions during consumer payments at non-critical businesses), circulation servers (used for invoice-related transactions during the circulation of goods at non-critical businesses), and servers for key businesses (used for invoice-related transactions at key businesses). Key businesses are those of a certain scale that require dedicated servers to handle invoice-related transactions. The full name of the electronic tax bureau is the Electronic Taxation Bureau, which provides online tax services. Tax e-invoices refer to electronic invoices issued by the electronic tax bureau. Electronic invoices refer to invoices that are generated, stored, transmitted, and managed electronically. The tax network is a network that serves taxpayers, and the local tax bureau is the government agency responsible for local taxation.
[0082] The local tax bureau's server in the tax-dedicated network generates an e-invoice issuance transaction in response to the electronic tax bureau's e-invoice issuance request and requests the consensus network layer to upload this transaction to the blockchain. The invoicing server in the public cloud generates an e-invoice collection transaction in response to e-invoice requests from non-critical enterprises and requests the consensus network layer to upload this transaction to the blockchain. The reimbursement server in the public cloud generates an e-invoice reimbursement transaction in response to e-invoice reimbursement requests from non-critical enterprises and requests the consensus network layer to upload this transaction to the blockchain. The key enterprise server in the public cloud generates an e-invoice collection or reimbursement transaction in response to e-invoice collection or reimbursement requests from key enterprises and requests the consensus network layer to upload this transaction to the blockchain. The payment server in the private cloud generates an e-invoice issuance request transaction in response to consumer payment actions at non-critical enterprises and requests the consensus network layer to upload this transaction to the blockchain. The transfer server in the private cloud generates an e-invoice transfer transaction in response to the exchange of goods between consumers of non-critical enterprises and requests the consensus network layer to upload this transaction to the blockchain. The key enterprise server in the private cloud generates transactions requiring invoicing or circulation based on the payment or item circulation requirements of the key enterprise's consumers, and requests the consensus network layer to upload the transaction to the chain.
[0083] Note that the various servers mentioned above must obtain the subject's consent when generating transactions and requesting the consensus network layer to upload them to the blockchain based on the subject's needs. Specifically, when generating a transaction and sending it to the consensus network layer for on-chain upload, a query box can be displayed to the subject, asking whether the subject agrees to have the generated transaction uploaded to the blockchain. If the subject disagrees, the implementation method will not be implemented, or only the portion of the transaction that the subject agrees to be uploaded will be uploaded to the blockchain.
[0084] The routing proxy layer is the layer that acts as a router between nodes. It is responsible for routing data related to the business layer and the consensus network layer. It includes authentication services, certificate cache, routing services, and peer-to-peer services. The routing service routes pending transactions generated by the business layer to the consensus network layer. The authentication service authenticates pending transactions before routing them to the consensus network layer. For example, this involves verifying the signature of the pending transaction using key certificates. The certificate cache is specifically used to cache the public and private key certificates required by the authentication service. The peer-to-peer service provides peer-to-peer communication between nodes. After a pending transaction is uploaded to the consensus network layer, the peer-to-peer service is used to receive the on-chain verification information returned by the consensus network layer.
[0085] The consensus network layer includes the same local consensus network as in Figure 1C, a first global consensus network, and a first relay node located between the two. The local consensus network includes multiple first consensus nodes, each of which contains a permission contract for determining whether it has permission to upload to the blockchain, as well as storage used for processing the upload of local transactions to the blockchain, and locally maintains its own uploaded blocks. The first global consensus network includes multiple second consensus nodes, each of which contains a permission contract for determining whether it has permission to upload to the blockchain, as well as storage used for processing the upload of target transactions to the blockchain, and locally maintains its own uploaded blocks.
[0086] In Figure 2, the consensus network layer has three branches. If a request for on-chain e-invoice issuance generated by a local tax bureau server is received, forwarded by a proxy node, it is forwarded to the first consensus node in branch 1. The first consensus node queries its own permission contract and finds it lacks permission to on-chain the local transaction blockchain (because e-invoice issuance is a transaction that is private to third parties and must be forwarded to the first global consensus network for on-chaining to a second blockchain). It then forwards the request to the second consensus node in branch 1 via the first relay node. If a request for on-chain e-invoice issuance, reimbursement, or other transactions generated by various public cloud servers is received, forwarded by a proxy node, it is forwarded to the first consensus node in branch 2. The first consensus node queries its own permission contract and finds it lacks permission to on-chain the local transaction blockchain (because e-invoice issuance and reimbursement are transactions that are private to third parties and must be forwarded to the first global consensus network for on-chaining to a second blockchain). It then forwards the request to the second consensus node in branch 2 via the first relay node. If a request for on-chain e-invoice issuance, e-invoice circulation, or other transactions is received, forwarded by a proxy node, it is forwarded to the first consensus node in branch 3. The first consensus node queries its own permission contract and discovers it lacks permission to record transactions on the local transaction blockchain (because the issuance and circulation of electronic invoices are matters that third parties are not permitted to know about, and therefore must be forwarded to the first global consensus network and linked to the second blockchain). It then forwards the request to the second consensus node in branch 3 via the first relay node. After the second consensus node in branch 1-3 records the target transaction on the second blockchain, the second blockchain becomes inaccessible to the outside world, improving the security of the target transaction on-chain.
[0087] General description of the embodiments of this application
[0088] According to one embodiment of the present application, a transaction on-chain method is provided.
[0089] This transaction on-chain method is generally used in business scenarios where transaction data is not intended to be known to the outside world, such as the scenario of the tax electronic invoice blockchain system shown in Figure 2. Transactions that are not intended to be known to the outside world are called target transactions. The embodiment of the present application provides a solution for uniformly executing and recording local transactions of the first type, which can improve the security of target transaction on-chain. At the same time, in order to ensure that the target transaction is actually on-chain, a verification mechanism is also provided. This transaction on-chain method is executed by the first relay node in the blockchain layered consensus network.
[0090] As shown in FIG3 , a transaction on-chain method according to one embodiment of the present application may include:
[0091] Step 310: When the first consensus node receives a local transaction, determine the parent type of the local transaction;
[0092] Step 320: If the parent type of the local transaction is the second type, instruct the first consensus node to execute the local transaction and record the local transaction in the first blockchain, which is accessible to nodes other than the first consensus node; and
[0093] Among them, nodes other than the first consensus node refer to nodes in the blockchain system other than the nodes in the local consensus network, including witness nodes, first relay nodes, second relay nodes, nodes in the first global consensus network, and nodes in the second global consensus network.
[0094] In step 320, since the first blockchain allows access by nodes other than the first consensus node, when the parent type of the local transaction is the second type, the first consensus node is instructed to execute the local transaction and record the local transaction to the first blockchain, so that any external node can view the local transaction.
[0095] Step 330: If the parent type of the local transaction is the first type, the local transaction is sent to the second consensus node. The local transaction is used to instruct the second consensus node to execute the local transaction, record the local transaction on the second blockchain, generate first on-chain verification information for the local transaction, and send the first on-chain verification information of the local transaction to the third consensus node. The first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction based on the first on-chain verification information, thereby obtaining an on-chain verification result of the local transaction. The second blockchain is prohibited from being accessed by any node other than the second consensus node.
[0096] Step 340: Obtain the on-chain verification result of the local transaction from the third consensus node.
[0097] Steps 310 - 340 are described in detail below.
[0098] In step 310, the first relay node determines the parent type of the local transaction received by the first consensus node in the local consensus network. The parent type is either the first type or the second type. The first type refers to a type of transaction that is not allowed to be known to the outside world. The second type refers to a type of transaction that is allowed to be known to the outside world.
[0099] The first relay node is a module used to determine the parent type of a local transaction and forward the first-type local transaction. The first relay node can be an independent device, such as a separate computer or server, or a part of an independent device, such as a virtual machine partitioned from a server. A local transaction whose parent type is the first type is referred to as a target transaction in this application.
[0100] The first consensus node is a module within the local consensus network that receives local transactions, executes the second type of local transactions, and records them on the first blockchain. The first blockchain records local transactions and is accessible to nodes other than the first consensus node. The first consensus node can be an independent device, such as a separate computer or server, or part of an independent device, such as a virtual machine partitioned off a server.
[0101] Step 310 can be divided into an interactive process in which the first consensus node receives the local transaction, the first relay node discovers the local transaction, and the first relay node determines the parent type of the local transaction. A local transaction refers to a local transaction that needs to be executed by a consensus node and recorded in the blockchain, such as an invoice reimbursement transaction of a certain company. The parent type of a local transaction is used to indicate whether the local transaction is allowed to be known to a third party. The parent type of the local transaction can be one of the first type (for example, the type of the invoice reimbursement transaction is the first type) or the second type (for example, a weather information transaction). The first type of local transaction needs to be executed by a consensus node (for example, the second consensus node that appears below) and recorded in a blockchain that cannot be accessed by the outside world. The second type of local transaction needs to be executed by a consensus node (for example, the first consensus node) and recorded in a blockchain that can be accessed by the outside world.
[0102] In some embodiments, the setting of the determination period of the parent type of a local transaction includes the following situations:
[0103] (1) upon discovering that the first consensus node has received a local transaction, immediately determining the parent type of the local transaction; and,
[0104] (2) According to the determination period pre-set by the first relay node, after the local transaction is found to exist on the first consensus node and after the determination period has passed, the parent type of the local transaction is determined. For example, if the determination period pre-set by the first relay node is 1 hour and it is found that the first consensus node receives the local transaction at 7:00 a.m. on the same day, the parent type of the local transaction is determined at 8:00 a.m. on the same day.
[0105] In some embodiments, the parent type of a local transaction is determined in the following ways, but is not limited to:
[0106] (1) After discovering that the first consensus node has received a local transaction, it extracts the first key field from the content of the local transaction and searches the field parent type comparison table based on the first key field to determine the parent type of the local transaction. The following is an example of a field and parent type comparison table:
[0107] Table 1
[0108] As shown in Table 1, for a local transaction whose first key field is invoice, disclosure to the outside world is not permitted, so the parent type of the local transaction is determined to be type 1. For a local transaction whose first key field is resource, disclosure to the outside world is also not permitted, so the parent type of the local transaction is determined to be type 1. For a local transaction whose first key field is weather, disclosure to the outside world is permitted, so the parent type of the local transaction is determined to be type 2.
[0109] For example, the content of a local transaction includes "Electronic invoice 0001 reimbursement: amount 500, and used for accommodation outside", and the first key field included is "invoice", so the parent type of the local transaction is determined to be the first type. For another example, the local transaction is "100 first resources converted into 10 second resources", and the first key field included is "resource", so the parent type of the local transaction is determined to be the first type. For another example, the local transaction is "Weather 10001: XX month XX day sunny", and the first key field included is "weather", so the parent type of the local transaction is determined to be the second type.
[0110] (2) After discovering that the first consensus node has received the local transaction, the type identifier is obtained from the content of the local transaction, and the parent type of the local transaction is determined according to the type identifier.
[0111] There are two types of type identifiers. One is to use a character to indicate whether it is the first type, for example, "1" is used as the type identifier to indicate the first type, and "0" is used as the type identifier to indicate the second type. The other is to directly use the first type or the second type as the type identifier.
[0112] For example, if the content of a local transaction includes "Electronic invoice 0001 reimbursement, amount 500, and used for accommodation outside; [first type]", then the parent type of the local transaction is determined to be the first type based on the "[first type]" included in the content. For another example, if the content of a local transaction includes "Electronic invoice 0001 reimbursement, amount 500, and used for accommodation outside; [1]", then the parent type of the local transaction is determined to be the first type based on the "[1]" included in the content.
[0113] After the parent type of the local transaction is determined in step 310, there are two cases. The first case is that the parent type of the local transaction is determined to be the second type, and step 320 is executed. The second case is that the parent type of the local transaction is determined to be the first type, and step 330 is executed.
[0114] The first situation generated after step 310 will be described first.
[0115] In step 320, in response to determining that the parent type of the local transaction is the second type, the first consensus node executes the local transaction and records the local transaction to the first blockchain.
[0116] A common business smart contract (such as the order smart contract described below) runs on the first consensus node, with the business logic publicly embodied in the contract code. Local transactions interacting with this common business smart contract are executed on the first consensus node, and the execution results are recorded on the first blockchain maintained by the first consensus node. Furthermore, these execution results can also be transmitted back to the second global consensus network within the global consensus network via the first relay node.
[0117] For example, let's assume the second type of local transaction is "Order 10001: Purchase 50 office supplies." The first consensus node invokes the order smart contract to execute this local transaction, and the execution result is "Completed: Order 10001: Purchase 50 office supplies." This execution result is recorded by the first consensus node on the first blockchain, and all nodes except the first consensus node can access this first blockchain.
[0118] The specific process of recording the local transaction to the first blockchain is as follows:
[0119] Generally, a witness node generates a local transaction based on the object's operational behavior, and sends the local transaction and the witness node's digital signature to the adjacent first consensus node on the local consensus network, allowing the first consensus node to verify the authenticity of the local transaction. During verification, the first consensus node uses the witness node's public key to verify the digital signature, obtaining a first digest value for the local transaction. It then calculates a digest of the local transaction using a digest algorithm to obtain a second digest value for the local transaction. The first and second digest values are compared. If they are identical, verification passes, and the local transaction is a genuine transaction generated by the witness node.
[0120] After verification, the local transaction and other local transactions sent by the witness node are accumulated. When the accumulation reaches a certain level (for example, the number of accumulated transactions reaches a certain threshold, or the accumulation time reaches a certain threshold), these local transactions are packaged into blocks and sent to other first consensus nodes in the local consensus network for consensus. After consensus is successful, each first consensus node records the block on the first blockchain maintained by each first consensus node.
[0121] Next, the second situation generated after step 310 is described.
[0122] Continuing with FIG. 3 , step 330 may be divided into:
[0123] Step 330a (performed by the first relay node), in response to the parent type of the local transaction being the first type, sending the local transaction to a second consensus node in the first global consensus network;
[0124] Step 330b (performed by the second consensus node): execute the local transaction and record the local transaction to the second blockchain;
[0125] Step 330c (performed by the second consensus node), sending the first on-chain verification information of the local transaction to a third consensus node in the second global consensus network; and
[0126] Step 330d (performed by the third consensus node) verifies the on-chain transmission of the local transaction based on the first on-chain verification information.
[0127] Steps 330a-330d are described in detail below.
[0128] In step 330a, after determining that the parent type of the local transaction is the first type, the first relay node obtains the consent of the subject that generated the target transaction before uploading it to the blockchain, as the target transaction is not intended to be accessible or known to third parties. Specifically, a query box may be displayed to the subject, asking whether the subject agrees to uploading the target transaction to the blockchain. If the subject disagrees, the implementation method is not implemented, or only the portion of the transaction that the subject agrees to uploading is uploaded to the blockchain.
[0129] The local transaction is then sent to a second consensus node in the first global consensus network.
[0130] After determining that the parent type of the local transaction is the first type, the first relay node indicates that the local transaction needs to be executed and recorded in the second blockchain that cannot be accessed by the outside world, and therefore the local transaction needs to be executed by the second consensus node.
[0131] The second consensus node, located within the first global consensus network, is a module responsible for receiving and executing local transactions of the first type and recording them on the second blockchain. This second blockchain is inaccessible to all nodes other than the second consensus node, ensuring the security of the target transaction on-chain. The second consensus node can be an independent device, such as a separate computer or server, or part of an independent device, such as a virtual machine partitioned off a server.
[0132] In step 330b, the specific process of the second consensus node executing the local transaction and recording the local transaction to the second blockchain can refer to the specific process of the first consensus node executing the local transaction and recording it to the first blockchain.
[0133] After the second consensus node records the local transaction to the second blockchain, in order to verify that the second consensus node has actually uploaded the local transaction to the chain, the second consensus node also generates first chain verification information.
[0134] In step 330c, the first on-chain verification information is sent by the second consensus node to the third consensus node in the second global consensus network.
[0135] In step 330d, a third consensus node is located in the second global consensus network and is a module for receiving and performing verification based on the first on-chain verification information. The third blockchain maintained by the third consensus node can be accessed by nodes other than the third consensus node. When the third consensus node verifies the first on-chain verification information, it runs the deployment target state verification smart contract, which maintains the verification code for the first on-chain verification information sent by the first global consensus network. The third consensus node can be an independent device, such as a separate computer or server, or it can be part of an independent device, such as a virtual machine partitioned from a server.
[0136] Then, after step 330, in step 340, the first relay node obtains the on-chain verification result of the local transaction from the third consensus node.
[0137] In one embodiment, step 340 includes an interactive process in which the first relay node obtains the on-chain verification result from the third consensus node and sends the on-chain verification result to the local consensus network. The on-chain verification result indicates that the local transaction of the first type has been successfully on-chained.
[0138] Through the above steps 310-340, the embodiment of the present application divides the global consensus network into a second global consensus network and a first global consensus network. By utilizing the local consensus network's ability to synchronize information with the second global consensus network and relaying local transactions in the local consensus network via the first relay node, the target transaction is securely uploaded to the blockchain. In other words, local transactions are executed and recorded in the first global consensus network, and the uploaded verification results are confirmed in the second global consensus network. The specific calculation process, calculation logic, and intermediate results are all completed in the first global consensus network. At the same time, the consensus of the first global consensus network itself and the verification in the main blockchain effectively utilize the blockchain's tamper-proof nature to ensure the accuracy and credibility of transactions.
[0139] The above is a general description of steps 310 to 340. Since steps 320 and 330b have been described in detail in the above general description, the specific implementation of steps 330a, 330c-330d and step 340 will be described in detail below.
[0140] Detailed description of step 330a
[0141] In step 330a, after determining that the parent type of the local transaction is the first type, the first relay node sends the local transaction to the second consensus node in the first global consensus network.
[0142] In some embodiments, the setting of the sending period of the local transaction includes the following situations:
[0143] (1) after determining that the parent type of the local transaction is the first type, immediately sending the local transaction; and,
[0144] (2) According to the first transmission period preset by the first relay node, after determining that the parent type of the local transaction is the first type and after the first transmission period has elapsed, the local transaction is transmitted. For example, if the first transmission period preset by the first relay node is 2 hours, and if the parent type of the local transaction is determined to be the first type at 7:00 PM on the same day, the local transaction is transmitted at 9:00 PM on the same day.
[0145] Regarding the decomposition of step 330a, the present embodiment provides three decomposition methods. Each decomposition method provides a detailed description of step 330a from a different perspective. The first decomposition method will be described first.
[0146] Referring to the above description of the sending cycle of local transactions, whether it is sent immediately or after the first sending cycle, it is equivalent to establishing a connection with the first global consensus network every time a first type of local transaction is encountered, which is very expensive. To reduce overhead and minimize network resource loss, in one embodiment, the transactions can be queued first and then packaged and sent once when predetermined conditions are met.
[0147] In the embodiment of the present application, for the first type of local transaction, the local transaction is sent to the second consensus node to instruct the second consensus node to record the local transaction on the second blockchain. Since the second blockchain is not allowed to be accessed by other nodes other than the second consensus node, the security of the first type of local transaction is guaranteed. At the same time, after the second consensus node completes the chaining of the local transaction, the first chaining verification information after the chaining is sent to the third consensus node, and the third consensus node performs the chaining verification to obtain the chaining verification result, and obtains the chaining verification result from the third consensus node, ensuring that although the local transaction cannot be viewed externally, its chaining is authentic and trustworthy, thereby improving the security of the local transaction chaining.
[0148] In some embodiments, the first consensus node belongs to a local consensus network, the second consensus node belongs to a first global consensus network in the global consensus network, the third consensus node belongs to a second global consensus network in the global consensus network, and the first relay node is used to send the first type of local transaction to the second consensus node in the first global consensus network.
[0149] In this embodiment of the present application, the global consensus network is divided into a second global consensus network and a first global consensus network. By leveraging the local consensus network's ability to synchronize information with the second global consensus network and relaying local transactions within the local consensus network via the first relay node, the secure on-chain transmission of the first type of local transactions is achieved. In other words, local transactions are executed and recorded within the first global consensus network, and the on-chain verification results are confirmed within the second global consensus network. The specific computational process, computational logic, and intermediate results are all completed within the first global consensus network. Simultaneously, the consensus of the first global consensus network itself and its verification within the main blockchain effectively leverage the blockchain's immutable nature to ensure the accuracy and reliability of transactions. This embodiment of the present application improves the on-chain security of target transactions within a blockchain layered consensus system. This embodiment of the present application can be applied to various scenarios, including blockchain, structured information processing, and security technology.
[0150] In the specific implementation of this embodiment, referring to FIG4 , step 330a (performed by the first relay node) specifically includes:
[0151] Step 410: Place the local transaction in a queue; and
[0152] Step 420: In response to the queue meeting a predetermined condition, the local transactions in the queue are packaged and sent to the second consensus node.
[0153] Steps 410 - 420 are described in detail below.
[0154] In step 410, a queue is set up in the first relay node. The queue is a transaction storage container for storing local transactions. Each time the first relay node determines that the parent type of a local transaction is the first type, the local transaction is placed in the queue.
[0155] There are generally two ways to place it in the queue:
[0156] (1) Place the local transaction directly at the end of the queue; and,
[0157] (2) First determine the position in the queue where the local transaction is to be inserted. The position in the queue where the local transaction is to be inserted is called the target position. Move the local transaction at the target position and the local transactions behind the target position backward, and then place the local transaction at the target position in the queue.
[0158] In step 420, in response to the queue meeting a predetermined condition, the first relay node packages the local transactions in the queue and sends them to the second consensus node.
[0159] The predetermined condition includes at least one of the following: the number of local transactions reaches a first threshold, and the time difference between the current time and the time of the last package reaches a second threshold. For example, in response to the number of local transactions in the queue reaching the first threshold, the first relay node packages the local transactions in the queue and sends them to the second consensus node. For another example, in response to the time difference between the current time and the time of the last package in the queue reaching the second threshold, the first relay node packages the local transactions in the queue and sends them to the second consensus node. For another example, in response to the number of local transactions in the queue reaching the first threshold and the time difference between the current time and the time of the last package in the queue reaching the second threshold, the first relay node packages the local transactions in the queue and sends them to the second consensus node.
[0160] In this embodiment, all local transactions of the first type are placed in the same queue for packaging and sending, thereby improving packaging efficiency.
[0161] Under the above predetermined conditions, if only the number reaching the first threshold is considered, the timeliness of packaging and sending will be affected, resulting in some local transactions not being able to be uploaded to the chain for a long time. If only the time difference reaching the second threshold is considered, although timeliness is guaranteed, it may result in too few packages each time, wasting network resources. Similarly, if both the number reaching the first threshold and the time difference reaching the second threshold are considered at the same time, there is a possibility that the time difference has met the second threshold, but the number has not been able to reach the first threshold, which still affects the timeliness of packaging and sending. Therefore, in some embodiments, step 420 specifically includes:
[0162] In response to the number of local transactions in the queue reaching a first threshold, the local transactions in the queue are packed.
[0163] In this embodiment, the number of local transactions is determined as a condition for packaging, thereby avoiding too small a number of transactions each time and wasting network resources.
[0164] In some embodiments, step 420 specifically further includes: in response to the number of local transactions in the queue not reaching a first threshold, determining a time difference between the current time and the last packaging time;
[0165] In response to the time difference reaching a second threshold, the local transactions in the queue are packaged.
[0166] In this embodiment, by combining the number and time difference, the number of packages each time will not be too small, which will waste network resources, and timeliness will be taken into account, so that some local transactions will not be unable to be put on the chain for a long time.
[0167] Since the subtypes of each first-type local transaction are different, it is considered that bundling local transactions of the same subtype into a single package and uploading them together will improve the efficiency of the first global consensus network. Therefore, in other embodiments, each subtype corresponds to its own queue so that local transactions of the same subtype can be placed in the same queue. For example, Figure 5 shows two queues, queue M and queue N. Queue M is used to store local transactions of subtype a. Queue N is used to store local transactions of subtype b.
[0168] In a specific implementation of this embodiment, step 410 includes: determining a subtype of the first type of local transaction; determining a queue corresponding to the subtype of the local transaction; and placing the local transaction in the queue corresponding to the subtype.
[0169] Continuing with Figure 5 , local transactions 1-8 have been placed into corresponding queues based on their subtypes. Specifically, local transactions 1, 3, 5, and 7 of subtype a are placed in queue M, while local transactions 2, 4, 6, and 8 of subtype b are placed in queue N. When local transaction 9 needs to be placed into a queue, the subtype of local transaction 9 is first determined. If local transaction 9 is of subtype a, it is placed at the end of queue M (indicated by the dashed box in queue M in Figure 5 ). If local transaction 9 is of subtype b, it is placed at the end of queue N (indicated by the dashed box in queue N in Figure 5 ).
[0170] In this embodiment, local transactions of the same subtype are packaged and sent, and the second consensus node can use the target smart contract of the same seed type (the target smart contract or target contract refers to the smart contract that processes the target transaction of a certain subtype on the chain, which contains the code for processing the target transaction of the subtype on the chain) to uniformly execute these local transactions, reducing the back-and-forth calls to target smart contracts of different subtypes, thereby improving execution efficiency. For example, the second consensus node receives a packaged local transaction, in which all local transactions are executed using the target smart contract T. Then, when processing these local transactions, the second consensus node can use the target smart contract T for all processing, alleviating the problem of reducing the processing efficiency of the second consensus node due to the need to change the target smart contract multiple times.
[0171] Step 420 includes: if the number of local transactions in a queue reaches a third threshold, the local transactions in the queue are packaged. For example, if local transaction 9 is placed in queue M, after local transaction 9 is placed, the number of local transactions in queue M reaches a third threshold (for example, the third threshold is 5). The local transactions in queue M are packaged and sent to the second consensus node.
[0172] In this embodiment, the number of local transactions is determined as a condition for packaging, thereby avoiding too small a number of transactions each time and wasting network resources.
[0173] The above is a detailed description of the first decomposition method of step 330a. Next, the second decomposition method is described.
[0174] When step 330a is broken down into steps 410-420, local transactions are directly placed in a queue for on-chain processing. However, for some local transactions that require urgent on-chain processing, if they are directly placed in a queue, the urgent on-chain processing needs of different local transactions cannot be met. Therefore, in one embodiment, step 330a combines the priorities of local transactions and sends high-priority local transactions to the first global consensus network for on-chain processing first, thus meeting the urgent on-chain processing needs.
[0175] In a specific implementation of this embodiment, referring to FIG6 , step 330a (performed by the first relay node) includes:
[0176] Step 610: Determine the subtype of the first type of local transaction.
[0177] Step 620: Determine the priority of the local transaction based on the subtype;
[0178] Step 630: Place the local transactions in a queue in descending order of priority; and
[0179] Step 640: Take out local transactions from the queue in sequence and send them to the second consensus node.
[0180] Steps 610-640 are described in detail below.
[0181] In step 610, the first relay node determines a subtype of the first type of local transaction.
[0182] Before explaining the subtypes, it is emphasized again that the parent type of a local transaction is used to indicate whether the local transaction needs to be executed and recorded on a blockchain that is not accessible to the outside world. Therefore, the first type of local transaction indicates that the local transaction needs to be executed and recorded on a blockchain that is not accessible to the outside world (that is, it is executed by the second consensus node and recorded on the second blockchain). Unlike the first type, the subtype refers to the transaction type of the local transaction itself. For example, if the local transaction is an invoice reimbursement transaction, the transaction type of the invoice reimbursement transaction itself is the invoice type, so the subtype is the invoice type. For another example, if the local transaction is an enterprise procurement transaction, the transaction type of the enterprise procurement transaction itself is the order type, so the subtype is the order type. Taking the invoice type as an example, the first relay node determines the priority corresponding to the invoice type, thereby reflecting the urgent need to upload the enterprise invoicing transaction whose subtype is the invoice type according to the priority.
[0183] In some embodiments, the subtype of the first type of local transaction is determined in the following manner, but is not limited to:
[0184] (1) Extract the second key field from the content of the first type of local transaction, and search the second key field and subtype comparison table based on the second key field to determine the subtype of the local transaction. The following is an example of a second key field and subtype comparison table:
[0185] Table 2
[0186] As shown in Table 2, for local transactions whose second key fields are Reimbursement, Invoice Query, and Invoice Issuance, the subtypes of the local transactions are Invoice Reimbursement, Invoice Query, and Invoice Issuance, respectively. Similarly, for local transactions whose second key fields are Resource Exchange, Resource Transfer, and Resource Statistics, the subtypes of the local transactions are Resource Exchange, Resource Transfer, and Resource Statistics, respectively.
[0187] It should be noted that in Table 1, the first key field is used to determine whether the parent type of the local transaction is the first type or the second type, while Table 2 determines the subtype based on the second key field after determining that the local transaction is the first type.
[0188] For example, the content of a local transaction includes "Electronic invoice reimbursement 0001, amount 500, and used for accommodation outside the home." The first key field included is "invoice." Therefore, the parent type of the local transaction is determined to be the first type, and the subtype is determined to be the invoice reimbursement type based on the second key field included being "reimbursement." For another example, the local transaction is "Exchange resources, 100 first resources for 10 second resources." The first key field included is "resources." Therefore, the parent type of the local transaction is determined to be the first type, and the subtype is determined to be the resource exchange type based on the second key field included being "Exchange resources."
[0189] (2) After discovering that the first consensus node has received the local transaction, obtain the subtype identifier from the content of the local transaction and determine the subtype of the local transaction according to the subtype identifier.
[0190] For example, the content of a local transaction includes "electronic invoice reimbursement 0001, amount 500, and used for accommodation outside; [invoice reimbursement type]", and the subtype is determined to be the invoice reimbursement type based on the type identifier "[invoice reimbursement type]".
[0191] After the subtype is determined, in step 620 , a method of determining the priority according to the subtype includes: determining the priority by looking up a subtype and priority comparison table.
[0192] The subtype and priority comparison table lists the correspondence between subtypes and priorities. The following is an example of a subtype and priority comparison table:
[0193] Table 3
[0194] As shown in Table 3, for transactions with the invoice reimbursement subtype, the need for urgent on-chain posting is higher, so the priority is set to 10. Similarly, based on the different needs for urgent on-chain posting for each subtype, the priority of the invoice query type is set to 9, the priority of the invoice issuance type is set to 8, the priority of the resource exchange type is set to 7, the priority of the resource transfer type is set to 6, and the priority of the resource statistics type is set to 5.
[0195] For example, if the content of a local transaction includes "Electronic invoice reimbursement 0001, amount 500, and used for accommodation away from home," and the subtype is determined to be invoice reimbursement, the priority is 10. For another example, if the local transaction is "100 first resources exchanged for 10 second resources," and the subtype is determined to be resource exchange, the priority is 7.
[0196] After determining the priorities, in step 630 , the first relay node places the local transactions in a queue in descending order of priority.
[0197] Referring to Figure 7 , Figure 7 shows queue L before local transaction 5 is placed and queue L after local transaction 5 is placed. Before local transaction 5 is placed into queue L, queue L already contains local transactions 1-4, and the priorities of local transactions 1-4 are 9, 8, 7, and 6, respectively. When a local transaction needs to be placed into queue L, the priority of the local transaction is first determined to be 10. Based on the order of priority from high to low, the target location for placing local transaction 5 into queue L is determined, which is the dotted box in queue L shown on the left side of Figure 7 . Local transaction 1 at the target location and local transactions 2-4 behind the target location are moved backward, and then local transaction 5 is placed at the target location in the queue. The result after placement is queue L shown on the right side of Figure 7 .
[0198] In step 640, local transactions are sequentially taken from the queue and sent to the second consensus node.
[0199] The method of taking out the local transaction from the queue in step 640 includes:
[0200] (1) Referring to FIG. 7 , if the number of local transactions in the queue reaches a fourth threshold, the local transactions are sequentially taken out of the queue, packaged, and sent to the second consensus node in the first global consensus network; and
[0201] (2) When it is determined that the time difference between the current time and the time of the last package reaches the fifth threshold, the local transactions are sequentially taken out from the queue for packaging and sent to the second consensus node in the first global consensus network.
[0202] Through steps 610-640, the urgent on-chain needs of target transactions are met according to priority, thereby improving the on-chain flexibility.
[0203] The above is a detailed description of the second decomposition method of step 330a. Next, the third decomposition method is described.
[0204] When step 330a is expanded into steps 410-420 in the first decomposition method described above, or when step 330a is expanded into steps 610-640 in the second decomposition method described above, the first relay node only sends the local transaction to the second consensus node. In other words, the second consensus node cannot determine whether the received local transaction is a genuine transaction generated by the first relay node, resulting in lower security. Therefore, in some embodiments, step 330a is combined with signature verification by the first relay node, allowing the second consensus node in step 330b to ensure that the local transaction is a genuine transaction sent by the first relay node, thereby improving security.
[0205] In the specific implementation of this embodiment, referring to FIG8 , step 330a (performed by the first relay node) includes:
[0206] Step 810: Generate a third digest for the local transaction according to a predetermined digest algorithm;
[0207] Step 811: Encrypt the third digest using the private key of the first relay node to obtain a second signature; and
[0208] Step 812: Send the local transaction and the second signature to the second consensus node.
[0209] Correspondingly, step 330b (performed by the second consensus node) includes:
[0210] Step 820: Decrypt the second signature using the public key of the first relay node to obtain a fourth digest.
[0211] Step 821: Generate a third digest for the local transaction according to a predetermined digest algorithm; and
[0212] Step 822: When the third digest is consistent with the fourth digest, the local transaction is executed and recorded in the second blockchain.
[0213] Steps 810 - 812 and steps 820 - 822 are described in detail below.
[0214] In steps 810-812, the signing process involves using a digest algorithm (e.g., a hash algorithm) to generate a digest of the signature subject, and then encrypting the digest using the signer's private key (or public key). Differences in signature algorithms can be reflected in, for example, the use of different digest algorithms. Therefore, when the first relay node generates the second signature, it uses a predetermined digest algorithm to generate a third digest of the local transaction, and then encrypts the third digest using the first relay node's private key.
[0215] In steps 820-822, the signature verification process includes the verifier decrypting the signature using the signer's public key (or private key), then generating a digest for the subject being verified using the same digest algorithm as used in the signing process. If the decrypted digest and the generated digest are identical, the verification is successful. Therefore, when the second consensus node verifies the signature, it decrypts the second signature using the first relay node's public key to obtain a third digest. The same predetermined digest algorithm is then used to generate a fourth digest for the local transaction, and the third digest is compared with the fourth digest. If the third digest and the fourth digest are identical, the verification of the second signature is successful.
[0216] The above is a general description of the three decomposition methods of step 330a. In the above decomposition methods, the global consensus network includes a second blockchain as the basis (as shown in Figure 1C), and the first relay node sends each local transaction of the first type to the same first global consensus network. However, in another embodiment, the first global consensus network is selected from multiple candidate global consensus networks (multiple candidate global consensus networks as shown in Figure 10), and each candidate global consensus network corresponds to a different subtype of local transaction. For example, there is a dedicated first global consensus network for processing subtypes of invoice types, and a dedicated first global consensus network for processing subtypes of order types, which helps to improve the efficiency of transaction chaining.
[0217] In the specific implementation of this embodiment, referring to FIG9 , step 330a (performed by the first relay node) specifically includes:
[0218] Step 910: Determine the subtype of the first type of local transaction.
[0219] Step 920: Determine a candidate global consensus network corresponding to the subtype as the first global consensus network; and
[0220] Step 930: Send the local transaction to the second consensus node in the first global consensus network.
[0221] Steps 910-930 are described in detail below.
[0222] In step 910 , the definition of the subtype and the method of determining the subtype are described in the above step 610 .
[0223] In step 920, as shown in FIG10, the global consensus network includes multiple candidate global consensus networks (FIG10 only shows four candidate global consensus networks, but the number may be less than or greater than four). Each candidate global consensus network corresponds to a subtype.
[0224] In advance, a comparison table between subtypes and the first global consensus network is developed based on the target smart contract requirements of the subtype, as shown in the following table:
[0225] Table 4
[0226] As shown in Table 4, the subtypes of local transactions can specifically include invoice reimbursement, invoice issuance, resource exchange, and resource statistics. For invoice reimbursement, a target smart contract for reimbursement is required. Therefore, candidate global consensus network 1 is selected as the first global consensus network. Candidate global consensus network 1 uniformly calls the target smart contract for reimbursement to execute local transactions of the invoice reimbursement type. For invoice issuance transactions, a target smart contract for issuance is required. Therefore, candidate global consensus network 2 is selected as the first global consensus network. Candidate global consensus network 2 uniformly calls the target smart contract for issuance to execute local transactions of the invoice issuance type. Similarly, for resource exchange, candidate global consensus network 3 uniformly calls the target smart contract for exchange to execute local transactions of the resource exchange subtype. Similarly, for resource statistics, candidate global consensus network 4 uniformly calls the target smart contract for statistics to execute local transactions of the resource statistics subtype.
[0227] After the above comparison table is formulated, the above comparison table can be searched according to the subtype to determine the first global consensus network.
[0228] After determining the first global consensus network, in step 930 , the first relay node sends the local transaction to a second consensus node in the first global consensus network.
[0229] Taking the invoice reimbursement subtype as an example, the first global consensus network is candidate global consensus network 1. The first relay node sends the local transaction to the second consensus node in candidate global consensus network 1. The second consensus node calls the target smart contract for reimbursement to execute the local transaction and record the local transaction to the second blockchain in candidate second blockchain 1.
[0230] The specific process of executing local transactions by the second consensus node and recording them on the second blockchain can be referenced to the description of executing the second type of local transactions by the first consensus node and recording them on the first blockchain in the above embodiment. However, the difference is that the first blockchain can be accessed by nodes other than the first consensus node, while the second blockchain is prohibited from being accessed by nodes other than the second consensus node.
[0231] In the embodiment of steps 910-930, local transactions of the same subtype are effectively sent to the same candidate global consensus network through the mapping relationship between the subtype and the first global consensus network, so that the candidate second blockchain can uniformly call the target smart contract of the same type to execute local transactions, thereby improving the processing efficiency of the first global consensus network in processing local transactions.
[0232] The above is a detailed description of step 330a.
[0233] Detailed description of steps 330c-330d
[0234] In step 330c, (the second consensus node) sends the first on-chain verification information of the local transaction to the third consensus node in the second global consensus network. In step 330d, the third consensus node verifies the on-chain of the local transaction based on the first on-chain verification information.
[0235] The execution link of the second consensus node is divided into two situations: one is that the second consensus node has a trusted execution environment, and the other is that the second consensus node does not have a trusted execution environment.
[0236] Before describing that the second consensus node has a trusted execution environment, the relevant content of the trusted execution environment is explained first.
[0237] Trusted Execution Environment (TEE): A hardware-based secure computing solution. It creates a secure enclave within the CPU through hardware and software methods, ensuring the confidentiality and integrity of loaded programs and data. The TEE partitions the system's hardware and software resources into two execution environments: a trusted portion and an untrusted portion (normal portion). These two environments are isolated, and the untrusted portion cannot access the storage and memory of the trusted portion.
[0238] Trusted execution environment solutions include Intel SGX, ARM TrustZone, and AMD SEV. Intel SGX is a trusted execution environment solution developed by Intel that supports it on specific Intel CPU models. References to trusted execution environments in this document, unless otherwise specified, refer to those based on Intel SGX.
[0239] Trusted Execution Environment hardware key: This is a hardware key burned into the CPU during Intel production. Its private key cannot be exported under any circumstances. Its public key can be exported in specific scenarios, but Intel does not recommend this practice.
[0240] Based on the content of the above-mentioned trusted execution environment, in this embodiment, when the second consensus node has a trusted execution environment, the second blockchain is encrypted with the key of the trusted execution environment. The first on-chain verification information is sent by the second consensus node to the second relay node in response to the first on-chain verification information request sent by the second relay node. The first on-chain verification information request is sent by the second relay node in response to adding an encrypted block to the second blockchain. The encrypted block is encrypted with the key of the trusted execution environment. The first on-chain verification information is used to instruct the second relay node to forward the first on-chain verification information to the third consensus node.
[0241] In this embodiment, the block is encrypted using the key of the trusted execution environment, and the first on-chain verification information is forwarded through the second relay node, thereby further improving the security of the target transaction on-chain of the first global consensus network.
[0242] The above is a description of the second consensus node having a trusted execution environment. The following is a detailed description of the second consensus node not having a trusted execution environment.
[0243] In some embodiments, as shown in Figure 12A, the first on-chain verification information includes the summary value of the local transaction and the summary value recorded by the first bypass node determined according to the first path in the first tree. The leaf node in the first tree records the summary value of the transaction recorded on the second blockchain. The first path is the path from a leaf node in the first tree to the root node in the first tree, and a leaf node in the first tree records the summary value of the local transaction. The first bypass node is a sibling node of the node in the first tree other than the root node in the first path. The first on-chain verification information is also used to instruct the third consensus node to determine a first comparison summary value based on the summary value of the local transaction and the summary value recorded in the first bypass node. When the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the verification is successful.
[0244] The first tree is generated by the second consensus node. Referring to FIG. 11 , step 330c (performed by the second consensus node) includes:
[0245] Step 1110: Generate a first tree;
[0246] Step 1111: Determine a first bypass node of a first path; and
[0247] Step 1112: Send the summary value of the local transaction and the summary value recorded in the first bypass node to the third consensus node.
[0248] Correspondingly, step 330d (performed by the third consensus node) includes:
[0249] Step 1120: Determine a first comparison digest value based on the digest value of the local transaction and the digest value recorded in the first bypass node; and
[0250] Step 1121: When the digest value recorded in the root node of the first tree is consistent with the first comparison digest value, the verification is successful.
[0251] Steps 1110 - 1112 and steps 1120 - 1121 are described in detail below.
[0252] In step 1110, the leaf nodes in the first tree are the summary values of the transactions recorded on the second blockchain, where the recorded transactions include local transactions. The order of the leaf nodes in the first tree may be the order in which the second consensus node receives the local transactions. For example, if the second consensus node first receives local transaction 1, "Employee A reimburses 1,000 resources at Enterprise B," and then receives local transaction 2, "Employee C reimburses 500 resources at Enterprise D," local transaction 1 is used as the first leaf node, and local transaction 2 is used as the second leaf node. The digest algorithm used to obtain the digest value may be one of the following:
[0253] (1) The second consensus node pre-specifies that the same digest algorithm is used for each entity to which the local transaction belongs. For example, the same digest algorithm is used for the electronic invoice reimbursement transaction of enterprise B and the electronic invoice reimbursement transaction of enterprise D; and
[0254] (2) The second consensus node pre-specifies different digest algorithms for the entity to which each local transaction belongs. For example, different digest algorithms are pre-specified for Enterprise B and Enterprise D. When it is determined that the local transaction belongs to Enterprise B, the digest algorithm pre-specified for Enterprise B is used. When it is determined that the local transaction belongs to Enterprise D, the digest algorithm pre-specified for Enterprise D is used. This embodiment increases the difficulty of deciphering local transactions from the digest value by using different digest algorithms for different entities, thereby improving the security of local transactions on the chain.
[0255] When the third consensus node performs verification based on the summary value of the local transaction and the summary value recorded by the first bypass node, the summary algorithm used is consistent with the above summary algorithm.
[0256] In this embodiment, there is at least one intermediate layer between the layer where the leaf nodes reside and the layer where the root node resides in the first tree. The intermediate layer includes at least one intermediate node. In two adjacent layers in the first tree, the node in the upper layer is generated from at least two nodes in the lower layer, and the same node in the lower layer is only used to generate one node in the upper layer. Nodes include root nodes, intermediate nodes, and leaf nodes.
[0257] The first tree in the embodiment of the present application is typically a binary tree, but may also be a multi-branch tree. The first tree has all the characteristics of a tree structure, which often includes multiple nodes (the nodes shown in FIG12B ), including at least one leaf node and one root node, and typically also includes multiple intermediate nodes between the leaf nodes and the root node.
[0258] Referring to the first tree shown in Figure 12B , the leaf nodes of the first tree record transaction digest values. In two adjacent layers of the first tree, the nodes of the upper layer are generated by at least two nodes in the lower layer, and the same node in the lower layer is only used to generate one node in the upper layer. As shown in Figure 12B , leaf nodes 1 and 2 in the first layer are concatenated, and a digest algorithm is used to generate the digest value of intermediate node 7 in the second layer. Leaf nodes 3 and 4 are concatenated, and a digest algorithm is used to generate the digest value of intermediate node 8. Leaf nodes 5 and 6 are concatenated, and a digest algorithm is used to generate the digest value of intermediate node 9. Intermediate nodes 7 and 8 are concatenated, and a digest algorithm is used to generate the digest value of intermediate node 11 in the third layer. Intermediate nodes 9 and 10 are concatenated, and a digest algorithm is used to generate the digest value of intermediate node 12 in the third layer. Intermediate nodes 11 and 12 are concatenated, and a digest algorithm is used to generate the digest value of the root node in the first tree.
[0259] In step 1111, the first path is a path from a leaf node corresponding to the summary value of the local transaction in the first tree to a root node in the first tree. The first bypass node is a sibling node of the node in the first path other than the root node in the first tree.
[0260] As shown in Figure 12C, assuming that the summary value of the local transaction is recorded in leaf node 4, the first path is the path from leaf node 4 in the first tree to the root node in the first tree, where the first path includes leaf node 4, intermediate node 8, intermediate node 11, and the root node in the first tree. Since intermediate node 8 needs to be generated based on leaf nodes 3 and 4, if leaf node 4 is known, leaf node 3 also needs to be obtained. Therefore, leaf node 3 is determined as the first bypass node. Similarly, since intermediate node 11 needs to be generated based on intermediate nodes 7 and 8, after intermediate node 8 is generated from leaf nodes 3 and 4, intermediate node 7 needs to be obtained. Therefore, intermediate node 7 is determined as the first bypass node. Similarly, since intermediate node 13 needs to be generated based on intermediate nodes 11 and 12, after intermediate node 11 is generated from intermediate nodes 8 and 7, intermediate node 12 needs to be obtained. Therefore, intermediate node 12 is determined as the first bypass node. Therefore, the first bypass node includes leaf node 3, intermediate node 7, and intermediate node 12. The first bypass node is represented by a thick black solid box in Figure 12C. Nodes in the first tree other than the first bypass node and the leaf node corresponding to the local transaction are not provided to the third consensus node. The advantage of this is that when the third consensus node performs verification, the relevant information generated from the leaf node corresponding to the summary value of the local transaction to the root node is provided to the third consensus node layer by layer, ensuring that the third consensus node can perform correct verification. At the same time, information unrelated to verification is minimized from being provided to the third consensus node, reducing information leakage from other transactions. Furthermore, even for the first bypass node, information is generally only provided in the form of a summary value, etc., to reduce the leakage of the actual information of the related transaction.
[0261] After determining the first bypass node in step 1111, in step 1112, the second consensus node sends the summary value of the local transaction and the summary value recorded in the first bypass node to the third consensus node.
[0262] Next, after receiving the digest value of the local transaction and the digest value recorded in the first bypass node, the third consensus node determines a first comparison digest value in step 1120 using the digest value recorded in the first bypass node and the digest value of the local transaction.
[0263] The process of determining the first comparison summary value includes: determining the summary value of the local transaction, and then inferring the summary values recorded by each node in the first path layer by layer (such as the part circled by the curve in Figure 12C) based on the summary value recorded by the first bypass node and the summary value of the local transaction. The summary value inferred for the root node in the first path is the first comparison summary value.
[0264] As shown in Figure 12C, when determining the first comparison digest value using the digest value recorded by the first bypass node and the digest value of the local transaction, it is assumed that the digest value of the local transaction is recorded in leaf node 4, and the first bypass node includes leaf node 3, intermediate node 7, and intermediate node 12. In this case, the digest value recorded by intermediate node 8 is inferred based on the digest value recorded by leaf node 4 and the digest value recorded by leaf node 3. The digest value of intermediate node 11 is inferred based on the inferred digest values of intermediate node 8 and intermediate node 7. The digest value of the root node is inferred based on the inferred digest values of intermediate node 11 and intermediate node 12.
[0265] After obtaining the first comparison digest value in step 1120, the third consensus node compares the digest value recorded in the root node of the first tree with the first comparison digest value. In step 1121, if the digest value recorded in the root node of the first tree is consistent with the first comparison digest value, the verification is successful.
[0266] Through steps 1110-1112 and 1120-1121, the present embodiment ensures that the third consensus node can accurately verify the local transaction and verify whether the transaction has been truly uploaded to the blockchain. Furthermore, because the summary value of the local transaction and the summary value recorded in the first bypass node are only shared with the three consensus nodes, the leakage of the actual information of the relevant transaction is reduced, thereby improving security.
[0267] In other embodiments, in addition to verifying whether a transaction is truly recorded, the associated data generated after the execution of a partial transaction can also be verified. Associated data refers to parameters that may be affected by the execution of a transaction, such as the total amount of resources or the number of items. For example, a partial transaction is "Electronic invoice reimbursement 0001, amount 500, and used for accommodation away from home." After this transaction is executed and uploaded to the blockchain, it will have an impact on the total amount of resources of the enterprise. Suppose the enterprise's original total resources were 500,000. After the electronic invoice is reimbursed, the total amount of resources becomes 499,500. This total amount of resources is the associated data generated by the invoice reimbursement. For another example, a partial transaction is "Give 600 movie tickets to Enterprise A." After this transaction is executed, it will affect the number of movie tickets remaining at the cinema. Suppose the cinema originally had 5,000 movie tickets. After this transaction is executed and uploaded to the blockchain, the number of movie tickets remaining at the cinema becomes 4,400. This number of movie tickets is the associated data generated by the gift transaction. In order to verify the associated data after the execution of the local transaction, in another embodiment, in addition to including the summary value of the local transaction and the summary value recorded by the first bypass node (as shown in Figure 12A), the first on-chain verification information also includes the summary value of the associated data after the execution of the local transaction and the summary value recorded by the second bypass node (as shown in Figure 14A).
[0268] In some embodiments, the first on-chain verification information also includes a summary value of the associated data obtained after the execution of the local transaction and a summary value recorded by the second bypass node in the second tree. The leaf node in the second tree records the summary value of the associated data obtained after the execution of the transaction recorded on the second blockchain. The second path is a path from a leaf node in the second tree to the root node in the second tree. A leaf node in the second tree records the summary value of the associated data obtained after the execution of the local transaction. The second bypass node is a sibling node of the node on the second path in the second tree except the root node. The first on-chain verification information is also used to indicate that when the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the third consensus node determines the second comparison summary value based on the summary value of the associated data obtained after the execution of the local transaction and the summary value recorded in the second bypass node. When the summary value recorded by the root node in the second tree is consistent with the second comparison summary value, the verification is successful.
[0269] The second tree is generated by the second consensus node. In this embodiment, referring to FIG. 13 , step 330c (performed by the second consensus node) further includes:
[0270] Step 1310: Generate a second tree;
[0271] Step 1311: Determine a second bypass node of the second path; and
[0272] Step 1312: Send the summary value of the associated data after the local transaction is executed and the summary value recorded by the second bypass node to the third consensus node.
[0273] Correspondingly, step 1121 in step 330d (performed by the third consensus node) further includes:
[0274] Step 1320: When the digest value recorded in the root node of the first tree is consistent with the first comparison digest value, determine a second comparison digest value based on the digest value of the associated data after the local transaction is executed and the digest value recorded in the second bypass node; and
[0275] Step 1321: When the digest value recorded in the root node of the second tree is consistent with the second comparison digest value, the verification is successful.
[0276] Steps 1310 - 1312 and steps 1320 - 1321 are described in detail below.
[0277] In step 1310, the leaf nodes of the second tree record the digest values of the associated data after the execution of the transaction recorded on the second blockchain. The recorded transaction includes a local transaction. The order of the leaf nodes of the second tree can be a pre-specified order of the associated data. For example, the order of enterprises A, B, C, D, etc. can be used as the order of the leaf nodes of the second tree. When the second consensus node receives local transaction 1, "Employee X reimburses 1,000 resources at Enterprise B," this transaction causes a change in the total number of resources of Enterprise B to 49,000. Therefore, the digest value of leaf node 2 in the second tree is changed to 49,000. When the second consensus node receives local transaction 2, "Employee Y reimburses 500 resources at Enterprise D," this transaction causes a change in the total number of resources of Enterprise D to 24,500. Therefore, the digest value of leaf node 4 in the second tree is changed to 24,500. The entities to which the local transactions belong can have corresponding digest algorithms, and the digest values of the local transactions can be generated by the digest algorithms corresponding to the entities to which they belong. The digest algorithms corresponding to different entities can be the same or different. The digest algorithm can be pre-specified by the second consensus node.
[0278] In step 1311, the second path is a path between a leaf node corresponding to a summary value of associated data after execution of a local transaction in the second tree and a root node in the second tree, and the second bypass node is a sibling node of the node in the second path other than the root node in the second tree.
[0279] As shown in Figure 14C , assuming that the digest value of the associated data after the execution of the local transaction is recorded in leaf node 4, the second path is the path from leaf node 4 in the second tree to the root node in the second tree. This second path also includes leaf node 4, intermediate node 8, intermediate node 11, and the root node in the second tree. The second bypass node of the second path includes leaf node 3, intermediate node 7, and intermediate node 12. The second bypass node is represented by a thick black solid box in Figure 14C . Except for the digest value recorded by the second bypass node and the digest value of the associated data after the execution of the local transaction, other digest values in the second tree are not provided to the third consensus node.
[0280] After determining the second bypass node in step 1311, in step 1312, the second consensus node sends the summary value of the associated data after the local transaction is executed and the summary value recorded in the second bypass node to the third consensus node.
[0281] Then, after receiving the summary value of the associated data after the execution of the local transaction and the summary value recorded in the second bypass node, in step 1320, when the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the third consensus node determines the second comparison summary value based on the summary value of the associated data after the execution of the local transaction and the summary value recorded in the second bypass node.
[0282] The process of determining the second comparison digest value includes inferring the digest values recorded by each node in the second path (such as the circled portion of the curve in Figure 14C) based on the digest value recorded by the second bypass node and the digest value of the associated data after the transaction is executed. The digest value inferred for the root node in the second path is the second comparison digest value.
[0283] After obtaining the second comparison digest value in step 1320, the third consensus node compares the digest value recorded in the root node of the second tree with the second comparison digest value. In step 1321, if the digest value recorded in the root node of the second tree is consistent with the second comparison digest value, the verification is successful.
[0284] Through the above steps 1310-1312 and steps 1320-1321, the embodiment of the present application can not only verify whether the local transaction has been truly put on the chain through the local transaction itself, but also verify whether the local transaction has been truly put on the chain through the generated associated data. The double verification further improves the verification accuracy.
[0285] In some embodiments, the first on-chain verification information also includes a first signature of the second bypass node. The first signature is obtained by the second consensus node encrypting the first digest with the first private key of the second consensus node. The first digest is generated by the second consensus node based on the digest value of the local transaction, the digest value recorded by the first bypass node, the digest value of the associated data obtained after the execution of the local transaction, and the digest value recorded by the second bypass node. The first signature is used to indicate that when the root node of the third consensus node in the second tree is consistent with the second root node to be compared, the first public key of the second consensus node is used to decrypt the first signature to obtain the second digest. The third digest is generated based on the digest value of the local transaction, the digest value recorded by the first bypass node, the digest value of the associated data obtained after the execution of the local transaction, and the digest value recorded by the second bypass node. When the third digest is consistent with the second digest, the verification is successful.
[0286] Referring to Figure 15, the first on-chain verification information shown in Figure 15 includes not only the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data after the execution of the local transaction, and the summary value recorded by the second bypass node, but also the first signature.
[0287] The first signature is obtained by the second consensus node signing the digest value of the local transaction, the digest value of the first bypass record, the digest value of the associated data after the local transaction is executed, and the digest value of the second bypass node record. The second consensus node generates the first signature in the following way:
[0288] Concatenate the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data after the local transaction is executed, and the summary value recorded by the second bypass node to obtain concatenated data;
[0289] Processing the concatenated data according to a predetermined digest algorithm to generate a first digest; and
[0290] The first summary is encrypted using the first private key of the second consensus node to obtain a first signature.
[0291] If the first on-chain verification information also includes the first signature, step 1321 includes:
[0292] When the digest value recorded in the root node of the second tree is consistent with the second comparison digest value, the first signature is decrypted using the first public key of the second consensus node to obtain the second digest;
[0293] Processing the concatenated data according to a predetermined digest algorithm to generate a third digest; and
[0294] If the third digest is consistent with the second digest, the verification is successful.
[0295] The order of concatenation of the digest value of the local transaction, the digest value recorded by the first bypass node, the digest value of the associated data after the execution of the local transaction, and the digest value recorded by the second bypass node can be one of the following:
[0296] (1) a pre-specified order, for example, a predetermined order of the digest value of the local transaction - the digest value recorded by the first bypass node - the digest value of the associated data after the execution of the local transaction - the digest value recorded by the second bypass node; and,
[0297] (2) According to the dictionary order of the first characters of the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data after the execution of the local transaction, and the summary value recorded by the second bypass node. For example, if the first character of the summary value of the local transaction is t, the first character of the summary value recorded by the first bypass node is m, the first character of the summary value of the associated data after the execution of the local transaction is a, and the first character of the summary value recorded by the second bypass node is c, then the attribute concatenation is as follows: the summary value of the associated data after the execution of the local transaction - the summary value recorded by the second bypass node - the summary value recorded by the first bypass node - the summary value of the local transaction. This embodiment helps to improve the verification complexity and improve the on-chain security of the first type of local transactions.
[0298] In the above steps 1310-1312 and 1320-1321, through the first signature of the second consensus node and the verification of the first signature by the third consensus node, it is ensured that the concatenated summary value of the local transaction to be on-chain, the summary value recorded by the first bypass node, the summary value of the associated data after the execution of the local transaction to be on-chain, and the summary value recorded by the second bypass node are authentically issued by the second consensus node, thereby further improving the on-chain security of the first type of local transaction.
[0299] The above is a detailed description of steps 330c-330d.
[0300] Detailed description of step 340
[0301] In step 340, the first relay node obtains the on-chain verification result of the local transaction from the third consensus node.
[0302] Before the first relay node obtains the on-chain verification result, the on-chain verification result is obtained by the third consensus node after verifying the on-chain of the local transaction based on the first on-chain verification information. Referring to Figure 16, the first on-chain verification information includes the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data after the local transaction is executed, the summary value recorded by the second bypass node, and the transaction desensitization information. The transaction desensitization information is obtained by the second consensus node after desensitizing the local transaction. The desensitization process is performed based on the desensitization field in the target contract, and the target contract corresponds to the subtype of the local transaction.
[0303] If the first on-chain verification information includes transaction masking information, step 340 includes obtaining the transaction masking information from the third consensus node as the on-chain verification result. Transaction masking information refers to information in the target transaction that can be disclosed to a third party, such as "Transaction type XX has been completed and on-chain."
[0304] Transaction desensitization information is generated by the second consensus node. The method for the second consensus node to generate transaction desensitization information is as follows:
[0305] Get the subtype of the first type of local transaction;
[0306] Get the target contract corresponding to the subtype; and,
[0307] According to the desensitized fields in the target contract, the local transaction is desensitized to obtain the desensitized transaction information.
[0308] In this embodiment, the manner of obtaining the subtype is similar to the manner of determining the subtype in the above embodiment.
[0309] A target contract is a contract that executes the on-chain execution of a Type 1 transaction of a certain subtype. For example, a Type 1 transaction of the invoice subtype corresponds to an invoice subtype target contract, which is used to execute the on-chain execution of Type 1 transactions of the invoice subtype. A Type 1 transaction of the order subtype corresponds to an order subtype target contract, which is used to execute the on-chain execution of Type 1 transactions of the order subtype. Generally speaking, a target contract requires execution by all second-consensus nodes.
[0310] The target contract can be determined in the following way: according to the subtype, a comparison table of the subtype and candidate target contracts is searched to determine the target contract.
[0311] Subtypes can be the aforementioned invoice type, order type, resource exchange type, resource statistics type, etc. Based on the contract requirements of each subtype, a comparison table between the subtype and the target contract is prepared in advance, for example:
[0312] Table 5
[0313] As shown in Table 5, for the invoice reimbursement subtype, a unified reimbursement target contract can be set. For the invoice issuance subtype, a unified invoicing target contract can be set. Similarly, for the resource exchange subtype, a unified exchange target contract can be set, and for the resource statistics subtype, a unified statistics target contract can be set.
[0314] After the above comparison table is prepared, you can search the above comparison table according to the subtype to determine the target contract corresponding to the subtype.
[0315] After the target contract is determined, the local transaction is desensitized based on the desensitized fields in the target contract, resulting in desensitized transaction information. Desensitized fields are fields that carry information that can be disclosed to third parties. For example, in an electronic invoice reimbursement transaction, the transaction subtype and number do not contain information that cannot be disclosed to third parties and can therefore be disclosed to third parties.
[0316] For example, the first type of local transaction is "Electronic invoice 0001 reimbursement, amount 500, and used for accommodation away from home". Then first obtain the subtype of the local transaction as the invoice reimbursement type (for example, according to the second key field including invoice reimbursement, determine that the subtype is the invoice type). Secondly, according to the subtype of the invoice reimbursement type, search the above-mentioned comparison table to obtain the target contract as the reimbursement target contract (the desensitized fields of the reimbursement target contract include the amount and purpose). Then, according to the desensitized fields in the reimbursement target contract, that is, the transaction subtype and number, remove the amount and purpose in "Electronic invoice reimbursement 0001, amount 500, and used for accommodation away from home", and only retain the transaction subtype and number. The desensitized transaction information obtained is "Electronic invoice reimbursement 0001 has been successfully reimbursed".
[0317] The benefit of this embodiment is that by processing the desensitized fields in the target contract, the accuracy of desensitization is improved, thereby improving the security of the target transaction on the chain.
[0318] The first on-chain verification information in the above embodiment includes transaction desensitization information, but in another embodiment, the first on-chain verification information does not include transaction desensitization information, but includes immediacy information.
[0319] In some embodiments, the first on-chain verification information also includes immediacy information of the local transaction, where the immediacy information is determined by the second consensus node based on the subtype of the local transaction; and obtaining the on-chain verification result of the local transaction from the third consensus node includes: when the immediacy information indicates that the local transaction is an immediacy transaction, after the third consensus node successfully verifies it, receiving the on-chain verification result returned by the third consensus node.
[0320] Referring to Figure 17, the first on-chain verification information shown in Figure 17 includes the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data after the local transaction is executed, the summary value recorded by the second bypass node, and the immediacy information. In the case where the first on-chain verification information includes the immediacy information, step 340 includes:
[0321] When the immediacy information indicates that the local transaction is an immediate transaction, after successful verification by the third consensus node, the on-chain verification result returned by the third consensus node is received.
[0322] In the specific implementation of this embodiment, the immediacy information is generated in the following manner:
[0323] Get the subtype of the local transaction of the first type; and,
[0324] Based on the sub-type, the immediacy of the information is determined.
[0325] In this embodiment, the manner of obtaining the subtype is similar to the manner of determining the subtype in the above embodiment.
[0326] Subtypes can be the aforementioned invoice reimbursement type, invoice issuance type, resource exchange type, resource statistics type, etc. A comparison table of subtypes and immediacy information is prepared in advance based on the immediacy requirements of each subtype, for example:
[0327] Table 6
[0328] As shown in Table 6, for transactions with a subtype of invoice reimbursement or invoice issuance, where immediacy is a higher requirement, the immediacy information can be set to immediate (so that the on-chain verification results of local transactions with a subtype of invoice can be returned to the first relay node immediately). For transactions with a subtype of resource exchange or resource statistics, where immediacy is a lower requirement than for transactions with a subtype of invoice reimbursement, the immediacy information can be set to non-immediate.
[0329] After the above-mentioned comparison table is prepared, the above-mentioned comparison table can be searched according to the sub-type to determine the instant information corresponding to the sub-type.
[0330] For example, consider a local transaction of type 1: "Electronic invoice reimbursement 0001, amount 500, for accommodation away from home." First, the subtype of this local transaction is determined to be "Invoice reimbursement." Next, based on the subtype being "Invoice type," the comparison table is searched. If the immediacy information is "Instant," this indicates that "Electronic invoice reimbursement 0001, amount 500, for accommodation away from home" is an instant transaction. After successful verification by the third consensus node, it immediately returns the on-chain verification result to the first relay node, enhancing the immediacy of instant transaction processing.
[0331] The benefit of this embodiment is that the on-chain verification results are immediately returned for immediate local transactions, ensuring the immediate processing of immediate transactions.
[0332] In some embodiments, when the immediacy information indicates that the local transaction is a non-immediate transaction, a request for on-chain verification result is sent to the third consensus node, and the on-chain verification result is obtained from the response of the third consensus node to the on-chain verification result request.
[0333] For example, the first type of local transaction is "100 first resources exchanged for 10 second resources". Then first obtain the subtype of the local transaction as resource exchange type. Secondly, according to the subtype of resource exchange type, search the above comparison table and obtain the immediacy information as non-immediate, which means "100 first resources exchanged for 10 second resources" is a non-immediate transaction. At this time, after the third consensus node successfully verifies, the third consensus node does not need to return the on-chain verification result to the first relay node so urgently. It can wait for the first relay node to send an on-chain verification result request to the third consensus node and respond to the request. The first relay node obtains the on-chain verification result from the response of the third consensus node to the on-chain verification result request.
[0334] The advantage of this embodiment is that, for non-immediate local transactions, waiting for the request from the first relay node reduces the occupancy of transmission resources.
[0335] When the immediacy information indicates that the local transaction is not immediacy, the first relay node sends an on-chain verification result request to the third consensus node, so as to obtain the on-chain verification result from the third consensus node's response to the on-chain verification result request. The on-chain verification result request is described below.
[0336] Referring to Figure 18, the on-chain verification result request shown in Figure 18 includes a block identifier, a source address, and a destination address. The source address refers to the address of the first relay node, while the destination address refers to the address of the third consensus node. As for the block identifier, it is used to indicate the block where the on-chain verification result is located (this block is on the third blockchain maintained by the third consensus node).
[0337] The block identifier is generated by the third consensus node and sent by the third consensus node to the first relay node. For example, step 330d includes the third consensus node verifying the on-chain of the local transaction based on the first on-chain verification information, generating an on-chain verification result, recording the on-chain verification result on the third blockchain, and returning the block identifier recorded on the third blockchain to the first relay node.
[0338] In a specific implementation of this embodiment, before the third consensus node sends the block identifier to the first relay node, it generates a block based on the on-chain verification result and records the block on the third blockchain. A block consists of a block body and a block header. The block body is divided into multiple blocks. The on-chain verification result may occupy only one, several, or all of these blocks. If only one or several of these blocks are occupied, the remaining blocks record the on-chain verification results of local transactions of other third consensus nodes. Specifically, the third consensus node packages the block occupied by the on-chain verification result and the blocks corresponding to the on-chain verification results of other third consensus nodes that need to be uploaded into a block body, adds the block header to form a single block, and records it on the blockchain. The block header indicates relevant information about the block, including version number, feature value, timestamp, and difficulty value. The block identifier distinguishes the block from other blocks, such as the block height and feature value. The characteristic value of a block is generally a digest value generated by a digest algorithm using the block body. Since different block bodies produce different digest values, the digest value uniquely identifies the block. The block height indicates the number of blocks recorded on the blockchain. This also uniquely distinguishes the block from other blocks. After the block is recorded on the third blockchain, the block identifier recorded on the third blockchain is returned to the first relay node.
[0339] After the first relay node receives the block identifier, in some embodiments, step 340 includes: sending a chain verification result request to the third consensus node, the chain verification result request including the block identifier, so that the third consensus node can obtain the chain verification result from the third blockchain based on the block identifier, and receiving the chain verification result returned by the third consensus node. The advantage of this is that the third consensus node records the chain verification result on the third blockchain, making it easier for other nodes to check, and the chain verification result is not easily tampered with, thereby improving the security of the chain verification result.
[0340] The methods for determining the request to send the verification result on-chain include but are not limited to the following three situations:
[0341] (1) After the first relay node receives the block identifier, the first relay node immediately sends a chain verification result request to the third consensus node.
[0342] (2) The first relay node pre-sets a second sending period. After receiving the block identifier and after the second sending period has passed, the first relay node sends a request for on-chain verification results to the third consensus node.
[0343] (3) After the first relay node receives the block identifier, the first relay node sends a prompt message to the local consensus network, "Do you want to obtain the first on-chain verification result?". When the first relay node receives the "yes" indication information returned by the first consensus node, the first relay node sends a request for the on-chain verification result to the third consensus node in response to the indication information returned by the first consensus node.
[0344] Considering the need for global transactions to be put on the chain
[0345] The transaction on-chain method described in the above embodiment only addresses the on-chain needs of local transactions. Local transactions are executed and recorded on the corresponding blockchain based on their parent type. For example, a second consensus node records a first-type local transaction on a second blockchain, which is inaccessible to nodes other than the second consensus node. Another example is a first consensus node records a second-type local transaction on a first blockchain, which is accessible to nodes other than the first consensus node. In other words, all second-type local transactions are recorded on the first consensus node within the local consensus network. However, in a hierarchical blockchain consensus system, local transactions recorded by each local consensus network need to be aggregated into a global consensus network. The global transaction generated by the aggregation of second-type local transactions is then recorded on a third blockchain by the second global consensus network within the global consensus network. Therefore, in one embodiment, after the first consensus node executes the local transaction in response to determining that the parent type of the local transaction is the second type and records it on the first blockchain, it is also necessary to further record the global transaction generated by the local transaction on the third blockchain.
[0346] As shown in FIG19 , after step 320, the transaction on-chain method according to one embodiment of the present application may further include:
[0347] Step 1910: Obtain a global transaction derived from a plurality of local transactions of the second type; and
[0348] Step 1920: Send the global transaction to the third consensus node. The global transaction is used to instruct the third consensus node to execute the global transaction and record the global transaction in the third blockchain.
[0349] Steps 1910-1920 are described in detail below.
[0350] In step 1910, a global transaction may be summarized from multiple local transactions in a local consensus network, or a global transaction may be summarized from local transactions in multiple local consensus networks.
[0351] The ways to summarize global transactions include:
[0352] (1) After the first consensus node receives a predetermined number of local transactions, it generates a global transaction based on the predetermined number of local transactions.
[0353] (2) When the time difference between the current time of the first consensus node and the time of the last global transaction sent exceeds a threshold, a new global transaction is generated based on the received local transaction.
[0354] (3) After the first consensus node receives a predetermined number of local transactions, it generates a global transaction based on the predetermined number of local transactions. If the predetermined number is not met, but the time difference between the current time of the first consensus node and the time of the last summarized global transaction exceeds a threshold, a global transaction is generated based on the received local transactions.
[0355] For example, suppose there are three Type 2 local transactions: "Order 10001: Purchase 50 office supplies," "Order 10002: Purchase 150 office supplies," and "Order 10003: Purchase 200 office supplies." Based on these three local transactions, the resulting global transaction could be "Total number of orders is 3" or "Total order purchase amount is 400 office supplies," and so on.
[0356] Continuing with reference to FIG. 19 , step 1920 can be specifically divided into 1920a sending the summarized global transaction to the third consensus node, and 1920b (performed by the third consensus node) executing the summarized global transaction and recording the summarized global transaction to the third blockchain.
[0357] In step 1920a, the first consensus node sends the summarized global transaction in the following manner:
[0358] (1) After the first consensus node obtains the local transaction, it immediately sends the summarized global transaction to the third consensus node.
[0359] (2) The first consensus node pre-sets a third sending cycle. After the first consensus node obtains the local transaction and the third sending cycle has passed, the first consensus node sends the summarized global transaction to the third consensus node.
[0360] In step 1920b, the third consensus node executes the summarized global transaction and records the summarized global transaction on the third blockchain. The third blockchain records the summarized global transaction and can be accessed by nodes other than the third consensus node.
[0361] For the specific process of the third consensus node executing and recording to the third blockchain, reference may be made to the description of the first consensus node executing and recording to the first blockchain in the above embodiment.
[0362] The advantage of the above embodiment is that, based on the hierarchical consensus system architecture (as shown in Figure 10), it can ensure that each local consensus network runs local affairs relatively independently, which is convenient for hierarchical business governance. There is no need to aggregate all the traffic of the business alliance in the entire witness network to the global consensus network. Under the premise of data isolation, business security isolation, and legal compliance, steps 1910-1920 can ensure that the second global consensus network does not need to carry a large number of segmented businesses and can focus on the governance of key tasks and global affairs.
[0363] In addition, in the above embodiment, after the third consensus node records the summarized global transaction to the third blockchain, the first relay node can obtain the second on-chain verification information from the third consensus node and send it to the first consensus node, so that the first consensus node can verify the second on-chain verification information to ensure that the summarized global transaction has been truly executed and truly on-chain.
[0364] As shown in FIG20 , after step 1920, the transaction on-chain method according to one embodiment of the present application may further include:
[0365] Step 2010: When the third consensus node records the global transaction to the third blockchain to generate second on-chain verification information, receive the second on-chain verification information from the third consensus node; and
[0366] Step 2020: Send the second on-chain verification information to the first consensus node. The second on-chain verification information is used to instruct the first consensus node to verify the on-chain of the summarized global transaction.
[0367] For example, assuming that the second on-chain verification information includes the summarized global transaction digest value and the digest value recorded by the third bypass node, the third bypass node is obtained by the third consensus node in the following manner:
[0368] A third tree is generated, wherein leaf nodes of the third tree record summary values of transactions recorded on the third blockchain, and the recorded transactions include summarized global transactions. In two adjacent layers of the third tree, nodes in the upper layer are generated by at least two nodes in the lower layer, and the same node in the lower layer is only used to generate one node in the upper layer.
[0369] Determine a third bypass node of a third path, where the third path is a path between a leaf node corresponding to a summary value of the global transaction summarized on the third tree and a root node in the third tree, and the third bypass node is a sibling node of a node in the third path other than the root node in the third tree.
[0370] Correspondingly, step 2020 includes:
[0371] Determining a third comparison digest value based on the summarized digest value of the global transaction and the digest value of the third bypass record; and
[0372] If the third comparison digest value is consistent with the digest value recorded in the root node of the third tree, the verification is successful.
[0373] For the specific method of verification based on the second on-chain verification information, refer to the specific method of verification based on the first on-chain verification information.
[0374] Through steps 2010-2020, the embodiment of the present application ensures that the first consensus node can accurately verify the summarized global transactions and can verify that the summarized global transactions are truly recorded without cheating.
[0375] Implementation details of the transaction chain method of this application embodiment
[0376] 21 , the implementation details of the transaction chaining method according to an embodiment of the present application will be described in detail.
[0377] In step 310, the first relay node determines that the parent type of the local transaction is the first type, or determines that the parent type of the local transaction is the second type.
[0378] In step 320, in response to determining that the parent type of the local transaction is the second type, the first consensus node executes the local transaction and records the local transaction to the first blockchain.
[0379] In step 330, it is divided into steps 330a-330d. In step 330a, the first relay node places the local transaction in a queue (step 410). In response to the queue meeting a predetermined condition, the local transactions in the queue are packaged and sent to the second consensus node (step 420). In step 330b: the second consensus node executes the local transaction and records the local transaction in the second blockchain. In step 330c: step 1110 generates a first tree; step 1111 determines the first bypass node of the first path; and step 1112 sends the digest value of the local transaction and the digest value recorded in the first bypass node to the third consensus node. In step 330d, based on the digest value of the local transaction and the digest value recorded in the first bypass node, a first comparison digest value is determined (step 1120); and, when the digest value recorded in the root node of the first tree is consistent with the first comparison digest value, verification is successful (step 1121).
[0380] In step 340, the on-chain verification result of the local transaction is obtained from the third consensus node. For example, if the digest value recorded in the root node of the first tree is consistent with the first comparison digest value, the on-chain verification result is verification success; if the digest value recorded in the root node of the first tree is inconsistent with the first comparison digest value, the on-chain verification result is verification failure.
[0381] In addition to local transactions that need to be on-chain, there are also summarized global transactions that need to be recorded on the third blockchain. Therefore, referring to Figure 21, in step 1910, the summarized global transaction generated for the local transaction is obtained; in step 1920, the summarized global transaction is sent to the third consensus node (1920a); the third consensus node executes the summarized global transaction and records the summarized global transaction to the third blockchain (1920b). Then, after step 1920, step 2010 receives the second on-chain verification information of the summarized global transaction from the third consensus node; step 2020a sends the second on-chain verification information to the first consensus node; and step 2020b (executed by the first consensus node) verifies the on-chain of the summarized global transaction.
[0382] The advantages of this embodiment include but are not limited to: being able to distinguish whether a local transaction is of the first type or the second type, thereby meeting the on-chain security requirements of the target transaction; reducing network overhead by packaging and sending multiple local transactions together; using the summary value and the summary value recorded by the bypass node as the first on-chain verification information, verifying the on-chain authenticity of the local transaction and reducing the leakage of the true information of other related transactions; enabling the third consensus node to more centrally process global transactions by executing and recording the summarized global transaction on the third blockchain; and, through the second on-chain verification information, verifying the on-chain authenticity of the summarized global transaction, thereby improving security.
[0383] The above embodiment is mainly described with the first relay node as the core processing module. The following describes the transaction chain method of another embodiment with the second consensus node as the core processing module.
[0384] 22 , the transaction on-chain method executed by the second consensus node includes:
[0385] Step 2210: Receive a local transaction forwarded by a first relay node, where the parent type of the local transaction is a first type;
[0386] Among them, local transactions come from the local consensus network.
[0387] Step 2220: Execute the local transaction and record the local transaction in the second blockchain; wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node;
[0388] Step 2230: Obtain the first on-chain verification information of the local transaction; and
[0389] Step 2240: Send the first on-chain verification information to the third consensus node in the second global consensus network (step 2240a). The first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain the on-chain verification result (step 2240b).
[0390] In this embodiment, for the first type of local transaction, the local transaction is sent to the second consensus node to instruct the second consensus node to record the local transaction on the second blockchain. Since the second blockchain is not accessible to any nodes other than the second consensus node, the security of the first type of local transaction is guaranteed. At the same time, after the second consensus node completes the on-chain upload of the local transaction, it sends the first on-chain verification information after the on-chain upload to the third consensus node. The third consensus node performs on-chain verification to obtain the on-chain verification result, and obtains the on-chain verification result from the third consensus node. This ensures that although the local transaction cannot be viewed externally, its on-chain upload is authentic and trustworthy, thereby improving the security of the local transaction on-chain upload.
[0391] In some embodiments, the second consensus node has a trusted execution environment, and the second blockchain is encrypted with a key of the trusted execution environment; sending the first on-chain verification information to the third consensus node includes: receiving a first on-chain verification information request sent by the second relay node; and, in response to the first on-chain verification information request, sending the first on-chain verification information to the second relay node, the first on-chain verification information being used to instruct the second relay node to forward the first on-chain verification information to the third consensus node.
[0392] Specifically, in response to adding a block encrypted with the trusted execution environment's key to the second blockchain, the second relay node sends a first on-chain verification information request to the second consensus node. In response to the first on-chain verification information request sent by the second relay node, the second consensus node sends the first on-chain verification information to the second relay node, and the second relay node forwards the first on-chain verification information to a third consensus node in the second global consensus network.
[0393] In this embodiment, the local transactions recorded in the second blockchain on the first global consensus network cannot be seen by the first relay node, and therefore, key encryption in a trusted execution environment is adopted. However, the addition of a block to the second blockchain can be discovered. Therefore, the second relay node can identify whether there are additional key-encrypted blocks on the second blockchain. After discovering the presence of additional key-encrypted blocks on the second blockchain, it sends a first chain verification information request to the second consensus node. After the second consensus node receives the first chain verification information request, it cannot directly return the first chain verification information to the first relay node. Instead, it must return the first chain verification information to the second relay node, which then forwards it to the third consensus node, which then verifies it based on the first chain verification information.
[0394] In the embodiment of the present application, the block is encrypted by the key of the trusted execution environment, and the first on-chain verification information is forwarded through the second relay node, thereby further improving the security of the target transaction on-chain of the first global consensus network.
[0395] Description of the apparatus and device of the embodiments of the present application
[0396] It is to be understood that, although the steps in the above-mentioned flowcharts are shown in sequence according to the arrow representations, these steps are not necessarily performed in sequence according to the order represented by the arrows. Unless otherwise specified in the present embodiment, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned flowcharts may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0397] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the characteristics of the target object, such as the target object attribute information or attribute information set, the permission or consent of the target object will be obtained first, and the collection, use and processing of such data will comply with the relevant laws, regulations and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain the attribute information of the target object, the target object's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the target object's separate permission or separate consent, the necessary target object-related data for the normal operation of the embodiment of the present application will be obtained.
[0398] FIG23 is a schematic diagram of the structure of a transaction on-chain device 2300 provided in an embodiment of the present application. The transaction on-chain device 2300 includes:
[0399] The first determining unit 2310 is configured to determine the parent type of a local transaction when the local transaction is received by the first consensus node.
[0400] The first sending unit 2330 is used to send the local transaction to the second consensus node when the parent type of the local transaction is the first type, where the local transaction is used to instruct the second consensus node to execute the local transaction, record the local transaction to the second blockchain, generate first on-chain verification information of the local transaction, and send the first on-chain verification information to the third consensus node, where the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information, to obtain the on-chain verification result of the local transaction, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node.
[0401] The first acquisition unit 2340 is used to obtain the on-chain verification result of the local transaction from the third consensus node.
[0402] In some embodiments, the first consensus node belongs to a local consensus network, the second consensus node belongs to a first global consensus network in the global consensus network, the third consensus node belongs to a second global consensus network in the global consensus network, and the first relay node is used to send the first type of local transaction to the second consensus node in the first global consensus network.
[0403] In some embodiments, the transaction on-chain device 2300 also includes a first on-chain unit 2320, which is used to instruct the first consensus node to execute a local transaction and record the local transaction to the first blockchain when the parent type is the second type, wherein the first blockchain allows access by nodes other than the first consensus node.
[0404] In some embodiments, the transaction on-chain device 2300 further includes:
[0405] A third acquiring unit is configured to acquire a global transaction summarized from a plurality of local transactions of the second type; and
[0406] The third sending unit is used to send the global transaction to the third consensus node, where the global transaction is used to instruct the third consensus node to execute the global transaction and record the global transaction in the third blockchain, wherein the third blockchain allows access by nodes other than the third consensus node.
[0407] In some embodiments, the transaction on-chain device 2300 further includes:
[0408] a second receiving unit, configured to receive second on-chain verification information from the third consensus node when the third consensus node records the global transaction to the third blockchain to generate second on-chain verification information; and
[0409] The third sending unit is used to send the second on-chain verification information to the first consensus node, where the second on-chain verification information is used to instruct the first consensus node to verify the on-chain of the global transaction.
[0410] In some embodiments, the first on-chain verification information includes the summary value of the local transaction and the summary value recorded by the first bypass node determined according to the first path in the first tree. The leaf node in the first tree records the summary value of the transaction recorded on the second blockchain. The first path is the path from a leaf node in the first tree to the root node in the first tree, and a leaf node in the first tree records the summary value of the local transaction. The first bypass node is a sibling node of the node in the first tree other than the root node in the first path. The first on-chain verification information is also used to instruct the third consensus node to determine a first comparison summary value based on the summary value of the local transaction and the summary value recorded in the first bypass node. When the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the verification is successful.
[0411] In some embodiments, the first on-chain verification information also includes a summary value of the associated data obtained after the execution of the local transaction and a summary value recorded by the second bypass node in the second tree. The leaf node in the second tree records the summary value of the associated data obtained after the execution of the transaction recorded on the second blockchain. The second path is a path from a leaf node in the second tree to the root node in the second tree. A leaf node in the second tree records the summary value of the associated data obtained after the execution of the local transaction. The second bypass node is a sibling node of the node on the second path in the second tree except the root node. The first on-chain verification information is also used to indicate that when the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the third consensus node determines the second comparison summary value based on the summary value of the associated data obtained after the execution of the local transaction and the summary value recorded by the second bypass node. When the summary value recorded by the root node in the second tree is consistent with the second comparison summary value, the verification is successful.
[0412] In some embodiments, the first on-chain verification information also includes transaction desensitization information. The transaction desensitization information is obtained by the second consensus node desensitizing the local transaction. The desensitization is performed based on the desensitization field in the target contract, and the target contract corresponds to the subtype of the local transaction.
[0413] The first acquiring unit 2340 is further specifically configured to:
[0414] Obtain transaction desensitized information from the third consensus node as the on-chain verification result.
[0415] In some embodiments, the first on-chain verification information also includes immediacy information of the local transaction, and the immediacy information is determined by the second consensus node based on the subtype of the local transaction.
[0416] The first acquiring unit 2340 is further specifically configured to:
[0417] When the immediacy information indicates that the local transaction is an immediate transaction, after successful verification by the third consensus node, the on-chain verification result returned by the third consensus node is received.
[0418] In some embodiments, the first acquisition unit 2340 is further used to: when the immediacy information indicates that the local transaction is a non-immediate transaction, send an on-chain verification result request to the third consensus node, and obtain the on-chain verification result from the third consensus node's response to the on-chain verification result request.
[0419] In some embodiments, the first on-chain verification information also includes a first signature of the summary value recorded by the second bypass node. The first signature is obtained by the second consensus node encrypting the first summary with the first private key of the second consensus node. The first summary is generated by the second consensus node based on the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data obtained after the execution of the local transaction, and the summary value recorded by the second bypass node. The first signature is used to indicate that when the root node of the third consensus node in the second tree is consistent with the second root node to be compared, the first public key of the second consensus node is used to decrypt the first signature to obtain the second summary. The third summary is generated based on the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data obtained after the execution of the local transaction, and the summary value recorded by the second bypass node. When the third summary is consistent with the second summary, the verification is successful.
[0420] In some embodiments, the transaction on-chain device 2300 is further used to: after the third consensus node records the block including the on-chain verification result to the third blockchain, receive the block identifier returned by the third consensus node, where the block identifier refers to the block including the on-chain verification result.
[0421] The first acquiring unit 2340 is further configured to:
[0422] Sending an on-chain verification result request to the third consensus node, where the on-chain verification result request carries a block identifier, and the on-chain verification result request is used to instruct the third consensus node to obtain the on-chain verification result from the third blockchain according to the block identifier; and receiving the on-chain verification result returned by the third consensus node.
[0423] In some embodiments, the first sending unit 2330 is further configured to:
[0424] enqueue the local transaction in a queue; and,
[0425] In response to the queue meeting a predetermined condition, the local transactions in the queue are packaged and sent to the second consensus node.
[0426] In some embodiments, the first sending unit 2330 is further specifically configured to:
[0427] In response to the number of local transactions in the queue reaching a first threshold, the local transactions in the queue are packed.
[0428] In some embodiments, the first sending unit 2330 is further specifically configured to: in response to the number of local transactions in the queue not reaching a first threshold, determine a time difference between the current time and the time of the last package; and,
[0429] In response to the time difference reaching a second threshold, the local transactions in the queue are packaged.
[0430] In some embodiments,
[0431] The first sending unit 2330 is further specifically configured to:
[0432] Determine a subtype of the local transaction; determine a queue corresponding to the subtype of the local transaction; and place the local transaction in the queue corresponding to the subtype.
[0433] In some embodiments, the first sending unit 2330 is further configured to: in response to the number of local transactions in the queue reaching a third threshold, pack the local transactions in the queue.
[0434] In some embodiments, the first sending unit 2330 is further specifically configured to:
[0435] Determine the subtype of the local transaction;
[0436] Determine the priority of local transactions based on subtype;
[0437] Place local transactions in the queue in descending order of priority; and
[0438] Local transactions are sequentially taken out of the queue and sent to the second consensus node.
[0439] In some embodiments, the second consensus node has a trusted execution environment, and the second blockchain is encrypted with the key of the trusted execution environment; the first on-chain verification information is sent by the second consensus node to the second relay node in response to the first on-chain verification information request sent by the second relay node, and the first on-chain verification information request is sent by the second relay node in response to adding an encrypted block to the second blockchain. The encrypted block is encrypted with the key of the trusted execution environment, and the first on-chain verification information is used to instruct the second relay node to forward the first on-chain verification information to the third consensus node.
[0440] FIG24 is a schematic diagram of the structure of a transaction on-chain device 2400 provided in an embodiment of the present application. The transaction on-chain device 2400 includes:
[0441] A first receiving unit 2410 is configured to receive a local transaction forwarded by a first relay node, where the parent type of the local transaction is a first type;
[0442] A second on-chain unit 2420 is configured to execute a local transaction and record the local transaction in a second blockchain, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node;
[0443] The second obtaining unit 2430 is configured to obtain first on-chain verification information of a local transaction; and
[0444] The second sending unit 2440 is used to send the first on-chain verification information to the third consensus node. The first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain an on-chain verification result.
[0445] In some embodiments, the second consensus node has a trusted execution environment, and the second blockchain is encrypted with the key of the trusted execution environment; the second sending unit 2440 is also used to: receive a first up-chain verification information request sent by the second relay node; the first up-chain verification information request is sent by the second relay node in response to adding an encrypted block to the second blockchain, and the encrypted block is encrypted with the key of the trusted execution environment; and, in response to the first up-chain verification information request, send the first up-chain verification information to the second relay node, and the first up-chain verification information is used to instruct the second relay node to forward the first up-chain verification information to the third consensus node.
[0446] 25 , which is a block diagram of a portion of a terminal that implements the transaction on-chain method according to an embodiment of the present application. The terminal includes components such as a radio frequency (RF) circuit 2510, a memory 2515, an input unit 2530, a display unit 2540, a sensor 2550, an audio circuit 2560, a wireless fidelity (WiFi) module 2570, a processor 2580, and a power supply 2590. Those skilled in the art will appreciate that the terminal structure shown in FIG25 does not limit the scope of a mobile phone or computer, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0447] RF circuit 2510 can be used to receive and send signals during information transmission or calls. In particular, it receives downlink information from the base station and sends it to processor 2580 for processing. In addition, it sends uplink data to the base station.
[0448] The memory 2515 may be used to store software programs and modules. The processor 2580 executes various functional applications and data processing of the target terminal by running the software programs and modules stored in the memory 2515 .
[0449] The input unit 2530 may be configured to receive input digital or character information and generate key signal input related to the setting and function control of the target terminal. Specifically, the input unit 2530 may include a touch panel 2531 and other input devices 2532.
[0450] The display unit 2540 may be configured to display input information or provided information and various menus of the target terminal. The display unit 2540 may include a display panel 2541.
[0451] The audio circuit 2560, the speaker 2561, and the microphone 2562 may provide an audio interface.
[0452] In this embodiment, the processor 2580 included in the terminal can execute the transaction on-chain method of the previous embodiment.
[0453] The terminals of the embodiments of the present application include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to data security, blockchain, data storage, information technology, etc.
[0454] Figure 26 is a block diagram of the structure of part of the server for implementing the transaction chain method of an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 2622 (for example, one or more processors) and memories 2632, and one or more storage media 2130 (for example, one or more mass storage devices) for storing application programs 2642 or data 2644. Among them, the memories 2632 and the storage media 2630 can be temporary storage or permanent storage. The program stored in the storage medium 2630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 2622 can be configured to communicate with the storage medium 2630 to execute a series of instruction operations in the storage medium 2630 on the server.
[0455] The server may also include one or more power supplies 2626, one or more wired or wireless network interfaces 2650, one or more input and output interfaces 2658, and / or one or more operating systems 2641, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0456] The central processor 2622 in the server can be used to execute the transaction chaining method of the embodiment of the present application.
[0457] An embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable instructions, and the computer-readable instructions are used to execute the transaction chaining method of each of the aforementioned embodiments.
[0458] The present application also provides a computer program product, which includes a computer program. A processor of a computer device reads and executes the computer program, so that the computer device executes the above-mentioned transaction on-chain.
[0459] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "comprise" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0460] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0461] It should be understood that in the description of the embodiments of the present application, multiple (or multiple items) means more than two, greater than, less than, exceed, etc. are understood to exclude the number itself, and above, below, within, etc. are understood to include the number itself.
[0462] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0463] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0464] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0465] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store computer-readable instructions, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0466] It should also be understood that the various implementation methods provided in the embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0467] The above is a specific description of the implementation methods of the present application, but the present application is not limited to the above implementation methods. Technical personnel familiar with the art can also make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A transaction on-chain method, characterized in that: The method is executed by the first relay node and includes: When the first consensus node receives a local transaction, determining a parent type of the local transaction; In the case where the parent type is the first type, the local transaction is sent to the second consensus node, the local transaction is used to instruct the second consensus node to execute the local transaction, the local transaction is recorded in the second blockchain, the first on-chain verification information of the local transaction is generated, and the first on-chain verification information is sent to the third consensus node, the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information, and obtain the on-chain verification result of the local transaction, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node; and, Obtain the on-chain verification result of the local transaction from the third consensus node.
2. The method according to claim 1, characterized in that The first consensus node belongs to a local consensus network, the second consensus node belongs to a first global consensus network in the global consensus network, the third consensus node belongs to a second global consensus network in the global consensus network, and the first relay node is used to send a local transaction of the first type to the second consensus node in the first global consensus network.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: In a case where the parent type is the second type, the first consensus node is instructed to execute the local transaction and record the local transaction to a first blockchain, wherein the first blockchain allows access by nodes other than the first consensus node.
4. The method according to claim 3, characterized in that The method further comprises: Obtaining a global transaction summarized from a plurality of second-type local transactions; and, The global transaction is sent to the third consensus node, where the global transaction is used to instruct the third consensus node to execute the global transaction, and the global transaction is recorded in a third blockchain, wherein the third blockchain allows access by nodes other than the third consensus node.
5. The method according to claim 4, characterized in that The method further comprises: In a case where the third consensus node records the global transaction to the third blockchain to generate second on-chain verification information, receiving the second on-chain verification information from the third consensus node; and, The second on-chain verification information is sent to the first consensus node, where the second on-chain verification information is used to instruct the first consensus node to verify the on-chain of the global transaction.
6. The method according to any one of claims 1 to 5, characterized in that: The first on-chain verification information includes a summary value of the local transaction and a summary value recorded by a first bypass node determined according to a first path in the first tree. A leaf node in the first tree records a summary value of a transaction recorded on the second blockchain. The first path is a path from a leaf node in the first tree to a root node in the first tree, and a leaf node in the first tree records a summary value of the local transaction. The first bypass node is a sibling node of a node in the first tree other than a root node in the first path. The first on-chain verification information is also used to instruct the third consensus node to determine a first comparison summary value based on the summary value of the local transaction and the summary value recorded in the first bypass node. When the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the verification is successful.
7. The method according to claim 6, characterized in that The first on-chain verification information also includes a summary value of the associated data obtained after the execution of the local transaction and a summary value recorded by the second bypass node in the second tree. The leaf node in the second tree records the summary value of the associated data obtained after the execution of the transaction recorded on the second blockchain. The second path is a path from a leaf node in the second tree to a root node in the second tree. A leaf node in the second tree records the summary value of the associated data obtained after the execution of the local transaction. The second bypass node is a sibling node of the node on the second path in the second tree except the root node. The first on-chain verification information is also used to indicate that when the summary value recorded by the root node in the first tree is consistent with the first comparison summary value, the third consensus node determines a second comparison summary value based on the summary value of the associated data obtained after the execution of the local transaction and the summary value recorded by the second bypass node. When the summary value recorded by the root node in the second tree is consistent with the second comparison summary value, the verification is successful.
8. The method according to claim 7, characterized in that The first on-chain verification information also includes transaction desensitization information, which is obtained by the second consensus node performing desensitization processing on the local transaction. The desensitization processing is performed based on the desensitization field in the target contract, and the target contract corresponds to the subtype of the local transaction; and, The obtaining the on-chain verification result of the local transaction from the third consensus node includes: The transaction desensitization information is obtained from the third consensus node as the on-chain verification result.
9. The method according to claim 7, characterized in that: The first on-chain verification information also includes immediacy information of the local transaction, where the immediacy information is determined by the second consensus node according to the subtype of the local transaction; and, The obtaining the on-chain verification result of the local transaction from the third consensus node includes: When the immediacy information indicates that the local transaction is an instant transaction, after the third consensus node successfully verifies, the on-chain verification result returned by the third consensus node is received.
10. The method according to claim 9, characterized in that The method further comprises: When the immediacy information indicates that the local transaction is a non-immediate transaction, a request for an on-chain verification result is sent to the third consensus node, and the on-chain verification result is obtained from a response of the third consensus node to the request for the on-chain verification result.
11. The method according to claim 7, characterized in that The first on-chain verification information also includes a first signature of the second bypass node, where the first signature is obtained by the second consensus node encrypting a first digest using a first private key of the second consensus node, and the first digest is generated by the second consensus node according to a digest value of the local transaction, a digest value recorded by the first bypass node, a digest value of associated data obtained after the execution of the local transaction, and a digest value recorded by the second bypass node; The first signature is used to indicate that the root node of the third consensus node in the second tree is consistent with the second root node to be compared. In this case, the first signature is decrypted with the first public key of the second consensus node to obtain a second summary, and a third summary is generated according to the summary value of the local transaction, the summary value recorded by the first bypass node, the summary value of the associated data obtained after the execution of the local transaction, and the summary value recorded by the second bypass node. When the third summary is consistent with the second summary, the verification is successful.
12. The method according to claim 1, characterized in that The method further comprises: After the third consensus node records the block including the on-chain verification result to the third blockchain, receiving a block identifier returned by the third consensus node, where the block identifier refers to the block including the on-chain verification result; The obtaining the on-chain verification result of the local transaction from the third consensus node includes: Sending a chain verification result request to the third consensus node, wherein the chain verification result request carries the block identifier, and the chain verification result request is used to instruct the third consensus node to obtain the chain verification result from the third blockchain according to the block identifier; and, Receive the on-chain verification result returned by the third consensus node.
13. The method according to any one of claims 1 to 12, characterized in that: The sending the local transaction to the second consensus node includes: placing the local transaction in a queue; and, In response to the queue satisfying a predetermined condition, the local transactions in the queue are packaged and sent to the second consensus node.
14. The method according to claim 13, characterized in that In response to the queue satisfying a predetermined condition, packaging the local transactions in the queue comprises: In response to the number of local transactions in the queue reaching a first threshold, the local transactions in the queue are packaged.
15. The method according to claim 13, characterized in that In response to the queue satisfying a predetermined condition, packaging the local transactions in the queue comprises: In response to the number of local transactions in the queue not reaching a first threshold, determining a time difference between a current time and a previous packaging time; and, In response to the time difference reaching a second threshold, the local transactions in the queue are packaged.
16. The method according to claim 13, characterized in that Placing the local transaction in a queue comprises: Determining a subtype of the local transaction; Determining a queue corresponding to the subtype of the local transaction; and, The local transaction is placed in a queue corresponding to the subtype and queued.
17. The method according to claim 16, characterized in that In response to the queue satisfying a predetermined condition, packaging the local transactions in the queue comprises: In response to the number of local transactions in the queue reaching a third threshold, the local transactions in the queue are packaged.
18. The method according to any one of claims 1 to 17, characterized in that The sending the local transaction to the second consensus node includes: Determining a subtype of the local transaction; Determining the priority of the local transaction according to the subtype; Placing the local transactions in a queue in descending order of priority; and, The local transactions are sequentially taken out from the queue and sent to the second consensus node.
19. The method according to any one of claims 1 to 18, characterized in that: The second consensus node has a trusted execution environment, and the second blockchain is encrypted with the key of the trusted execution environment; the first on-chain verification information is sent by the second consensus node to the second relay node in response to the first on-chain verification information request sent by the second relay node, and the first on-chain verification information request is sent by the second relay node in response to adding an encrypted block to the second blockchain, and the encrypted block is encrypted with the key of the trusted execution environment. The first on-chain verification information is used to instruct the second relay node to forward the first on-chain verification information to the third consensus node.
20. A transaction on-chain method, characterized in that: Executed by the second consensus node, including: receiving a local transaction forwarded by a first relay node, wherein the parent type of the local transaction is a first type; Executing the local transaction, and recording the local transaction to a second blockchain, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node; Obtaining first on-chain verification information of the local transaction; and, The first on-chain verification information is sent to the third consensus node, where the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain an on-chain verification result.
21. The method according to claim 20, characterized in that The second consensus node has a trusted execution environment, and the second blockchain is encrypted with a key of the trusted execution environment; The sending the first on-chain verification information to the third consensus node includes: Receive a first up-chain verification information request sent by a second relay node; the first up-chain verification information request is sent by the second relay node in response to adding an encrypted block on the second blockchain, and the encrypted block is encrypted using the key of the trusted execution environment; and, in response to the first up-chain verification information request, send the first up-chain verification information to the second relay node, and the first up-chain verification information is used to instruct the second relay node to forward the first up-chain verification information to the third consensus node.
22. A transaction on-chain device, characterized in that: include: A first determining unit, configured to determine, in the case of a local transaction received by the first consensus node, a parent type of the local transaction; A first sending unit is configured to send the local transaction to a second consensus node when the parent type is the first type, The local transaction is used to instruct the second consensus node to execute the local transaction, record the local transaction to the second blockchain, generate the first on-chain verification information of the local transaction, and send the first on-chain verification information of the local transaction to the third consensus node, the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information, and obtain the on-chain verification result of the local transaction, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node; and, The first acquisition unit is used to obtain the on-chain verification result of the local transaction from the third consensus node.
23. A transaction on-chain device, characterized in that: include: A first receiving unit, configured to receive a local transaction forwarded by a first relay node, wherein the parent type of the local transaction is a first type; A second on-chain unit, configured to execute the local transaction and record the local transaction in a second blockchain, wherein the second blockchain is prohibited from being accessed by nodes other than the second consensus node; A second acquisition unit is used to acquire first on-chain verification information of the local transaction; and The second sending unit is used to send the first on-chain verification information to a third consensus node, where the first on-chain verification information is used to instruct the third consensus node to verify the on-chain of the local transaction according to the first on-chain verification information to obtain an on-chain verification result.
24. An electronic device comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, characterized in that: When the processor executes the computer-readable instructions, it implements the transaction chaining method according to any one of claims 1 to 21.
25. One or more readable storage media storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by one or more processors, the transaction chaining method according to any one of claims 1 to 21 is implemented.
26. A computer program product, comprising computer-readable instructions, wherein the computer-readable instructions are read and executed by one or more processors of a computer device, so that the computer device executes the transaction chaining method according to any one of claims 1 to 21.
Citation Information
Patent Citations
Partitioned blockchain network and method of realizing partition consensus thereby
CN107807984A
Block chain hierarchical consensus method, block chain network system and block chain node
CN109462587A
Intelligent contract implementation method and device based on full-chain consensus and local deployment
CN112580112A
Data processing method and apparatus in blockchain network, storage medium, and computer device
US20210203509A1
