WO2023207471A1 - 基于区块链的数据处理方法、相关装置及介质和程序产品 - Google Patents

基于区块链的数据处理方法、相关装置及介质和程序产品 Download PDF

Info

Publication number
WO2023207471A1
WO2023207471A1 PCT/CN2023/084224 CN2023084224W WO2023207471A1 WO 2023207471 A1 WO2023207471 A1 WO 2023207471A1 CN 2023084224 W CN2023084224 W CN 2023084224W WO 2023207471 A1 WO2023207471 A1 WO 2023207471A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource exchange
verification
resource
data
processed
Prior art date
Application number
PCT/CN2023/084224
Other languages
English (en)
French (fr)
Inventor
陈自民
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2023207471A1 publication Critical patent/WO2023207471A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification

Definitions

  • This application relates to the field of computer technology, and in particular to blockchain-based data processing methods, blockchain-based data processing devices, computer equipment, computer-readable storage media, and computer program products.
  • the embodiment of this application provides a data processing method based on a blockchain.
  • the blockchain includes a main business chain and a business sub-chain.
  • the method includes:
  • Each resource exchange in the resource exchange set to be processed contains a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different;
  • the verification instruction information is used to instruct the verification node to perform the correctness of the resource exchange in the target resource exchange block. verify;
  • the verification data When the verification data indicates that the correctness verification of the target resource exchange block has passed, the verification data will be sent to the main chain node corresponding to the business main chain, so that the main chain node can verify the validity of the verification data;
  • the embodiment of this application provides another data processing method based on the blockchain.
  • the blockchain includes a business main chain and a business sub-chain.
  • the method includes:
  • the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block.
  • the target resource exchange block is based on the sub-chain node to be Generated by processing the resource exchange set.
  • Each resource exchange in the resource exchange set to be processed is obtained from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange contains a resource exchange identifier and belongs to each resource exchange of the same object. The resource exchange identifiers are different; the verification data is sent by the sub-chain node when the verification data indicates that the correctness verification of the target resource exchange block has passed;
  • the verification results are sent to the sub-chain nodes, so that the sub-chain nodes can process each resource exchange in the resource exchange set to be processed accordingly based on the verification results.
  • the embodiment of this application provides a data processing device based on a blockchain.
  • the blockchain includes a business main chain and a business sub-chain.
  • the device includes:
  • the processing unit is used to obtain the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange in the resource exchange set to be processed contains a resource exchange identifier and belongs to the resource exchange of each resource exchange of the same object.
  • the logo is different;
  • the processing unit is also used to generate a target resource exchange block based on the resource exchange set to be processed;
  • the communication unit is used to send verification instruction information containing the target resource exchange block to the verification node, and the verification instruction information is used to indicate Indicates that the verification node verifies the correctness of the resource exchange in the target resource exchange block;
  • the communication unit is also used to receive verification data returned by the verification node for the target resource exchange block
  • the communication unit is also used to send the verification data to the main chain node corresponding to the business main chain, so that the main chain node can verify the validity of the verification data; receive Verification results of the verification data returned by the main chain node;
  • the processing unit is also used to process each resource exchange in the resource exchange set to be processed according to the verification results.
  • the processing unit when the processing unit obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, it is specifically used to: obtain the resource exchange to be processed from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange includes a resource exchange identifier; based on the resource exchange identifier of the resource exchange to be processed, it is detected whether the resource exchange to be processed is included in the resource exchange set to be processed, and the resource exchange set to be processed is determined from the resource exchange set to be processed.
  • the resource exchange identification of the target resource exchange is related to the generation order of the target resource exchange in the resource exchange generated for the first object, the first object is the object to which the target resource exchange belongs, and the target resource exchange is the resource exchange pool. any resource exchange.
  • the processing unit is also used to obtain key resource exchange information for each resource exchange in the resource exchange set to be processed; and generate a key resource exchange information set based on the key resource exchange information;
  • the communication unit is also used to send the key resource exchange information set to the main chain node; wherein the key resource exchange information in the key resource exchange information set is used to determine the resource exchange status data of the second object, and the second object is the resource to be processed. Exchange any object associated with a resource exchange in the collection.
  • the processing unit when the processing unit performs corresponding processing on each resource exchange in the resource exchange set to be processed according to the verification result, it is specifically configured to: when the verification result indicates that the verification data passes the validity check, execute the pending processing Each resource exchange in the resource exchange set; based on the resource exchange data and resource exchange execution results of each resource exchange, the resource exchange status data of each object to which the resource exchange belongs is updated.
  • the communication unit is also configured to send the recorded resource exchange status data of each object to the main chain node when the status data reporting conditions are met, so that the main chain node can pair the resource exchange status data based on the received resource exchange status data.
  • the resource exchange status data of each object recorded by it is updated.
  • meeting the status data reporting conditions includes: the number of resource exchanges performed in the current stage reaches a preset number, or all resource exchanges in the resource exchange pool have been performed.
  • the embodiment of this application provides another data processing device based on the blockchain.
  • the blockchain includes a business main chain and a business sub-chain.
  • the device includes:
  • the communication unit is used to receive verification data sent by the sub-chain node corresponding to the business sub-chain.
  • the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block.
  • the target resource exchange block is The sub-chain node is generated based on the resource exchange set to be processed. Each resource exchange in the resource exchange set to be processed is obtained from the resource exchange pool corresponding to the business sub-chain. Each resource exchange contains a resource exchange identifier and belongs to the same object. The resource exchange identification of each resource exchange is different; the verification data is sent by the sub-chain node when the verification data indicates that the correctness of the target resource exchange block has been verified;
  • the processing unit is used to verify the validity of the verification data and obtain the verification results of the verification data
  • the communication unit is also used to send the verification results to the sub-chain nodes, so that the sub-chain nodes can process each resource exchange in the resource exchange set to be processed accordingly based on the verification results.
  • the verification data includes verification data corresponding to the target resource exchange block, encrypted data obtained by encrypting the verification data using an encryption key corresponding to the verification node; the processing unit performs validity verification on the verification data , when the verification result of the verification data is obtained, it is specifically used to: obtain the decryption key that matches the encryption key, use the decryption key to decrypt the encrypted data included in the verification data, and obtain the decrypted data; based on the verification data included in the verification data Compare the verification data and decrypted data to determine the verification result of the verification data.
  • the communication unit is also used to receive the key resource exchange information set sent by the sub-chain node.
  • the key resource exchange information set is generated based on the key resource exchange information of each resource exchange in the resource exchange set to be processed.
  • the key resource exchange information in the key resource exchange information set is used to determine the resource exchange status data of the target object.
  • the target object is any object associated with the resource exchange in the resource exchange set to be processed; the processing unit is also used to store key resources. Exchange information collections.
  • the communication unit is also configured to receive the resource exchange status data of each object recorded by the sub-chain node sent by the sub-chain node when the status data reporting conditions are met; the processing unit is also configured to exchange resources based on the received status data recorded
  • the resource exchange status data of each object is updated; among them, the conditions for meeting the status data reporting include: the number of resource exchanges executed in the current stage reaches the preset number, or all resource exchanges in the resource exchange pool have been executed.
  • An embodiment of the present application provides a computer device, including: a processor, a communication interface, and a memory.
  • the processor, the communication interface, and the memory are connected to each other.
  • the memory stores executable program code, and the processor is used to call The executable program code implements the blockchain-based data processing method provided by the embodiments of this application.
  • embodiments of the present application also provide a computer-readable storage medium, including: a computer program stored in the computer-readable storage medium.
  • a computer program stored in the computer-readable storage medium.
  • the block-based storage medium provided by the embodiments of the present application is implemented. Chain data processing methods.
  • inventions of the present application provide a computer program product.
  • the computer program product includes a computer program or computer instructions. When executed by a processor, the computer program or computer instructions implement the blockchain-based data provided by the embodiments of the present application. Approach.
  • inventions of the present application provide a computer program.
  • the computer program includes computer instructions.
  • the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and processes the computer instructions.
  • the computer executes computer instructions, causing the computer device to execute the blockchain-based data processing method provided by the embodiments of this application.
  • Figure 1 is a schematic structural diagram of a blockchain provided by an embodiment of this application.
  • Figure 2 is a schematic diagram of the network architecture of a blockchain network provided by an embodiment of the present application.
  • Figure 3 is an architectural diagram of a blockchain-based data processing system provided by an embodiment of the present application.
  • Figure 4 is a schematic flow chart of a blockchain-based data processing method provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of a blockchain-based data processing scenario provided by an embodiment of the present application.
  • Figure 6 is a schematic flow chart of another blockchain-based data processing method provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of an application scenario of blockchain-based data processing provided by the embodiment of the present application.
  • Figure 8 is a schematic diagram of a sub-chain node updating data status data provided by an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of a blockchain-based data processing device provided by an embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • Blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithms. It is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting). ) and generate the next block.
  • blockchain is a chain data structure that combines data blocks in a sequential manner in chronological order, and is cryptographically guaranteed to be an untamperable and unforgeable distributed ledger.
  • blockchain technology uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses automated script codes
  • a new distributed infrastructure and computing method composed of smart contracts to program and operate data.
  • Smart contract a computerized agreement that can execute the terms of a certain contract and is implemented through code deployed on a shared ledger for execution when certain conditions are met.
  • the code is used to complete automated transactions based on actual business needs. (also called “resource exchange”), such as checking the logistics status of the goods purchased by the buyer, and transferring the buyer's digital assets to the merchant after the buyer signs for the goods. address; of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts that process received information.
  • Non-homogeneous equity certificate It is a non-replicable, indivisible and unique digital encrypted equity certificate that contains several rules and information and is used to indicate a certain Ownership of rights and interests in digital items.
  • the embodiments of this application provide a blockchain-based data processing method, related devices, media and program products, which can alleviate the storage pressure of the main chain nodes in the blockchain network, while effectively preventing the same resource exchange from being repeatedly executed, solving the problem Resource exchange double spending problem.
  • double spending is also called double spending, which means that the same resource is paid to two recipients at the same time.
  • Figure 1 is a schematic diagram of a blockchain structure provided by an embodiment of the present application.
  • the blockchain 101 is composed of multiple blocks.
  • the first block of the blockchain is called the genesis block (which can be referred to as the genesis block).
  • the genesis block includes the block header and the area.
  • Block body stores the input information characteristic value, version number, timestamp and difficulty value, and the block body stores the input information;
  • the next block of the genesis block takes the genesis block as the parent block, and the next
  • the block also includes a block header and a block body.
  • the block header stores the input information characteristic value of the current block, the block header characteristic value of the parent block, the version number, the timestamp and the difficulty value, and so on, so that
  • the block data stored in each block in the blockchain is related to the block data stored in the parent block, ensuring the security of the information input in the block.
  • the blockchain network can be maintained by each blockchain node.
  • the blockchain network can be understood as a data sharing system for data sharing between blockchain nodes.
  • the data sharing An exemplary structure of the system can be seen in Figure 2; as shown in Figure 2, the data sharing system can include multiple blockchain nodes 102, and each blockchain node 102 can be a server connected to the blockchain network. , or it can be a terminal device (such as a client) connected to the blockchain network.
  • the specific form of the blockchain node 102 is not limited here.
  • Each blockchain node 102 in the blockchain network has a corresponding node identifier, and each blockchain node 102 in the blockchain network can store other blockchains in the blockchain network.
  • the node identifier of the node 102 is used to subsequently broadcast the generated block to other blockchain nodes 102 in the data sharing system based on the node identifiers of other blockchain nodes 102.
  • Each blockchain node 102 can maintain a node identification list, and store the node name and the node identification correspondingly in the node identification list; where, the node identification list can be seen in Table 1:
  • the node identifier can be an IP (Internet Protocol, a protocol for interconnection between networks) address and any other information that can be used to identify the node; for example, the node identifier can also be a binary sequence code (such as 110001110 ), Table 1 only takes the IP address as an example for explanation.
  • IP Internet Protocol, a protocol for interconnection between networks
  • Table 1 only takes the IP address as an example for explanation.
  • the embodiment of the present application provides a blockchain-based data processing system suitable for the blockchain-based data processing method.
  • Figure 3 is a blockchain-based data processing system provided by the embodiment of the present application.
  • the blockchain network 103 maintains a business main chain 104 and a business sub-chain 105.
  • the business main chain 104 includes a main chain node 1041
  • the business sub-chain 105 includes a sub-chain node 1051
  • a main chain node 1041 Data transmission between the sub-chain node 1051 and the sub-chain node 1051 can be achieved through a communication network.
  • the sub-chain node 1051 can obtain the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain 105, and then generate the target resource exchange block based on the resource exchange set to be processed. It is worth noting that each resource exchange in the resource exchange set to be processed includes a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different.
  • the child chain node 1051 sends verification instruction information including the target resource exchange block to the verification node, instructing the verification node to verify the correctness of the resource exchange in the target resource exchange block.
  • the verification node may be a node in the blockchain network 103 or a node outside the blockchain network 103, which is not limited in the embodiment of the present application.
  • the verification node After the verification node verifies the correctness of the target resource exchange block, it generates verification data for the target resource exchange block, and sends the verification data to the main chain node 1041 in the business main chain 104.
  • the main chain node 1041 performs validity verification on the verification data, obtains the verification result of the verification data, and then returns the verification result to the sub-chain node 1051.
  • the sub-chain node 1051 can then add the verification result to the resource exchange set to be processed. Each resource exchange will be processed accordingly.
  • the resource exchange on the business main chain can be transferred to the business sub-chain, which can alleviate the storage pressure of the business main chain and solve the problem of TPS (Transaction processing systems) of the business main chain.
  • TPS Transaction processing systems
  • This is a problem of insufficient performance indicators (performance indicators that express system processing capabilities); at the same time, because each resource exchange contains a resource exchange identifier, and each resource exchange belonging to the same object is distinguished by different resource exchange identifiers, This ensures that the resource exchange on the business sub-chain will not be processed repeatedly, avoids double spending of resource exchange, and is conducive to increasing the security of the system.
  • the main chain nodes of the business main chain and the sub-chain nodes of the business sub-chain involved in the embodiments of this application may be servers or terminals connected to the blockchain network.
  • the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, and cloud communications. , middleware services, domain name services, security services, CDN, and big data and other cloud servers based on cloud computing services.
  • the terminal can be a smart phone (such as an Android phone, iOS phone, etc.), a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this.
  • Each node can be connected directly or indirectly through wired or wireless communication methods, which is not limited in this application.
  • the blockchain network may include a business main chain and a business sub-chain.
  • the method may be composed of a business sub-chain corresponding to Sub-chain node execution, including but not limited to the following steps:
  • the sub-chain nodes in the business sub-chain can obtain the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain.
  • the resource exchange set to be processed includes multiple resources to be processed for multiple different objects.
  • Exchange in which each resource exchange includes a resource exchange identifier, and each resource exchange belonging to the same object has different resource exchange identifiers.
  • the resource exchange identifier here refers to an identifier used to indicate the generation sequence of each resource exchange belonging to the same object, and may be a specific numerical value, for example. For example, assume that in the set of resource exchanges to be processed obtained from the resource exchange pool corresponding to the business sub-chain, the resource exchanges belonging to object A include resource exchange a, resource exchange b and resource exchange c.
  • the resource exchange sequence is that resource exchange b precedes resource exchange a, and resource exchange a precedes resource exchange c. Then the resource exchange identifier corresponding to resource exchange b can be the value 1, and the resource exchange identifier corresponding to resource exchange a can be the value 2.
  • the resource exchange identifier corresponding to exchange c can be a value of 3.
  • the resource exchange identifiers of each resource exchange belonging to the same object may be a value that increases linearly based on the generation order of each resource exchange, or may be a value that increases exponentially based on the generation order of each resource exchange. It can also be a value that increases logarithmically based on the generation order of each resource exchange, and this application does not limit this.
  • the sub-chain node obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain.
  • the specific method may be to first obtain the resource exchange to be processed from the resource exchange pool corresponding to the business sub-chain.
  • the resources Each resource exchange in the exchange pool is also a resource exchange that contains the above resource exchange identifier.
  • the resource exchange identifier can represent the generation sequence of each resource exchange belonging to the same object, based on the resource exchange identifier of the resource exchange to be processed, it can be detected Whether the pending resource exchange set composed of the acquired resource exchanges contains the pending resource exchange; if the pending resource exchange set constituted by the acquired resource exchanges does not include the pending resource exchange, it means that the pending resource exchange has been If the resource exchange identifier contained in the resource exchange set to be processed formed by the obtained resource exchange is different from the resource exchange identifier of the resource exchange to be processed, the resource exchange to be processed can be added to the resource exchange set to be processed; If the resource exchange to be processed is included in the resource exchange set to be processed composed of the resource exchange that has been obtained, it means that the resource exchange identifier included in the resource exchange in the resource exchange set to be processed is composed of the resource exchange that has been obtained, exists.
  • the resource exchange to be processed is discarded, or the resource exchange to be processed is deleted from the resource exchange pool. In this way, it can be avoided that resource exchanges with the same resource exchange identifier exist in the pending resource exchange set, causing the same resource exchange to be executed repeatedly.
  • the child chain node after the child chain node obtains the resource exchange set to be processed, it can save the resource exchanges belonging to each object through a tree data structure.
  • the tree that saves the resource exchanges of each object can be called a state. Tree.
  • the state tree includes leaf nodes and roots.
  • the leaf nodes can store resource exchanges belonging to each object, and the root can store the resource exchange status data corresponding to each object.
  • the sub-chain performs each resource exchange, the corresponding changes in the state tree are For leaf nodes, after each resource exchange corresponding to each object is executed, the resource exchange status data corresponding to each object stored in the root of the status tree is updated.
  • step S402 and step S404 need to be performed respectively to ensure the authenticity of the data and enhance the security of the system.
  • the following explains the process of verification after the sub-chain node obtains the resource exchange set to be processed.
  • S402. Generate a target resource exchange block based on the resource exchange set to be processed, and send verification instruction information including the target resource exchange block to the verification node.
  • the sub-chain node can package and process the blocks corresponding to each pending resource exchange in the pending resource exchange set into a target resource exchange block, and then send a block containing the target resource exchange block to the verification node.
  • Verification instruction information to instruct the verification node to verify the correctness of the resource exchange in the target resource exchange block.
  • the verification node refers to the verification obtained
  • the purpose of verifying whether the resource exchange is correct is to ensure the completeness and correctness of the resource exchange.
  • the verification node can be a node in the blockchain network or a node outside the blockchain network. Among them, when generating the target resource When exchanging blocks, the sub-chain nodes collect the blocks containing each pending transaction resource exchange, and package the blocks based on the collected pending transaction resource exchanges to generate the above-mentioned target resource exchange block.
  • the verification node can verify the correctness of the resource exchange in the target resource exchange block.
  • the verification node verifies the resource exchange in the target resource exchange block, in order to ensure the privacy of the resource exchange, in the embodiment of this application, the verification node completes the target resource exchange without knowing the specific content of the resource exchange. Correctness verification of resource exchanges in blocks.
  • the verification node can use the zero-knowledge proof algorithm to verify the resource exchange in the target resource exchange block.
  • the characteristic of the zero-knowledge proof algorithm is that one party proves a certain assertion to the other party through zero-knowledge proof without leaking the information. The assertion contains confidential information.
  • the other party can verify the zero-knowledge proof to believe that the assertion is correct, and at the same time, it cannot obtain any confidential information. Therefore, the verification node can verify the resource exchange in the target resource exchange block based on a zero-knowledge proof algorithm, and generate verification data for the target resource exchange block.
  • the zero-knowledge proof algorithm can, for example, be zero-knowledge concise non-interactive knowledge.
  • Argument zero-knowledge succinct non-interactive argument of knowledge, zkSNARK
  • elliptic curve encryption algorithm RSA (named after three mathematicians, Rivest, Shamir, Adleman) algorithm, etc.
  • the generated verification data can be obtained based on the zero-knowledge proof algorithm.
  • a proof if the resource exchange in the target resource exchange block fails to pass the verification of the verification node based on the zero-knowledge proof algorithm, it means that there is an error in the resource exchange in the target resource exchange block, then the generated verification data can be A character or numerical value used to indicate a resource exchange error.
  • the resource exchange in the target resource exchange block may have errors in the following situations: 1 There is not enough balance in the account of the target resource exchange object to pay the transfer amount or handling fee in the pending resource exchange; 2 Target The resource exchange identifier contained in the resource exchange corresponding to the resource exchange object is incorrect; 3The resource exchange signature corresponding to the target resource exchange object is incorrect.
  • the target resource exchange object can be any object with a resource exchange error.
  • the sub-chain node can receive the verification data returned by the verification node for the target resource exchange block. If the verification data received by the sub-chain node indicates that the correctness verification of the target resource exchange block has passed, it means that the resource exchange logic in the target resource exchange block is correct and needs to be further verified by the main chain node of the business main chain.
  • This Step S404 is executed; if the verification data received by the sub-chain node indicates that the correctness verification of the target resource exchange block has not passed, it means that there is an error in the resource exchange in the target resource exchange block.
  • the target resource exchange block can be The resource exchange is determined to be an invalid resource exchange, and the resource exchange in the target resource exchange block is abandoned.
  • the sub-chain node when the verification data indicates that the target resource exchange block has passed the correctness verification, the sub-chain node can send the verification data to the main chain node corresponding to the business main chain, so that the main chain node can further verify the verification data.
  • Validity check The purpose of the main chain node's validity verification of verification data is to prevent sub-chain nodes from doing evil, such as maliciously modifying the resource exchange of an object, or maliciously not collecting the resource exchange of an object, etc. If the sub-chain node has any For malicious operations, the above verification data will fail to pass the validity check of the main chain node.
  • the process of the main chain node verifying the validity of the verification data can be seen in step S602 in the embodiment shown in Figure 6, which will not be described in detail here.
  • the sub-chain node when sending verification data to the main chain node, can also generate a key resource exchange information set based on the key resource exchange information, and also send the key resource exchange information set to the main chain node.
  • Key resource exchange information refers to the streamlined information used to describe each resource exchange in the resource exchange set to be processed. Compared with the complete resource exchange information corresponding to each resource exchange, some unnecessary data is omitted to achieve savings.
  • the purpose of storage space is because under the premise of the same storage capacity, the smaller the storage space occupied by each resource exchange, the more resource exchanges can be accommodated.
  • the complete resource exchange information included in each resource exchange may include, for example, the resource exchange transfer party (from), the resource exchange recipient (to), the resource exchange amount (amount), the handling fee (fee), the resource The exchange identifier (nonce), resource exchange signature (signature), and the corresponding format of the complete resource exchange information can be (from, to, amount, fee, nonce, signature); accordingly, the key resource exchange information included in each resource exchange is There can be only the resource exchange transfer party, the resource exchange receiver, the resource exchange amount, and the resource exchange identifier. The corresponding format of the key resource exchange information can be (from, to, amount, nonce). It can be seen that the key resource exchange information is less complete than Resource exchange information is more streamlined, which helps save storage space.
  • the key resource exchange information set can be obtained by sorting each key resource exchange information according to the resource exchange order.
  • the main chain node can determine the resource exchange of the second object based on the key resource exchange information in the key resource exchange information set.
  • Status data the second object can be any object associated with the resource exchange in the resource exchange set to be processed.
  • the object associated with the resource exchange may be the resource exchange transfer party corresponding to the resource exchange, or the resource exchange receiver.
  • the main chain node can determine that the sub-chain node is suspected of doing evil.
  • the main chain node can choose not to trust This sub-chain node and the main chain node can perform each resource exchange on their own based on the key resource exchange information set to determine the resource exchange status data of each object.
  • the key resource exchange information set is obtained by sorting the key resource exchange information according to the resource exchange sequence, it will be more convenient for the main chain node to perform each resource exchange based on the key resource exchange information set, thereby reducing the burden of the main chain node. Deal with stress.
  • S405 Receive the verification result of the verification data returned by the main chain node, and process each resource exchange in the resource exchange set to be processed accordingly according to the verification result.
  • the sub-chain node can receive the verification result returned by the main chain node, and conduct each resource exchange in the resource exchange set to be processed based on the verification result. Process accordingly.
  • each resource exchange in the pending resource exchange set can be executed to obtain the resource exchange execution result of each resource exchange. , and then update the resource exchange status data of each object to which the resource exchange belongs based on the resource exchange data and resource exchange execution results of each resource exchange.
  • the resource exchange execution result is used to indicate whether the current resource exchange is successfully executed. Because in actual applications, there may be problems with resource exchange execution failure. For example, resource exchange execution fails due to network instability. Therefore, only when the resource exchange execution result indicates that the current resource exchange execution is successful, Only when the resource exchange is successfully executed, the child chain node will update the resource exchange status data of the object to which the resource exchange belongs based on the resource exchange data of each resource exchange.
  • the recorded resource exchange status data of each object can be sent to the main chain node, so that The main chain node updates the resource exchange status data of each object it records based on the received resource exchange status data.
  • meeting the conditions for status data reporting may include any one or more of the following: 1
  • the number of resource exchanges performed in the current stage reaches the preset number; for example, the preset number is 100, then the number of resource exchanges performed reaches 100
  • the sub-chain node can send the resource exchange status data of each object to the main chain node.
  • the resource exchange in the pending resource exchange set can be terminated, that is, the execution of the resource exchange set can be given up. Resource exchange to avoid resource exchange problems and affect the security of the system.
  • Figure 5 is a schematic diagram of a blockchain-based data processing scenario provided by an embodiment of the present application.
  • the sub-chain node 501 obtains the resource exchange set to be processed from the resource exchange pool 50 corresponding to the business sub-chain.
  • Each resource exchange contains a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different.
  • the sub-chain node 501 packages the pending resource exchange set into a target resource exchange block, and then verifies Node 502 sends verification instruction information containing the target resource exchange block; (2) After verifying the target resource exchange block received by node 502, it verifies the correctness of the resource exchange in the target resource exchange block and reports it to the sub-chain. Node 501 returns to generate verification data. Verification node 502 can verify the resource exchange in the target resource exchange block based on the zero-knowledge proof algorithm. This is conducive to ensuring the privacy of the data.
  • the sub-chain node 501 can send the verification data to the main chain node 503 for further validity verification; (3) After the main chain node 503 performs validity verification on the verification data, it generates the verification data The verification result is returned to the sub-chain node 501.
  • the sub-chain node 501 can process each resource exchange in the to-be-processed set accordingly based on the verification result. If the verification result indicates that the verification data passes the validity verification When The resource exchange status data of each object to which the exchange belongs is updated.
  • the sub-chain node obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, then generates the target resource exchange block based on the resource exchange set to be processed, and then sends the target resource exchange block to the verification
  • the node performs correctness verification and receives verification data from the verification node.
  • the verification data indicates that the target resource exchange block passes the correctness verification
  • the verification data is sent to the main chain node for validity verification and receives the verification data from the main chain node. Verify the result, and finally treat it according to the verification result
  • Each resource exchange in the management resource exchange set is processed accordingly.
  • each resource exchange in the resource exchange set to be processed contains a resource exchange identifier
  • the sub-chain node can ensure that there is no duplicate resource exchange in the resource exchange set to be processed based on the resource exchange identifier, ensuring the same The resource exchange will not be executed repeatedly, avoiding the double-spending problem of resource exchange and increasing the security of the system.
  • the main chain node does not need to perform each resource exchange, but only needs to verify the verification data. When the verification passes, the sub-chain node can perform each resource exchange in the pending resource exchange set, which improves The TPS and processing performance of main chain node resource exchange also relieve the storage pressure of main chain nodes. All in all, by implementing the embodiments of this application, the system security can be ensured while expanding the main chain node capacity.
  • the blockchain network may include a business main chain and a business sub-chain.
  • the method may be composed of a business chain and a business sub-chain.
  • the main chain node corresponding to the main chain executes, including but not limited to the following steps:
  • the main chain node can receive verification data sent by the sub-chain node corresponding to the business sub-chain.
  • the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block.
  • the target resource exchange block is generated by the sub-chain node based on the resource exchange set to be processed.
  • Each resource exchange is obtained from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange contains a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different. It is worth noting that only when the verification data indicates that the target resource exchange block passes the correctness verification, the sub-chain node will send the verification data to the main chain node, otherwise it will not send it.
  • S602. Perform validity verification on the verification data to obtain verification results of the verification data.
  • the main chain node can perform validity verification on the received verification data to obtain the verification result of the verification data.
  • the verification data may include verification data corresponding to the target resource exchange block, and encrypted data obtained by encrypting the verification data using an encryption key corresponding to the verification node.
  • the verification data is data used to indicate that the target resource exchange block has passed the correctness verification, and can be a numerical value.
  • the verification node verifies the target resource exchange block based on the zero-knowledge proof algorithm
  • the school The verification data can be the proof value generated by the verification node based on the zero-knowledge proof algorithm.
  • the encryption key used to encrypt the verification data can be a symmetric key or an asymmetric key.
  • the symmetric key means that the encryption key used for encryption and the decryption key used for decryption are consistent. There is a difference between the symmetric key, that is, the encryption key used for encryption and the decryption key used for decryption.
  • the encryption algorithm used to obtain the encryption key can be a symmetric encryption algorithm, such as DES algorithm (Data Encryption Standard, Data Encryption Standard), 3DES algorithm, Blowfish algorithm (block encryption algorithm developed by Bruce Schnell), etc. etc., it can also be an asymmetric encryption algorithm, such as the knapsack algorithm, RSA algorithm, ECC (Elliptic Curve Crypto) algorithm, etc.
  • the main chain node can verify the validity of the verification data by obtaining a decryption key that matches the encryption key, and using the decryption key to decrypt the encrypted data included in the verification data to obtain the decryption data, and then determine the verification result of the verification data based on the comparison result of the verification data included in the verification data and the decrypted data.
  • the decryption key can be stored in the main chain node smart contract.
  • the main chain node uses the decryption key to decrypt the encrypted data included in the verification data, the decrypted data obtained is the same as the verification data included in the verification data, then it means The verification data passes the validity check of the main chain node; conversely, if the main chain node uses the decryption key to decrypt the encrypted data included in the verification data and the decrypted data is different from the verification data included in the verification data, it means The verification data did not pass the validity check of the main chain node.
  • the main chain node can receive the resource exchange status data of each object sent by the sub-chain node.
  • the main chain node can pair the recorded resource exchange status data based on the received resource exchange status data.
  • the resource exchange status data of each object is updated.
  • the triggering time for the sub-chain node to send the resource exchange status data of each object to the main chain node can be when the sub-chain node meets certain reporting conditions.
  • the reporting condition here can be, for example, that the sub-chain node has executed resources at the current stage. The number of exchanges reaches the preset number, or all resource exchanges in the resource exchange pool have been executed, or the preset time interval has been reached, etc.
  • the main chain node can also receive the key resource exchange information set sent by the sub-chain node and store the key resource exchange information set.
  • the main chain node can based on the key resource exchange information set.
  • the key resource exchange information of each resource exchange in the resource exchange information set is used to determine the resource exchange status data of the target object.
  • the target object can be any object associated with the resource exchange in the resource exchange set to be processed.
  • the main chain node can also store the resource exchange of each object through a tree data structure.
  • the key resource exchange information corresponding to each object can be stored in the leaf nodes of the tree.
  • the resource exchange corresponding to each object The status data is stored in the root of the tree, which can represent the resource exchange status of all objects in the current system.
  • the main chain node can directly update the root in the tree based on the received resource exchange status data of each object. In this way, the sub-chain node performs a batch of resource exchanges.
  • the corresponding main chain node can only update the resource exchange status of the root storage data, thereby improving the operating efficiency of the main chain node; when the above verification data does not pass the validity check of the main chain node, the main chain node needs to update the entire tree based on the key resource exchange information stored in the leaf nodes to ensure that each object The resource exchange status data can be updated correctly, enhancing system stability.
  • the main chain node can send the verification result to the sub-chain node, so that the sub-chain node can process each resource exchange in the set to be processed accordingly based on the verification result.
  • the process of the sub-chain node correspondingly processing each resource exchange in the set to be processed according to the verification results can be seen in the detailed description of step S405 in the embodiment shown in Figure 4, which will not be described again here.
  • the main chain node performs validity verification on the verification data sent by the received sub-chain node, obtains the verification result of the verification data, and then returns the verification result to the sub-chain node, so that the sub-chain node can The verification results are processed accordingly for each resource exchange in the resource exchange set to be processed.
  • the main chain node only needs to confirm that the verification data sent by the sub-chain node passes the verification, and can directly update the resource exchange status data of each object, which improves the TPS of the main chain node and also alleviates the main chain node's TPS. Storage pressure.
  • the blockchain-based data processing method proposed in the embodiment of this application can be applied to the business scenario of digital commodity resource exchange, and can solve the problem of slow resource exchange speed and repeated resource exchange of non-homogeneous equity certificates in the blockchain network.
  • Packaging issue may include but are not limited to the deposit of digital goods from the main chain node to the sub-chain node, the refund of digital goods from the sub-chain node to the main chain node (withdraw), and the update of object information (updataAccount).
  • digital commodity resource exchange transfer. The following takes the deposit of digital goods from the main chain node to the sub-chain node as an example.
  • Figure 7 is a schematic diagram of an application scenario of blockchain-based data processing provided by an embodiment of the present application.
  • Object A submitted a deposit resource exchange, deposit equity certificate (Token) A, quantity 10, to the main chain node.
  • Token can be understood as a tradable equity certificate in the blockchain and can be used as the basic unit of resource exchange.
  • the main chain node can send a deposit resource exchange request for object A to the sub-chain node. After receiving the resource exchange request, the sub-chain node can obtain the pending resource exchange set.
  • the pending resource exchange set includes the pending resource exchange corresponding to object A.
  • the sub-chain node packages the resource exchange set to be processed into the target resource exchange block, and sends the verification instruction information containing the target resource exchange block to the verification node.
  • the verification node can exchange the target resource block based on the zero-knowledge proof algorithm. Perform verification and generate verification data.
  • the sub-chain node can send the verification data to the main chain node, so that the main chain node can verify the validity of the verification data.
  • the sub-chain node can also The key resource exchange information set is also sent to the main chain node, so that the main chain node can determine the resource exchange status data of each object based on the key resource exchange information set. 5
  • the main chain node After the main chain node verifies the validity of the verification data, it can generate a verification result of the verification data. If the verification result indicates that the verification data passes the validity verification, the sub-chain node can perform resource exchange in the pending resource exchange set. .
  • the process of the sub-chain node executing the pending resource exchange can be seen in Figure 8.
  • the sub-chain node can manage the resource exchange belonging to each object through the tree data structure.
  • For object A Before the status update, a quantity of 10 TokenA has been stored in the leaf node.
  • After executing the pending resource exchange object A deposits TokenA, quantity 10
  • a quantity of 20 TokenA will be stored in the leaf node corresponding to object A.
  • the root will also be updated accordingly. It can be understood that the root stores the hash value of the resource exchange status data of each object.
  • the main chain node can receive the resource exchange status data of each object sent by the sub-chain node, and update the resource exchange status data recorded in the smart contract based on the received resource exchange status data of each object, such as resource exchange object A deposit
  • the state of object A in the smart contract will be changed to object A and the number of TokenA is 20.
  • the circulation speed of non-homogeneous proof of rights certificates on the main chain nodes can be improved, while ensuring that the resource exchange of sub-chain nodes will not be packaged repeatedly, enhancing the security of the system.
  • the execution carrier used to execute each step in the above method embodiment may be composed of hardware, software, or a combination of software and hardware.
  • data related to resource exchange to be processed, resource exchange data, target resource exchange objects, resource exchange status data, accounts, etc. are involved, and the data used are all authorized by the object.
  • the data used needs to be subject to permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws and standards of relevant countries and regions.
  • FIG. 9 is a schematic structural diagram of a blockchain-based data processing device provided by an embodiment of the present application.
  • the blockchain includes a main business chain and a business sub-chain.
  • the blockchain-based data processing device 900 may include:
  • the processing unit 901 is configured to obtain a resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange in the resource exchange set to be processed includes a resource exchange identifier and belongs to the resources of each resource exchange of the same object.
  • the exchange identifiers are different;
  • the processing unit 901 is also configured to generate a target resource exchange block based on the resource exchange set to be processed;
  • the communication unit 902 is configured to send verification instruction information including the target resource exchange block to the verification node, and the verification instruction information is used to instruct the verification node to verify the correctness of the resource exchange in the target resource exchange block;
  • the communication unit 902 is also used to receive verification data returned by the verification node for the target resource exchange block;
  • the communication unit 902 is also used to send the verification data to the main chain node corresponding to the business main chain, so that the main chain node can perform validity verification on the verification data; Receive the verification results of the verification data returned by the main chain node;
  • the processing unit 901 is also configured to perform corresponding processing on each resource exchange in the resource exchange set to be processed according to the verification results.
  • the processing unit 901 when the processing unit 901 obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, it is specifically used to: obtain the resource exchange to be processed from the resource exchange pool corresponding to the business sub-chain.
  • the resource exchange pool Each resource exchange in contains a resource exchange identifier; based on the resource exchange identifier of the resource exchange to be processed, it is detected whether the resource exchange to be processed is included in the resource exchange set to be processed based on the resource exchanges obtained from the resource exchange pool; if the resource exchange to be processed is If the resource exchange to be processed is not included in the resource exchange set to be processed based on the resource exchange obtained from the resource exchange pool, the resource exchange to be processed is added to the resource exchange set to be processed; if the resource exchange to be processed is included in the resource exchange set based on the resource exchange to be processed. In the pending resource exchange set composed of resource exchanges that have been acquired by the pool, the pending resource exchanges are discarded.
  • the resource exchange identification of the target resource exchange is related to the generation order of the target resource exchange in the resource exchange generated for the first object, the first object is the object to which the target resource exchange belongs, and the target resource exchange is the resource exchange pool. any resource exchange.
  • the processing unit 901 is also configured to obtain key resource exchange information for each resource exchange in the resource exchange set to be processed; and generate a key resource exchange information set based on the key resource exchange information;
  • the communication unit 902 is also used to send the key resource exchange information set to the main chain node; wherein the key resource exchange information in the key resource exchange information set is used to determine the resource exchange status data of the second object, and the second object is to be processed Any object associated with a resource exchange in the resource exchange collection.
  • the processing unit 901 when processing each resource exchange in the resource exchange set to be processed according to the verification result, is specifically configured to: when the verification result indicates that the verification data passes the validity check, execute the to-be-processed resource exchange. Process each resource exchange in the resource exchange set; update the resource exchange status data of each object to which the resource exchange belongs based on the resource exchange data and resource exchange execution results of each resource exchange.
  • the communication unit 902 is also configured to send the recorded resource exchange status data of each object to the main chain node when the status data reporting conditions are met, so that the main chain node can exchange status data based on the received resources. Update the resource exchange status data of each object recorded by it.
  • meeting the status data reporting conditions includes: the number of resource exchanges performed in the current stage reaches a preset number, or all resource exchanges in the resource exchange pool have been performed.
  • the blockchain-based data processing method described in the embodiments of this application can also be applied to the main chain node of the above-mentioned business main chain.
  • the blockchain-based data processing device 900 can include:
  • the communication unit 902 is used to receive verification data sent by the sub-chain node corresponding to the business sub-chain, where the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block, and the target resource exchange block It is generated by the sub-chain node based on the resource exchange set to be processed.
  • Each resource exchange in the resource exchange set to be processed is obtained from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange contains a resource exchange identifier and belongs to the same The resource exchange identification of each resource exchange of the object is different; the verification data is sent by the sub-chain node when the verification data indicates that the correctness of the target resource exchange block has been verified;
  • the processing unit 901 is used to verify the validity of the verification data and obtain the verification result of the verification data;
  • the communication unit 902 is also used to send the verification results to the sub-chain nodes, so that the sub-chain nodes perform corresponding processing on each resource exchange in the resource exchange set to be processed according to the verification results.
  • the verification data includes verification data corresponding to the target resource exchange block, and encrypted data obtained by encrypting the verification data using an encryption key corresponding to the verification node; the processing unit 901 performs validity on the verification data.
  • Verification when the verification result of the verification data is obtained, is specifically used to: obtain the decryption key that matches the encryption key, use the decryption key to decrypt the encrypted data included in the verification data, and obtain the decrypted data; based on the verification data including The comparison result of the verification data and the decrypted data determines the verification result of the verification data.
  • the communication unit 902 is also used to receive the key resource exchange information set sent by the sub-chain node.
  • the source exchange information set is generated based on the key resource exchange information of each resource exchange in the resource exchange set to be processed.
  • the key resource exchange information in the key resource exchange information set is used to determine the resource exchange status data of the target object.
  • the target object is Any object associated with resource exchange in the resource exchange set to be processed; the processing unit 901 is also used to store a key resource exchange information set.
  • the communication unit 902 is also configured to receive the resource exchange status data of each object recorded by the sub-chain node sent by the sub-chain node when the status data reporting conditions are met; the processing unit 901 is also configured to based on the received The resource exchange status data updates the recorded resource exchange status data of each object; among them, the conditions for meeting the status data reporting include: the number of resource exchanges executed in the current stage reaches the preset number, or all resource exchanges in the resource exchange pool have been executed .
  • the embodiment of the present application also provides a data processing device based on a blockchain.
  • the blockchain includes a main business chain and a business sub-chain.
  • the device includes:
  • the communication unit is used to receive verification data sent by the sub-chain node corresponding to the business sub-chain, wherein the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block, and the The target resource exchange block is generated by the sub-chain node based on the resource exchange set to be processed.
  • Each resource exchange in the resource exchange set to be processed is obtained from the resource exchange pool corresponding to the business sub-chain, so Each resource exchange includes a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different; the sub-chain node is sent when the verification data indicates that the correctness verification of the target resource exchange block has passed. of the verification data;
  • a processing unit performs validity verification on the verification data to obtain verification results of the verification data
  • the communication unit is configured to send the verification result to the child chain node, so that the child chain node responds to each resource exchange in the resource exchange set to be processed according to the verification result. deal with.
  • the verification data includes verification data corresponding to the target resource exchange block and encrypted data obtained by encrypting the verification data using an encryption key corresponding to the verification node;
  • a processing unit configured to obtain a decryption key that matches the encryption key, and use the decryption key to decrypt the encrypted data included in the verification data to obtain decrypted data; based on the verification included in the verification data The comparison result between the data and the decrypted data determines the verification result of the verification data.
  • the blockchain-based data processing device provided by the embodiments of the present application can be implemented in software.
  • the blockchain-based data processing device can be stored in the memory, which can be in the form of programs, plug-ins, etc. software, and includes a series of units, including a processing unit and a communication unit; wherein the processing unit and communication unit are used to implement the blockchain-based data processing method provided by the embodiments of this application.
  • the blockchain-based data processing device provided by the embodiments of the present application can also be implemented by combining software and hardware.
  • the blockchain-based data processing device provided by the embodiments of the present application can be It is a processor in the form of a hardware decoding processor, which is programmed to execute the blockchain-based data processing method provided by the embodiments of this application.
  • a processor in the form of a hardware decoding processor can use one or more applications Application Specific Integrated Circuit (ASIC, Application Specific Integrated Circuit), DSP, Programmable Logic Device (PLD, Programmable Logic Device), Complex Programmable Logic Device (CPLD, Complex Programmable Logic Device), Field Programmable Gate Array (FPGA, Field- Programmable Gate Array) or other electronic components.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processing
  • PLD Programmable Logic Device
  • CPLD Complex Programmable Logic Device
  • FPGA Field- Programmable Gate Array
  • the sub-chain node obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, then generates the target resource exchange block based on the resource exchange set to be processed, and then sends the target resource exchange block to the verification
  • the node performs correctness verification and receives verification data from the verification node.
  • the verification data indicates that the target resource exchange block passes the correctness verification
  • the verification data is sent to the main chain node for validity verification and receives the verification data from the main chain node. Verify the results, and finally process each resource exchange in the resource exchange set to be processed accordingly based on the verification results.
  • each resource exchange in the resource exchange set to be processed contains a resource exchange identifier
  • the sub-chain node can ensure that there is no duplicate resource exchange in the resource exchange set to be processed based on the resource exchange identifier, ensuring the same The resource exchange will not be executed repeatedly, avoiding the double-spending problem of resource exchange and increasing the security of the system.
  • the main chain node does not need to perform each resource exchange, but only needs to verify the verification data. When the verification passes, the sub-chain node can perform each resource exchange in the pending resource exchange set, which improves The processing performance of the main chain node also relieves the storage pressure of the main chain node. All in all, by implementing the embodiments of this application, the system security can be ensured while expanding the main chain node capacity.
  • FIG. 10 is a schematic structural diagram of a computer device 1000 provided by an embodiment of the present application.
  • the computer device may include: a communication interface 1001, a memory 1002, and a processor 1003.
  • the communication interface 1001, the memory 1002, and the processor 1003 are connected through one or more communication buses.
  • the communication buses are used to implement connection communication between these components.
  • Communication interface 1001 It can include standard wired interfaces and wireless interfaces (such as WIFI interface).
  • the memory 1002 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 1002 may also include non-volatile memory (non-volatile memory), such as flash memory (flash memory).
  • the processor 1003 may be a central processing unit (CPU).
  • the processor 1003 may further include hardware chips.
  • the above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), etc.
  • the above-mentioned PLD can be a field-programmable gate array (FPGA), a general array logic (generic array logic, GAL), etc.
  • the computer device 1000 is used to implement the blockchain-based data processing method in the previous embodiment, where the blockchain includes a main business chain and a business sub-chain.
  • the computer device may correspond to the sub-chain node of the aforementioned business sub-chain.
  • the processor 1003 performs the following operations by running the executable program code in the memory 1002:
  • Each resource exchange in the to-be-processed resource exchange set contains a resource exchange identifier, and the resource exchange identifiers of each resource exchange belonging to the same object are different; based on the to-be-processed resource exchange set, Process the resource exchange set to generate a target resource exchange block, and send verification instruction information containing the target resource exchange block to the verification node through the communication interface 1001.
  • the verification instruction information is used to instruct the verification node to correctly exchange the resources in the target resource exchange block.
  • Verification receive verification data for the target resource exchange block returned by the verification node through the communication interface 1001; when the verification data indicates that the correctness verification of the target resource exchange block has passed, the verification data is sent to the main chain node corresponding to the business main chain , so that the main chain node performs validity verification on the verification data; receives the verification result of the verification data returned by the main chain node through the communication interface 1001, and performs corresponding processing for each resource exchange in the resource exchange set to be processed based on the verification result. deal with.
  • the processor 1003 when the processor 1003 obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, it is specifically used to: obtain the resource exchange to be processed from the resource exchange pool corresponding to the business sub-chain.
  • the resource exchange pool Each resource exchange in contains a resource exchange identifier; based on the resource exchange identifier of the resource exchange to be processed, it is detected whether the resource exchange to be processed is included in the resource exchange set to be processed based on the resource exchanges obtained from the resource exchange pool; if the resource exchange to be processed is If the resource exchange to be processed is not included in the resource exchange set to be processed based on the resource exchange obtained from the resource exchange pool, the resource exchange to be processed is added to the resource exchange set to be processed; if the resource exchange to be processed is included in the resource exchange set based on the resource exchange to be processed. In the pending resource exchange set composed of resource exchanges that have been acquired by the pool, the pending resource exchanges are discarded.
  • the resource exchange identification of the target resource exchange is related to the generation order of the target resource exchange in the resource exchange generated for the first object, the first object is the object to which the target resource exchange belongs, and the target resource exchange is the resource exchange pool. any resource exchange.
  • the processor 1003 is also configured to obtain key resource exchange information for each resource exchange in the resource exchange set to be processed; generate a key resource exchange information set based on the key resource exchange information; and exchange key resources through the communication interface 1001 The information set is sent to the main chain node; wherein, the key resource exchange information in the key resource exchange information set is used to determine the resource exchange status data of the second object, and the second object is any resource exchange associated with the resource exchange set to be processed. an object.
  • the processor 1003 when processing each resource exchange in the resource exchange set to be processed according to the verification result, is specifically configured to: when the verification result indicates that the verification data passes the validity check, execute the to-be-processed resource exchange. Process each resource exchange in the resource exchange set; update the resource exchange status data of each object to which the resource exchange belongs based on the resource exchange data and resource exchange execution results of each resource exchange.
  • the processor 1003 is also configured to: when the status data reporting conditions are met through the communication interface 1001, send the recorded resource exchange status data of each object to the main chain node, so that the main chain node can base the received status data on the main chain node.
  • the resource exchange status data updates the resource exchange status data of each object recorded by it.
  • meeting the status data reporting conditions includes: the number of resource exchanges performed in the current stage reaches a preset number, or all resource exchanges in the resource exchange pool have been performed.
  • the computer device may correspond to the main chain node of the business main chain mentioned above.
  • the processor 1003 performs the following operations by running the executable program code in the memory 1002: through the communication interface 1001 receives the verification data sent by the sub-chain node corresponding to the business sub-chain.
  • the verification data is generated by the verification node after verifying the correctness of the resource exchange in the target resource exchange block.
  • the target resource exchange block is based on the sub-chain node.
  • the resource exchange set to be processed is generated.
  • Each resource exchange in the resource exchange set to be processed is obtained from the resource exchange pool corresponding to the business sub-chain.
  • Each resource exchange contains a resource exchange identifier and belongs to each resource of the same object.
  • the exchanged resource exchange identifiers are different; the verification data is sent by the sub-chain node when the verification data indicates that the target resource exchange block has passed the correctness verification; the verification data is verified for validity and the verification result of the verification data is obtained; the verification data is The result is sent to the sub-chain node, so that the sub-chain node can exchange each resource in the to-be-processed resource exchange set based on the verification result. Resource exchanges are processed accordingly.
  • the verification data includes verification data corresponding to the target resource exchange block and encrypted data obtained by encrypting the verification data using an encryption key corresponding to the verification node; the processor 1003 performs validity verification on the verification data.
  • Verification when the verification result of the verification data is obtained, it is specifically used to: obtain the decryption key that matches the encryption key, use the decryption key to decrypt the encrypted data included in the verification data, and obtain the decrypted data; based on the verification data included The comparison result of the verification data and the decrypted data determines the verification result of the verification data.
  • the processor 1003 is also configured to: receive, through the communication interface 1001, the resource exchange status data of each object recorded by the sub-chain node that is sent by the sub-chain node when the status data reporting conditions are met; based on the received resource exchange status The data updates the recorded resource exchange status data of each object; among them, the conditions for meeting the status data reporting include: the number of resource exchanges performed in the current stage reaches the preset number, or all resource exchanges in the resource exchange pool have been performed.
  • the communication interface 1001, memory 1002 and processor 1003 described in the embodiment of this application can execute the sub-chain nodes and sub-chain nodes of the business sub-chain described in the blockchain-based data processing method provided by the embodiment of this application.
  • the implementation of the main chain node of the business main chain can also be implemented as described in the blockchain-based data processing device provided in the embodiment of this application, and will not be described again here.
  • the sub-chain node obtains the resource exchange set to be processed from the resource exchange pool corresponding to the business sub-chain, then generates the target resource exchange block based on the resource exchange set to be processed, and then sends the target resource exchange block to the verification
  • the node performs correctness verification and receives verification data from the verification node.
  • the verification data indicates that the target resource exchange block passes the correctness verification
  • the verification data is sent to the main chain node for validity verification and receives the verification data from the main chain node. Verify the results, and finally process each resource exchange in the resource exchange set to be processed accordingly based on the verification results.
  • each resource exchange in the resource exchange set to be processed contains a resource exchange identifier
  • the sub-chain node can ensure that there is no duplicate resource exchange in the resource exchange set to be processed based on the resource exchange identifier, ensuring the same The resource exchange will not be executed repeatedly, avoiding the double-spending problem of resource exchange and increasing the security of the system.
  • the main chain node does not need to perform each resource exchange, but only needs to verify the verification data. When the verification passes, the sub-chain node can perform each resource exchange in the pending resource exchange set, which improves The processing performance of the main chain node also relieves the storage pressure of the main chain node. All in all, by implementing the embodiments of this application, the system security can be ensured while expanding the main chain node capacity.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • a computer program is stored in the computer-readable storage medium.
  • the computer can implement the block-based method as described in the embodiments of the present application. Chain data processing methods.
  • the specific implementation method can be referred to the previous description and will not be repeated here.
  • inventions of the present application provide a computer program product.
  • the computer program product includes a computer program or computer instructions. When executed by a processor, the computer program or computer instructions implement the blockchain-based data provided by the embodiments of the present application. Approach.
  • inventions of the present application provide a computer program.
  • the computer program includes computer instructions.
  • the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and processes the computer instructions.
  • the computer executes computer instructions, causing the computer device to execute the blockchain-based data processing method provided by the embodiments of this application.
  • the program can be stored in a computer-readable storage medium.
  • the program can be stored in a computer-readable storage medium.
  • the process may include the processes of the embodiments of each of the above methods.
  • the storage medium can be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.

