Transaction processing method and device in block chain and computer program product

By introducing the business layer and consensus layer into the blockchain and expanding the service sub-chain to handle different types of transactions in the consensus layer, the problem of low business processing efficiency in the layered blockchain is solved, and efficient transaction processing and ledgers are realized renew.

CN119090631APending Publication Date: 2024-12-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310666542.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In hierarchical blockchain technology, the main chain limitations of the consensus network lead to low service processing efficiency, witnessing that the business nodes in the network need to filter a large amount of main chain data, affecting the processing efficiency.

Method used

The business layer and consensus layer are introduced into the blockchain, and the transaction processing request is sent to the consensus layer through the business nodes. The core main chain sends transaction information to the target service sub-chain for processing, and synchronizes the service sub-block and transaction status to the core main Chain, business nodes synchronize the core main chain ledger to obtain sub-ledgers to avoid unnecessary main chain data access.

Benefits of technology

Improve business processing efficiency. By extending the service sub-chain to process different types of transactions in the consensus layer, the dependence of business nodes on main chain data is reduced, and the efficiency and system performance of transaction processing are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090631A_ABST
    Figure CN119090631A_ABST
Patent Text Reader

Abstract

The invention provides a transaction processing method and device in a block chain and a computer program product. The method comprises the steps that any service node in a service layer sends a transaction processing request to a core main chain in a consensus layer; the core main chain sends the transaction information to the target service sub-chain based on the identification information of the target service sub-chain; performing transaction processing based on the transaction information through the target service sub-chain to obtain a corresponding service sub-block and a transaction state of the target service sub-chain, and synchronizing the transaction state of the service sub-block and the transaction state of the target service sub-chain to a core main chain, the core main chain updates the account book of each node in the core main chain based on the transaction state of the service sub-block and the target service sub-chain; and synchronizing an account book of the core main chain through any service node, and obtaining a sub-account book for the target service sub-chain based on the account book. According to the scheme, a plurality of service sub-chains are expanded on the basis of the hierarchical block chain, and the sub-account books with the service sub-chains are maintained in the corresponding service nodes, so that the service processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology. Specifically, the present application relates to a transaction processing method, device and computer program product in a blockchain. Background Art

[0002] Blockchain technology can solve the problem of trust establishment between nodes in a decentralized system through distributed node verification and consensus mechanisms, and realize a decentralized and distributed trust establishment mechanism, thereby completing the transfer of value while transmitting information. The transaction privacy, security, data immutability and auditability, integrity, system transparency and fault tolerance of blockchain make blockchain widely used in many fields, including identity management, intelligent transportation, supply chain management, Internet of Things, Industrial Internet, Energy Internet, etc.

[0003] With the development of blockchain technology, layered blockchain has been proposed, which separates the consensus network and the witness network. The consensus network mainly performs the core consensus algorithm, and the witness network performs data clearing and synchronization, and completes related specific services based on the SPV (Simplified Payment Verification) node. Since the consensus network is in a relatively secure private cloud, its mutual access is guaranteed by the consensus mechanism, and there is no need to add additional identity management and network control. However, the business node is in the public network and may be accessed by other uncertain network terminals. Therefore, the behavior of the business node and other possible nodes accessing the consensus network needs to be strictly controlled.

[0004] However, the core performance of the above-mentioned layered blockchain technology is limited by the main chain of the consensus network. Various different businesses will be mixed in the main chain. The business nodes in the witness network need to filter a large amount of main chain data when processing the corresponding business, resulting in low business processing efficiency. Summary of the invention

[0005] The purpose of this application is to solve at least one of the above technical defects. The technical solutions provided by the embodiments of this application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a transaction processing method in a blockchain, characterized in that the blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes a core main chain and at least one service subchain, each service subchain is used to process transactions of a corresponding type, and the method includes:

[0007] Send a transaction processing request to the core main chain in the consensus layer through any business node in the business layer. The transaction processing request contains the identification information and transaction information of the corresponding target service subchain;

[0008] The transaction information is sent to the target service subchain through the core mainchain based on the identification information of the target service subchain;

[0009] The target service subchain processes the transaction based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, and synchronizes the transaction status of the service subblock and the target service subchain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service subblock and the target service subchain;

[0010] Synchronize the ledger of the core main chain through any business node, and obtain the sub-ledger for the target service sub-chain based on the ledger.

[0011] In an optional embodiment of the present application, sending transaction information to a target service subchain includes:

[0012] If the transaction information does not involve data in the core main chain, the transaction information will be directly forwarded to the target service subchain through the core main chain;

[0013] If the transaction request involves data in the core main chain, the transaction information will be forwarded to the target service subchain through the core main chain, and after obtaining the relevant data of the transaction, the relevant data will be sent to the target service subchain through the preset inbox contract of the target service subchain. The preset inbox contract is set on the core main chain.

[0014] In an optional embodiment of the present application, the target service subchain performs transaction processing based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, including:

[0015] Receive transaction information through the transaction organization node of the target service subchain, and generate a service subblock based on the transaction information;

[0016] Send the service sub-block to the virtual machine of the target service sub-chain, execute the transaction in the service sub-block through the virtual machine, and obtain the transaction status of the target service sub-chain;

[0017] Among them, the transaction organization node and virtual machine are both set on the target service subchain.

[0018] In an optional embodiment of the present application, generating a service sub-block based on transaction information includes:

[0019] If the transaction organization node satisfies at the current moment that the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the time from the current moment to the last time a service sub-block was sent to the virtual machine is not less than the preset time, then a service sub-block will be generated based on the transaction information and other transaction information.

[0020] In an optional embodiment of the present application, the method further includes:

[0021] When receiving transaction information through the transaction organization node, pledge a preset amount of the transaction corresponding to the transaction information;

[0022] When a challenge to a service sub-block is received through the core main link, the transaction in the service sub-block is re-executed. If the transaction status of the target service sub-chain obtained by the re-execution is inconsistent with the transaction status of the target service sub-chain obtained before the challenge, a preset proportion of the preset amount will be rewarded to the challenger.

[0023] In an optional embodiment of the present application, synchronizing the transaction status of the service sub-block and the target service sub-chain to the core main chain includes:

[0024] The transaction status of the service sub-block and the target service sub-chain is synchronized to the core main chain through the preset service synchronization contract of the target service sub-chain, and the preset service synchronization contract is set on the core main chain.

