Data processing method and device of block chain system, equipment and medium
By introducing proxy nodes into the second-layer network of the blockchain system and configuring proxy ordering functions, the problem of high operating costs of ordering nodes is solved, thereby reducing operating costs and improving network efficiency.
Patent Information
- Application Number
- CN202410948343.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2026-01-16
AI Technical Summary
The operating cost of sequencer nodes in blockchain Layer 2 networks is relatively high, mainly because they require configuration of demanding transaction execution functions.
Introducing proxy nodes into the second-layer network of the blockchain system and configuring proxy ordering functions allows the ordering node to only forward transactions and receive transaction execution information, while the proxy node actually executes the transactions and updates the state root, thus reducing the configuration requirements of the ordering node.
By introducing proxy nodes in the second-layer network, the operating costs of the sequencer nodes are reduced, network bandwidth consumption is decreased, and operational efficiency is improved.
Smart Images

Figure CN121357193A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus, device, and medium for a blockchain system. Background Technology
[0002] Blockchain Layer 2 network technology reduces the computational burden on the blockchain by dividing the blockchain system into a first-layer network and a second-layer network. Transactions are processed in the second-layer network, while consensus is reached in the first-layer network on the transaction execution information returned by the second-layer network.
[0003] Currently, the second layer of a blockchain network can include sequencer nodes. These sequencer nodes confirm and execute the transaction order within the second layer network, and then submit each transaction and its execution information to the first layer network. The network nodes in the first layer network then reach a consensus on the transactions and their execution information, storing them on the blockchain. It is evident that because transactions in the second layer network are executed by sequencer nodes, the configuration requirements for running these nodes are high, increasing their operational costs. Summary of the Invention
[0004] This application provides a data processing method, apparatus, device, and medium for a blockchain system, which can improve the operating cost of sequencer nodes in a blockchain layer 2 network.
[0005] This application provides a data processing method for a blockchain system, which may include a first-layer network and a second-layer network. The method can be executed by a sequencer node in the second-layer network, and the method includes:
[0006] Obtain the set of transactions to be uploaded to the blockchain, and determine the target proxy node corresponding to the set of transactions to be uploaded to the blockchain among the proxy nodes contained in the second-layer network;
[0007] The set of transactions to be uploaded to the blockchain is forwarded to the target proxy node so that the target proxy node can execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain.
[0008] Receive the transaction execution information returned by the target agent node, update the state root corresponding to the sequencer node according to the transaction execution information, and obtain the updated state root;
[0009] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network so that the network nodes in the first-layer network can store the set of transactions to be added to the blockchain and the updated state root.
[0010] This application provides a data processing method for a blockchain system, which includes a first-layer network and a second-layer network. The method is executed by a target proxy node in the second-layer network and includes:
[0011] Receive the set of transactions to be uploaded to the blockchain sent by the sequencer node in the second-layer network;
[0012] Execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain, and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain;
[0013] The transaction execution information is sent to the sequencer node so that the sequencer node can update its corresponding state root based on the transaction execution information and obtain the updated state root.
[0014] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network by the sequencer node; the network nodes in the first-layer network are used to store the set of transactions to be added to the blockchain and the updated state root.
[0015] This application provides a data processing device for a blockchain system, which includes a first-layer network and a second-layer network. The device is applied to an orderer node in the second-layer network and includes:
[0016] The proxy node selection module is used to obtain the set of transactions to be uploaded to the blockchain and determine the target proxy node corresponding to the set of transactions to be uploaded to the blockchain from the proxy nodes included in the second-layer network.
[0017] The transaction forwarding module is used to forward the set of transactions to be uploaded to the blockchain to the target proxy node, so that the target proxy node can execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain;
[0018] The execution information receiving module is used to receive transaction execution information returned by the target agent node, and update the state root corresponding to the sequencer node according to the transaction execution information to obtain the updated state root;
[0019] The state root submission module is used to submit the set of transactions to be added to the blockchain and the updated state root to the first-layer network, so that the network nodes in the first-layer network can store the set of transactions to be added to the blockchain and the updated state root.
[0020] The proxy node selection module obtains the set of transactions to be uploaded to the blockchain and uses it to perform the following steps:
[0021] Receive the transactions to be uploaded to the blockchain from the target node and add them to the transaction pool corresponding to the sequencer node.
[0022] Based on the relationships between the transactions to be uploaded to the blockchain contained in the transaction pool, N transactions to be uploaded to the blockchain are identified in the transaction pool and added to the set of transactions to be uploaded to the blockchain; N is a positive integer.
[0023] The number of agent nodes in the second layer network is M, where M is a positive integer;
[0024] The proxy node selection module determines the target proxy node corresponding to the set of transactions to be uploaded to the blockchain from among the proxy nodes included in the second-layer network, and performs the following steps:
[0025] Obtain the proxy resource consumption corresponding to M proxy nodes in the second layer network, and obtain the priority of M proxy nodes;
[0026] Based on the proxy resource consumption and priority, the target proxy node corresponding to the set of transactions to be uploaded to the chain is determined from M proxy nodes.
[0027] The proxy node selection module determines the target proxy node corresponding to the set of transactions to be uploaded to the blockchain from M proxy nodes based on proxy resource consumption and priority, and performs the following steps:
[0028] Among the M proxy nodes, the proxy node with the lowest proxy resource consumption is determined as the candidate proxy node;
[0029] If the priority of the candidate proxy node meets the selection criteria, the candidate proxy node will be determined as the target proxy node for the set of transactions to be uploaded to the blockchain.
[0030] If the priority of the candidate proxy node does not meet the selection criteria, then the target proxy node corresponding to the set of transactions to be uploaded to the chain will be determined from the M-1 proxy nodes other than the candidate proxy nodes.
[0031] The execution information receiving module updates the state root corresponding to the sequencer node based on the transaction execution information, obtaining the updated state root, which is then used to execute the following steps:
[0032] Obtain the first state read set corresponding to the sequencer node, compare the first state read set with the second state read set in the transaction execution information, and obtain the set comparison result;
[0033] If the set comparison results indicate that the results are consistent, then the first state write set corresponding to the sequencer node is updated to the second state write set in the transaction execution information, and the second state write set and the proxy signature in the transaction execution information are stored.
[0034] Based on the second state write set, perform a hash operation on the state data corresponding to the sequencer node to obtain the updated state root.
[0035] The execution information receiving module compares the first state read set with the second state read set in the transaction execution information to obtain the set comparison result, which is used to execute the following steps:
[0036] Iterate through the identifiers in the first state read set and the second state read set;
[0037] If the data content of the same identifier is the same in the first state read set and the second state read set, then the set comparison result is determined to be the correct result;
[0038] If the data content of the same identifier in the first state read set and the second state read set is different, then the set comparison result is determined to be an error result.
[0039] The device may further include:
[0040] The read / write set submission module is used to send the second state read set and the second state write set stored in the sequencer node to the second layer network contract in the first layer network if a challenge request corresponding to the challenge node in the second layer network is received through the first layer network.
[0041] The second-layer network contract is used to verify the second state read set and the second state write set to obtain the state verification result; when the state verification result indicates that the verification is successful, the second-layer network contract is used to return the challenge failure result to the challenge node.
[0042] When the status verification result indicates that the verification failed, the second-layer network contract is used to obtain the proxy signature submitted by the sequencer node and the proxy public key corresponding to the target proxy node, and return the challenge success result to the challenge node.
[0043] The device also includes:
[0044] The compensation distribution module is used to receive compensation digital assets distributed by the second-layer network contract if the second-layer network contract determines that the proxy signature is the correct signature of the target proxy node.
[0045] The exception message module is used to receive exception message returned by the second-layer network contract if the second-layer network contract determines that the proxy signature is an incorrect signature of the target proxy node; the exception message is used to indicate that the sequencer node is determined to be an invalid node.
[0046] One embodiment of this application provides a data processing device for a blockchain system, the blockchain system including a first-layer network and a second-layer network, the device being applied to a target proxy node in the second-layer network, the device comprising:
[0047] The transaction receiving module is used to receive the set of transactions to be uploaded to the chain sent by the sequencer node in the second-layer network;
[0048] The transaction execution module is used to execute the transactions to be uploaded to the blockchain in the transaction set to be uploaded to the blockchain, and to obtain the transaction execution information corresponding to the transaction set to be uploaded to the blockchain;
[0049] The execution information sending module is used to send transaction execution information to the sequencer node, so that the sequencer node can update the state root corresponding to the sequencer node according to the transaction execution information and obtain the updated state root.
[0050] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network by the sequencer node; the network nodes in the first-layer network are used to store the set of transactions to be added to the blockchain and the updated state root.
[0051] The transaction execution module executes the transactions to be uploaded to the blockchain from the set of transactions to be uploaded, and obtains the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain, which is used to execute the following steps:
[0052] Insert the reward transaction corresponding to the target proxy node into the set of transactions to be uploaded to the blockchain. Based on the contract identifier contained in the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain, call the smart contract deployed in the blockchain. The transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain include reward transactions.
[0053] Through smart contracts, transactions to be uploaded to the blockchain are executed, and the corresponding transaction execution information is obtained.
[0054] The transaction execution module uses smart contracts to execute transactions in the set of transactions to be uploaded to the blockchain, obtaining transaction execution information corresponding to the set of transactions to be uploaded to the blockchain, which is then used to execute the following steps:
[0055] The second state read set is obtained through a smart contract. The transactions to be written to the chain in the transaction to be written to the chain set are executed according to the second state read set, thus obtaining the second state write set.
[0056] Based on the public key of the target proxy node, the second state read set and the second write set are signed to obtain the proxy signature corresponding to the target proxy node.
[0057] The second-state read set, the second-state write set, and the proxy signature are determined as the transaction execution information corresponding to the transaction set to be uploaded to the blockchain.
[0058] The device may further include:
[0059] The commitment asset submission module is used to submit the standby commitment assets corresponding to the target proxy node to the second-layer network contract in the first-layer network;
[0060] When the proxy signature in the transaction execution information generated by the target proxy node is an incorrect signature, the second-layer network contract in the first-layer network is used to determine the compensation digital asset corresponding to the sequencer node, and transfer the compensation digital asset from the backup commitment asset corresponding to the target proxy node to the sequencer node.
[0061] One aspect of this application provides a computer device, including a memory and a processor. The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided in one aspect of this application.
[0062] One aspect of this application provides a computer-readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having a processor performs the method provided in one aspect of this application.
[0063] According to one aspect of this application, a computer program product is provided, which may include a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and executes the computer program, causing the computer device to perform the method provided in the above aspect.
[0064] The blockchain system involved in this application includes a first-layer network and a second-layer network. A set of transactions to be uploaded to the blockchain is obtained through an orderer node in the second-layer network. From the proxy nodes included in the second-layer network, a target proxy node is selected to execute this set of transactions. The set of transactions to be uploaded to the blockchain is forwarded to the target proxy node, which can execute the transactions in the set to be uploaded to the blockchain, obtaining transaction execution information corresponding to the set of transactions. The system receives the transaction execution information returned by the target proxy node and updates the state root corresponding to the orderer node according to the transaction execution information, obtaining the updated state root. The set of transactions to be uploaded to the blockchain and the updated state root are submitted to the first-layer network, so that network nodes in the second-layer network can store the set of transactions to be uploaded to the blockchain. In other words, by creating proxy nodes in the second-layer network and configuring proxy ordering functions (also known as transaction execution functions, which can provide proxy ordering services for sequencer nodes) for these proxy nodes, the sequencer nodes forward these transactions to the proxy nodes for execution after obtaining them. The sequencer nodes only need to receive the transaction execution information generated by the proxy nodes, which can reduce the configuration requirements of the sequencer nodes and thus reduce the operating costs of the sequencer nodes. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application;
[0067] Figure 2 This is a timing diagram of a data processing method for a blockchain system provided in an embodiment of this application. Figure 1 ;
[0068] Figure 3 This is a schematic diagram illustrating how a sequencer node selects a target proxy node, as provided in an embodiment of this application.
[0069] Figure 4 This is a schematic diagram of transaction submission in a blockchain system provided in an embodiment of this application;
[0070] Figure 5 This is a timing diagram of a data processing method for a blockchain system provided in an embodiment of this application. Figure 2 ;
[0071] Figure 6 This is a schematic diagram of a challenge process provided in an embodiment of this application;
[0072] Figure 7 This is a schematic diagram of the structure of a data processing device for a blockchain system provided in an embodiment of this application. Figure 1 ;
[0073] Figure 8 This is a schematic diagram of the structure of a data processing device for a blockchain system provided in an embodiment of this application. Figure 2 ;
[0074] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0075] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0076] This application relates to blockchain technology. For ease of understanding, the basic technical concepts involved in this application embodiment are described below:
[0077] I. Blockchain: Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, blockchain is a decentralized database, a data structure composed of several linked data blocks. Each data block consists of transactions generated within a certain period, packaged by blockchain nodes that have the right to record transactions, and independently verified by each blockchain node.
[0078] This application specifically relates to a blockchain layer-2 network, which is an architectural mechanism of blockchain that may include a first-layer network (or a single-layer network, or the main chain) and a second-layer network (or a second-layer network). The first-layer network can be used for consensus confirmation of transactions in traditional blockchains, while the second-layer network can be used for the actual execution of transactions.
[0079] II. Public Key and Private Key: A public key and a private key are a key pair (one public key and one private key) obtained through a specific algorithm. The public key is the publicly disclosed part of the key pair, while the private key is the non-public part. Public keys are typically used for encrypting data, verifying digital signatures, etc. This algorithm ensures that the resulting key pair is unique. When using this key pair, if data is encrypted with one key, it can be decrypted with the other key. For example, data encrypted with the public key can be decrypted using the private key, and vice versa; otherwise, decryption will fail.
[0080] III. Smart Contracts: A computer protocol designed to disseminate, verify, or execute contracts in an information-based manner. A smart contract can be understood as a computer program running on a distributed ledger (i.e., blockchain) with pre-defined rules, states, and conditional responses. It can encapsulate, verify, and execute complex behaviors of distributed nodes to complete information exchange, value transfer, and asset management. Based on the distributed architecture and consensus algorithms of blockchain, smart contracts allow users who do not trust each other to complete transactions without the need for any trusted third-party intermediaries or authorities. Furthermore, digital smart contracts can be flexibly embedded in various tangible or intangible assets, transactions, and data to achieve active or passive asset and information management and control, gradually building programmable smart assets and systems.
[0081] IV. State Read / Write Set: This refers to the specific operation records of state data generated during the execution of a transaction or smart contract, such as which data was read, written, or updated. In other words, the state read / write set can be the collection of read / write key-value (KV) pairs of data manipulated and saved during transaction execution or smart contract execution; for example, the keys and values corresponding to product invoices, logistics, and other information stored in a smart contract.
[0082] V. State Data: State data is the data structure used in a blockchain system to represent the current state of the system. State data includes the balances of all blockchain addresses, the state of smart contracts, and other relevant information. State data is continuously updated as transactions are executed, reflecting the global state of the blockchain system at a given point in time. In blockchain systems, state data is typically stored in the form of a Merkle tree or other cryptographic data structures to ensure its integrity and security.
[0083] Please see Figure 1 , Figure 1 This is a schematic diagram of the structure of a blockchain system provided in an embodiment of this application. Figure 1 As shown, the blockchain system can be a layer-two blockchain network composed of a first-layer network 100a and a second-layer network 100b. The first-layer network 100a can be considered a common account-based blockchain layer-one network. Because the first-layer network 100a adopts an account model, it can support smart contracts. The first-layer network 100a can include mainnet blocks and second-layer network contracts (also called second-layer network smart contracts). Mainnet blocks can be understood as all data blocks in the first-layer network 100a. The second-layer network contracts run on the first-layer network 100a and are used to maintain the smart contracts of the second-layer network 100b. The second-layer network 100b can refer to a layer-two network running on the first-layer network 100a. It can be understood as off-chain scaling on the first-layer network 100a of the blockchain system. The second-layer network 100b can also refer to a layer-two network using OP (Optimistic Rollup) type Rollups, such as OPStack (Optimistic Rollup Stack), to construct the layer-two network.
[0084] The first-layer network 100a may include one or more network nodes. This embodiment of the application does not limit the number of network nodes included in the first-layer network 100a. For example... Figure 1As shown, the first-layer network 100a may include network nodes 10a, 10b, 10c, and 10d, etc. Each network node in the first-layer network 100a (e.g., the aforementioned network nodes 10a, 10b, 10c, and 10d) can maintain the same blockchain (e.g., Figure 1 As shown in the blockchain 10e, any two network nodes in the first-layer network 100a can form a peer-to-peer network. This peer-to-peer network can employ a peer-to-peer protocol, which is an application-layer protocol running on top of the Transmission Control Protocol (TCP). Each network node in the first-layer network 100a can participate in the blockchain consensus process, verifying the source and integrity of transaction data submitted by the second-layer network 100b, and then recording successfully verified transactions in the data block, thus constructing the blockchain. Each network node in the first-layer network 100a can also be used to maintain the consensus mechanism within the blockchain system to ensure its decentralization and security.
[0085] The second-layer network 100b can be composed of nodes with different functions, such as sequencer nodes, proxy nodes, and challenger nodes. The number of sequencer nodes, proxy nodes, and challenger nodes in the second-layer network 100b can be one or more. This application does not limit the number of nodes in the second-layer network 100b. Figure 1 As shown, assume that the second-layer network 100b includes a sequencer node 20f, a proxy node 20g, and a challenge node 20h. The sequencer node 20f is the node that actually runs the accounting program in the blockchain system, packaging transactions from the second-layer network 100b and sending them to the first-layer network 100a for on-chain storage. Transactions sent from the sequencer node 20f to the first-layer network 100a can be stored in the second-layer network contract within the first-layer network 100a and can be read externally, such as by the challenge node 20h in the second-layer network 100b. The proxy node 20g can be configured with proxy ordering functionality to execute all transactions forwarded by the sequencer node 20f. The challenge node 20h is responsible for obtaining transaction execution information from the second-layer network 100b from the first-layer network 100a and verifying the obtained information. If an error is detected, it can initiate a challenge request to the first-layer network 100a.
[0086] To ensure data interoperability between nodes in a blockchain system, data connections can exist between different nodes. For example, data connections exist between network nodes in the first-layer network 100a, such as between network node 10a and network node 10b, and between network node 10a and network node 10c. Data connections exist between nodes in the second-layer network 100b, such as between sequencer node 20f and proxy node 20g. Data connections also exist between network nodes in the first-layer network 100a and nodes in the second-layer network 100b, such as between network node 10a and sequencer node 20f.
[0087] Understandable, Figure 1 Each node in the blockchain system shown (e.g., each network node in the first layer network 100a, the sequencer node 20f, the proxy node 20g, and the challenge node 20h in the second layer network 100b) can be any computer device. The computer device here can be a terminal device, or a server, or a system composed of terminal devices and servers. This application embodiment does not limit this.
[0088] The terminal devices may include smartphones, tablets, laptops, handheld computers, desktop computers, wearable devices (such as smartwatches, smart bracelets, etc.), smart voice interaction devices, smart home appliances (such as smart TVs, etc.), in-vehicle devices, aircraft, and other electronic devices. This application does not limit the type of terminal device.
[0089] A server can be a standalone physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This application does not limit the type of server.
[0090] Please see Figure 2 , Figure 2 This is a timing diagram of a data processing method for a blockchain system provided in an embodiment of this application. Figure 1 Understandably, the data processing method of this blockchain system can be determined by... Figure 1 The sequencer node and target proxy node in the second-layer network of the blockchain system shown interact with the network nodes in the first-layer network. For example... Figure 2 As shown, the data processing method of this blockchain system may include the following steps S101 to S107:
[0091] Step S101: Obtain the set of transactions to be uploaded to the blockchain. Among the proxy nodes included in the second-layer network, determine the target proxy node corresponding to the set of transactions to be uploaded to the blockchain.
[0092] The set of transactions to be added to the blockchain can be a collection of transactions selected by a designated sequencer node from all received transactions to be added to the blockchain. This set may include one or more transactions to be added to the blockchain. Each transaction to be added to the blockchain may refer to a transaction that has been submitted by a user to the blockchain system but has not yet been written to the blockchain. The transactions to be added to the blockchain involved in this application embodiment are a form of blockchain execution. Each transaction to be added to the blockchain contains the initiator's private key signature, which can guarantee the authenticity, non-forgeability, and non-repudiation of the transaction content.
[0093] In one or more embodiments, the sequencer node in the second-layer network of the blockchain system can receive transactions to be uploaded to the blockchain sent by the object node, add the transactions to be uploaded to the transaction pool corresponding to the sequencer node, and determine N transactions to be uploaded to the blockchain in the transaction pool according to the relationship between the transactions to be uploaded to the blockchain contained in the transaction pool, and form a set of transactions to be uploaded to the blockchain from the N transactions to be uploaded to the blockchain; N is a positive integer, such as N can take the value 1, 2, ...
[0094] In this context, an object node can refer to an application client that provides users of the second-layer network of the blockchain system with the means to submit transactions to the blockchain system. When users of the second-layer network want to submit transaction data to the blockchain system, they can register their identity in the aforementioned application client. After completing the identity registration, they can log in to the application client and submit transactions to be uploaded to the blockchain system to the first-layer network through the application client.
[0095] The transactions to be uploaded to the blockchain can include the transaction content that the second-layer network user wants to submit to the first-layer network of the blockchain system, as well as the digital signature of the transaction content by the second-layer network user. A second-layer network user refers to a user who has registered their identity within the blockchain system; this registration is essentially identity registration within the second-layer network. Second-layer network users have the authority to submit transactions to the second-layer network. For example, second-layer network users can interact with the second-layer network through the aforementioned application client without needing to interact with the first-layer network, which can improve the data security of the blockchain within the first-layer network.
[0096] It is understandable that the digital signature can be obtained by the second-layer network user confirming the transaction content and signing it using their own object private key; alternatively, the digital signature can also be obtained by the second-layer network user handing over their own object private key to the resource client for management, and then the resource client signing the transaction content using the second-layer network user's object private key.
[0097] The resource client is a tool used to manage and store digital resources. This resource client and the aforementioned application client can be the same client or different clients; this application does not impose any limitations on this. If the resource client and the aforementioned application client are the same client, then the resource client can directly sign the user's transaction content to generate a transaction to be uploaded to the blockchain. If the resource client and the aforementioned application client are different clients, then the application client can encapsulate the transaction content that the user wants to submit to the blockchain system into a transaction, and call the user's object private key managed by the resource client to sign the transaction content in the transaction, generating a transaction to be uploaded to the blockchain.
[0098] A transaction pool is a data structure in a blockchain system used to store transactions that have not yet been executed and are awaiting on-chain processing. When an object node submits a new transaction to the first-layer network, that transaction can enter the transaction pool; that is, the transaction pool can be used to store all transactions awaiting on-chain processing received by the sequencer node. It is understood that the transaction pool is merely an example of a data structure used to store transactions awaiting on-chain processing in a blockchain system. This application does not limit the data structure used to store transactions awaiting on-chain processing in a blockchain system; for example, Merkle trees, index structures, etc., can be used to store the transactions awaiting on-chain processing received by the sequencer node.
[0099] In one or more embodiments, after receiving a transaction to be added to the blockchain, the sequencer node can verify the transaction to determine whether it was actually sent by the object node. Specifically, it can obtain the digital signature of the transaction to be added to the blockchain and the object public key corresponding to the object node (the object public key of the object node is public); through the signature verification function and the object public key corresponding to the object node, it verifies the validity of the digital signature of the transaction to be added to the blockchain, thereby obtaining the signature verification result corresponding to the transaction to be added to the blockchain.
[0100] The signature verification function is a function used to verify the validity of a digital signature. This function can receive signature data (signed data, such as a transaction to be added to the blockchain), original data (unsigned data, such as an unsigned original transaction), and the public key of the object node. Through a series of calculations and comparisons, it determines whether the digital signature in the transaction to be added to the blockchain was generated by the object node possessing the object's private key and whether it matches the original data. This signature verification function can be any of RSA (Rivest-Shamir-Adleman, an asymmetric encryption algorithm), ECDSA (Elliptic Curve Digital Signature Algorithm), or DSA (Data Signature Algorithm). This application does not limit the type of digital signature algorithm.
[0101] Specifically, the sequencer node can decrypt the digital signature in the transaction to be uploaded to the blockchain using the public key of the target node, obtaining the first digest information corresponding to the digital signature. Then, it performs a hash operation on the original transaction (the original transaction before the signature) using a hash function (the same hash function used by the target node when generating the digital signature), obtaining the second digest information corresponding to the transaction to be uploaded to the blockchain. The first and second digest information can be compared. When they are the same, it indicates that the digital signature carried by the transaction to be uploaded to the blockchain is valid, meaning the signature verification result indicates successful verification. When they are different, it indicates that the digital signature carried by the transaction to be uploaded to the blockchain is invalid, meaning the signature verification result indicates failed verification, such as the transaction being tampered with during submission to the first-layer network. The sequencer node can store the verified transactions to be uploaded to the blockchain, discard the failed transactions, and return a transaction error message to the target node.
[0102] The transactions awaiting blockchain inclusion in the transaction pool may have related relationships, such as execution order (e.g., the execution of transaction B is based on the execution result of transaction A), causal relationship (e.g., the execution of transaction B is triggered by transaction A, or the execution of transaction B depends on the execution result of transaction A), or business logic relationship (different transactions awaiting blockchain inclusion are related to each other according to certain business rules), etc. This application does not limit these relationships. The sequencer node in the first-layer network can select N transactions to be packaged in the current batch from the transaction pool based on the relationships between the transactions awaiting blockchain inclusion in the transaction pool, and combine the N transactions in the current batch into a set of transactions to be blockchain inclusion.
[0103] Optionally, the transactions to be uploaded to the blockchain in the set of transactions to be uploaded can be executed in a certain order. For example, each transaction to be uploaded to the blockchain in the set of transactions to be uploaded can carry a sequence identifier, which can be used to indicate the execution order of the transactions to be uploaded to the blockchain.
[0104] Optionally, the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain can be presented in the form of a list. For example, the set of transactions to be uploaded to the blockchain can be considered as a transaction list. The transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain can be executed sequentially according to their positions in the transaction list. In this case, the position of the transaction to be uploaded to the blockchain in the transaction list can be understood as the sequential identifier of the transaction to be uploaded to the blockchain.
[0105] The sequencer node can acquire the set of transactions to be uploaded to the blockchain in batches. For example, it can acquire a set of transactions to be uploaded to the blockchain at regular intervals (e.g., one set of transactions to be uploaded to the blockchain every minute, or one set of transactions to be uploaded to the blockchain every 5 minutes, etc., which is not limited in this application). Alternatively, it can acquire a set of transactions to be uploaded to the blockchain when the number of transactions to be uploaded to the blockchain received by the sequencer node reaches a preset threshold. Or, it can acquire the next set of transactions to be uploaded to the blockchain after the previous set of transactions to be uploaded to the blockchain is submitted to the first layer network. This application does not limit the frequency at which the sequencer node acquires the set of transactions to be uploaded to the blockchain.
[0106] In a blockchain system, different Layer 2 network users can send transactions to be uploaded to the blockchain one by one to the sequencer node in the Layer 2 network over a period of time. For example, the i-th transaction to be uploaded to the blockchain by a Layer 2 network user to the sequencer node can be denoted as L2TX. i The specific form is as follows: Where SEQUNCER represents the sequencer node in the second layer network of the blockchain system, L2Users represents the second layer network users, L2 represents the second layer network in the blockchain system, and i is a positive integer less than or equal to N.
[0107] After a period of time, the sequencer node SEQUNCER can obtain the set of transactions to be uploaded to the blockchain in this batch. This set of transactions to be uploaded to the blockchain can be denoted as L2TXs, and can be represented in the following form: L2TXs={L2TX1,L2TX2,…,L2TX} N}; where L2TX1, L2TX2, ..., L2TX N These are represented sequentially as the first transaction to be uploaded to the blockchain, the second transaction to be uploaded to the blockchain, ..., the Nth transaction to be uploaded to the blockchain, received by the sequencer node.
[0108] Since the sequencer nodes in the second-layer network of a blockchain system do not have transaction execution capabilities, they need to forward the set of transactions to be uploaded to the blockchain to one or more proxy nodes in the second-layer network. It should be noted that the more proxy nodes the sequencer node forwards the set of transactions to be uploaded to the blockchain, the greater the network bandwidth consumption. Therefore, the sequencer node can select one proxy node from M proxy nodes as the target proxy node, which then executes the transactions to be uploaded to the blockchain. Compared to forwarding the set of transactions to be uploaded to multiple proxy nodes, this reduces network bandwidth consumption and thus lowers the operating costs of the blockchain system. In this scenario, the M proxy nodes can engage in a game theory approach, distributing appropriate proxy resource consumption within the second-layer network. For ease of understanding, this application embodiment describes the example of the sequencer node forwarding the set of transactions to be uploaded to the blockchain to a single proxy node.
[0109] In this embodiment, M proxy nodes can be configured in the second-layer network of the blockchain system, where M is a positive integer, such as 1, 2, ... The proxy nodes in the second-layer network can be configured with a proxy ordering function (providing proxy ordering services to the ordering node), which executes the transactions to be uploaded to the blockchain from the set of transactions to be uploaded. Each proxy node in the second-layer network can pre-publish its own proxy resource consumption in the second-layer network, where the proxy resource consumption corresponding to the j-th proxy node can be denoted as AgentFee. j , where j can be a positive integer less than or equal to M. The proxy resource consumption refers to the proxy ordering fee (or proxy fee) that the proxy node needs to charge when executing transactions in the set of transactions to be added to the blockchain. This proxy resource consumption can serve as a reference factor for the orderer node to select a target proxy node from among the M proxy nodes.
[0110] For the sequencer node in the second layer network of the blockchain system, it can obtain the proxy resource consumption and priority of the M proxy nodes in the second layer network; based on the proxy resource consumption and priority, it can determine the target proxy node corresponding to the set of transactions to be uploaded to the chain from the M proxy nodes.
[0111] The agent resource consumption corresponding to the M agent nodes can be denoted as: AgentFees = {AgentFee1, AgentFee2, ..., AgentFee} M}; where AgentFee1 represents the agent resource consumption corresponding to the first agent node in the second-layer network, AgentFee2 represents the agent resource consumption corresponding to the second agent node in the second-layer network, and AgentFee M This indicates the proxy resource consumption corresponding to the Mth proxy node in the second-layer network.
[0112] Each proxy node in the second-layer network can be configured with a priority. This priority can be used to indicate the probability that the current proxy node will be selected by the sequencer node to execute the transaction to be uploaded to the chain. The higher the priority, the higher the probability that the proxy node will be selected, and the lower the priority, the lower the probability that the proxy node will be selected.
[0113] In one or more embodiments, the priority of a proxy node can be dynamically adjusted. For example, when the sequencer node verifies that the proxy node has published an incorrect, low proxy resource consumption in the second-layer network, the priority of the proxy node can be reduced, and the new priority can be used in the subsequent proxy node selection process. When a network node in the first-layer network verifies that the proxy node has returned incorrect transaction execution information, the priority of the proxy node can be reduced, and the new priority can be used in the subsequent proxy node selection process. When the proxy node returns correct transaction execution information for a continuous period of time (e.g., one month, two months, etc.), the priority of the proxy node can be increased, and the new priority can be used in the subsequent proxy node selection process, and so on.
[0114] After obtaining the proxy resource consumption and priority of M proxy nodes, the sequencer node can determine the proxy node with the smallest proxy resource consumption as a candidate proxy node among the M proxy nodes. If the priority of the candidate proxy node meets the selection criteria, the candidate proxy node is determined as the target proxy node for the set of transactions to be uploaded to the chain. If the priority of the candidate proxy node does not meet the selection criteria, the target proxy node for the set of transactions to be uploaded to the chain is determined from the remaining M-1 proxy nodes.
[0115] The selection criteria can be used as a reference factor for the sequencer node to select the target agent node; the selection criteria can be the priority level set according to the actual application, such as setting the selection criteria to the highest priority in the second layer network, or setting the selection criteria to reach a certain specific priority in the second layer network, and this application does not limit this.
[0116] The sequencer node can select proxy nodes from M proxy nodes whose priority meets the selection criteria. Then, from these priority-meeting proxy nodes, it can select the proxy node with the lowest proxy resource consumption as the target proxy node. Optionally, the sequencer node can identify the proxy node with the lowest proxy resource consumption among the M proxy nodes as a candidate proxy node; it can then determine whether this candidate proxy node meets the selection criteria. If it does, it is designated as the target proxy node; if it does not, it is removed from the M proxy nodes, and the above operation is repeated until a target proxy node that meets the selection criteria is obtained. For example, when the j-th proxy node among the M proxy nodes has the lowest proxy resource consumption, and the priority of the j-th proxy node meets the selection criteria, the j-th proxy node can be designated as the target proxy node.
[0117] It is understandable that in the second-layer network of a blockchain system, multiple sequencer nodes can exist simultaneously. Each sequencer node can have multiple proxy nodes providing services (such as proxy sequencing services) when executing tasks. In other words, the second-layer network can include one or more sequencer nodes, each with the same function to perform the same task. This application's embodiments use any one sequencer node in the second-layer network as an example. It should be understood that the same transaction to be uploaded to the blockchain only needs to be submitted to the first-layer network once. If a sequencer node in the second-layer network has already submitted the transaction to the first-layer network, then other sequencer nodes do not need to submit the same transaction to the first-layer network again.
[0118] Step S102: Forward the set of transactions to be uploaded to the blockchain.
[0119] Specifically, after the sequencer node determines the target proxy node (e.g., the j-th proxy node) from the M proxy nodes, it can forward the set of transactions to be uploaded to the blockchain to that target proxy node. The forwarding process of this set of transactions can be represented as follows: Among them AGENT j L2TXs represents the j-th proxy node in the second-layer network (such as the target proxy node mentioned above), L2TXs represents the set of transactions to be uploaded to the chain that the sequencer node forwards to the target proxy node, and SEQUENCER represents the sequencer node in the second-layer network.
[0120] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating how a sequencer node selects a target proxy node, as provided in an embodiment of this application. Figure 3 The sequencer node 30d shown can be any sequencer node in the second-layer network of the blockchain system. Multiple second-layer network users can submit transactions to be uploaded to the chain to sequencer node 30d at the same time. For example, second-layer network user A can use terminal device 30a to submit transaction L2TX1 to sequencer node 30d, and second-layer network user B can use terminal device 30b to submit transaction L2TX to sequencer node 30d. i In the second-layer network, user C can use terminal device 30c to submit L2TX transactions to be uploaded to the chain to sequencer node 30d. N (N is a positive integer), etc. The sequencer node 30d can obtain the set of transactions to be added to the chain in this batch, L2TXs = {L2TX1, L2TX2, ..., L2TX}. N}
[0121] The sequencer node 30d can obtain the agent resource consumption corresponding to M agent nodes in the second-layer network. For example, the agent resource consumption corresponding to agent node 1 in the second-layer network is denoted as AgentFee1, the agent resource consumption corresponding to agent node 2 is denoted as AgentFee2, and the agent resource consumption corresponding to agent node M is denoted as AgentFee. M Based on the proxy resource consumption and priority of each proxy node, the target proxy node corresponding to the set of transactions to be uploaded to the chain is determined from the M proxy nodes. If proxy node 4 among the M proxy nodes has the minimum proxy resource consumption and its priority meets the selection criteria, then proxy node 4 can be determined as the target proxy node. The sequencer node 30d can set the above set of transactions to be uploaded to the chain L2TXs={L2TX1,L2TX2,…,L2TX…} N The transaction is forwarded to proxy node 4, which then executes each transaction in the set of transactions to be added to the blockchain.
[0122] Step S103: Execute the transactions to be uploaded to the blockchain in the transaction set to be uploaded to the blockchain, and obtain the transaction execution information corresponding to the transaction set to be uploaded to the blockchain.
[0123] Specifically, after receiving the set of transactions to be uploaded to the blockchain forwarded by the sequencer node, the target proxy node can execute the transactions in the set, obtain the second-state read set and the second-state write set of the transactions during the execution process, and sign the second-state read set and the second-state write set using the private key of the target proxy node to obtain the proxy signature corresponding to the target proxy node. The second-state read set, the second-state write set, and the proxy signature can then be used as the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain. For ease of understanding, the second-state read set and the second-state write set can be collectively referred to as the second-state read-write set.
[0124] The second state read set can refer to the relevant data on the current state of the blockchain read by the target proxy node during the execution of the transaction to be uploaded to the blockchain; such as the balance of an account, the value of a contract variable, and the state values of certain attributes read by the target proxy node. The second state write set can refer to the set of operations performed by the target proxy node to change the state of the blockchain after the transaction to be uploaded to the blockchain is completed; this second state write set can include the account state that needs to be updated (such as the increase or decrease of the balance), new contract variable settings, etc.
[0125] Each node in a blockchain system (e.g., proxy nodes, challenge nodes, sequencer nodes, network nodes in the first-layer network, etc.) can obtain a key pair (including a public key and a private key). Each node's key pair can be calculated by the node itself using a specific algorithm. For example, for a target proxy node, it can generate a key pair using a specific algorithm. In this case, the private key in the key pair can be called the node's private key, and the public key can be called the node's public key. The target proxy node's public key can be publicly disclosed in the blockchain system, while its private key is not publicly disclosed and is kept by the target proxy node itself. Alternatively, the target proxy node can entrust its private key to a third party (e.g., the aforementioned resource client) for safekeeping; this application does not impose any limitations on this.
[0126] In one or more embodiments, the target proxy node, acting as a proxy node for executing transactions to be uploaded to the blockchain within a set of transactions to be uploaded, can obtain reward assets for that set of transactions. If a non-blockchain settlement method is used to settle the reward assets for the target proxy node, then after receiving the set of transactions to be uploaded to the blockchain, the target proxy node can directly execute the transactions to be uploaded to the blockchain within that set. The non-blockchain settlement method can refer to distributing reward assets to the target proxy node using an off-chain settlement method, such as a cloud-based billing settlement method, or an online settlement method using preset rules.
[0127] Optionally, the blockchain settlement method can refer to distributing reward assets to the target agent node on the blockchain. If the blockchain settlement method is used to distribute reward assets to the target agent node, then the reward transaction corresponding to the target agent node can be inserted into the set of transactions to be uploaded to the blockchain. This reward transaction can be used to represent the reward received by the target agent node after completing the execution of the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain. This reward transaction can be inserted at the end of the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain. If the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain are a transaction list, then the reward transaction corresponding to the target agent node can be inserted at the end of the transaction list.
[0128] The reward transaction inserted into the set of transactions to be added to the blockchain can be represented as: RewardL2TX = <SENQNCER,AGENT j AgentFee jThe set of transactions to be added to the blockchain for inserting reward transactions can be denoted as FinalL2TXs = L2TXs.Concat([RewardL2TX]). RewardL2TX represents the reward transaction, which can be represented as a triple. This triple can include the sender (From), receiver (To), and transaction quantity (Value) common in blockchain asset transfer transactions. SENQNCER in RewardL2TX represents the sender (or asset transferor) in the reward transaction, and AGENT... j AgentFee refers to the recipient (or asset recipient) in a reward transaction. j This represents the number of transactions in the reward transaction (or the number of asset transfers, i.e., the amount of reward assets). This reward transaction (RewardL2TX) can represent a transfer from the sequencer node (SENQNCER) to the target agent node (AGENT). j The number of blockchain accounts transferred was AgentFee. j The reward asset here refers to the proxy resource consumption (proxy ordering fee) of the target proxy node. `FinalL2TXs` represents the set of transactions to be added to the blockchain after the insertion of a reward transaction. `Concat` is a function that concatenates two arrays, adding the reward transaction `RewardL2TX` to the end of the set of transactions to be added to the blockchain (`FinalL2TXs`). The reward transactions (`RewardL2TX`) in the set of transactions to be added to the blockchain after the insertion of the reward transaction can then be considered as transactions to be added to the blockchain.
[0129] In this embodiment of the application, when the transactions to be added to the blockchain in the transaction set involve the invocation of smart contracts deployed in the blockchain, that is, when the transactions to be added to the blockchain are contract invocation transactions, the smart contracts deployed in the blockchain can be invoked according to the contract identifiers contained in the transactions to be added to the blockchain in the transaction set; through the smart contracts, the transactions to be added to the blockchain in the transaction set are executed to obtain the transaction execution information corresponding to the transaction set to be added to the blockchain.
[0130] Specifically, a second-state read set of the second-layer network can be obtained through a smart contract. Based on the second-state read set, the transactions to be uploaded to the blockchain in the transaction set to be uploaded are executed to obtain a second-state write set. Based on the node public key corresponding to the target proxy node, the second-state read set and the second-state write set are signed to obtain the proxy signature corresponding to the target proxy node. Then, the second-state read set, the second-state write set, and the proxy signature can be used to determine the transaction execution information corresponding to the transaction set to be uploaded to the blockchain.
[0131] During the execution of transactions to be added to the blockchain within the target proxy node's transaction set, the target proxy node can read the second-state read set of the second-layer network. Within this second-state read set, it can check whether the sender of a transaction has sufficient balance or permissions to execute the transaction. If sufficient balance or permissions are detected, the node can update the balance, data, and other status information of the sender and receiver accounts based on the transaction content. After the transaction is completed, the target proxy node obtains the second-state write set. The target proxy node can then sign the second-state read set and the second-state write set using its own node private key to obtain its proxy signature. This second-state read set, second-state write set, and proxy signature can then be used to determine the target proxy node's transaction execution information for the transaction set to be added to the blockchain.
[0132] For example, the second-state read set mentioned above can be represented as KVRead, and the second-state write set can be denoted as KVWrite; where KVRead, KVWrite = Execute(FinalL2TXs), and Execute represents the function provided by the target proxy node based on the current state execution parameters for the transactions to be uploaded to the blockchain in the second-layer network. The current state execution parameters may include, but are not limited to, at least one of the following: a transaction ID (Identity) used to uniquely identify the transactions to be uploaded to the blockchain, the transaction content in the transactions to be uploaded to the blockchain, the account balance information involved in the transactions to be uploaded to the blockchain, the smart contract state involved in the transactions to be uploaded to the blockchain, the timestamp of the execution of the transactions to be uploaded to the blockchain, the fees required for the execution of the transactions to be uploaded to the blockchain, and network state parameters (e.g., network latency, bandwidth, etc.). The proxy signature generated by the target proxy node for the set of transactions to be uploaded to the blockchain can be represented as: Signature = Sign(KVRead + KVWrite, AGENTj.PriKey); where Signature represents the proxy signature, Sign represents the signature function, and AGENTjPriKey represents the node private key corresponding to the target proxy node.
[0133] Optionally, after the transaction to be uploaded to the blockchain is executed, the target proxy node obtains the transaction execution result corresponding to the second state write set and the transaction to be uploaded to the blockchain. This transaction execution result can include a flag indicating whether the transaction was successfully executed, such as success or failure. If the transaction to be uploaded to the blockchain is successfully executed, the transaction execution result may include changes to relevant data after the transaction is executed, such as asset transfers or data updates. If the transaction to be uploaded to the blockchain fails, the transaction execution result may only include a flag indicating failure. At this point, the target proxy node can use its own node private key to sign the transaction execution result corresponding to each transaction to be uploaded to the blockchain in the second state read set, the second state write set, and the transaction execution result corresponding to each transaction to be uploaded to the blockchain, obtaining the proxy signature corresponding to the target proxy node. This allows the target proxy node to determine the transaction execution information of the transaction set to be uploaded to the blockchain based on the second state read set, the second state write set, the transaction execution results corresponding to each transaction to be uploaded to the blockchain, and the proxy signature.
[0134] Step S104: Return transaction execution information.
[0135] Specifically, the target proxy node can return transaction execution information to the sequencer node, such as returning the second-state read set KVRead, the second-state write set KVWrite, and the proxy signature Signature to the sequencer node.
[0136] It should be noted that, to ensure the correctness of the transaction execution information returned by the target proxy node to the sequencer node, each proxy node in the Layer 2 network (including the target proxy node) can submit its corresponding backup commitment assets (or guarantee assets) to the Layer 2 network contract in the Layer 1 network before providing proxy sequencing services. These backup commitment assets can represent the amount of penalty assets that can be deducted if the transaction execution information returned by the proxy node is incorrect, or they can be understood as the range of assets that can be used to compensate the sequencer node if the transaction execution information returned by the proxy node is incorrect. The verification process for whether the transaction execution information is incorrect can be performed in the subsequent challenge process, which will be described later.
[0137] The standby commitment assets submitted by M agent nodes to the second-layer network contract in the first-layer network can be represented as: AgentStakes = {AgentStake1, AgentStake2, ..., AgentStake...} M}; where AgentStakes represents the set of standby committed assets submitted by all agent nodes (which can be represented as an array), AgentStake1 represents the standby committed assets of the first agent node among the M agent nodes, AgentStake2 represents the standby committed assets of the second agent node, and AgentStake... M This represents the spare committed assets of the Mth agent node; when the target agent node is an AGENT. j At that time, the standby committed assets of the target agent node can be recorded as AgentStake. j If the target proxy node returns an error message, the amount of on-chain assets that should be penalized for that target proxy node can be determined. This amount of on-chain assets can then be used as compensation digital assets to compensate the given sequencer node. When the amount of on-chain assets that should be penalized for the target proxy node is K, the target proxy node AGENT... j The standby committed assets need to meet the following requirements: AgentStake j ≥K; if the standby committed assets are greater than or equal to K, it means that the target proxy node has the proxy ordering function; if the standby committed assets are less than K, it means that the target proxy node does not have the proxy ordering function.
[0138] Step S105: Update the state root corresponding to the sequencer node according to the transaction execution information to obtain the updated state root.
[0139] Specifically, after receiving the transaction execution information (such as the second-state read set, the second-state write set, and the proxy signature) returned by the target proxy node, the sequencer node can obtain the first-state read set corresponding to itself. That is, the sequencer node can obtain its own local first-state read set. This first-state read set can be relevant data about the current state of the blockchain read by the specified sequencer node; for example, the balance of a certain account, the value of a certain contract variable, or the state values of certain attributes read by the sequencer node.
[0140] The first state read set and the second state read set in the transaction execution information are compared to obtain the set comparison result. If the set comparison result indicates that the results are consistent, that is, the data in the first state read set and the second state read set are consistent, the first state write set corresponding to the sequencer node can be updated to the second state write set in the transaction execution information, and the proxy signature in the second state write set and the transaction execution information can be stored, such as in the local database of the sequencer node, for backup of potential challenge processes in the future.
[0141] Furthermore, based on the second state write set, a hash operation can be performed on the state data corresponding to the sequencer node to obtain the updated state root. For example, based on the second state write set, the current state data of the sequencer node can be modified sequentially according to the transaction order in the set of transactions to be uploaded to the chain, such as monthly account changes, contract state updates, etc., to obtain the updated state data; a specific hash function is then used to calculate the hash value of the updated complete state data, which can be called the locally updated state root of the sequencer node.
[0142] The comparison process between the first and second state read sets may include, but is not limited to, iterating through the identifiers in both sets. The first and second state read sets can be key-value pair sets, where the identifier can be the key. If the data content of the same identifier is the same in both sets, the comparison result is considered correct. If the data content of the same identifier differs between the sets, the comparison result is considered incorrect. The data content of the identifier in the two state read sets can be the value in a key-value pair.
[0143] In one or more embodiments, after obtaining the second state read set, the second state write set, and the proxy signature, the sequencer node can verify the second state read set and the second state write set, and update its own state. Specifically, it can update the first state read set and the first state write set of the sequencer node. The specific implementation process can be as follows: Valid = StateVerify(KVRead) && StateUpdate(KVWrite); where Valid can represent the result of the sequencer node verifying the second state read set and the second state write set, and updating its own state based on the verification result. The StateVerify function can be used to verify the first state read set local to the sequencer node. The StateVerify function works as follows: For each identifier (Key) in the second state read set (KVRead), query the identifier (Key) in the first state read set local to the sequencer node to see if the data content (Value) in the first state read set is equal to the data content (Value) corresponding to the current identifier (Key) in the second state read set (KVRead). If all identifiers have the same data content (Value) in both state read sets, the StateVerify function returns true, indicating a correct set comparison. If any identifier has a different data content (Value) in the two state read sets, the StateVerify function returns false, indicating an incorrect set comparison.
[0144] When the StateVerify function returns false, it indicates that the target proxy node failed to order the on-chain transaction set, meaning the transaction execution information returned by the target proxy node is an error message. If the StateVerify function returns true, the sequencer node can execute the StateUpdate function to update the data content (Value) corresponding to each identifier (Key) in the second state write set (KVWrite) to the data content (Value) corresponding to the same identifier (Key) in the sequencer node's local first state write set. Furthermore, the sequencer node can save the second state read set, the second state write set, and the proxy signature in a local database as a backup for potential challenge processes.
[0145] Step S106: Submit the set of transactions to be added to the blockchain and the updated state root.
[0146] Specifically, the sequencer node can submit the updated state root to the first-layer network, following the technical path of submission from the second-layer network to the first-layer network in the blockchain system. This technical path can be any existing design in a blockchain's second-layer network for submitting data to the first-layer network, and will not be elaborated upon here. It is understandable that the sequencer node can submit the set of transactions to be added to the chain and the updated state root together to the second-layer network contract within the first-layer network.
[0147] Step S107: Store the set of transactions to be added to the blockchain and the updated state root to the blockchain.
[0148] Specifically, network nodes in the first-layer network can obtain the set of transactions to be added to the blockchain and the updated state root from the second-layer network contract, and encapsulate the transactions to be added to the blockchain and the updated state root into data blocks. It is understood that all network nodes in the first-layer network can elect a block-generating node. This block-generating node can be any network node in the first-layer network, and can be elected from all network nodes included in the first-layer network using methods such as Proof-of-Stake (PoS), random election, reputation or credibility mechanisms (evaluated based on the past performance and reputation of each network node), distributed consensus algorithms, and voting mechanisms. This application does not limit the election method for the block-generating node.
[0149] In the first-layer network, block-generating nodes can broadcast their generated data blocks to all network nodes in the first-layer network, allowing each node to access the data block. Each network node in the first-layer network can then perform consensus processing on the received data blocks, obtaining consensus vote messages from each node. Each node can then broadcast its consensus vote message to other network nodes in the first-layer network. The consensus vote message indicates whether participating network nodes agree to write the data block into the blockchain. This consensus vote message can be either a "yes" or "no" vote message; a "yes" vote message indicates that a network node agrees to write the data block into the blockchain, while a "no" vote message indicates that a network node opposes writing the data block into the blockchain.
[0150] In the first-layer network, network nodes can receive consensus voting messages not only from themselves but also from other network nodes. Each network node in the first-layer network can receive consensus voting messages from multiple network nodes. A network node can count the number of "yes" votes among the received consensus voting messages and determine this number as the consensus vote count. If the consensus vote count is greater than or equal to a threshold, the data block has passed consensus in the first-layer network and can be written into the blockchain. If the consensus vote count is less than the threshold, the data block has failed consensus and cannot be written into the blockchain. This threshold is related to the consensus algorithm used in the first-layer network; for example, the threshold could be 51% of the number of network nodes in the first-layer network or 2 / 3 of the number of network nodes in the first-layer network. This application does not limit this to any specific threshold.
[0151] In one feasible implementation, since all transactions submitted to the first-layer network for on-chain processing are executed by proxy nodes in the second-layer network, meaning all transactions in the data block have already been executed, the network nodes in the first-layer network do not need to execute the transactions in the data block for on-chain processing when performing consensus processing on the data block. They only need to verify the updated state root stored in the data block, which improves the consensus efficiency of the data block.
[0152] It should be noted that after the sequencer node submits the set of transactions to be added to the blockchain and the updated state root to the second-layer network contract in the first-layer network, it can configure a challenge period for the set of transactions to be added to the blockchain and the updated state root. This challenge period can be before or after the set of transactions to be added to the blockchain and the updated state root are stored in the form of data blocks; this application does not limit this. During this challenge period, the challenge node in the second-layer network can obtain the set of transactions to be added to the blockchain and the updated state root from the second-layer network contract of the first-layer network, verify them, and, following the blockchain second-layer network technology, initiate a challenge request to the sequencer node in the first-layer network. If the challenge node succeeds (the challenge is valid), it indicates that the target proxy node has made an error in the execution of the set of transactions to be added to the blockchain, and the sequencer node needs to be penalized in the first-layer network. The target proxy node should then compensate the sequencer node. The specific challenge process will be described in the following sections.
[0153] Please see Figure 4 , Figure 4 This is a schematic diagram of transaction submission in a blockchain system provided in an embodiment of this application. For example... Figure 4As shown, the blockchain system involved in this application embodiment may include a first-layer network and a second-layer network. The first-layer network may include mainnet blocks and second-layer network contracts. The mainnet blocks may include all data blocks that have reached consensus among the network nodes included in the first-layer network. That is, the mainnet blocks in the first-layer network can form a blockchain. The second-layer network contract may refer to a smart contract used to maintain the second-layer network. The second-layer network may include one or more sequencer nodes, M proxy nodes (M is a positive integer), and one or more challenge nodes, etc.
[0154] In a blockchain system, second-layer network users can send transactions to be uploaded to the blockchain one by one to the sequencer nodes in the second-layer network. The sequencer nodes can package the transactions received within a certain period into a set of transactions to be uploaded to the blockchain, L2TXs. The sequencer nodes can select a suitable proxy node from the M proxy nodes in the second-layer network as the target proxy node for executing the set of transactions to be uploaded to the blockchain, L2TXs. For example, it can select the target proxy node based on the proxy resource consumption of each proxy node in the second-layer network, and select the proxy node with the lowest proxy resource consumption and the priority that meets the selection criteria (e.g., the j-th proxy node in the first-layer network).
[0155] The sequencer node can forward the set of transactions to be added to the blockchain, L2TXs, to the target proxy node. After receiving the set of transactions to be added to the blockchain, the target proxy node can insert the reward transaction RewardL2TX corresponding to the target proxy node into the set of transactions to be added to the blockchain, generating a set of transactions to be added to the blockchain, FinalL2TXs, with the reward transaction inserted. The target proxy node can execute FinalL2TXs to obtain the transaction execution information corresponding to FinalL2TXs. This transaction execution information may include the second-state read set KVRead, the second-state write set KVWrite, and the digital signature of the target proxy node on KVRead and KVWrite (which can be called the proxy signature). The target proxy node can return the above transaction execution information to the sequencer node.
[0156] After receiving the transaction execution information, the sequencer node can verify whether the second state read / write set (including the second state read set KVRead and the second state write set KVWrite) in the transaction execution information matches the sequencer node's own local state read / write set. If the second state read set KVRead matches the sequencer node's own local first state read set, then the sequencer node can update its own local first state write set to the second state write set KVWrite, and save the second state read set KVRead, the second state write set KVWrite, and the proxy signature to the sequencer node's local database.
[0157] The sequencer node can perform a hash function calculation on the updated complete state data to obtain the updated state root. Then, it can submit the set of transactions to be added to the blockchain (which can be the aforementioned FinalL2TXs) and the updated state root to the second-layer network contract of the first-layer network. This allows the network nodes in the first-layer network to store the set of transactions to be added to the blockchain and the updated state root in the form of data blocks.
[0158] For the set of transactions to be added to the chain and the updated state root submitted by the sequencer node to the first-layer network, the challenge node in the second-layer network can verify the transactions to be added to the chain and the updated state root submitted to the first-layer network. If the updated state root is found to be incorrect, a challenge request can be initiated to the first-layer network. The challenge process for this challenge request will be described in the following content.
[0159] It should be noted that in existing blockchain layer-2 network technologies, the sequencer node is responsible for executing transactions to be added to the chain in the order of the transactions in the layer-2 network, and submitting the transactions themselves and the hash value of the final state (which can be called the updated state root) to the layer-1 network. In this process, the sequencer node has the highest configuration requirements; that is, the specific execution of the transactions to be added to the chain requires high configuration, which affects the decentralization of the sequencer node in the layer-2 network. Therefore, in the blockchain system involved in this application embodiment, the transaction execution function of the sequencer node in the existing blockchain layer-2 network technology can be transferred to the proxy node in the layer-2 network, enabling the proxy node to have transaction execution capabilities. This transaction execution function of the proxy node can also be called proxy sequencing functionality. The proxy node executes the transactions to be added to the chain in the layer-2 network, while the sequencer node in the layer-2 network only needs to update the state root according to the transaction execution information returned by the proxy node and submit the transactions to be added to the chain and the updated state root to the layer-1 network. In other words, the transaction execution function, which consumes the most computing resources, can be transferred to the proxy service provided by the proxy node (specifically, the proxy ordering service within the proxy service). This can reduce the configuration requirements of the ordering node in the second-layer network (for example, a lower-configuration CPU and mechanical hard disk storage can be used), thereby reducing the operating cost of the ordering node.
[0160] Please see Figure 5 , Figure 5 This is a timing diagram of a data processing method for a blockchain system provided in an embodiment of this application. Figure 2 Understandably, the data processing method of this blockchain system can be determined by... Figure 1 The sequencer node and challenge node in the second-layer network of the blockchain system shown interact with the network nodes in the first-layer network. For example... Figure 5 As shown, this may include the following steps S201 to S206:
[0161] Step S201: Initiate a challenge request.
[0162] Specifically, once the proxy ordering is complete, and the sequencer node submits the set of transactions to be added to the blockchain and the updated state root to the first-layer network, if a challenge is launched against the second-layer network from within the first-layer network, and it is confirmed that the target proxy node's proxy ordering is incorrect (e.g., the updated state root is incorrect, or the transaction execution information is incorrect), then the sequencer node will be penalized. Therefore, compensation digital assets can be issued to the sequencer node from the backup commitment assets corresponding to the target proxy node, thus ensuring the security of the proxy ordering result (transaction execution information).
[0163] In one or more embodiments, a challenging node can follow the challenge process of an OP-type Rollup in a blockchain layer 2 network technology. During the challenge period, if the challenging node detects that the updated state root submitted by the sequencer node to the first layer network is an incorrect state root, then the challenging node can initiate a challenge request to the second layer network contract in the first layer network.
[0164] Step S202: Send the second state read set and the second state write set stored by the sequencer node to the second layer network contract in the first layer network.
[0165] Specifically, after the challenge node initiates a challenge request to the second-layer network contract in the first-layer network, the sequencer node can send the second state read set and the second state write set stored by the sequencer node to the second-layer network contract. The second state read set and the second state write set here can be regarded as the read and write sets suspected of being erroneous in the challenge process.
[0166] It should be noted that there are multiple ways to implement the sequencer node to submit the second state read set and the second state write set to the second layer network contract. For example, the binary search method can be used to locate and negotiate the second state read and write set. Only the state read and write key-value pairs (KV) before and after a single step need to be provided. This can reduce the amount of data transmitted by the sequencer node to the first layer network, thereby reducing network bandwidth.
[0167] Optionally, considering the simplicity of implementation, this embodiment can adopt the method of transmitting the full set of second-state reads and writes to the second-layer network contract, which then executes all transactions suspected of execution errors in the first-layer network. The process of the sequencer node submitting the full set of second-state reads KVRead and the set of second-state writes KVWrite to the second-layer network contract can be represented as follows: Where L2Contract represents the second-layer network contract in the first-layer network, and SEQUENCER represents the sequencer node.
[0168] Step S203: Verify the second state read set and the second state write set to obtain the state verification result.
[0169] Specifically, network nodes in the first-layer network can verify the second-state read set and the second-state write set through the second-layer network contract to obtain the state verification result. For example, transactions suspected of having execution errors in the set of transactions to be added to the chain can be executed, and after execution, a third-state read-write set (which may include the third-state read set and the third-state write set) is obtained. If the third-state read-write set is consistent with the second-state read-write set (including the second-state read set and the second-state write set), then it can be determined that the second-state read-write set is correct. In other words, the state verification result at this time indicates that the verification has passed, the challenge process can end, no further steps are needed, and a challenge failure result is returned to the challenge node. If the third-state read-write set is inconsistent with the second-state read-write set, then it can be determined that the second-state read-write set is incorrect. In other words, the state verification result at this time indicates that the verification has failed.
[0170] Step S204: When the status verification result indicates that the verification failed, submit the proxy signature and the proxy public key corresponding to the target proxy node to the second-layer network contract in the first-layer network.
[0171] Specifically, when the state verification result indicates that the verification failed, the sequencer node can further submit to the second-layer network contract the proxy signature generated by the target proxy node for the second state read / write set, as well as the proxy public key corresponding to the target proxy node. The process of the sequencer node submitting the proxy signature and proxy public key to the second-layer network contract can be represented as follows: Where Signature represents the target agent node AGENT j The proxy signature generated for the second-state read / write set, AGENT j .PubKey represents the target proxy node AGENT j The corresponding proxy public key.
[0172] Step S205: Verify the correctness of the proxy signature based on the proxy public key.
[0173] Specifically, the second-layer network contract can verify whether the second-state read-write set uses a proxy ordering service, that is, verify whether the second-state read-write set is obtained after the proxy node completes the transaction execution. If the second-layer network determines that the second-state read-write set uses a proxy ordering service, it can further verify the correctness of the proxy signature, that is, verify whether the proxy signature was generated by the target proxy node.
[0174] The process of verifying the correctness of the proxy signature can be represented as: IsAgent = Verify(KVRead + KVWrite, AGENT.PubKey, Signature); where IsAgent represents the signature verification result corresponding to the proxy signature, and Verify can refer to the signature verification function corresponding to the aforementioned signature function Sign. The signature verification function Verify can verify the second state read / write set (KVRead + KVWrite) and the target proxy node (AGENT). j ) Proxy public key (AGENT) j The system checks whether there is a correspondence between the .PubKey and the proxy signature (Signature), that is, whether the proxy signature was issued by the target proxy node using its own proxy private key.
[0175] The signature verification result corresponding to the proxy signature can be a correct signature result or a signature error result. A correct signature result indicates that the proxy signature is a correct signature, that is, confirming that the proxy signature is a correct signature generated by the target proxy node using its own proxy private key. A signature error result indicates that the proxy signature is an incorrect signature, that is, confirming that the proxy signature is not a correct signature generated by the target proxy node using its own proxy private key.
[0176] Step S206: When the proxy signature is correct, compensation digital assets are distributed to the sequencer node from the standby commitment assets submitted by the target proxy node.
[0177] Specifically, when the proxy signature is correct, it can be determined that the second-state read / write set generated by the target proxy node is incorrect. In this case, the first-layer network can penalize the target proxy node through the second-layer network contract and compensate the sequencer node. Furthermore, a successful challenge result can be returned to the challenging node. For example, the amount of on-chain assets K that should be penalized by the target proxy node can be determined. This on-chain asset data K can then be used as compensation digital assets to compensate the given sequencer node. For instance, the amount of on-chain assets K can be deducted from the standby committed assets submitted by the target proxy node, and the deducted amount of on-chain assets K can be transferred to the given sequencer node as compensation digital assets.
[0178] The process by which the second-layer network contract deducts the on-chain asset quantity K from the standby committed assets corresponding to the target agent node can be represented as: AgentStake i =AgentStake j -K, where AgentStake jThe remaining assets, after deducting the on-chain asset quantity K, represent the target proxy node's backup committed assets. The updated backup committed assets for the target proxy node can be represented as follows: The process of the second-layer network contract distributing compensation digital assets to the sequencer node can be expressed as:
[0179] Optionally, if the Layer 2 network contract determines that the proxy signature is not a correct signature generated by the target proxy node using its own proxy private key, then the transaction execution information generated by the target proxy node can be determined to be correct. Consequently, the updated state root submitted by the sequencer node can be determined to be an incorrect state root, meaning that the information transmitted by the sequencer node to the Layer 1 network has an error. In this case, the Layer 2 network contract can send an exception message to the sequencer node, which can be used to instruct the sequencer node to be an invalid node and to suspend its operation. For example, it can suspend operation for a period of time before resuming normal operation, such as a day, a week, or a month, etc. This application does not limit this. Optionally, when the information transmitted by the sequencer node to the Layer 1 network has an error, the sequencer node can be designated as an invalid node, and a new sequencer node can be reconfigured in the Layer 2 network. This can improve the security of the sequencer node.
[0180] Please see Figure 6 , Figure 6 This is a schematic diagram of a challenge process provided in an embodiment of this application. For example... Figure 6 The blockchain system shown is as follows Figure 4 The blockchain system shown will not be elaborated further here. Before providing the proxy sequencing function to the outside world, the challenge node in the second-layer network can submit backup commitment assets to the second-layer network contract of the first-layer network; the backup commitment assets can serve as the range of assets that can be used to compensate the sequencer node when the transaction execution information returned by the proxy node is incorrect.
[0181] During the challenge period, if a challenge node detects that the updated state root submitted to the first-layer network by the sequencer node is an incorrect state root, then the challenge node can initiate a challenge request to the second-layer network contract in the first-layer network.
[0182] After the challenging node initiates a challenge request, the sequencer node can submit a second state read / write set and a proxy signature to the second-layer network contract. The second-layer network contract can verify the second state read / write set to obtain a state verification result. If the state verification result indicates that the verification failed, the proxy signature can be verified using the proxy public key corresponding to the target proxy node to obtain a signature verification result. If the signature verification result indicates that the proxy signature is correct, it can be determined that the target proxy node failed to sequence the transaction, that is, the transaction execution information generated by the target proxy node is erroneous, and compensation digital assets can be issued to the sequencer node. This compensation digital asset can come from the target proxy node's backup commitment assets, that is, to penalize the target proxy node. In this challenge process, it means that the challenging node has succeeded in the challenge.
[0183] If the state verification result indicates successful verification, it means that the transaction execution information generated by the target proxy node is correct, and the challenge process can end, indicating that the challenge node has failed. Optionally, if the state verification result indicates unsuccessful verification, and the signature verification result indicates that the proxy signature is incorrect, it means that the transaction execution information generated by the target proxy node is correct, but the updated state root submitted by the sequencer node is incorrect. The responsibility lies with the sequencer node, and therefore, the sequencer node can be penalized. For example, it can be designated as an invalid node and prevented from working as a sequencer node in the second-layer network; or its normal operation can be suspended.
[0184] In the blockchain system involved in this application embodiment, when the updated state root submitted by the second-layer network is an erroneous state root, the challenge technology configured in the blockchain system can be used. By storing the second state read / write set and proxy signature generated by the target proxy node in the local database of the sequencer node, the source of the second state read / write set in the sequencer node can be verified when the challenger node initiates a challenge request. If it is determined that the second state read / write set truly originates from the target proxy node and the second state read / write set is verified to be erroneous, then the sequencer node can be compensated, which can effectively ensure the security of the sequencer node when using the proxy node's proxy ordering service.
[0185] It is understood that the specific implementation of this application may involve user account information, application login information and other related information. When the above embodiments of this application are applied to specific products or technologies, permission or consent from relevant institutions or departments or the user himself or himself or himself or her ...
[0186] Please see Figure 7 , Figure 7This is a schematic diagram of the structure of a data processing device for a blockchain system provided in an embodiment of this application. Figure 1 .like Figure 7 As shown, the blockchain system includes a first-layer network and a second-layer network. The device is applied to the sequencer node in the second-layer network. The data processing device 1 of the blockchain system may include: a proxy node selection module 101, a transaction forwarding module 102, an execution information receiving module 103, and a state root submission module 104.
[0187] The proxy node selection module 101 is used to obtain the set of transactions to be uploaded to the blockchain and determine the target proxy node corresponding to the set of transactions to be uploaded to the blockchain among the proxy nodes included in the second-layer network.
[0188] The transaction forwarding module 102 is used to forward the set of transactions to be uploaded to the blockchain to the target proxy node, so that the target proxy node can execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain.
[0189] The execution information receiving module 103 is used to receive transaction execution information returned by the target agent node, and update the state root corresponding to the sequencer node according to the transaction execution information to obtain the updated state root;
[0190] The state root submission module 104 is used to submit the set of transactions to be added to the blockchain and the updated state root to the first-layer network, so that the network nodes in the first-layer network can store the set of transactions to be added to the blockchain and the updated state root.
[0191] In one or more embodiments, the proxy node selection module 101 obtains a set of transactions to be uploaded to the blockchain and performs the following steps:
[0192] Receive the transactions to be uploaded to the blockchain from the target node and add them to the transaction pool corresponding to the sequencer node.
[0193] Based on the relationships between the transactions to be uploaded to the blockchain contained in the transaction pool, N transactions to be uploaded to the blockchain are identified in the transaction pool and added to the set of transactions to be uploaded to the blockchain; N is a positive integer.
[0194] In one or more embodiments, the number of proxy nodes in the second-layer network is M, where M is a positive integer;
[0195] The proxy node selection module 101 determines the target proxy node corresponding to the set of transactions to be uploaded to the blockchain from among the proxy nodes included in the second-layer network, and performs the following steps:
[0196] Obtain the proxy resource consumption corresponding to M proxy nodes in the second layer network, and obtain the priority of M proxy nodes;
[0197] Based on the proxy resource consumption and priority, the target proxy node corresponding to the set of transactions to be uploaded to the chain is determined from M proxy nodes.
[0198] In one or more embodiments, the proxy node selection module 101 determines the target proxy node corresponding to the set of transactions to be uploaded to the blockchain from M proxy nodes based on proxy resource consumption and priority, for the purpose of performing the following steps:
[0199] Among the M proxy nodes, the proxy node with the lowest proxy resource consumption is determined as the candidate proxy node;
[0200] If the priority of the candidate proxy node meets the selection criteria, the candidate proxy node will be determined as the target proxy node for the set of transactions to be uploaded to the blockchain.
[0201] If the priority of the candidate proxy node does not meet the selection criteria, then the target proxy node corresponding to the set of transactions to be uploaded to the chain will be determined from the M-1 proxy nodes other than the candidate proxy nodes.
[0202] In one or more embodiments, the execution information receiving module 103 updates the state root corresponding to the sequencer node according to the transaction execution information to obtain the updated state root, which is used to perform the following steps:
[0203] Obtain the first state read set corresponding to the sequencer node, compare the first state read set with the second state read set in the transaction execution information, and obtain the set comparison result;
[0204] If the set comparison results indicate that the results are consistent, then the first state write set corresponding to the sequencer node is updated to the second state write set in the transaction execution information, and the second state write set and the proxy signature in the transaction execution information are stored.
[0205] Based on the second state write set, perform a hash operation on the state data corresponding to the sequencer node to obtain the updated state root.
[0206] In one or more embodiments, the execution information receiving module 103 compares the first state read set with the second state read set in the transaction execution information to obtain a set comparison result, which is used to perform the following steps:
[0207] Iterate through the identifiers in the first state read set and the second state read set;
[0208] If the data content of the same identifier is the same in the first state read set and the second state read set, then the set comparison result is determined to be the correct result;
[0209] If the data content of the same identifier in the first state read set and the second state read set is different, then the set comparison result is determined to be an error result.
[0210] In one or more embodiments, the data processing device 1 of the blockchain system may further include: a read / write set submission module 105;
[0211] The read / write set submission module 105 is used to send the second state read set and the second state write set stored by the sequencer node to the second layer network contract in the first layer network if a challenge request corresponding to the challenge node in the second layer network is received through the first layer network.
[0212] The second-layer network contract is used to verify the second state read set and the second state write set to obtain the state verification result; when the state verification result indicates that the verification is successful, the second-layer network contract is used to return the challenge failure result to the challenge node.
[0213] When the status verification result indicates that the verification failed, the second-layer network contract is used to obtain the proxy signature submitted by the sequencer node and the proxy public key corresponding to the target proxy node, and return the challenge success result to the challenge node.
[0214] In one or more embodiments, the data processing device 1 of the blockchain system may further include: a compensation distribution module 106 and an anomaly notification module 107;
[0215] The compensation distribution module 106 is used to receive the compensation digital assets distributed by the second-layer network contract if the second-layer network contract determines that the agent signature is the correct signature of the target agent node.
[0216] The exception prompt module 107 is used to receive the exception prompt information returned by the second-layer network contract if the second-layer network contract determines that the proxy signature is an incorrect signature of the target proxy node; the exception prompt information is used to indicate that the sequencer node is determined to be an invalid node.
[0217] According to one embodiment of this application, the foregoing Figure 2 The data processing method of the blockchain system shown can involve the relevant steps by Figure 7 The data processing unit 1 of the blockchain system shown is used to execute the process. For example, Figure 2 The step S101 shown can be performed by Figure 7 The agent node shown is selected by module 101 for execution. Figure 2 The step S102 shown can be performed by Figure 7 The transaction forwarding module 102 shown is used to execute this. Figure 2 The step S105 shown can be performed by Figure 7 The execution information receiving module 103 shown is used for execution. Figure 2 The step S106 shown can be performed by Figure 7 The status root submission module 104 shown is used to execute, etc.
[0218] According to one embodiment of this application, Figure 7 The modules in the data processing device 1 of the blockchain system shown can be individually or entirely merged into one or more modules, or some of the modules can be further divided into at least two functionally smaller units to achieve the same operation without affecting the technical effects of the embodiments of this application. The above modules are based on logical function division. In practical applications, the function of one module can also be implemented by at least two units, or the function of at least two modules can be implemented by one module. In other embodiments of this application, the data processing device 1 of the blockchain system may also include other modules or units. In practical applications, these functions can also be implemented with the assistance of other modules, and can be implemented collaboratively by at least two modules.
[0219] In this embodiment, the transaction execution function of the sequencer node in the existing blockchain Layer 2 network technology can be transferred to the proxy node in the Layer 2 network, enabling the proxy node to have transaction execution capabilities. This transaction execution function of the proxy node can also be called proxy sequencing functionality. The proxy node executes the transactions to be uploaded to the chain in the Layer 2 network, while the sequencer node in the Layer 2 network only needs to update the state root based on the transaction execution information returned by the proxy node and submit the transaction to be uploaded and the updated state root to the Layer 1 network. In other words, the transaction execution function, which consumes the most computational resources, can be transferred to the proxy service provided by the proxy node (specifically, the proxy sequencing service within the proxy service). This reduces the configuration requirements of the sequencer node in the Layer 2 network (e.g., it can use a lower-configuration CPU, hard disk storage, etc.), thereby reducing the operating cost of the sequencer node.
[0220] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a data processing device for a blockchain system provided in an embodiment of this application. Figure 2 .like Figure 8 As shown, the blockchain system includes a first-layer network and a second-layer network. The device is applied to the target proxy node in the second-layer network. The data processing device 2 of the blockchain system may include: a transaction receiving module 201, a transaction execution module 202, and an execution information sending module 203.
[0221] The transaction receiving module 201 is used to receive the set of transactions to be uploaded to the chain sent by the sequencer node in the second layer network;
[0222] Transaction execution module 202 is used to execute the transactions to be uploaded to the blockchain in the transaction set to be uploaded to the blockchain, and obtain the transaction execution information corresponding to the transaction set to be uploaded to the blockchain;
[0223] The execution information sending module 203 is used to send transaction execution information to the sequencer node so that the sequencer node can update the state root corresponding to the sequencer node according to the transaction execution information and obtain the updated state root.
[0224] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network by the sequencer node; the network nodes in the first-layer network are used to store the set of transactions to be added to the blockchain and the updated state root.
[0225] In one or more embodiments, the transaction execution module 202 executes the transactions to be uploaded to the blockchain in the transaction set to be uploaded, and obtains the transaction execution information corresponding to the transaction set to be uploaded to the blockchain, which is used to perform the following steps:
[0226] Insert the reward transaction corresponding to the target proxy node into the set of transactions to be uploaded to the blockchain. Based on the contract identifier contained in the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain, call the smart contract deployed in the blockchain. The transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain include reward transactions.
[0227] Through smart contracts, transactions to be uploaded to the blockchain are executed, and the corresponding transaction execution information is obtained.
[0228] In one or more embodiments, the transaction execution module 202 executes the transactions to be uploaded to the blockchain in the transaction set to be uploaded to the blockchain through a smart contract, and obtains the transaction execution information corresponding to the transaction set to be uploaded to the blockchain, which is then used to perform the following steps:
[0229] The second state read set of the second layer network is obtained through a smart contract. The transactions to be written to the chain in the transaction to be written to the chain set are executed according to the second state read set to obtain the second state write set.
[0230] Based on the public key of the target proxy node, the second state read set and the second write set are signed to obtain the proxy signature corresponding to the target proxy node.
[0231] The second-state read set, the second-state write set, and the proxy signature are determined as the transaction execution information corresponding to the transaction set to be uploaded to the blockchain.
[0232] In one or more embodiments, the data processing device 2 of the blockchain system may further include: a commitment asset submission module 204;
[0233] The commitment asset submission module 204 is used to submit the standby commitment assets corresponding to the target agent node to the second-layer network contract in the first-layer network.
[0234] When the proxy signature in the transaction execution information generated by the target proxy node is an incorrect signature, the second-layer network contract in the first-layer network is used to determine the compensation digital asset corresponding to the sequencer node, and transfer the compensation digital asset from the backup commitment asset corresponding to the target proxy node to the sequencer node.
[0235] According to one embodiment of this application, the foregoing Figure 2 The data processing method of the blockchain system shown can involve the relevant steps by Figure 8 The data processing unit 2 of the blockchain system shown is used to execute this process. For example, Figure 2 The step S103 shown can be performed by Figure 8 The transaction execution module 202 shown is used to execute the transaction. Figure 2 Step S104 shown can be derived from Figure 8 The execution information sending module 203 shown is used for execution, etc.
[0236] According to one embodiment of this application, Figure 8 The modules in the data processing device 2 of the blockchain system shown can be individually or entirely merged into one or more modules, or some of the modules can be further divided into at least two functionally smaller units to achieve the same operation without affecting the technical effects of the embodiments of this application. The above modules are based on logical function division. In practical applications, the function of one module can also be implemented by at least two units, or the function of at least two modules can be implemented by one module. In other embodiments of this application, the data processing device 2 of the blockchain system may also include other modules or units. In practical applications, these functions can also be implemented with the assistance of other modules, and can be implemented collaboratively by at least two modules.
[0237] In this embodiment, the blockchain system can be divided into a first-layer network and a second-layer network. By creating proxy nodes in the second-layer network and configuring proxy ordering functions for these proxy nodes, the orderer node, after obtaining the set of transactions to be uploaded to the blockchain, forwards the set to the target proxy node. Upon receiving the set of transactions to be uploaded to the blockchain, the target proxy node can execute the transactions in the set to obtain transaction execution information. In other words, the orderer node does not need to configure proxy ordering functions; the proxy ordering function of the orderer node is transferred to the proxy node. The orderer node only needs to receive the transaction execution information generated by the target proxy node, which reduces the configuration requirements of the orderer node and thus reduces its operating costs. Challenge nodes in the second-layer network can challenge the updated state root submitted by the orderer node, thereby improving the security of the transaction execution information generated by the proxy node (the proxy ordering service of the proxy node).
[0238] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 As shown, the computer device 1000 can be a terminal device or a server; this is not a limitation. For ease of understanding, this application uses the computer device as a terminal device as an example. The computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 9 As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application.
[0239] The network interface 1004 in the computer device 1000 can also provide network communication functions, and the optional user interface 1003 can also include a display screen and a keyboard. Figure 9 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0240] Obtain the set of transactions to be uploaded to the blockchain, and determine the target proxy node corresponding to the set of transactions to be uploaded to the blockchain among the proxy nodes contained in the second-layer network;
[0241] The set of transactions to be uploaded to the blockchain is forwarded to the target proxy node so that the target proxy node can execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain.
[0242] Receive the transaction execution information returned by the target agent node, update the state root corresponding to the sequencer node according to the transaction execution information, and obtain the updated state root;
[0243] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network so that the network nodes in the first-layer network can store the set of transactions to be added to the blockchain and the updated state root.
[0244] Alternatively, processor 1001 can be used to call the device control application stored in memory 1005 to achieve:
[0245] Receive the set of transactions to be uploaded to the blockchain sent by the sequencer node in the second-layer network;
[0246] Execute the transactions to be uploaded to the blockchain in the set of transactions to be uploaded to the blockchain, and obtain the transaction execution information corresponding to the set of transactions to be uploaded to the blockchain;
[0247] The transaction execution information is sent to the sequencer node so that the sequencer node can update its corresponding state root based on the transaction execution information and obtain the updated state root.
[0248] The set of transactions to be added to the blockchain and the updated state root are submitted to the first-layer network by the sequencer node; the network nodes in the first-layer network are used to store the set of transactions to be added to the blockchain and the updated state root.
[0249] It should be understood that the computer device 1000 described in the embodiments of this application can execute the foregoing text. Figure 2 , Figure 5 The description of the data processing method for the blockchain system in any of the embodiments can also be performed as described above. Figure 7 The description of the data processing device 1 of the blockchain system in the corresponding embodiment, or Figure 8 The description of the data processing device 2 of the blockchain system in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated here.
[0250] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the data processing device 1 or the data processing device 2 of the blockchain system mentioned above. The computer program includes computer instructions, and when the processor executes the computer instructions, it can execute the aforementioned... Figure 2 , Figure 5The description of the data processing method of the blockchain system in any of the embodiments is already provided, and therefore will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. For technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application. As an example, program instructions can be deployed and executed on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network. Multiple computer devices distributed across multiple locations and interconnected via a communication network can constitute a blockchain system.
[0251] Furthermore, it should be noted that this application also provides a computer program product, which may include a computer program that can be stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium, and the processor can execute the computer program, causing the computer device to perform the aforementioned... Figure 2 , Figure 5 The description of the data processing method for the blockchain system in any of the embodiments is already provided, and therefore will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer program products or computer program embodiments related to this application, please refer to the description of the method embodiments of this application.
[0252] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different media content, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0253] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0254] The methods and related apparatuses provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.
[0255] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0256] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A data processing method of a blockchain system, characterized by, The blockchain system comprises a first layer network and a second layer network, the method is executed by a sequencer node in the second layer network, and the method comprises: obtaining a set of to-be-chained transactions, determining a target agent node corresponding to the set of to-be-chained transactions in an agent node included in the second layer network; forwarding the set of to-be-chained transactions to the target agent node, so that the target agent node executes a to-be-chained transaction in the set of to-be-chained transactions to obtain transaction execution information corresponding to the set of to-be-chained transactions; receiving the transaction execution information returned by the target agent node, updating a state root corresponding to the sequencer node according to the transaction execution information to obtain an updated state root; submitting the set of to-be-chained transactions and the updated state root to the first layer network, so that a network node in the first layer network stores the set of to-be-chained transactions and the updated state root to a blockchain.
2. The method of claim 1, wherein, The obtaining of the set of to-be-chained transactions comprises: receiving a to-be-chained transaction sent by an object node and adding the to-be-chained transaction to a transaction pool corresponding to the sequencer node; determining N to-be-chained transactions in the transaction pool according to an association relationship between to-be-chained transactions included in the transaction pool and adding the N to-be-chained transactions to the set of to-be-chained transactions; N is a positive integer.
3. The method of claim 1, wherein, The number of agent nodes in the second layer network is M, and M is a positive integer; The determining of the target agent node corresponding to the set of to-be-chained transactions in the agent node included in the second layer network comprises: obtaining agent resource consumption corresponding to M agent nodes in the second layer network and obtaining priorities corresponding to the M agent nodes; determining the target agent node corresponding to the set of to-be-chained transactions from the M agent nodes according to the agent resource consumption and the priorities.
4. The method of claim 3, wherein, The determining of the target agent node corresponding to the set of to-be-chained transactions from the M agent nodes according to the agent resource consumption and the priorities comprises: determining an agent node corresponding to minimum agent resource consumption as a candidate agent node in the M agent nodes; if the priority corresponding to the candidate agent node satisfies a selection condition, determining the candidate agent node as the target agent node corresponding to the set of to-be-chained transactions; if the priority corresponding to the candidate agent node does not satisfy the selection condition, determining the target agent node corresponding to the set of to-be-chained transactions in M-1 agent nodes except the candidate agent node.
5. The method of claim 1, wherein, The updating of the state root corresponding to the sequencer node according to the transaction execution information to obtain the updated state root comprises: obtaining a first state read set corresponding to the sequencer node, comparing the first state read set with a second state read set in the transaction execution information to obtain a set comparison result; If the set comparison result indicates a correct result, a first state write set corresponding to the sequencer node is updated to a second state write set in the transaction execution information, and a proxy signature in the second state write set and the transaction execution information are stored; According to the second state write set, the state data corresponding to the sequencer node is hashed to obtain an updated state root.
6. The method of claim 5, wherein, The first state read set and the second state read set are compared to obtain a set comparison result, including: Traverse the identifiers in the first state read set and the second state read set; If the data contents of the same identifier in the first state read set and the second state read set are the same, it is determined that the set comparison result is a correct result; If the data contents of the same identifier in the first state read set and the second state read set are different, it is determined that the set comparison result is an incorrect result.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: If the challenge request corresponding to the challenge node in the second layer network is received through the first layer network, the second state read set and the second state write set stored by the sequencer node are sent to the second layer network contract in the first layer network; Wherein, the second layer network contract is used to verify the second state read set and the second state write set to obtain a state verification result; when the state verification result indicates that the verification is passed, the second layer network contract is used to return a challenge failure result to the challenge node; When the state verification result indicates that the verification is not passed, the second layer network contract is used to obtain the proxy signature submitted by the sequencer node and the proxy public key corresponding to the target proxy node, and returns a challenge success result to the challenge node.
8. The method of claim 7, wherein, The method further includes: If the second layer network contract determines that the proxy signature is the correct signature of the target proxy node, the compensation digital asset issued by the second layer network contract is received; If the second layer network contract determines that the proxy signature is the incorrect signature of the target proxy node, the abnormal prompt information returned by the second layer network contract is received; the abnormal prompt information is used to indicate that the sequencer node is determined as an invalid node. 9.A data processing method of a blockchain system, characterized by, The blockchain system includes a first layer network and a second layer network, and the method is executed by a target proxy node in the second layer network, including: Receiving a set of to-be-chained transactions sent by a sequencer node in the second layer network; Executing the to-be-chained transactions in the set of to-be-chained transactions to obtain transaction execution information corresponding to the set of to-be-chained transactions; The transaction execution information is sent to the sequencer node, so that the sequencer node updates the state root corresponding to the sequencer node according to the transaction execution information to obtain an updated state root; Wherein, the set of to-be-chained transactions and the updated state root are submitted to the first layer network by the sequencer node; the network node in the first layer network is used to store the set of to-be-chained transactions and the updated state root to the blockchain.
10. The method of claim 9, wherein, The executing the to-be-chained transactions in the to-be-chained transaction set to obtain transaction execution information corresponding to the to-be-chained transaction set comprises: inserting the reward transaction corresponding to the target agent node into the to-be-chained transaction set, and invoking a smart contract deployed in the blockchain according to a contract identifier included in the to-be-chained transaction in the to-be-chained transaction set; the to-be-chained transaction in the to-be-chained transaction set comprises the reward transaction; executing the to-be-chained transactions in the to-be-chained transaction set through the smart contract to obtain transaction execution information corresponding to the to-be-chained transaction set.
11. The method of claim 10, wherein, The executing the to-be-chained transactions in the to-be-chained transaction set through the smart contract to obtain transaction execution information corresponding to the to-be-chained transaction set comprises: obtaining a second state read set of the second layer network through the smart contract, executing the to-be-chained transactions in the to-be-chained transaction set according to the second state read set to obtain a second state write set; signing the second state read set and the second write set according to the node public key corresponding to the target agent node to obtain an agent signature corresponding to the target agent node; determining the second state read set, the second state write set, and the agent signature as the transaction execution information corresponding to the to-be-chained transaction set.
12. The method according to any one of claims 9 to 11, characterized in that, The method further comprises: submitting a backup commitment asset corresponding to the target agent node to a second layer network contract in the first layer network; wherein, when the agent signature in the transaction execution information generated by the target agent node is an incorrect signature, the second layer network contract in the first layer network is configured to determine a compensation digital asset corresponding to a sequencer node, and transfer the compensation digital asset from the backup commitment asset corresponding to the target agent node to the sequencer node.
13. A data processing apparatus of a blockchain system, characterized by, The blockchain system comprises a first layer network and a second layer network, and the device is applied to a sequencer node in the second layer network, and the device comprises: an agent node selection module configured to obtain a to-be-chained transaction set, and determine a target agent node corresponding to the to-be-chained transaction set from among agent nodes included in the second layer network; a transaction forwarding module configured to forward the to-be-chained transaction set to the target agent node, so that the target agent node executes to-be-chained transactions in the to-be-chained transaction set to obtain transaction execution information corresponding to the to-be-chained transaction set; an execution information receiving module configured to receive transaction execution information returned by the target agent node, and update a state root corresponding to the sequencer node according to the transaction execution information to obtain an updated state root; a state root submission module configured to submit the to-be-chained transaction set and the updated state root to the first layer network, so that network nodes in the first layer network store the to-be-chained transaction set and the updated state root to a blockchain. 14.A data processing apparatus of a blockchain system, characterized by, The blockchain system comprises a first layer network and a second layer network, and the device is applied to a target agent node in the second layer network, and the device comprises: The transaction receiving module is configured to receive a set of to-be-chained transactions sent by a sequencer node in the second-layer network; The transaction executing module is configured to execute the to-be-chained transactions in the set of to-be-chained transactions to obtain transaction execution information corresponding to the set of to-be-chained transactions; The execution information sending module is configured to send the transaction execution information to the sequencer node, so that the sequencer node updates a state root corresponding to the sequencer node according to the transaction execution information to obtain an updated state root; The set of to-be-chained transactions and the updated state root are submitted to the first-layer network by the sequencer node, and a network node in the first-layer network is configured to store the set of to-be-chained transactions and the updated state root to a block chain.
15. A computer device, comprising: comprises a memory and a processor; The memory is connected to the processor, and the memory is configured to store a computer program, and the processor is configured to call the computer program to enable the computer device to execute the method in any one of claims 1 to 8 or the method in any one of claims 9 to 12.
16. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by the processor to enable a computer device with the processor to execute the method in any one of claims 1 to 8 or the method in any one of claims 9 to 12.
17. A computer program product, characterised in that, The computer program is executed by the processor to implement the method in any one of claims 1 to 8 or the method in any one of claims 9 to 12.