Abstract

本申请提供了一种基于区块链的数据处理方法、相关装置及介质和程序产品,其中,该方法包括:从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;基于待处理资源交换集合生成目标资源交换区块,并向验证节点发送包含目标资源交换区块的验证指示信息;接收验证节点返回的针对目标资源交换区块的验证数据;将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验;接收主链节点返回的验证数据的校验结果,并根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。

Description

基于区块链的数据处理方法、相关装置及介质和程序产品
本申请要求于2022年04月28日提交中国专利局、申请号为202210458205.9名称为“基于区块链的交易处理方法、相关装置及介质和程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及基于区块链的数据处理方法、基于区块链的数据处理装置、计算机设备及计算机可读存储介质、计算机程序产品。
背景
随着区块链技术的快速发展,基于区块链网络可以实现多种数字资产的交易。在相关的区块链网络中,所有的交易都存储在一条主链区块链中,这使得主链区块链的存储压力过大,进而影响区块链网络的性能。对此,开发者们提出了各种各样的方案来尝试为区块链网络扩容,然而在对区块链网络进行扩容的过程中,可能存在交易被重复记录的问题,即同一个交易生效两次,从而导致区块链网络的安全性降低。
技术内容
本申请实施例提供一种基于区块链的数据处理方法,区块链包括业务主链和业务子链,该方法包括:
从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;
基于待处理资源交换集合生成目标资源交换区块,并向验证节点发送包含目标资源交换区块的验证指示信息,验证指示信息用于指示验证节点对目标资源交换区块中的资源交换进行正确性验证;
接收验证节点返回的针对目标资源交换区块的验证数据;
当验证数据指示目标资源交换区块正确性验证通过时,将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验;
接收主链节点返回的验证数据的校验结果,并根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
本申请实施例提供了另一种基于区块链的数据处理方法,区块链包括业务主链和业务子链,该方法包括:
接收业务子链对应的子链节点发送的验证数据,其中,验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,目标资源交换区块为子链节点基于待处理资源交换集合生成的,待处理资源交换集合中的每笔资源交换是从业务子链对应的资源交换池中获取的,每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;验证数据是子链节点在验证数据指示目标资源交换区块正确性验证通过时发送的;
对验证数据进行有效性校验,得到验证数据的校验结果;
将校验结果发送至子链节点,以使子链节点根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
本申请实施例提供了一种基于区块链的数据处理装置,区块链包括业务主链和业务子链,该装置包括:
处理单元,用于从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;
处理单元,还用于基于待处理资源交换集合生成目标资源交换区块;
通信单元,用于向验证节点发送包含目标资源交换区块的验证指示信息,验证指示信息用于指 示验证节点对目标资源交换区块中的资源交换进行正确性验证;
通信单元,还用于接收验证节点返回的针对目标资源交换区块的验证数据;
当验证数据指示目标资源交换区块正确性验证通过时,通信单元,还用于将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验;接收主链节点返回的验证数据的校验结果;
处理单元,还用于根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,处理单元从业务子链对应的资源交换池中获取待处理资源交换集合时,具体用于:从业务子链对应的资源交换池中获取待处理资源交换,资源交换池中的每笔资源交换包含资源交换标识;基于所述待处理资源交换的资源交换标识,检测所述待处理资源交换是否包含于待处理资源交换集合中,所述待处理资源交换集合由从所述资源交换池获取的资源交换构成;若所述待处理资源交换未包含于所述待处理资源交换集合中,则将所述待处理资源交换加入所述待处理资源交换集合中;若所述待处理资源交换包含于所述待处理资源交换集合中,则舍弃所述待处理资源交换。
在一个实施例中,目标资源交换的资源交换标识与目标资源交换在针对第一对象生成的资源交换中的生成顺序相关,第一对象为目标资源交换所属的对象,目标资源交换为资源交换池中的任意一笔资源交换。
在一个实施例中,处理单元,还用于获取待处理资源交换集合中的每笔资源交换的关键资源交换信息;基于关键资源交换信息生成关键资源交换信息集合;
通信单元,还用于将关键资源交换信息集合发送至主链节点;其中,关键资源交换信息集合中的关键资源交换信息用于确定第二对象的资源交换状态数据,第二对象为待处理资源交换集合中的资源交换所关联的任一对象。
在一个实施例中,处理单元在根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理时,具体用于:当校验结果指示验证数据通过有效性校验时,执行待处理资源交换集合中的每笔资源交换;根据每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。
在一个实施例中,通信单元,还用于在满足状态数据上报条件时,将记录的各个对象的资源交换状态数据发送至主链节点,以使主链节点基于接收到的资源交换状态数据对其记录的各个对象的资源交换状态数据进行更新。
在一个实施例中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
本申请实施例提供了另一种基于区块链的数据处理装置,区块链包括业务主链和业务子链,该装置包括:
通信单元,用于接收业务子链对应的子链节点发送的验证数据,其中,验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,目标资源交换区块为子链节点基于待处理资源交换集合生成的,待处理资源交换集合中的每笔资源交换是从业务子链对应的资源交换池中获取的,每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;验证数据是子链节点在验证数据指示目标资源交换区块正确性验证通过时发送的;
处理单元,用于对验证数据进行有效性校验,得到验证数据的校验结果;
通信单元,还用于将校验结果发送至子链节点,以使子链节点根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,验证数据包括目标资源交换区块对应的校验数据、利用验证节点对应的加密密钥对校验数据进行加密处理得到的加密数据;处理单元对验证数据进行有效性校验,得到验证数据的校验结果时,具体用于:获取与加密密钥相匹配的解密密钥,利用解密密钥对验证数据包括的加密数据进行解密,得到解密数据;基于验证数据包括的校验数据和解密数据的比较结果,确定验证数据的校验结果。
在一个实施例中,通信单元,还用于接收子链节点发送的关键资源交换信息集合,关键资源交换信息集合是基于待处理资源交换集合中的每笔资源交换的关键资源交换信息生成的,关键资源交换信息集合中的关键资源交换信息用于确定目标对象的资源交换状态数据,目标对象为待处理资源交换集合中的资源交换所关联的任一对象;处理单元,还用于存储关键资源交换信息集合。
在一个实施例中,通信单元,还用于接收子链节点在满足状态数据上报条件时发送的子链节点记录的各个对象的资源交换状态数据;处理单元,还用于基于接收到的资源交换状态数据对记录的 各个对象的资源交换状态数据进行更新;其中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
本申请实施例提供了一种计算机设备,包括:处理器、通信接口和存储器,上述处理器、上述通信接口和上述存储器相互连接,其中,上述存储器存储有可执行程序代码,上述处理器用于调用所述可执行程序代码,实现本申请实施例提供的基于区块链的数据处理方法。
相应地,本申请实施例还提供了一种计算机可读存储介质,包括:该计算机读存储介质中存储有计算机程序,该计算机程序被处理器执行时,实现本申请实施例提供的基于区块链的数据处理方法。
相应地,本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机程序或计算机指令,该计算机程序或计算机指令被处理器执行时实现本申请实施例提供的基于区块链的数据处理方法。
相应地,本申请实施例提供了一种计算机程序,该计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中,计算机设备的处理器从计算机可读存储介质读取计算机指令,处理器执行计算机指令,使得计算机设备执行本申请实施例提供的基于区块链的数据处理方法。
附图说明
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术对象来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种区块链的结构示意图;
图2是本申请实施例提供的一种区块链网络的网络架构示意图;
图3是本申请实施例提供的一种基于区块链的数据处理系统的架构图;
图4是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;
图5是本申请实施例提供的一种基于区块链的数据处理的场景示意图;
图6是本申请实施例提供的另一种基于区块链的数据处理方法的流程示意图;
图7是本申请实施例提供的一种基于区块链的数据处理的应用场景示意图;
图8是本申请实施例提供的一种子链节点更新数据状态数据的示意图;
图9是本申请实施例提供的一种基于区块链的数据处理装置的结构示意图;
图10是本申请实施例提供的一种计算机设备的结构示意图。
实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术对象在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为了更好地理解本申请实施例的方案,下面先对本申请实施例可能涉及的一些基本概念进行介绍。
(1)区块链:区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。它本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。狭义来讲,区块链是一种按照时间顺序将数据区块以顺序相连的方式组合成的一种链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本,广义来讲,区块链技术是利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算方式。
(2)智能合约:计算机化的协议,可以执行某个合约的条款,通过部署在共享账本上的用于在满足一定条件时而执行的代码实现,根据实际的业务需求代码用于完成自动化的交易(也叫“资源交换”),例如查询买家所购买商品的物流状态,在买家签收货物后将买家的数字资产转移到商户 的地址;当然,智能合约不仅限于执行用于交易的合约,还可以执行对接收的信息进行处理的合约。
(3)非同质化权益证明凭证:是在区块链技术基础上衍生出一种的内含若干规则与信息的具有不可复制、不可分割的唯一性数字加密权益证明,用来表明某个数字物品的权益归属。
本申请实施例提供了一种基于区块链的数据处理方法、相关装置及介质和程序产品,可以缓解区块链网络中主链节点的存储压力,同时有效避免相同资源交换被重复执行,解决资源交换双花问题。其中,双花又叫双重支出,是指同一资源同时支付给两个接收者。
请参见图1,是本申请实施例提供的一种区块链结构示意图。
如图1所示,区块链101由多个区块组成,区块链的第一个区块称为创世区块(可简称为创世快),创世块中包括区块头和区块体,区块头中存储有输入信息特征值、版本号、时间戳和难度值,区块体中存储有输入信息;创世块的下一区块以创世块为父区块,下一区块中同样包括区块头和区块体,区块头中存储有当前区块的输入信息特征值、父区块的区块头特征值、版本号、时间戳和难度值,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中输入信息的安全性。
进一步的,区块链网络可以由各个区块链节点进行维护,可以将区块链网络理解为一个用于区块链节点与区块链节点之间进行数据共享的数据共享系统,该数据共享系统的一种示例性结构可参见图2;图2所示,数据共享系统中可包括多个区块链节点102,各个区块链节点102可以为接入至该区块链网络中的服务器,也可以为接入至该区块链网络中的终端设备(如客户端),这里对区块链节点102的具体形式不做限定。对于区块链网络中的每个区块链节点102,均具有与其对应的节点标识,而且区块链网络中的每个区块链节点102均可以存储有区块链网络中其它区块链节点102的节点标识,以便后续根据其它区块链节点102的节点标识,将生成的区块广播至数据共享系统中的其它区块链节点102。每个区块链节点102中可维护一个节点标识列表,将节点名称和节点标识对应存储至节点标识列表中;其中,节点标识列表可参见表1:
表1
如表1所示,节点标识可为IP(Internet Protocol,网络之间互联的协议)地址以及其它任一种能够用于标识该节点的信息;例如,节点标识还可以是二进制序列码(如110001110),表1中仅以IP地址为例进行说明。当区块链网络中产生待验证区块时,区块链网络中运行共识机制的区块链节点(或称为共识节点)对该待验证区块进行共识,并在共识成功后通过节点标识列表中的节点标识,将该待验证区块同步至区块链网络中的各个区块链节点,实现在区块链网络中对数据的分布式存储。
基于上述描述,本申请实施例提供了基于区块链的数据处理方法所适用的基于区块链的数据处理系统,请参见图3,为本申请实施例提供的一种基于区块链的数据处理系统的架构图。如图3所示,区块链网络103中维护有业务主链104和业务子链105,业务主链104中包括主链节点1041,业务子链105中包括子链节点1051,主链节点1041与子链节点1051之间可以通过通信网络实现彼此之间的数据传输。
在本申请实施例中,子链节点1051可以从业务子链105对应的资源交换池中获取待处理资源交换集合,然后基于待处理资源交换集合生成目标资源交换区块。值得注意的是,待处理资源交换集合中的每笔资源交换都包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不相同。接着,子链节点1051向验证节点发送包含目标资源交换区块的验证指示信息,指示验证节点对该目标资源交换区块中的资源交换进行正确性验证。这里,验证节点可以是区块链网络103中的节点,也可以是区块链网络103之外的节点,本申请实施例对此不做限制。验证节点对目标资源交换区块进行正确性验证后,生成针对该目标资源交换区块的验证数据,并将该验证数据发送至业务主链104中的主链节点1041。主链节点1041对验证数据进行有效性校验,得到该验证数据的校验结果,再将该校验结果返回子链节点1051,子链节点1051便可以根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。通过这种方式,可以将业务主链上的资源交换转移到业务子链上,缓解业务主链的存储压力,解决业务主链TPS(Transaction processing systems,每秒事务处 理量,是一种表达系统处理能力的性能指标)不足的问题;同时,由于每笔资源交换都包含有资源交换标识,且属于同一对象的各笔资源交换的用不同资源交换标识来区分,如此保证了业务子链上的资源交换不会被重复处理,避免出现资源交换双花,有利于增加系统的安全性。
需要说明的是,本申请实施例中所涉及业务主链的主链节点和业务子链的子链节点可以是接入区块链网络中的服务器或者终端。其中,服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据等基于云计算服务的云服务器。终端可以是智能手机(如Android手机、iOS手机等)、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。各个节点之间可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。
下面结合附图对本申请实施例提供的基于区块链的数据处理方法进行详细说明。
请参见图4,是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图,该区块链网络可以包括业务主链和业务子链,该方法可以由业务子链对应的子链节点执行,包括但不限于以下步骤:
S401、从业务子链对应的资源交换池中获取待处理资源交换集合。
在本申请实施例中,业务子链中的子链节点可以从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中包括多个不同对象的多笔待处理资源交换,其中,每笔资源交换都包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同。这里的资源交换标识是指用以表示属于同一对象的各笔资源交换的生成顺序的一种标识,例如可以是一个具体的数值。举例来说,假设从业务子链对应的资源交换池中获取到的待处理资源交换集合中,属于对象A的资源交换有资源交换a、资源交换b以及资源交换c,若三笔资源交换的资源交换顺序为资源交换b先于资源交换a,资源交换a先于资源交换c,则资源交换b对应的资源交换标识可以为数值1,资源交换a对应的资源交换标识可以为数值2,资源交换c对应的资源交换标识可以为数值3。在一种实现方式中,属于同一对象的各笔资源交换的资源交换标识可以是基于各笔资源交换的生成顺序线性增长的数值,也可以是基于各笔资源交换的生成顺序指数增长的数值,还可以为是基于各笔资源交换的生成顺序对数增长的数值,本申请对此不做限制。
在一个实施例中,子链节点从业务子链对应的资源交换池中获取待处理资源交换集合的方式具体可以是,先从业务子链对应的资源交换池中获取待处理资源交换,这里资源交换池中的每笔资源交换也是包含上述资源交换标识的资源交换,由于该资源交换标识可以表示属于同一对象的各笔资源交换的生成顺序,基于待处理资源交换的资源交换标识,则可以检测已经获取到的资源交换所构成的待处理资源交换集合中是否包含该待处理资源交换;若已经获取到的资源交换所构成的待处理资源交换集合中未包含该待处理资源交换,即表明已经获取到的资源交换所构成的待处理资源交换集合中的资源交换包含的资源交换标识,与待处理资源交换的资源交换标识不相同,则可以将待处理资源交换加入待处理资源交换集合中;若已经获取到的资源交换所构成的待处理资源交换集合中包含该待处理资源交换,即表明已经获取到的资源交换所构成的待处理资源交换集合中的资源交换包含的资源交换标识,存在与待处理资源交换的资源交换标识相同的,则将该待处理资源交换舍弃,或者,将该待处理资源交换从资源交换池中删除。通过这种方式,可以避免待处理资源交换集合中存在资源交换标识相同的资源交换,导致相同的资源交换被重复执行。
在一种可能实现的方式中,子链节点获取到待处理资源交换集合后,可以通过树形数据结构来保存属于各个对象的资源交换,保存有各个对象的资源交换的树可以称之为状态树。其中,状态树包括叶子节点和根,叶子节点可以存储属于各个对象的资源交换,根可以存储各个对象对应的资源交换状态数据,当子链执行各笔资源交换时,则对应修改状态树中的叶子节点,各个对象对应的各笔资源交换执行完成后则更新状态树中的根存储的各个对象对应的资源交换状态数据。需要说明的是,在对各个对象对应的资源交换状态数据进行更新之前,还需要分别执行步骤S402和步骤S404描述的两方面的验证,以此确保数据真实性,增强系统的安全性。下面对子链节点获取到待处理资源交换集合之后如何进行验证的过程加以说明。
S402、基于待处理资源交换集合生成目标资源交换区块,并向验证节点发送包含目标资源交换区块的验证指示信息。
在本申请实施例中,子链节点可以将待处理资源交换集合中各待处理资源交换对应的区块打包处理为目标资源交换区块,然后再向验证节点发送包含该目标资源交换区块的验证指示信息,以指示验证节点对目标资源交换区块中的资源交换进行正确性验证。其中,验证节点是指验证获取到的 资源交换是否正确的节点,目的是保证资源交换的完备性和正确性,该验证节点可以是区块链网络中的节点,也可以是区块链网络之外的节点,其中,在生成目标资源交换区块时,子链节点收集包含各笔待处理交易资源交换的区块,并将根据收集的待处理交易资源交换的区块进行打包处理,生成上述目标资源交换区块。
在一个实施例中,子链节点向验证节点发送包含目标资源交换区块的验证指示信息之后,验证节点可以对目标资源交换区块中的资源交换进行正确性验证。当验证节点对目标资源交换区块中的资源交换进行验证时,为了确保资源交换的私密性,本申请实施例中,在验证节点不知道资源交换的具体内容的情况下,完成对目标资源交换区块中的资源交换的正确性验证。为了实现上述目的,验证节点可以采用零知识证明算法对目标资源交换区块中的资源交换进行验证,零知识证明算法的特点是一方通过零知识证明向另一方证明某个论断,同时不泄露该论断包含的保密信息,另一方可以通过验证零知识证明相信论断的正确性,同时也无法获取任何保密信息。因此,验证节点可以基于零知识证明算法对目标资源交换区块中的资源交换进行验证,并生成该目标资源交换区块的验证数据,该零知识证明算法例如可以是零知识简洁非交互式知识论证(zero-knowledge succinct non-interactive argument of knowledge,zkSNARK),椭圆曲线加密算法,RSA(以Rivest、Shamir、Adleman三位数学家的名字命名)算法等等。通过验证节点对目标资源交换区块中的资源交换进行正确性验证,可以确保每笔资源交换的资源交换逻辑正确,增强系统的稳定性。
具体的,若目标资源交换区块中的资源交换通过验证节点基于零知识证明算法的验证,即表明目标资源交换区块中的资源交换正确,则生成的验证数据可以是基于零知识证明算法得到的一个证明(proof);若目标资源交换区块中的资源交换未通过验证节点基于零知识证明算法的验证,即表明目标资源交换区块中的资源交换存在错误,则生成的验证数据可以是用于指示资源交换错误的字符或者是数值。其中,目标资源交换区块中的资源交换存在错误的情况可以是以下几种:①目标资源交换对象的账户中没有足够的余额支付待处理资源交换中的转账金额,或者是手续费;②目标资源交换对象对应的资源交换中包含的资源交换标识不正确;③目标资源交换对象对应的资源交换签名不正确。这里,目标资源交换对象可以是存在资源交换错误的任意一个对象。
S403、接收验证节点返回的针对目标资源交换区块的验证数据。
在本申请实施例中,验证节点完成对目标资源交换区块中的资源交换的正确性验证之后,子链节点可以接收验证节点返回的针对目标资源交换区块的验证数据。若子链节点接收到的验证数据指示目标资源交换区块正确性验证通过,即表明目标资源交换区块中的资源交换逻辑正确,需要进一步由业务主链的主链节点进行有效性校验,此时执行步骤S404;若子链节点接收到的验证数据指示目标资源交换区块正确性验证未通过,即表明目标资源交换区块中的资源交换存在错误,此时可以将目标资源交换区块中的资源交换确定为无效资源交换,放弃执行该目标资源交换区块中的资源交换。
S404、当验证数据指示目标资源交换区块正确性验证通过时,将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验。
在本申请实施例中,当验证数据指示目标资源交换区块正确性验证通过时,子链节点可以将验证数据发送至业务主链对应的主链节点,以使主链节点进一步对验证数据进行有效性校验。主链节点对验证数据的有效性校验,目的是防止子链节点作恶,例如恶意修改某个对象的资源交换,或者是恶意不搜集某个对象的资源交换等等,如果子链节点有任何作恶操作,上述验证数据将无法通过主链节点的有效性校验。主链节点对验证数据进行有效性校验的过程可见图6所示实施例中的步骤S602,在此先不做赘述。
在一个实施例中,子链节点在发送验证数据至主链节点时,还可以基于关键资源交换信息生成关键资源交换信息集合,并将该关键资源交换信息集合也发送至主链节点。关键资源交换信息是指用于描述待处理资源交换集合中的每笔资源交换的精简信息,相较于每笔资源交换对应的完整资源交换信息,省去了一些非必要的数据,以达到节省存储空间的目的,这是因为在相同存储容量的前提下,每笔资源交换所占存储空间越小,能容纳的资源交换数量也就越多。在一些实施例中,每笔资源交换所包含的完整资源交换信息例如可以有资源交换转账方(from),资源交换接收方(to),资源交换量(amount),手续费(fee),资源交换标识(nonce),资源交换签名(signature),完整资源交换信息对应的格式可以是(from,to,amount,fee,nonce,signature);相应地,每笔资源交换所包含关键资源交换信息则可以只有资源交换转账方,资源交换接收方,资源交换量,资源交换标识,关键资源交换信息对应的格式可以是(from,to,amount,nonce),由此可见关键资源交换信息相较于完整资源交换信息更加精简,有利于节省存储空间。
进一步的,关键资源交换信息集合可以是将各个关键资源交换信息按照资源交换顺序进行排序后得到的,主链节点根据关键资源交换信息集合中的关键资源交换信息,可以确定第二对象的资源交换状态数据,该第二对象可以是待处理资源交换集合中的资源交换所关联的任意一个对象。其中,资源交换关联的对象可以是该笔资源交换对应的资源交换转账方,也可以是资源交换接收方。在一种可能的实现方式中,当子链节点发送至主链节点的验证数据未通过有效性校验时,主链节点可以判断子链节点有作恶嫌疑,此时主链节点可以选择不信任此子链节点,主链节点基于关键资源交换信息集合可以自行执行各笔资源交换,以确定各个对象的资源交换状态数据。同时,由于关键资源交换信息集合是关键资源交换信息按照资源交换顺序排序后得到的,主链节点在基于关键资源交换信息集合执行各笔资源交换时也会更加便捷,以此减少主链节点的处理压力。
S405、接收主链节点返回的验证数据的校验结果,并根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在本申请实施例中,主链节点对验证数据进行有效性校验之后,子链节点可以接收主链节点返回的校验结果,并根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,当子链节点接收到的校验结果指示验证数据通过有效性校验时,可以执行待处理资源交换集合中的每笔资源交换,得到每笔资源交换的资源交换执行结果,然后再根据每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。其中,资源交换执行结果用于指示当前资源交换是否执行成功,因为实际应用中,可能会存在资源交换执行失败的问题,例如网络不稳定导致资源交换执行失败,所以只有在资源交换执行结果指示当前资源交换执行成功的情况下,子链节点才会根据每笔资源交换的资源交换数据更新资源交换所属对象的资源交换状态数据。
在一个实施例中,子链节点更新各笔资源交换所属对象的资源交换状态数据之后,在满足状态数据上报条件时,可以将记录的各个对象的资源交换状态数据发送至主链节点,以使主链节点基于接收到的资源交换状态数据对其记录的各个对象的资源交换状态数据进行更新。其中,满足状态数据上报条件可以包括以下任意一项或多项:①当前阶段已执行资源交换的数量达到预设数量;例如预设数量为100笔,则已执行资源交换的数量达到100笔时,子链节点便可以将各个对象的资源交换状态数据发送至主链节点。②资源交换池中的资源交换已全部执行;若资源交换池中的资源交换都已执行,当前已无待处理资源交换,此时子链节点也可以将各个对象的资源交换状态数据发送至主链节点。③当前时间间隔达到预设时间间隔;例如预设时间间隔为10分钟,则子链节点可以每间隔10分钟向主链节点发送一次各个对象的资源交换状态数据,以便于主链节点可以及时对其记录的各个对象的资源交换状态数据进行更新。
在另一个实施例中,当子链节点接收到的校验结果指示验证数据未通过有效性校验时,则可以终止待处理资源交换集合中的资源交换,也即放弃执行处理资源交换集合中的资源交换,避免出现资源交换问题,影响系统的安全性。
为了便于理解,请参见图5,图5是本申请实施例提供的一种基于区块链的数据处理的场景示意图。如图5所示,整个数据处理过程可以概括为三个部分:(1)子链节点501从业务子链对应的资源交换池50中获取待处理资源交换集合,这里,待处理资源交换集合中的每笔资源交换都包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不相同,然后子链节点501将待处理资源交换集合打包处理为目标资源交换区块,再向验证节点502发送包含该目标资源交换区块的验证指示信息;(2)验证节点502接收到的目标资源交换区块后,对目标资源交换区块中的资源交换进行正确性验证,并向子链节点501返回生成验证数据,验证节点502可以是基于零知识证明算法对目标资源交换区块中的资源交换进行验证,如此有利于保障数据的私密性,若目标资源交换区块中的资源交换通过验证节点的正确性验证,则子链节点501可以将验证数据发送至主链节点503进一步进行有效性校验;(3)主链节点503对验证数据进行有效性校验后,生成针对验证数据的校验结果,并向子链节点501返回校验结果,子链节点501根据校验结果可以对待处理集合中的每笔资源交换进行相应处理,若校验结果指示验证数据通过有效性校验时,子链节点501便可以执行待处理资源交换集中的每笔资源交换,到每笔资源交换的资源交换执行结果,然后再根据每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。
本申请实施例通过子链节点从业务子链对应的资源交换池中获取待处理资源交换集合,然后基于待处理资源交换集合生成目标资源交换区块,再将该目标资源交换区块发送至验证节点进行正确性验证,并接收验证节点的验证数据,当验证数据指示目标资源交换区块通过正确性验证时,将该验证数据发送至主链节点进行有效性校验,并接收主链节点的校验结果,最后根据校验结果对待处 理资源交换集合中的每笔资源交换进行相应处理。通过这种方式,一方面,由于待处理资源交换集合中的每笔资源交换都包含资源交换标识,子链节点可以根据资源交换标识保证待处理资源交换集合中不存在重复资源交换,确保了相同的资源交换不会被重复执行,避免了资源交换双花问题,增加了系统的安全性。另一方面,主链节点不需要执行每笔资源交换,只需要对验证数据进行校验,在校验通过时,可以由子链节点执行待处理资源交换集合中的每笔资源交换,如此提升了主链节点资源交换的TPS和处理性能,也缓解了主链节点的存储压力。总而言之,通过实施本申请实施例,可以在实现对主链节点进行扩容的同时保证系统安全性。
进一步的,请参见图6,是本申请实施例提供的另一种基于区块链的数据处理方法的流程示意图,该区块链网络可以包括业务主链和业务子链,该方法可以由业务主链对应的主链节点执行,包括但不限于以下步骤:
S601、接收业务子链对应的子链节点发送的验证数据。
在本申请实施例中,主链节点可以接收业务子链对应的子链节点发送的验证数据。其中,验证数据是验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,目标资源交换区块是子链节点基于待处理资源交换集合生成的,待处理资源交换集合中的每笔资源交换是从业务子链对应的资源交换池中获取的,每笔资源交换都包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不相同。值得注意的是,只有当验证数据指示目标资源交换区块通过正确性验证时,子链节点才会向主链节点发送该验证数据,反之,则不发送。
S602、对验证数据进行有效性校验,得到验证数据的校验结果。
在本申请实施例中,主链节点可以对接收到的验证数据进行有效性校验,得到验证数据的校验结果。其中,验证数据可以包括目标资源交换区块对应的校验数据,以及利用验证节点对应的加密密钥对校验数据进行加密处理得到的加密数据。这里,校验数据是用于指示目标资源交换区块通过正确性验证的数据,可以是一个数值,举例来说,当验证节点基于零知识证明算法对目标资源交换区块进行验证时,该校验数据便可以是验证节点基于零知识证明算法生成的proof的值。此外,对校验数据进行加密处理的加密密钥可以是对称密钥,也可以是非对称密钥,对称密钥即用于加密的加密密钥和用于解密的解密密钥是一致的,非对称密钥即用于加密的加密密钥和用于解密的解密密钥是存在区别的。相应地,获取加密密钥的加密算法可以是对称加密算法,例如,DES算法(Data Encryption Standard,数据加密标准),3DES算法,Blowfish算法(由布鲁斯·施奈尔开发的区块加密算法)等等,还可以是非对称加密算法,例如,背包算法、RSA算法、ECC(椭圆曲线加密)算法等等。
在一个实施例中,主链节点对验证数据进行有效性校验的方式可以是,获取与加密密钥相匹配的解密密钥,利用解密密钥对验证数据包括的加密数据进行解密,得到解密数据,然后再基于验证数据包括的校验数据和解密数据的比较结果,确定验证数据的校验结果。具体的,解密密钥可以存储在主链节点智能合约中,若主链节点利用解密密钥对验证数据包括的加密数据进行解密得到的解密数据,与验证数据包括的校验数据相同,则表明验证数据通过了主链节点的有效性校验;反之,若主链节点利用解密密钥对验证数据包括的加密数据进行解密得到的解密数据,与验证数据包括的校验数据不相同,则表明验证数据未通过主链节点的有效性校验。
在一个实施例中,主链节点可以接收子链节点发送的各个对象的资源交换状态数据,当上述验证数据通过有效性校验时,主链节点可以基于接收到的资源交换状态数据对记录的各个对象的资源交换状态数据进行更新。需要说明的是,子链节点向主链节点发送各个对象的资源交换状态数据的触发时机可以是在子链节点满足一定上报条件时,这里的上报条件例如可以是当前阶段子链节点已执行资源交换的数量达到预设数量,或者是资源交换池中的资源交换已经全部执行,又或者是达到预设时间间隔等等。
在一个实施例中,主链节点还可以接收子链节点发送的关键资源交换信息集合,并存储该关键资源交换信息集合,当上述验证数据未通过有效性校验时,主链节点可以基于关键资源交换信息集合中的每笔资源交换的关键资源交换信息来确定目标对象的资源交换状态数据,目标对象可以是待处理资源交换集合中的资源交换所关联的任一对象。
在一种可能的实现方式中,主链节点也可以通过树形数据结构来保存各个对象的资源交换,各个对象对应的关键资源交换信息可以保存在树的叶子节点中,各个对象对应的资源交换状态数据则保存在树的根中,这个根可以代表当前系统中所有对象的资源交换状态。相应地,当上述验证数据通过主链节点的有效性校验时,主链节点可以根据接收到的各个对象的资源交换状态数据直接更新树中的根,如此,子链节点执行一批资源交换,对应主链节点可以只需更新根存储的资源交换状态 数据,从而提高主链节点的运行效率;当上述验证数据未通过主链节点的有效性校验时,则需要主链节点根据叶子节点中存储的关键资源交换信息更新整个树,以确保各个对象的资源交换状态数据可以被正确更新,增强系统稳定性。
S603、将校验结果发送至子链节点,以使子链节点根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在本申请实施例中,主链节点可以将校验结果发送至子链节点,以使子链节点根据该校验结果对待处理集合中的每笔资源交换进行相应处理。子链节点根据校验结果对待处理集合中的每笔资源交换进行相应处理的过程,可见图4所示实施例中步骤S405的详细描述,在此不再赘述。
本申请实施例中主链节点通过对接收到的子链节点发送的验证数据进行有效性验证,得到验证数据的校验结果,再将校验结果返回至子链节点,使子链节点可以根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。通过这种方式,主链节点只需确认子链节点发送的验证数据通过校验,即可直接更新各个对象的资源交换状态数据,提升了主链节点的TPS,同时也缓解了主链节点的存储压力。
前文详细描述了本申请实施例提出的基于区块链的数据处理方法,为了便于理解本方案,下文将从具体应用场景的角度对本申请进一步阐述。
本申请实施例提出的基于区块链的数据处理方法可以应用于数字商品资源交换的业务场景中,可以解决非同质化权益证明凭证在区块链网络中资源交换速度慢,资源交换被重复打包的问题。具体的,本申请实施例的应用场景可以包括但不限于数字商品从主链节点到子链节点的存款,子链节点的数字商品退款到主链节点(withdraw),更新对象信息(updataAccount),数字商品资源交换(transfer)。下面以数字商品从主链节点到子链节点的存款为例进行说明。
请参见图7,是本申请实施例提供的一种基于区块链的数据处理的应用场景示意图。如图7所示,①对象A向主链节点提交了一项存款资源交换,存款权益证明凭证(Token)A,数量10。其中,Token可以理解为区块链中可流通的权益证明凭证,可作为资源交换的基本单位。②主链节点可以向子链节点发送对象A的存款资源交换请求,子链节点接收资源交换请求后可以获取待处理资源交换集合,该待处理资源交换集合中包括对象A对应的待处理资源交换(对象A存款Token A,数量10),并记录对象A对应的该笔待处理资源交换的资源交换标识,例如资源交换标识可以为1,相应地,当对象A再次发送下一笔待处理资源交换时,则资源交换标识将为2,如此可以防止资源交换被重复执行。③子链节点将待处理资源交换集合打包处理为目标资源交换区块,并将包含目标资源交换区块的验证指示信息发送至验证节点,验证节点可以基于零知识证明算法对目标资源交换区块进行验证,生成验证数据。④当验证数据指示目标资源交换区块正确性验证通过时,子链节点可以将验证数据发送至主链节点,使主链节点对验证数据进行有效性校验,此外,子链节点还可以将关键资源交换信息集合也发送至主链节点,使主链节点可以根据关键资源交换信息集合确定各个对象的资源交换状态数据。⑤主链节点对验证数据进行有效性验证之后,可以生成验证数据的校验结果,若校验结果指示验证数据通过有效性校验,则子链节点可以执行待处理资源交换集合中的资源交换。子链节点执行待处理资源交换(对象A存款TokenA,数量10)的过程可见图8,如图8所示,子链节点可以通过树形数据结构管理属于各个对象的资源交换,针对对象A,状态更新之前叶子节点中已存储数量10的TokenA,执行待处理资源交换(对象A存款TokenA,数量10)后,对象A对应的叶子节点中将存储数量20的TokenA,同时,树形数据结构中的根也会随之更新,可以理解的是,根存储的是各个对象的资源交换状态数据的哈希值。⑥主链节点可以接收子链节点发送的各个对象的资源交换状态数据,并根据接收到的各个对象的资源交换状态数据对智能合约中记录的资源交换状态数据进行更新,如资源交换对象A存款数量10的TokenA后,得到数量20的TokenA,则对应将智能合约中对象A的状态变更为对象A,TokenA的数量20。通过这种方式,可以提升非同质化权益证明凭证在主链节点上的流通速度,同时保证子链节点的资源交换不会被重复打包,增强系统的安全性。
另外,需要说明的是,用于执行上述方法实施例中各步骤的执行载体可以是由硬件构成,也可以是由软件构成,还可以是由软硬件结合构成。在本申请的具体实施方式中,涉及到待处理资源交换、资源交换数据、目标资源交换对象、资源交换状态数据、账户等相关的数据,所涉及使用到的数据均是经过对象授权的。当本申请以上实施例运用到具体产品或技术中时,所涉及使用到的数据需要获得对象许可或者同意,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法规和标准。
进一步的,请参见图9,为本申请实施例提供的一种基于区块链的数据处理装置的结构示意图。 其中,区块链包括业务主链和业务子链,该基于区块链的数据处理装置900可以包括:
处理单元901,用于从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;
处理单元901,还用于基于待处理资源交换集合生成目标资源交换区块;
通信单元902,用于向验证节点发送包含目标资源交换区块的验证指示信息,验证指示信息用于指示验证节点对目标资源交换区块中的资源交换进行正确性验证;
通信单元902,还用于接收验证节点返回的针对目标资源交换区块的验证数据;
当验证数据指示目标资源交换区块正确性验证通过时,通信单元902,还用于将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验;接收主链节点返回的验证数据的校验结果;
处理单元901,还用于根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,处理单元901从业务子链对应的资源交换池中获取待处理资源交换集合时,具体用于:从业务子链对应的资源交换池中获取待处理资源交换,资源交换池中的每笔资源交换包含资源交换标识;基于待处理资源交换的资源交换标识,检测待处理资源交换是否包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中;若待处理资源交换未包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中,则将待处理资源交换加入待处理资源交换集合中;若待处理资源交换包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中,则舍弃待处理资源交换。
在一个实施例中,目标资源交换的资源交换标识与目标资源交换在针对第一对象生成的资源交换中的生成顺序相关,第一对象为目标资源交换所属的对象,目标资源交换为资源交换池中的任意一笔资源交换。
在一个实施例中,处理单元901,还用于获取待处理资源交换集合中的每笔资源交换的关键资源交换信息;基于关键资源交换信息生成关键资源交换信息集合;
通信单元902,还用于将关键资源交换信息集合发送至主链节点;其中,关键资源交换信息集合中的关键资源交换信息用于确定第二对象的资源交换状态数据,第二对象为待处理资源交换集合中的资源交换所关联的任一对象。
在一个实施例中,处理单元901在根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理时,具体用于:当校验结果指示验证数据通过有效性校验时,执行待处理资源交换集合中的每笔资源交换;根据每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。
在一个实施例中,通信单元902,还用于在满足状态数据上报条件时,将记录的各个对象的资源交换状态数据发送至主链节点,以使主链节点基于接收到的资源交换状态数据对其记录的各个对象的资源交换状态数据进行更新。
在一个实施例中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
在其他可行的实施例中,本申请实施例中所描述的基于区块链的数据处理方法还可以应用于上述业务主链的主链节点,该基于区块链的数据处理装置900可以包括:
通信单元902,用于接收业务子链对应的子链节点发送的验证数据,其中,验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,目标资源交换区块为子链节点基于待处理资源交换集合生成的,待处理资源交换集合中的每笔资源交换是从业务子链对应的资源交换池中获取的,每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;验证数据是子链节点在验证数据指示目标资源交换区块正确性验证通过时发送的;
处理单元901,用于对验证数据进行有效性校验,得到验证数据的校验结果;
通信单元902,还用于将校验结果发送至子链节点,以使子链节点根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,验证数据包括目标资源交换区块对应的校验数据、利用验证节点对应的加密密钥对校验数据进行加密处理得到的加密数据;处理单元901在对验证数据进行有效性校验,得到验证数据的校验结果时,具体用于:获取与加密密钥相匹配的解密密钥,利用解密密钥对验证数据包括的加密数据进行解密,得到解密数据;基于验证数据包括的校验数据和解密数据的比较结果,确定验证数据的校验结果。
在一个实施例中,通信单元902,还用于接收子链节点发送的关键资源交换信息集合,关键资 源交换信息集合是基于待处理资源交换集合中的每笔资源交换的关键资源交换信息生成的,关键资源交换信息集合中的关键资源交换信息用于确定目标对象的资源交换状态数据,目标对象为待处理资源交换集合中的资源交换所关联的任一对象;处理单元901,还用于存储关键资源交换信息集合。
在一个实施例中,通信单元902,还用于接收子链节点在满足状态数据上报条件时发送的子链节点记录的各个对象的资源交换状态数据;处理单元901,还用于基于接收到的资源交换状态数据对记录的各个对象的资源交换状态数据进行更新;其中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
本申请实施例还提供一种基于区块链的数据处理装置,所述区块链包括业务主链和业务子链,该装置包括:
通信单元,用于接收所述业务子链对应的子链节点发送的验证数据,其中,所述验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,所述目标资源交换区块为所述子链节点基于待处理资源交换集合生成的,所述待处理资源交换集合中的每笔资源交换是从所述业务子链对应的资源交换池中获取的,所述每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;所述子链节点是在所述验证数据指示所述目标资源交换区块正确性验证通过时发送所述验证数据的;
处理单元,对所述验证数据进行有效性校验,得到所述验证数据的校验结果;
所述通信单元,用于将所述校验结果发送至所述子链节点,以使所述子链节点根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理。
在一些实施例中,所述验证数据包括所述目标资源交换区块对应的校验数据、利用所述验证节点对应的加密密钥对所述校验数据进行加密处理得到的加密数据;所述处理单元,用于获取与所述加密密钥相匹配的解密密钥,利用所述解密密钥对所述验证数据包括的加密数据进行解密,得到解密数据;基于所述验证数据包括的校验数据和所述解密数据的比较结果,确定所述验证数据的校验结果。
可以理解的是,本申请实施例提供的基于区块链的数据处理装置的各功能单元的功能可根据上述方法实施例中的相关方法具体实现,其具体实现过程可以参照上述方法实施例中的相关描述,此处不再赘述。
在可行的实施例中,本申请实施例提供的基于区块链的数据处理装置可以采用软件方式实现,基于区块链的数据处理装置可以存储在存储器中,其可以是程序和插件等形式的软件,并包括一系列的单元,包括处理单元和通信单元;其中,处理单元和通信单元用于实现本申请实施例提供的基于区块链的数据处理方法。
在其它可行的实施例中,本申请实施例提供的基于区块链的数据处理装置也可以采用软硬件结合的方式实现,作为示例,本申请实施例提供的基于区块链的数据处理装置可以是采用硬件译码处理器形式的处理器,其被编程以执行本申请实施例提供的基于区块链的数据处理方法,例如,硬件译码处理器形式的处理器可以采用一个或多个应用专用集成电路(ASIC,Application Specific Integrated Circuit)、DSP、可编程逻辑器件(PLD,Programmable Logic Device)、复杂可编程逻辑器件(CPLD,Complex Programmable Logic Device)、现场可编程门阵列(FPGA,Field-Programmable Gate Array)或其他电子元件。
本申请实施例通过子链节点从业务子链对应的资源交换池中获取待处理资源交换集合,然后基于待处理资源交换集合生成目标资源交换区块,再将该目标资源交换区块发送至验证节点进行正确性验证,并接收验证节点的验证数据,当验证数据指示目标资源交换区块通过正确性验证时,将该验证数据发送至主链节点进行有效性校验,并接收主链节点的校验结果,最后根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。通过这种方式,一方面,由于待处理资源交换集合中的每笔资源交换都包含资源交换标识,子链节点可以根据资源交换标识保证待处理资源交换集合中不存在重复资源交换,确保了相同的资源交换不会被重复执行,避免了资源交换双花问题,增加了系统的安全性。另一方面,主链节点不需要执行每笔资源交换,只需要对验证数据进行校验,在校验通过时,可以由子链节点执行待处理资源交换集合中的每笔资源交换,如此提升了主链节点的处理性能,也缓解了主链节点的存储压力。总而言之,通过实施本申请实施例,可以在实现对主链节点进行扩容的同时保证系统安全性。
请参见图10,图10是本申请实施例提供的一种计算机设备1000的结构示意图。该计算机设备可以包括:通信接口1001、存储器1002和处理器1003,通信接口1001、存储器1002和处理器1003通过一条或多条通信总线连接,通信总线用于实现这些组件之间的连接通信。通信接口1001 可以包括标准的有线接口、无线接口(如WIFI接口)。存储器1002可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器1002也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),固态硬盘(solid-state drive,SSD)等;存储器1002还可以包括上述种类的存储器的组合。处理器1003可以是中央处理器(central processing unit,CPU)。处理器1003还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)等。上述PLD可以是现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)等。
在本申请实施例中,该计算机设备1000用于实现前文实施例中的基于区块链的数据处理方法,其中,区块链包括业务主链和业务子链。
在可行的实施例中,该计算机设备可以对应于前文所述业务子链的子链节点,此时,处理器1003通过运存储器 1002中的可执行程序代码,执行如下操作:
从业务子链对应的资源交换池中获取待处理资源交换集合,待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;基于待处理资源交换集合生成目标资源交换区块,通过通信接口1001向验证节点发送包含目标资源交换区块的验证指示信息,验证指示信息用于指示验证节点对目标资源交换区块中的资源交换进行正确性验证;通过通信接口1001接收验证节点返回的针对目标资源交换区块的验证数据;当验证数据指示目标资源交换区块正确性验证通过时,将验证数据发送至业务主链对应的主链节点,以使主链节点对验证数据进行有效性校验;通过通信接口1001接收主链节点返回的验证数据的校验结果,并根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。
在一个实施例中,处理器1003从业务子链对应的资源交换池中获取待处理资源交换集合时,具体用于:从业务子链对应的资源交换池中获取待处理资源交换,资源交换池中的每笔资源交换包含资源交换标识;基于待处理资源交换的资源交换标识,检测待处理资源交换是否包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中;若待处理资源交换未包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中,则将待处理资源交换加入待处理资源交换集合中;若待处理资源交换包含于基于从资源交换池已获取的资源交换构成的待处理资源交换集合中,则舍弃待处理资源交换。
在一个实施例中,目标资源交换的资源交换标识与目标资源交换在针对第一对象生成的资源交换中的生成顺序相关,第一对象为目标资源交换所属的对象,目标资源交换为资源交换池中的任意一笔资源交换。
在一个实施例中,处理器1003还用于获取待处理资源交换集合中的每笔资源交换的关键资源交换信息;基于关键资源交换信息生成关键资源交换信息集合;通过通信接口1001将关键资源交换信息集合发送至主链节点;其中,关键资源交换信息集合中的关键资源交换信息用于确定第二对象的资源交换状态数据,第二对象为待处理资源交换集合中的资源交换所关联的任一对象。
在一个实施例中,处理器1003在根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理时,具体用于:当校验结果指示验证数据通过有效性校验时,执行待处理资源交换集合中的每笔资源交换;根据每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。
在一个实施例中,处理器1003还用于:通过通信接口1001在满足状态数据上报条件时,将记录的各个对象的资源交换状态数据发送至主链节点,以使主链节点基于接收到的资源交换状态数据对其记录的各个对象的资源交换状态数据进行更新。
在一个实施例中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
在其他可行的实施例中,该计算机设备可以对应于前文所述的业务主链的主链节点,此时,处理器1003通过运存储器 1002中的可执行程序代码,执行如下操作:通过通信接口1001接收业务子链对应的子链节点发送的验证数据,其中,验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,目标资源交换区块为子链节点基于待处理资源交换集合生成的,待处理资源交换集合中的每笔资源交换是从业务子链对应的资源交换池中获取的,每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;验证数据是子链节点在验证数据指示目标资源交换区块正确性验证通过时发送的;对验证数据进行有效性校验,得到验证数据的校验结果;将校验结果发送至子链节点,以使子链节点根据校验结果对待处理资源交换集合中的每 笔资源交换进行相应处理。
在一个实施例中,验证数据包括目标资源交换区块对应的校验数据、利用验证节点对应的加密密钥对校验数据进行加密处理得到的加密数据;处理器1003对验证数据进行有效性校验,得到验证数据的校验结果时,具体用于:获取与加密密钥相匹配的解密密钥,利用解密密钥对验证数据包括的加密数据进行解密,得到解密数据;基于验证数据包括的校验数据和解密数据的比较结果,确定验证数据的校验结果。
在一个实施例中,处理器1003还用于:通过通信接口1001接收子链节点在满足状态数据上报条件时发送的子链节点记录的各个对象的资源交换状态数据;基于接收到的资源交换状态数据对记录的各个对象的资源交换状态数据进行更新;其中,满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者资源交换池中的资源交换已全部执行。
具体实现中,本申请实施例中所描述的通信接口1001、存储器1002和处理器1003可执行本申请实施例提供的基于区块链的数据处理方法中所描述的业务子链的子链节点和业务主链的主链节点的实现方式,也可执行本申请实施例提供的基于区块链的数据处理装置中所描述的实现方式,在此不再赘述。
本申请实施例通过子链节点从业务子链对应的资源交换池中获取待处理资源交换集合,然后基于待处理资源交换集合生成目标资源交换区块,再将该目标资源交换区块发送至验证节点进行正确性验证,并接收验证节点的验证数据,当验证数据指示目标资源交换区块通过正确性验证时,将该验证数据发送至主链节点进行有效性校验,并接收主链节点的校验结果,最后根据校验结果对待处理资源交换集合中的每笔资源交换进行相应处理。通过这种方式,一方面,由于待处理资源交换集合中的每笔资源交换都包含资源交换标识,子链节点可以根据资源交换标识保证待处理资源交换集合中不存在重复资源交换,确保了相同的资源交换不会被重复执行,避免了资源交换双花问题,增加了系统的安全性。另一方面,主链节点不需要执行每笔资源交换,只需要对验证数据进行校验,在校验通过时,可以由子链节点执行待处理资源交换集合中的每笔资源交换,如此提升了主链节点的处理性能,也缓解了主链节点的存储压力。总而言之,通过实施本申请实施例,可以在实现对主链节点进行扩容的同时保证系统安全性。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机实现如本申请实施例所述的基于区块链的数据处理方法。其具体实现方式可参考前文描述,此处不再赘述。
相应地,本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机程序或计算机指令,该计算机程序或计算机指令被处理器执行时实现本申请实施例提供的基于区块链的数据处理方法。
相应地,本申请实施例提供了一种计算机程序,该计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中,计算机设备的处理器从计算机可读存储介质读取计算机指令,处理器执行计算机指令,使得计算机设备执行本申请实施例提供的基于区块链的数据处理方法。
需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术对象应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某一些步骤可以采用其他顺序或者同时进行。其次,本领域技术对象也应该知悉,说明书中所描述的实施例所涉及的动作和模块并不一定是本申请所必须的。
本领域普通技术对象可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。