[0025] In an optional embodiment of the present application, synchronizing the account book of the core main chain through any business node includes:

[0026] Get the Merkle tree information of each block in the account book of the core main chain;

[0027] The corresponding block is verified based on the Merkle tree information, and the ledger of the core main chain is obtained after the verification is passed.

[0028] In an optional embodiment of the present application, the method further includes:

[0029] In the core main chain, the ledgers of each node in the core main chain are updated based on the transaction status of the service sub-block and the target service sub-chain, and a Bloom filter is added to the block header of each block in the core main chain. The Bloom filter in the block header of each block is used to indicate whether the block contains the service sub-block of the target service sub-chain;

[0030] Obtain the sub-ledger for the target service sub-chain based on the ledger, including:

[0031] Determine the target block containing the service subblock of the target service subchain based on the Bloom filter in the block header of each block, and obtain the transaction status of the core main chain;

[0032] Obtain the service sub-block of the target service sub-chain from the target block, obtain the transaction status of the target service sub-chain from the transaction status of the core main chain, and obtain the sub-ledger of the target service sub-chain based on the service sub-block of the target service sub-chain and the transaction status of the target sub-chain.

[0033] In a second aspect, an embodiment of the present application provides a transaction processing device in a blockchain, characterized in that the blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes a core main chain and at least one service subchain, each service subchain is used to process transactions of a corresponding type, and the method includes:

[0034] The transaction processing request sending module is used to send a transaction processing request to the core main chain in the consensus layer through any business node in the business layer. The transaction processing request contains the identification information and transaction information of the corresponding target service subchain;

[0035] The transaction information sending module is used to send the transaction information to the target service subchain through the core main chain based on the identification information of the target service subchain;

[0036] The transaction processing module is used to obtain the transaction status of the corresponding service sub-block and the target service sub-chain by performing transaction processing based on the transaction information through the target service sub-chain, and synchronize the transaction status of the service sub-block and the target service sub-chain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service sub-block and the target service sub-chain;

[0037] The sub-ledger acquisition module is used to synchronize the core main chain's ledger through any business node, and obtain the sub-ledger for the target service sub-chain based on the ledger.

[0038] In an optional embodiment of the present application, the transaction information sending module is specifically used to:

[0039] If the transaction information does not involve data in the core main chain, the transaction information will be directly forwarded to the target service subchain through the core main chain;

[0040] If the transaction request involves data in the core main chain, the transaction information will be forwarded to the target service subchain through the core main chain, and after obtaining the relevant data of the transaction, the relevant data will be sent to the target service subchain through the preset inbox contract of the target service subchain. The preset inbox contract is set on the core main chain.

[0041] In an optional embodiment of the present application, the transaction processing module is specifically used to:

[0042] Receive transaction information through the transaction organization node of the target service subchain, and generate a service subblock based on the transaction information;

[0043] Send the service sub-block to the virtual machine of the target service sub-chain, execute the transaction in the service sub-block through the virtual machine, and obtain the transaction status of the target service sub-chain;

[0044] Among them, the transaction organization node and virtual machine are both set on the target service subchain.

[0045] In an optional embodiment of the present application, the transaction processing module is further used to:

[0046] If the transaction organization node satisfies at the current moment that the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the time from the current moment to the last time a service sub-block was sent to the virtual machine is not less than the preset time, then a service sub-block will be generated based on the transaction information and other transaction information.

[0047] In an optional embodiment of the present application, the device further includes a service sub-block challenge module, configured to:

[0048] When receiving transaction information through the transaction organization node, pledge a preset amount of the transaction corresponding to the transaction information;

[0049] When a challenge to a service sub-block is received through the core main link, the transaction in the service sub-block is re-executed. If the transaction status of the target service sub-chain obtained by the re-execution is inconsistent with the transaction status of the target service sub-chain obtained before the challenge, a preset proportion of the preset amount will be rewarded to the challenger.

[0050] In an optional embodiment of the present application, in an optional embodiment of the present application, the transaction processing module is specifically used to:

[0051] The transaction status of the service sub-block and the target service sub-chain is synchronized to the core main chain through the preset service synchronization contract of the target service sub-chain, and the preset service synchronization contract is set on the core main chain.

[0052] In an optional embodiment of the present application, the sub-ledger acquisition module is specifically used to:

[0053] Get the Merkle tree information of each block in the account book of the core main chain;

[0054] The corresponding block is verified based on the Merkle tree information, and the ledger of the core main chain is obtained after the verification is passed.

[0055] In an optional embodiment of the present application, the device further includes a Bloom filter adding module, which is used to:

[0056] In the core main chain, the ledgers of each node in the core main chain are updated based on the transaction status of the service sub-block and the target service sub-chain, and a Bloom filter is added to the block header of each block in the core main chain. The Bloom filter in the block header of each block is used to indicate whether the block contains the service sub-block of the target service sub-chain;

[0057] The sub-ledger acquisition module is specifically used for:

[0058] Determine the target block containing the service subblock of the target service subchain based on the Bloom filter in the block header of each block, and obtain the transaction status of the core main chain;

[0059] Obtain the service sub-block of the target service sub-chain from the target block, obtain the transaction status of the target service sub-chain from the transaction status of the core main chain, and obtain the sub-ledger of the target service sub-chain based on the service sub-block of the target service sub-chain and the transaction status of the target sub-chain.

[0060] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor;

[0061] A computer program is stored in the memory;

[0062] A processor is used to execute a computer program to implement the method provided in the embodiment of the first aspect or any optional embodiment of the first aspect.

[0063] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method provided in the embodiment of the first aspect or any optional embodiment of the first aspect is implemented.

[0064] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that when the computer device executes, the method provided in the embodiment of the first aspect or any optional embodiment of the first aspect is implemented.

[0065] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0066] A multi-layer blockchain system including a business layer and a consensus layer is constructed, and a service subchain for processing different types of transactions is extended in the consensus layer. When the core main chain receives a transaction of the type corresponding to the service subchain sent by the business subchain in the business layer, it will send the transaction to the corresponding target service subchain for processing. After processing, the target service subchain will synchronize the updated service subblock and transaction status to the core main chain. The core main chain will synchronize the service subblock and transaction status to the core main chain to update the ledgers of each node. The business node that sends the business processing request will synchronize the ledger of the core main chain and obtain a subledger consistent with the target service subchain based on the ledger. Based on the layered blockchain, this solution extends multiple service subchains for processing different types of transactions for the core main chain. At the same time, the business nodes corresponding to different types of service subchains maintain subledgers consistent with the corresponding service subchains. Business processing based on the subledger does not need to pass other irrelevant data to the main chain, which improves business processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0068] Figure 1 This is a schematic diagram of the structure of a distributed system 100 applied to a blockchain system in an example of an embodiment of the present application;