Claims (18)

  1. 一种基于区块链的数据处理方法,所述区块链包括业务主链和业务子链,所述方法由所述业务子链对应的子链节点执行,包括:
    从所述业务子链对应的资源交换池中获取待处理资源交换集合,所述待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;
    基于所述待处理资源交换集合生成目标资源交换区块,并向验证节点发送包含所述目标资源交换区块的验证指示信息,所述验证指示信息用于指示所述验证节点对所述目标资源交换区块中的资源交换进行正确性验证;
    接收所述验证节点返回的针对所述目标资源交换区块的验证数据;
    当所述验证数据指示所述目标资源交换区块正确性验证通过时,将所述验证数据发送至所述业务主链对应的主链节点,以使所述主链节点对所述验证数据进行有效性校验;
    接收所述主链节点返回的所述验证数据的校验结果,并根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理。
  2. 如权利要求1所述的方法,其中,所述从所述业务子链对应的资源交换池中获取待处理资源交换集合,包括:
    从所述业务子链对应的资源交换池中获取待处理资源交换,所述资源交换池中的每笔资源交换包含资源交换标识;
    基于所述待处理资源交换的资源交换标识,检测所述待处理资源交换是否包含于待处理资源交换集合中,所述待处理资源交换集合由从所述资源交换池获取的资源交换构成;
    若所述待处理资源交换未包含于所述待处理资源交换集合中,则将所述待处理资源交换加入所述待处理资源交换集合中;
    若所述待处理资源交换包含于所述待处理资源交换集合中,则舍弃所述待处理资源交换。
  3. 如权利要求2所述的方法,其特征在于,目标资源交换的资源交换标识与所述目标资源交换在针对第一对象所生成的资源交换中的生成顺序相关,所述第一对象为所述目标资源交换所属的对象,所述目标资源交换为所述资源交换池中的任意一笔资源交换。
  4. 如权利要求1-3任一项所述的方法,其特征在于,所述方法还包括:
    获取所述待处理资源交换集合中的每笔资源交换的关键资源交换信息;
    基于所述关键资源交换信息生成关键资源交换信息集合,并将所述关键资源交换信息集合发送至所述主链节点;
    其中,所述关键资源交换信息集合中的关键资源交换信息用于确定第二对象的资源交换状态数据,所述第二对象为所述待处理资源交换集合中的资源交换所关联的任一对象。
  5. 如权利要求1-3任一项所述的方法,其特征在于,所述根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理,包括:
    当所述校验结果指示所述验证数据通过所述有效性校验时,执行所述待处理资源交换集合中的每笔资源交换;
    根据所述每笔资源交换的资源交换数据和资源交换执行结果,对资源交换所属的各个对象的资源交换状态数据进行更新。
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:
    在满足状态数据上报条件时,将记录的各个对象的资源交换状态数据发送至所述主链节点,以使所述主链节点基于接收到的资源交换状态数据对其记录的各个对象的资源交换状态数据进行更新。
  7. 如权利要求6所述的方法,其特征在于,所述满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者所述资源交换池中的资源交换已全部执行。
  8. 一种基于区块链的数据处理方法,其特征在于,所述区块链包括业务主链和业务子链,所述方法由所述业务主链对应的主链节点执行,包括:
    接收所述业务子链对应的子链节点发送的验证数据,其中,所述验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,所述目标资源交换区块为所述子链节点基于待处理资源交换集合生成的,所述待处理资源交换集合中的每笔资源交换是从所述业务子链对应的资源交换池中获取的,所述每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;所述子链节点是在所述验证数据指示所述目标资源交换区块正确性验证通过时发送所述验证数据的;
    对所述验证数据进行有效性校验,得到所述验证数据的校验结果;
    将所述校验结果发送至所述子链节点,以使所述子链节点根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理。
  9. 如权利要求8所述的方法,其特征在于,所述验证数据包括所述目标资源交换区块对应的校验数据、利用所述验证节点对应的加密密钥对所述校验数据进行加密处理得到的加密数据;
    所述对所述验证数据进行有效性校验,得到所述验证数据的校验结果,包括:
    获取与所述加密密钥相匹配的解密密钥,利用所述解密密钥对所述验证数据包括的加密数据进行解密,得到解密数据;
    基于所述验证数据包括的校验数据和所述解密数据的比较结果,确定所述验证数据的校验结果。
  10. 如权利要求8或9所述的方法,其特征在于,所述方法还包括:
    接收所述子链节点发送的关键资源交换信息集合,所述关键资源交换信息集合是基于所述待处理资源交换集合中的每笔资源交换的关键资源交换信息生成的,所述关键资源交换信息集合中的关键资源交换信息用于确定目标对象的资源交换状态数据,所述目标对象为所述待处理资源交换集合中的资源交换所关联的任一对象;
    存储所述关键资源交换信息集合。
  11. 如权利要求8或9所述的方法,其特征在于,所述方法还包括:
    接收所述子链节点在满足状态数据上报条件时发送的所述子链节点记录的各个对象的资源交换状态数据;
    基于接收到的资源交换状态数据对记录的各个对象的资源交换状态数据进行更新;
    其中,所述满足状态数据上报条件包括:当前阶段已执行资源交换的数量达到预设数量,或者所述资源交换池中的资源交换已全部执行。
  12. 一种基于区块链的数据处理装置,所述区块链包括业务主链和业务子链,所述装置包括:
    处理单元,用于从所述业务子链对应的资源交换池中获取待处理资源交换集合,所述待处理资源交换集合中的每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;
    所述处理单元,用于基于所述待处理资源交换集合生成目标资源交换区块;
    通信单元,用于向验证节点发送包含所述目标资源交换区块的验证指示信息,所述验证指示信息用于指示所述验证节点对所述目标资源交换区块中的资源交换进行正确性验证;
    所述通信单元,用于接收所述验证节点返回的针对所述目标资源交换区块的验证数据;
    所述通信单元,用于当所述验证数据指示所述目标资源交换区块正确性验证通过时,将所述验证数据发送至所述业务主链对应的主链节点,以使所述主链节点对所述验证数据进行有效性校验;以及接收所述主链节点返回的所述验证数据的校验结果;
    所述处理单元,用于根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理。
  13. 根据权利要求12所述的装置,其中,所述处理单元,用于从所述业务子链对应的资源交换池中获取待处理资源交换,所述资源交换池中的每笔资源交换包含资源交换标识;基于所述待处理资源交换的资源交换标识,检测所述待处理资源交换是否包含于待处理资源交换集合中,所述待处理资源交换集合由从所述资源交换池获取的资源交换构成;若所述待处理资源交换未包含于所述待处理资源交换集合中,则将所述待处理资源交换加入所述待处理资源交换集合中;若所述待处理 资源交换包含于所述待处理资源交换集合中,则舍弃所述待处理资源交换。
  14. 一种基于区块链的数据处理装置,所述区块链包括业务主链和业务子链,所述装置包括:
    通信单元,用于接收所述业务子链对应的子链节点发送的验证数据,其中,所述验证数据为验证节点对目标资源交换区块中的资源交换进行正确性验证后生成的,所述目标资源交换区块为所述子链节点基于待处理资源交换集合生成的,所述待处理资源交换集合中的每笔资源交换是从所述业务子链对应的资源交换池中获取的,所述每笔资源交换包含资源交换标识,且属于同一对象的各笔资源交换的资源交换标识不同;所述子链节点是在所述验证数据指示所述目标资源交换区块正确性验证通过时发送所述验证数据的;
    处理单元,对所述验证数据进行有效性校验,得到所述验证数据的校验结果;
    所述通信单元,用于将所述校验结果发送至所述子链节点,以使所述子链节点根据所述校验结果对所述待处理资源交换集合中的每笔资源交换进行相应处理。
  15. 根据权利要求14所述的装置,其中,所述验证数据包括所述目标资源交换区块对应的校验数据、利用所述验证节点对应的加密密钥对所述校验数据进行加密处理得到的加密数据;
    所述验证单元,用于获取与所述加密密钥相匹配的解密密钥,利用所述解密密钥对所述验证数据包括的加密数据进行解密,得到解密数据;基于所述验证数据包括的校验数据和所述解密数据的比较结果,确定所述验证数据的校验结果。
  16. 一种计算机设备,其特征在于,包括:处理器、通信接口和存储器,所述处理器、所述通信接口和所述存储器相互连接,其中,所述存储器存储有可执行程序代码,所述处理器用于调用所述可执行程序代码,实现如权利要求1-7中任一项所述的基于区块链的数据处理方法,或者,实现如权利要求8-11中任一项所述的基于区块链的数据处理方法。
  17. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机指令,当其在计算机上运行时,使得计算机实现如权利要求1-7中任一项所述的基于区块链的数据处理方法,或者,实现如权利要求8-11中任一项所述的基于区块链的数据处理方法。
  18. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序或计算机指令,所述计算机程序或计算机指令被处理器执行时实现如权利要求1-7中任一项所述的基于区块链的数据处理方法,或者,实现如权利要求8-11中任一项所述的基于区块链的数据处理方法。