[0069] Figure 2 is a schematic diagram of a block structure in an example of an embodiment of the present invention;

[0070] Figure 3 This is a schematic diagram of the structure of a layered blockchain system in an example of an embodiment of the present application;

[0071] Figure 4 This is a schematic diagram of the structure of another layered blockchain system in an example of an embodiment of the present application;

[0072] Figure 5 System architecture diagram of a transaction processing method in a blockchain provided by an embodiment of the present application;

[0073] Figure 6 A flowchart of a transaction processing method in a blockchain provided in an embodiment of the present application;

[0074] Figure 7 A schematic diagram of a preset information interaction bridge in an example of an embodiment of the present application;

[0075] Figure 8 A schematic diagram of performing block verification based on Merkle tree information in an example of an embodiment of the present application;

[0076] Fig. 9 A schematic diagram of adding a Bloom filter to a blockchain in an example of an embodiment of the present application;

[0077] Fig.10 A structural block diagram of a transaction processing device in a blockchain provided in an embodiment of the present application

[0078] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0079] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.

[0080] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B".

[0081] It should be noted that the relevant data collection and processing in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0082] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0083] First, several terms involved in this application are introduced and explained:

[0084] P2P network: A peer-to-peer network based on a specific type of network protocol. Network nodes do not require a central node to maintain the network status. Instead, each node maintains the node status of the entire network or the connection status of its adjacent nodes through broadcast interactions with adjacent nodes.

[0085] Layered blockchain: refers to the separation of the consensus network and the witness network. The consensus network mainly performs the core consensus algorithm, and the witness network performs data clearing and synchronization, and completes related specific services based on the SPV node.

[0086] Transaction clearing: After receiving the request for transaction synchronization from the business node, the consensus node synchronizes the transactions that the business node has the authority to read to the business node.

[0087] Subchain: A concept that comes from the parent chain. Simply put, it is a blockchain built on the underlying parent chain. Subchains are representatives of various industries or vertical fields of blockchain, and are also a general term for various blockchain projects in various fields. When a subchain is created, the relevant information of the subchain will be recorded in the parent chain, which means that data on the chain must rely on the parent chain for storage, verification, and traceability.

[0088] The embodiments of the present application involve a blockchain system, which can be a distributed system formed by connecting a client and multiple nodes (any form of computing device in the access network, such as a server and a user terminal) through network communication.

[0089] Take the distributed system as the blockchain system as an example, see Figure 1 , Figure 1 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system. It is formed by multiple nodes (any form of computing devices in the access network, such as servers and user terminals) and clients, and the nodes form a peer-to-peer (P2P, Peer To Peer) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP, Transmission Control Protocol) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node. The node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0090] See also Figure 1 The functions of each node in the blockchain system shown include:

[0091] 1) Routing: a basic function of a node, used to support communication between nodes.

[0092] In addition to the routing function, the node can also have the following functions:

[0093] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0094] See also Figure 2 , Figure 2 This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0095] In order to explain the system architecture of the transaction processing method in the blockchain provided by the embodiment of the present application, the hierarchical blockchain structure is first explained. The basis of the system is a hierarchical blockchain structure, such as Figure 3 As shown, the hierarchical blockchain structure may include a business layer and a consensus layer. The business layer is set in the witness network, and includes multiple business nodes. The consensus layer is set in the consensus network, and includes multiple consensus nodes. Each consensus node constitutes the core main chain, which is used to run the consensus protocol of the blockchain. Since the consensus network is in a relatively secure private cloud, its mutual access has a consensus mechanism to ensure security, and there is no need to add additional identity management and network control. However, the business node is in the public network and may be accessed by other uncertain network terminals. Therefore, the behavior of the business node and other possible nodes accessing the consensus network needs to be strictly controlled.

[0096] Specifically, Figure 4 The figure shows a specific example of a layered blockchain structure, which includes: users (enterprises and individuals, etc.), business nodes corresponding to each user in the business layer (the business layer corresponding to different types of users may be set up on a public cloud or a private cloud), a routing proxy layer, and a consensus layer. The business layer interacts with the consensus layer through the routing proxy layer, and the routing proxy layer serves to isolate the business layer from the consensus layer.

[0097] Furthermore, the system architecture of the transaction processing method in the blockchain provided by the embodiment of the present application is as follows: Figure 5As shown, the system mainly includes a business layer and a consensus layer, the business layer includes multiple business nodes, and the consensus layer includes a core main chain and multiple service subchains. The nodes of the business layer can be divided into main chain business nodes and subchain business nodes, and each subchain business node can be divided into business nodes that receive (or generate) different types of transactions. Each service subchain in the consensus layer corresponds to each subchain business node, and is used to process the corresponding type of transactions sent by the corresponding subchain business node. Specifically, after the subchain business node generates a transaction of the corresponding type, it will send the transaction to the main chain business node, and then send the transaction to the core main chain through the main chain business node through the core network entrance. If it is determined that the transaction needs to be processed by the corresponding service subchain, the core main chain will forward the transaction to the corresponding service subchain, and the service subchain will synchronize the status to the core main chain after processing the transaction. Furthermore, in the embodiment of the present application, the consensus layer can realize the setting of multiple service subchains through Rollup technology, and each business node in the business layer can be an SPV node.

[0098] The transaction processing method in blockchain is explained in detail below.

[0099] Figure 6 A flowchart of a transaction processing method in a blockchain provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes a core main chain and at least one service subchain, each service subchain is used to process transactions of a corresponding type, and the method may include:

[0100] Step S601: Send a transaction processing request to the core main chain in the consensus layer through any business node in the business layer. The transaction processing request contains the identification information and transaction information of the corresponding target service subchain.