PCT/CN2023/084224 2022-04-28 2023-03-28 基于区块链的数据处理方法、相关装置及介质和程序产品 WO2023207471A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210458205.9A CN117010890A (zh) 2022-04-28 2022-04-28 基于区块链的交易处理方法、相关装置及介质和程序产品
CN202210458205.9 2022-04-28

Publications (1)

Publication Number Publication Date
WO2023207471A1 true WO2023207471A1 (zh) 2023-11-02

Family

ID=88517323

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/084224 WO2023207471A1 (zh) 2022-04-28 2023-03-28 基于区块链的数据处理方法、相关装置及介质和程序产品

Country Status (2)

Country Link
CN (1) CN117010890A (zh)
WO (1) WO2023207471A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239940A (zh) * 2017-05-11 2017-10-10 北京博晨技术有限公司 基于区块链系统的网络交易方法及装置
CN108881187A (zh) * 2018-05-31 2018-11-23 杭州秘猿科技有限公司 一种适用于许可链场景的跨链数据传递方法及设备
CN108876369A (zh) * 2018-06-05 2018-11-23 上海和数软件有限公司 基于区块链的数据通信方法、装置及计算机可读存储介质
CN110740044A (zh) * 2019-10-30 2020-01-31 北京海益同展信息科技有限公司 数据处理方法、装置、系统和存储介质
CN113821817A (zh) * 2021-11-22 2021-12-21 支付宝(杭州)信息技术有限公司 基于区块链的数据处理方法、装置、设备及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239940A (zh) * 2017-05-11 2017-10-10 北京博晨技术有限公司 基于区块链系统的网络交易方法及装置
CN108881187A (zh) * 2018-05-31 2018-11-23 杭州秘猿科技有限公司 一种适用于许可链场景的跨链数据传递方法及设备
CN108876369A (zh) * 2018-06-05 2018-11-23 上海和数软件有限公司 基于区块链的数据通信方法、装置及计算机可读存储介质
CN110740044A (zh) * 2019-10-30 2020-01-31 北京海益同展信息科技有限公司 数据处理方法、装置、系统和存储介质
CN113821817A (zh) * 2021-11-22 2021-12-21 支付宝(杭州)信息技术有限公司 基于区块链的数据处理方法、装置、设备及系统