[0101] Among them, it can be known from the previous description that the business nodes in the business layer include one or more sub-chain business nodes, which can generate specific types of transactions, that is, they can send specific types of transaction processing requests to the core main chain. The one or more service sub-chains in the consensus layer can handle different types of transactions respectively. For example, in the scheme of the present application, a service sub-chain for processing the transaction of "issuing invoices" is set up, and a service sub-chain for the transaction of "tax refund" that the user has processed is set up. Then, the user can generate transactions corresponding to "issuing invoices" or "tax refunds" through the corresponding business nodes. The business node can be a terminal device of the tax department or a user's own terminal device. These terminal devices may have application software for users to input transaction information, etc.

[0102] Specifically, the user submits transaction-related information through the business node in the business layer, and the business node generates a corresponding transaction processing request based on the relevant information. The transaction processing request includes transaction information and the identifier of the target service subchain, where the transaction information contains the information required for the blockchain to process the corresponding transaction, and the target service subchain is used to uniquely determine the service subchain used to process the corresponding transaction. Then, the business node will send the transaction processing request to the main chain business node, and then the main chain business node will send the transaction processing request to the core main chain through the core network entrance. It can be understood that the main chain business node can receive transaction processing requests sent by multiple business nodes at the same time, and send multiple business processing requests to the core main chain through the core network entrance.

[0103] Step S602: Send the transaction information to the target service subchain through the core main chain based on the identification information of the target service subchain.

[0104] Specifically, after obtaining the transaction processing request, the core main chain parses it to obtain the transaction information and the identification information of the target service subchain. According to the identification information of the target service subchain, the type of transaction corresponding to the transaction processing request can be determined, that is, which service subchain the transaction needs to be processed on. After determining the target service subchain according to the identification information, the core main chain will send the transaction information in the transaction processing request to the target service subchain.

[0105] It should be noted that the core main chain has the processing capabilities of each service sub-chain, that is, the core main chain can process various types of transactions. However, in the embodiment of the present application, in order to make each specific type of transaction be processed by a specific service sub-chain, the specific type of transaction will be sent to the corresponding target service sub-chain for processing, rather than being directly processed by the core main chain. In addition, if the identification information of the target service sub-chain obtained by the core main chain through parsing is empty or a specific identification value, it indicates that the transaction corresponding to the transaction processing request needs to be processed by the core main chain. This situation may be due to the fact that the service sub-chain corresponding to the transaction has not been pre-set.

[0106] For example, the core main chain receives transaction processing request 1 sent by business node A and transaction processing request 2 sent by business node B. Transaction processing request 1 is parsed to obtain the corresponding transaction information 1 and the identification information of the target service subchain is "a", then the core main chain sends the transaction data 1 to the service subchain corresponding to the identification information "a". Transaction processing request 2 is parsed to obtain the corresponding transaction information 2 and the identification of the target service subchain is empty, then the core main chain directly performs transaction processing based on the transaction data.

[0107] Step S603, the target service subchain performs transaction processing based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, and synchronizes the transaction status of the service subblock and the target service subchain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service subblock and the target service subchain.

[0108] Among them, the target service subchain processes the transaction based on the transaction information to obtain the corresponding service subblock and the transaction status of the target service subchain, which can be considered as the sub-ledger of the target service subchain, which records the block details corresponding to each transaction in the target service subchain and the status of the target service subchain. The sub-ledger needs to be synchronized to the core main chain and also needs to be synchronized to the corresponding business node.

[0109] Specifically, after receiving the transaction data, the target service subchain processes the corresponding transaction based on the transaction data according to the transaction processing method of the target service subchain, thereby obtaining the transaction status of the corresponding service subblock and the target service subchain. In other words, after processing the transaction corresponding to the transaction data, the target service subchain will update the subledger of each node in the target service subchain to obtain the latest subledger. Then, the information of the subledger is synchronized to the core main chain, and the core main chain will update the ledger of each node in the core main chain based on the information of the subledger.

[0110] It should be noted that the service subchain is an extension of the core main chain. When processing transactions, the core main chain requires each node to reach a consensus before updating the ledger, while the service subchain can directly update the ledger without reaching a consensus when processing transactions. That is, the service subchain can be understood as a lightweight blockchain. It is understandable that different service subchains can set the transaction processing method according to demand, and its basic function is to provide independent subchains for processing different types of transactions.

[0111] For example, for the transaction of "issuing invoices", after receiving the corresponding transaction information, that is, receiving the relevant information of "issuing invoices", the target service subchain will substitute the relevant information into the processing method of the "issuing invoices" business, generate the corresponding service subblock, and update the status of the target service subchain after processing, that is, obtain the sub-ledger of the target subchain. Then, the sub-ledger is synchronized to the core main chain, and the core main chain updates the ledgers of each node based on the sub-ledger. The updated ledgers of each node contain the details of the "issuing invoices" transaction and the corresponding status.

[0112] Step S604: synchronize the account book of the core main chain through any business node, and obtain the sub-account book for the target service sub-chain based on the account book.

[0113] Specifically, after synchronizing the sub-ledger of the target service sub-chain to the core main chain, the business node that generates the transaction processing request needs to know the status after the transaction processing. First, the business node will synchronize the account book of the core main chain through the main chain business node through the core network entrance. It can be understood that the account book contains not only the information of the sub-ledger in the target service sub-chain, but also the information of other blocks after transaction processing and the information of transaction status. When the business node is performing business processing, what is needed is the information of the sub-ledger in the target service sub-chain. Therefore, after synchronizing the account book of the core main chain, the business node can further filter the sub-ledger for the target service sub-chain based on the core main chain, and then maintain a set of sub-ledgers consistent with the target service sub-chain. It can be understood that, in principle, the business node can complete the subsequent business processing by only synchronizing the account book of the core main chain, but it is necessary to carry out the data in the core main chain that does not belong to the target service sub-chain, which will lead to low business processing efficiency. Therefore, in the embodiment of the present application, the method in this step is adopted to maintain a set of sub-ledgers consistent with the target service sub-chain.

[0114] Continuing with the above example, for the transaction of "issuing invoices", after the corresponding target service subchain completes the processing of the transaction and the core main chain completes the synchronization of the subledger of the target service subchain, the account book of the core main chain contains not only the subledger information corresponding to the transaction of "issuing invoices", but also the information of the subledger of transactions processed by other service subchains and the account book of transactions processed in the main chain. In the scheme of the embodiment of the present application, after the corresponding business node synchronizes the account book of the core main chain, it will further obtain the subledger of the corresponding target service subchain based on the account book of the core main chain. It can be understood that it is only necessary to update the maintained subledger in the above manner in the future.