Also Published As

Publication number Publication date
CN117010890A (zh) 2023-11-07

Similar Documents

Publication Publication Date Title
US20230023857A1 (en) Data processing method and apparatus, intelligent device, and storage medium
US20210056070A1 (en) System and method for secure management of digital contracts
US11171789B2 (en) System and method for implementing a resolver service for decentralized identifiers
US10067810B2 (en) Performing transactions between application containers
US10972448B2 (en) Technologies for data broker assisted transfer of device ownership
CN109756582B (zh) 区块链网络中的信息记录方法、装置、节点及存储介质
WO2022095244A1 (zh) 跨链交易方法、系统、装置、设备和存储介质
US20210304201A1 (en) Transaction verification method and apparatus, storage medium, and electronic device
US9749297B2 (en) Manicoding for communication verification
US11481375B2 (en) Point-to-point distributed decentralized system
CN111448781A (zh) 共享的区块链数据存储
CN110915164A (zh) 基于可信执行环境中执行的智能合约操作处理区块链数据
EP3763098A1 (en) Methods and systems for controlling access to, and integrity of, resources on a blockchain
US20210263907A1 (en) Documenting timestamps within a blockchain
WO2023045620A1 (zh) 一种交易数据处理方法、装置、计算机设备以及存储介质
US11108545B2 (en) Creating a blockchain account and verifying blockchain transactions
WO2020142603A1 (en) Hybrid identity as a service for decentralized browser based wallets
CN112036878B (zh) 数据处理方法及装置
US20210211286A1 (en) System and methods for data exchange using a distributed ledger
CN113706313A (zh) 基于区块链的融资方法、系统及计算机可读存储介质
CN110708390A (zh) 基于节点间数据共享的数据处理方法、设备、装置、介质
WO2023231558A1 (zh) 区块链共识方法、装置、介质、电子设备和程序产品
WO2023005500A1 (zh) 跨链交易处理方法、装置、电子设备以及存储介质
WO2023207471A1 (zh) 基于区块链的数据处理方法、相关装置及介质和程序产品
CN114092093A (zh) 区块链交易处理方法、装置、电子设备和可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23794906

Country of ref document: EP

Kind code of ref document: A1