[0115] The solution provided by this application builds a multi-layer blockchain system including a business layer and a consensus layer, and the consensus layer extends a service subchain for processing different types of transactions. When the core main chain receives a transaction of the type corresponding to the service subchain sent by the business subchain in the business layer, it will send the transaction to the corresponding target service subchain for processing. After processing, the target service subchain will synchronize the updated service subblock and transaction status to the core main chain. The core main chain will synchronize the service subblock and transaction status to the core main chain to update the ledger of each node. The business node that sends the business processing request will synchronize the ledger of the core main chain and obtain a sub-ledger consistent with the target service subchain based on the ledger. Based on the layered blockchain, this solution extends multiple service subchains for processing different types of transactions for the core main chain. At the same time, the business nodes corresponding to different types of service subchains maintain sub-ledgers consistent with the corresponding service subchains. Business processing based on the sub-ledger does not need to pass other irrelevant data to the main chain, which improves business processing efficiency.

[0116] In the embodiment of the present application, the core main chain needs to exchange information with the business nodes in the business layer, and also needs to exchange information with each service sub-chain in the consensus layer. The interaction between the core main chain and the business nodes is mainly carried out through the core network portal and the main chain business nodes. The information interaction between the core main chain and each service sub-chain needs to be through the preset information interaction bridge deployed on the core main chain (when the service sub-chain is expanded using Rollup technology, the preset information interaction bridge can be called Rollup bridge) and the transaction organization node deployed on the service sub-chain (when the service sub-chain is expanded using Rollup technology, the transaction organization node can be called Sequencer). Specifically, if Figure 7 As shown, the preset information interaction bridge may be provided with a preset inbox contract (when the service subchain is extended by Rollup technology, the preset inbox contract may be called Inbox contract), a preset outbox contract (when the service subchain is extended by Rollup technology, the preset outbox contract may be called Outbox contract) and a preset service synchronization contract (when the service subchain is extended by Rollup technology, the preset service synchronization contract may be called Rollup contract). The following will describe the information interaction between the core main chain and the service subchain in combination with the above components.

[0117] In an optional embodiment of the present application, sending transaction information to a target service subchain includes:

[0118] If the transaction information does not involve data in the core main chain, the transaction information will be directly forwarded to the target service subchain through the core main chain;

[0119] If the transaction request involves data in the core main chain, the transaction information will be forwarded to the target service subchain through the core main chain, and after obtaining the relevant data of the transaction, the relevant data will be sent to the target service subchain through the preset inbox contract of the target service subchain. The preset inbox contract is set on the core main chain.

[0120] Among them, whether the transaction information involves the data in the core main chain refers to the fact that when processing the transaction corresponding to the transaction information, if only the transaction information is needed, the transaction information does not involve the data in the core main chain; if not only the transaction information but also the data in the core main chain is needed, the transaction information involves the data in the main chain. For example, for the transaction of "tax refund", when the corresponding target service subchain processes the transaction, in addition to the transaction information corresponding to the transaction, the data of the transaction of "invoicing" is also needed, and the data of the transaction of "invoicing" needs to be obtained from the transaction main chain, that is, the transaction information of the transaction of "tax refund" involves the data of the core main chain. For the transaction of "flight management", when the corresponding target service subchain processes the transaction, only the transaction data corresponding to the transaction is needed, that is, the transaction information of the transaction of "flight management" does not involve the data of the core main chain.

[0121] Specifically, after the core main chain receives the transaction information and determines that the transaction corresponding to the transaction information needs to be processed by the corresponding service subchain, it first determines whether the transaction information involves data on the core main chain. Specifically, it can be determined based on the transaction type corresponding to the transaction information, or it can be determined based on the specific indication information contained in the transaction information. Then, if the transaction information does not involve the data of the core main chain, the core main chain will directly forward the received transaction information to the target service subchain, and finally the target service subchain will process the transaction based on the acquired transaction information. If the transaction information involves the data of the core main chain, it is necessary to obtain the relevant data of the transaction corresponding to the transaction information, and then forward the transaction information directly to the target service subchain, and put the relevant data of the transaction into the preset inbox contract of the target service subchain. The target service subchain will take out the relevant data of the transaction from the preset inbox contract, and finally the target service subchain will process the transaction based on the acquired transaction information and transaction-related data.

[0122] It can be understood that the preset inbox contract is an information interaction channel between the core main chain and the service subchain, and each service subchain will deploy a corresponding preset inbox contract in the core main chain to receive data in the core main chain.

[0123] In an optional embodiment of the present application, the target service subchain performs transaction processing based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, including:

[0124] Receive transaction information through the transaction organization node of the target service subchain, and generate a service subblock based on the transaction information;

[0125] Send the service sub-block to the virtual machine of the target service sub-chain, execute the transaction in the service sub-block through the virtual machine, and obtain the transaction status of the target service sub-chain;

[0126] Among them, the transaction organization node and virtual machine are both set on the target service subchain.

[0127] Among them, a virtual machine is also arranged in each service subchain (when the service subchain is expanded by Rollup technology, the virtual machine can be called Rollup-VM). The virtual machine and instruction set are implemented at the bottom of the service subchain, and the operating system environment in which the smart contract can be executed is realized. The core main chain provides an interface to connect the service subchain and ensure the correct operation of the virtual machine in the service subchain. It also provides some functions, such as deploying contracts, running contracts, querying balances, and all the capabilities required by blockchains with smart contracts. The virtual machine is used to perform all operations of the service subchain and maintain all storage space. One virtual machine manages the entire chain, and the management of multiple contracts is implemented by software running on the virtual machine.

[0128] Among them, the transaction organization node (when the Rollup technology is used to expand the service sub-chain, the transaction organization node can be called Sequencer) is used to receive transaction information and related data sent by the core main chain, and organize and process the received transaction information and related data and send them to the virtual machine for execution.

[0129] Specifically, the transaction organization node of the target service subchain receives the transaction information forwarded by the core main chain, and adds the transaction information to the service subblock corresponding to the current moment. Alternatively, the transaction organization node of the target service subchain receives the transaction information and related data sent by the core main chain, and adds the transaction information and related data to the service subblock corresponding to the current moment. It is understandable that, in addition to the transaction information or related data corresponding to the transaction, the service subblock may also include transaction information and / or related data corresponding to other transactions. Then, the transaction organization node will send the generated service subblock to the virtual machine for the virtual machine to execute each transaction in the service subblock, including executing the transaction, and finally obtain the transaction status of the target service subchain.

[0130] It should be noted that in the process of processing transactions on the service subchain, there is no consensus processing, but it is directly executed by the virtual machine after the service subchain is generated, that is, the service subchain is a lightweight blockchain compared to the core main chain. Since there is no need for consensus processing and it is directly executed by the virtual machine, the processing efficiency is further improved.

[0131] In an optional embodiment of the present application, generating a service sub-block based on transaction information includes:

[0132] If the transaction organization node satisfies at the current moment that the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the time from the current moment to the last time a service sub-block was sent to the virtual machine is not less than the preset time, then a service sub-block will be generated based on the transaction information and other transaction information.

[0133] Specifically, when generating a service sub-block, the organization node will try to add more transaction information or related data until the preset conditions are met, generate the corresponding service sub-block, and send the service sub-block to the virtual machine. Meeting the preset conditions means that the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the current time is not less than the preset time from the last time the service sub-block was sent to the virtual machine. At least one of the preset capacity and the preset time can be set according to actual needs.

[0134] In an optional embodiment of the present application, the method may further include:

[0135] When receiving transaction information through the transaction organization node, pledge a preset amount of the transaction corresponding to the transaction information;

[0136] When a challenge to a service sub-block is received through the core main link, the transaction in the service sub-block is re-executed. If the transaction status of the target service sub-chain obtained by the re-execution is inconsistent with the transaction status of the target service sub-chain obtained before the challenge, a preset proportion of the preset amount will be rewarded to the challenger.

[0137] Specifically, since there is no consensus processing process in the process of transaction processing in the service subchain, the embodiment of the present application provides a challenge mechanism for verifying whether the transaction is credible. Specifically, the challenge to the service subblock is received through the core main chain, and the node that initiates the challenge is called the challenger (or verifier), which can be any node of the core main chain, and the referee of the challenge is the aforementioned preset information interaction bridge. Specifically, the challenged service subblock will be re-executed. If the transaction status obtained after execution is inconsistent with the previous transaction status, it means that the challenge is successful, so that part of the preset amount pledged before the transaction will be rewarded to the challenger, for example, half of the pledged reward will be rewarded to the challenger. The credibility of the transaction processing can be guaranteed by this challenge mechanism.

[0138] In an optional embodiment of the present application, synchronizing the transaction status of the service sub-block and the target service sub-chain to the core main chain includes:

[0139] The transaction status of the service sub-block and the target service sub-chain is synchronized to the core main chain through the preset service synchronization contract of the target service sub-chain, and the preset service synchronization contract is set on the core main chain.

[0140] Specifically, after the target service subchain completes the processing of the transaction, the obtained service subchain and the corresponding transaction status will be synchronized to the core main chain through the preset service synchronization contract. The preset service synchronization contract also belongs to the preset information interaction bridge and is set on the core main chain.

[0141] In an optional embodiment of the present application, synchronizing the account book of the core main chain through any business node includes:

[0142] Get the Merkle tree information of each block in the account book of the core main chain;

[0143] The corresponding block is verified based on the Merkle tree information, and the ledger of the core main chain is obtained after the verification is passed.

[0144] Specifically, when each business node in the business layer synchronizes the ledger of the node in the core main chain, it first needs to verify each block in the core ledger, and then obtain the corresponding ledger after the verification is passed. Figure 8 As shown in the figure, transactions are represented by "TX". For each block in the ledger, the corresponding Merkle root is obtained from the block header of the block (header in the figure), and then the transaction information of all transactions in the block is obtained from the block body of the block (body in the figure). Based on these transaction information, the corresponding Merkle tree is constructed to obtain the final hash result, and the hash result is compared with the Merkle root. If the two match, it means that the verification is passed. If the two do not match, it means that the verification fails.

[0145] In an optional embodiment of the present application, the method may further include:

[0146] In the core main chain, the ledgers of each node in the core main chain are updated based on the transaction status of the service sub-block and the target service sub-chain, and a Bloom filter is added to the block header of each block in the core main chain. The Bloom filter in the block header of each block is used to indicate whether the block contains the service sub-block of the target service sub-chain;

[0147] Obtain the sub-ledger for the target service sub-chain based on the ledger, including:

[0148] Determine the target block containing the service subblock of the target service subchain based on the Bloom filter in the block header of each block, and obtain the transaction status of the core main chain;

[0149] Obtain the service sub-block of the target service sub-chain from the target block, obtain the transaction status of the target service sub-chain from the transaction status of the core main chain, and obtain the sub-ledger of the target service sub-chain based on the service sub-block of the target service sub-chain and the transaction status of the target sub-chain.

[0150] Specifically, the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service sub-block and the target service sub-chain, and adds a Bloom filter in the block header of each block of the core main chain to indicate whether each block contains the service sub-block of the target service sub-chain. Specifically, the numerical value corresponding to the identification information of the target service sub-chain is mapped to multiple arrays in the bitmap of the Bloom filter through multiple hash operations. Then, after synchronizing the ledger of the core main chain, when the business node obtains the sub-ledger of the target service sub-chain from the ledger, it can determine whether the block contains the service sub-block of the target service sub-chain through the Bloom filter in the block header of each block of the core main chain. For example, if Fig. 9 As shown, the ID (identity) value of the target service subchain is mapped to different arrays of the bitmap (the 2nd, 4th and 7th arrays) through three hash operations (Hash#1, Hash#2 and Hash#3). Then, when the business node obtains the service subnode, it confirms whether the 2nd, 4th and 7th arrays in the bitmap of the Bloom filter of the block header of each block of the core main chain are 1. If they are all 1, it means that the block may contain the service subblock of the target service subchain and needs to be processed. If any array is 0, it means that the block does not contain the service subblock of the target service subchain, and the block is directly skipped without processing.

[0151] It is understandable that by adding the Bloom filter, it is possible to avoid traversing all blocks of the core main chain, thereby improving the efficiency of obtaining the sub-ledger of the target service sub-chain. Then, in the process of maintaining the sub-ledger, the above method can also be used to update the sub-ledger.

[0152] Fig.10 A block diagram of a transaction processing device in a blockchain provided in an embodiment of the present application, such as Fig.10 As shown, the device 900 may include: a transaction processing request sending module 901, a transaction information sending module 902, a transaction processing module 903 and a sub-ledger acquisition module 904, wherein:

[0153] The transaction processing request sending module 901 is used to send a transaction processing request to the core main chain in the consensus layer through any business node in the business layer. The transaction processing request contains the identification information and transaction information of the corresponding target service subchain;

[0154] The transaction information sending module 902 is used to send the transaction information to the target service subchain through the core main chain based on the identification information of the target service subchain;

[0155] The transaction processing module 903 is used to obtain the transaction status of the corresponding service sub-block and the target service sub-chain by performing transaction processing based on the transaction information through the target service sub-chain, and synchronize the transaction status of the service sub-block and the target service sub-chain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service sub-block and the target service sub-chain;

[0156] The sub-ledger acquisition module 904 is used to synchronize the ledger of the core main chain through any business node, and obtain the sub-ledger for the target service sub-chain based on the ledger;

[0157] Among them, the blockchain includes a business layer and a consensus layer. The business layer includes at least one business node, and the consensus layer includes a core main chain and at least one service sub-chain. Each service sub-chain is used to process transactions of the corresponding type.

[0158] The solution provided by this application builds a multi-layer blockchain system including a business layer and a consensus layer, and the consensus layer extends a service subchain for processing different types of transactions. When the core main chain receives a transaction of the type corresponding to the service subchain sent by the business subchain in the business layer, it will send the transaction to the corresponding target service subchain for processing. After processing, the target service subchain will synchronize the updated service subblock and transaction status to the core main chain. The core main chain will synchronize the service subblock and transaction status to the core main chain to update the ledger of each node. The business node that sends the business processing request will synchronize the ledger of the core main chain and obtain a sub-ledger consistent with the target service subchain based on the ledger. Based on the layered blockchain, this solution extends multiple service subchains for processing different types of transactions for the core main chain. At the same time, the business nodes corresponding to different types of service subchains maintain sub-ledgers consistent with the corresponding service subchains. Business processing based on the sub-ledger does not need to pass other irrelevant data to the main chain, which improves business processing efficiency.

[0159] In an optional embodiment of the present application, the transaction information sending module is specifically used to:

[0160] If the transaction information does not involve data in the core main chain, the transaction information will be directly forwarded to the target service subchain through the core main chain;

[0161] If the transaction request involves data in the core main chain, the transaction information will be forwarded to the target service subchain through the core main chain, and after obtaining the relevant data of the transaction, the relevant data will be sent to the target service subchain through the preset inbox contract of the target service subchain. The preset inbox contract is set on the core main chain.

[0162] In an optional embodiment of the present application, the transaction processing module is specifically used to:

[0163] Receive transaction information through the transaction organization node of the target service subchain, and generate a service subblock based on the transaction information;

[0164] Send the service sub-block to the virtual machine of the target service sub-chain, execute the transaction in the service sub-block through the virtual machine, and obtain the transaction status of the target service sub-chain;

[0165] Among them, the transaction organization node and virtual machine are both set on the target service subchain.

[0166] In an optional embodiment of the present application, the transaction processing module is further used to:

[0167] If the transaction organization node satisfies at the current moment that the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the time from the current moment to the last time a service sub-block was sent to the virtual machine is not less than the preset time, then a service sub-block will be generated based on the transaction information and other transaction information.

[0168] In an optional embodiment of the present application, the device further includes a service sub-block challenge module, configured to:

[0169] When receiving transaction information through the transaction organization node, pledge a preset amount of the transaction corresponding to the transaction information;

[0170] When a challenge to a service sub-block is received through the core main link, the transaction in the service sub-block is re-executed. If the transaction status of the target service sub-chain obtained by the re-execution is inconsistent with the transaction status of the target service sub-chain obtained before the challenge, a preset proportion of the preset amount will be rewarded to the challenger.

[0171] In an optional embodiment of the present application, in an optional embodiment of the present application, the transaction processing module is specifically used to:

[0172] The transaction status of the service sub-block and the target service sub-chain is synchronized to the core main chain through the preset service synchronization contract of the target service sub-chain, and the preset service synchronization contract is set on the core main chain.

[0173] In an optional embodiment of the present application, the sub-ledger acquisition module is specifically used to:

[0174] Get the Merkle tree information of each block in the account book of the core main chain;

[0175] The corresponding block is verified based on the Merkle tree information, and the ledger of the core main chain is obtained after the verification is passed.

[0176] In an optional embodiment of the present application, the device further includes a Bloom filter adding module, which is used to:

[0177] In the core main chain, the ledgers of each node in the core main chain are updated based on the transaction status of the service sub-block and the target service sub-chain, and a Bloom filter is added to the block header of each block in the core main chain. The Bloom filter in the block header of each block is used to indicate whether the block contains the service sub-block of the target service sub-chain;

[0178] The sub-ledger acquisition module is specifically used for:

[0179] Determine the target block containing the service subblock of the target service subchain based on the Bloom filter in the block header of each block, and obtain the transaction status of the core main chain;

[0180] Obtain the service sub-block of the target service sub-chain from the target block, obtain the transaction status of the target service sub-chain from the transaction status of the core main chain, and obtain the sub-ledger of the target service sub-chain based on the service sub-block of the target service sub-chain and the transaction status of the target sub-chain.

[0181] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[0182] Reference below Fig.11 , which shows an electronic device suitable for implementing the embodiments of the present application (for example, executing Figure 6 The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0183] The electronic device includes: a memory and a processor, the memory is used to store a program for executing the method described in each of the above method embodiments; the processor is configured to execute the program stored in the memory. The processor here can be referred to as the processing device 1001 described below, and the memory can include at least one of the read-only memory (ROM) 1002, the random access memory (RAM) 1003, and the storage device 1008 described below, as shown below:

[0184] like Fig.11As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0185] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0186] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0187] It should be noted that the computer-readable storage medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0188] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0189] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0190] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0191] A transaction processing request is sent to the core main chain in the consensus layer through any business node in the business layer, and the transaction processing request includes the identification information and transaction information of the corresponding target service subchain; the transaction information is sent to the target service subchain through the core main chain based on the identification information of the target service subchain; the transaction processing is performed by the target service subchain based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, and the transaction status of the service subblock and the target service subchain is synchronized to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service subblock and the target service subchain; the ledger of the core main chain is synchronized through any business node, and the sub-ledger for the target service subchain is obtained based on the ledger; wherein the blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes the core main chain and at least one service subchain, and each service subchain is used to process transactions of a corresponding type.

[0192] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0193] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0194] The modules or units involved in the embodiments of the present application may be implemented by software or hardware. The name of a module or unit does not limit the unit itself in some cases. For example, the first constraint acquisition module may also be described as a "module for acquiring the first constraint".

[0195] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0196] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0197] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that when the computer device executes the computer instructions, the following conditions are achieved:

[0198] A transaction processing request is sent to the core main chain in the consensus layer through any business node in the business layer, and the transaction processing request includes the identification information and transaction information of the corresponding target service subchain; the transaction information is sent to the target service subchain through the core main chain based on the identification information of the target service subchain; the transaction processing is performed by the target service subchain based on the transaction information to obtain the transaction status of the corresponding service subblock and the target service subchain, and the transaction status of the service subblock and the target service subchain is synchronized to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service subblock and the target service subchain; the ledger of the core main chain is synchronized through any business node, and the sub-ledger for the target service subchain is obtained based on the ledger; wherein the blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes the core main chain and at least one service subchain, and each service subchain is used to process transactions of a corresponding type.

[0199] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0200] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A transaction processing method in a blockchain, characterized in that: The blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes a core main chain and at least one service subchain, each service subchain is used to process transactions of a corresponding type, and the method includes: Sending a transaction processing request to the core main chain in the consensus layer through any service node in the service layer, wherein the transaction processing request includes the identification information and transaction information of the corresponding target service subchain; Sending the transaction information to the target service subchain through the core main chain based on the identification information of the target service subchain; The target service subchain performs transaction processing based on the transaction information to obtain the corresponding service subblock and the transaction status of the target service subchain, and synchronizes the transaction status of the service subblock and the target service subchain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service subblock and the target service subchain; The ledger of the core main chain is synchronized through any of the business nodes, and the sub-ledger for the target service sub-chain is obtained based on the ledger.

2. The method according to claim 1, characterized in that The sending the transaction information to the target service subchain includes: If the transaction information does not involve data in the core main chain, the transaction information is directly forwarded to the target service subchain through the core main chain; If the transaction request involves data in the core main chain, the transaction information is forwarded to the target service subchain through the core main chain, and after obtaining the relevant data of the transaction, the relevant data is sent to the target service subchain through the preset inbox contract of the target service subchain, and the preset inbox contract is set on the core main chain.

3. The method according to claim 1, characterized in that The obtaining of the corresponding service sub-block and the transaction status of the target service sub-chain by performing transaction processing based on the transaction information through the target service sub-chain includes: Receiving the transaction information through the transaction organization node of the target service subchain, and generating the service subblock based on the transaction information; Send the service sub-block to the virtual machine of the target service sub-chain, execute the transaction in the service sub-block through the virtual machine, and obtain the transaction status of the target service sub-chain; Wherein, the transaction organization node and the virtual machine are both set on the target service subchain.

4. The method according to claim 3, characterized in that The generating the service sub-block based on the transaction information includes: If the transaction organization node, at the current moment, satisfies at least one of the following conditions: the total capacity of the received transaction information and other transaction information is not less than the preset capacity and the time from the current moment to the last time a service sub-block was sent to the virtual machine is not less than the preset length of time, then the service sub-block will be generated based on the transaction information and the other transaction information.

5. The method according to claim 3, characterized in that: The method further comprises: When the transaction information is received through the transaction organization node, a preset amount of money is pledged for the transaction corresponding to the transaction information; When a challenge to the service sub-block is received through the core main link, the transaction in the service sub-block is re-executed. If the transaction status of the target service sub-chain obtained by the re-execution is inconsistent with the transaction status of the target service sub-chain obtained before the challenge, a preset proportion of the preset amount is rewarded to the challenger.

6. The method according to claim 1, characterized in that The step of synchronizing the transaction status of the service sub-block and the target service sub-chain to the core main chain includes: The transaction status of the service sub-block and the target service sub-chain is synchronized to the core main chain through the preset service synchronization contract of the target service sub-chain, and the preset service synchronization contract is set on the core main chain.

7. The method according to claim 1, characterized in that The synchronizing the account book of the core main chain through any one of the business nodes includes: Obtaining the Merkle tree information of each block in the account book of the core main chain; The corresponding block is verified based on the Merkle tree information, and the account book of the core main chain is obtained after the verification is passed.

8. The method according to claim 7, characterized in that The method further comprises: In the core main chain, based on the transaction status of the service sub-block and the target service sub-chain, the ledger of each node in the core main chain is updated, and a Bloom filter is added to the block header of each block of the core main chain. The Bloom filter in the block header of each block is used to indicate whether the block contains the service sub-block of the target service sub-chain; The obtaining a sub-ledger for the target service sub-chain based on the ledger includes: Determine the target block containing the service subblock of the target service subchain based on the Bloom filter in the block header of each block, and obtain the transaction status of the core main chain; The service sub-block of the target service sub-chain is obtained from the target block, the transaction status of the target service sub-chain is obtained from the transaction status of the core main chain, and the sub-ledger of the target service sub-chain is obtained based on the service sub-block of the target service sub-chain and the transaction status of the target sub-chain.

9. A transaction processing device in a blockchain, characterized in that: The blockchain includes a business layer and a consensus layer, the business layer includes at least one business node, the consensus layer includes a core main chain and at least one service subchain, each service subchain is used to process transactions of a corresponding type, and the method includes: A transaction processing request sending module, used to send a transaction processing request to the core main chain in the consensus layer through any business node in the business layer, wherein the transaction processing request includes the identification information and transaction information of the corresponding target service subchain; A transaction information sending module, used to send the transaction information to the target service subchain through the core main chain based on the identification information of the target service subchain; A transaction processing module, configured to obtain the transaction status of the corresponding service sub-block and the target service sub-chain by performing transaction processing based on the transaction information through the target service sub-chain, and synchronize the transaction status of the service sub-block and the target service sub-chain to the core main chain, so that the core main chain updates the ledger of each node in the core main chain based on the transaction status of the service sub-block and the target service sub-chain; The sub-ledger acquisition module is used to synchronize the ledger of the core main chain through any business node, and obtain the sub-ledger for the target service sub-chain based on the ledger.

10. An electronic device, characterized in that: including memory and processor; The memory stores a computer program; The processor is configured to execute the computer program to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 8 when executed by a processor.