Cross-chain data subscription method and device
By deploying smart contract management subscription contracts in multi-blockchain systems, cross-chain connection between the data source blockchain and the subscription blockchain is realized, cross-chain data subscription and privacy security issues are solved, and data circulation and privacy protection are realized.
Patent Information
- Application Number
- CN202010927876.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-02
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-04-02
AI Technical Summary
In multi-blockchain systems, it is difficult for the existing technology to achieve efficient subscription and circulation of cross-chain data, resulting in data silos and privacy security issues.
By deploying smart contracts on the data source blockchain, managing subscription contract codes, and achieving cross-chain connections between the data source blockchain and subscription blockchain, data screening and pushing are realized, ensuring customized subscription and secure transmission of data.
The data circulation between blockchains is realized, the data silos are broken, the data utilization value is improved, and the privacy and security of privacy-sensitive information is ensured, and the privacy and security of data source blockchain users are maintained.
Smart Images

Figure CN112182096B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of blockchain technology, and in particular, to a cross-chain data subscription method and device. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, is an emerging technology in which several computing devices jointly participate in "bookkeeping" and jointly maintain a complete distributed database. Blockchain technology has been widely used in many fields because it is decentralized, open and transparent, each computing device can participate in database records, and data can be quickly synchronized between computing devices. The cross-chain interaction technology between multiple blockchains allows information to circulate between different blockchains. Summary of the invention
[0003] In view of this, one or more embodiments of this specification provide a cross-chain data subscription method, which is applied to a multi-chain system including a data source blockchain and a subscription blockchain. The data source blockchain is cross-chain connected to the subscription blockchain; a first smart contract is deployed on the data source blockchain for managing the subscription contract code that is cross-chain published from the subscription blockchain to the data source blockchain; the execution logic corresponding to the contract code of the first smart contract includes the audit logic of the subscription contract code; the method is executed by a node device of the data source blockchain, and includes:
[0004] In response to a data query request sent across the chain from a node device in the subscription blockchain, a data description of source data related to the target business stored in the data source blockchain is sent across the chain to the subscription blockchain;
[0005] Receiving a subscription contract code that is cross-chain published by a node device in a subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes data screening logic for screening out source data related to the target business stored in the data source blockchain and determining target data based on the data description;
[0006] Calling the first smart contract, executing the audit logic of the subscription contract code, auditing the subscription contract code, and publishing the subscription contract code to the data source blockchain when the audit is passed, so as to deploy the subscription contract corresponding to the subscription contract code on the data source blockchain;
[0007] The subscription contract is called, the data screening logic is executed, the target data is screened out from the source data, and the screened target data is sent to the subscription blockchain, so that the subscription blockchain executes the target business based on the target data.
[0008] In another illustrated embodiment, the data source blockchain is further deployed with a second smart contract for performing qualification review result statistics on the subscription chain, and the method further includes:
[0009] Before sending the data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain, receiving a qualification review application from a node device in the subscription blockchain to the data source blockchain that is cross-chain published;
[0010] Based on the qualification review application, perform a qualification review of the subscription blockchain, and send the qualification review result to the data source blockchain;
[0011] Calling the second smart contract, executing the qualification review result statistical logic declared by the second smart contract, and obtaining the qualification review result of the subscribed blockchain;
[0012] When the qualification review result of the subscription blockchain is passed, the data description of the source data related to the target business stored in the data source blockchain is sent to the subscription blockchain.
[0013] In another illustrated embodiment, the execution logic corresponding to the contract code of the first smart contract further includes a subscription interface authorization logic; and the method further includes:
[0014] Receive a subscription interface authorization application from a node device in the subscription blockchain to which the data source blockchain is cross-chain published;
[0015] The first smart contract is called, the subscription interface authorization logic is executed, and the interface calling permission for the subscription contract is set for the subscription blockchain.
[0016] In another illustrated embodiment, calling the subscription contract, executing the data screening logic, screening the target data from the source data, and sending the screened target data to the subscription blockchain so that the subscription blockchain executes the target business based on the target data includes:
[0017] Calling the first smart contract, and after determining that the subscription blockchain has the interface calling authority for the subscription contract, further calling the subscription contract, executing the data screening logic, and screening the target data from the source data;
[0018] The filtered target data is sent to the subscribing blockchain so that the subscribing blockchain executes the target business based on the target data.
[0019] In yet another illustrated embodiment, the method further includes:
[0020] Receive a subscription contract call request message sent across the subscription blockchain, where the subscription contract call request message is used to request a node device of the data source blockchain to call the subscription contract based on a preset time period or a preset trigger condition.
[0021] In yet another illustrated embodiment, the data description is generated based on the desensitized source data.
[0022] In another illustrated embodiment, the target business is a traceability business for a target commodity, and the target data is traceability information related to the production or circulation of the target commodity.
[0023] In yet another illustrated embodiment, the data source blockchain is a consortium chain.
[0024] Accordingly, this specification also provides a cross-chain data subscription device, which is applied to a multi-chain system including a data source blockchain and a subscription blockchain; wherein the data source blockchain is cross-chain connected to the subscription blockchain; a first smart contract for managing the subscription contract code that the subscription blockchain publishes cross-chain to the data source blockchain is deployed on the data source blockchain; the execution logic corresponding to the contract code of the first smart contract includes the review logic of the subscription contract code; the device is applied to the node device end of the data source blockchain, including:
[0025] A sending unit, in response to a data query request sent across the chain from a node device in the subscription blockchain, sends a data description of source data related to the target business stored in the data source blockchain to the subscription blockchain across the chain;
[0026] A receiving unit receives a subscription contract code that is cross-chain published by a node device in a subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes a data screening logic for screening out the source data related to the target business stored in the data source blockchain and determining the target data based on the data description;
[0027] A smart contract execution unit calls the first smart contract, executes the audit logic of the subscription contract code, audits the subscription contract code, and publishes the subscription contract code to the data source blockchain when the audit is passed, so as to deploy a subscription contract corresponding to the subscription contract code on the data source blockchain;
[0028] The smart contract execution unit is further used to call the subscription contract, execute the data screening logic, filter out the target data from the source data, and send the filtered target data to the subscription blockchain, so that the subscription blockchain executes the target business based on the target data.
[0029] In another illustrated embodiment, the data source blockchain is further deployed with a second smart contract for performing qualification review result statistics on the subscription chain;
[0030] The receiving unit is further configured to receive a qualification review application from a node device in the subscription blockchain to the data source blockchain that is cross-chain published to the data source blockchain before sending a data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain;
[0031] An audit unit, based on the qualification audit application, performs a qualification audit on the subscription blockchain, and sends the qualification audit result to the data source blockchain;
[0032] The smart contract execution unit is further used to call the second smart contract, execute the qualification review result statistical logic declared by the second smart contract, and obtain the qualification review result of the subscribed blockchain.
[0033] In yet another illustrated embodiment, the execution logic corresponding to the contract code of the first smart contract further includes a subscription interface authorization logic;
[0034] The receiving unit is further configured to receive a subscription interface authorization application from the data source blockchain to which the node device in the subscription blockchain publishes cross-chain;
[0035] The smart contract execution unit further calls the first smart contract, executes the subscription interface authorization logic, and sets interface calling permissions for the subscription contract for the subscription blockchain.
[0036] In another illustrated embodiment, the smart contract execution unit is further used to:
[0037] Calling the first smart contract, and after determining that the subscription blockchain has the interface calling authority for the subscription contract, further calling the subscription contract, executing the data screening logic, and screening the target data from the source data;
[0038] The sending unit is further used to send the filtered target data to the subscribing blockchain, so that the subscribing blockchain executes the target business based on the target data.
[0039] In another illustrated embodiment, the receiving unit is further used to receive a subscription contract call request message sent across the subscription blockchain, and the subscription contract call request message is used to request the node device of the data source blockchain to call the subscription contract based on a preset time period or a preset trigger condition.
[0040] In yet another illustrated embodiment, the data description is generated based on the desensitized source data.
[0041] In another illustrated embodiment, the target business is a traceability business for a target commodity, and the target data is traceability information related to the production or circulation of the target commodity.
[0042] In yet another illustrated embodiment, the data source blockchain is a consortium chain.
[0043] Accordingly, this specification also provides a computer device, comprising: a memory and a processor; the memory stores a computer program that can be executed by the processor; when the processor runs the computer program, it executes the cross-chain data subscription method executed by the node device of the data source blockchain as described in the above embodiments.
[0044] Accordingly, this specification also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it executes the cross-chain data subscription method executed by the node device of the data source blockchain as described in the above embodiments.
[0045] The cross-chain data subscription method, apparatus, computer device, and computer-readable storage medium provided in each embodiment of this specification use a subscription contract to customize the target data required by the subscription blockchain, and the data source blockchain calls and executes the subscription contract, and pushes the execution result to the subscription blockchain across the chain, thereby promoting data circulation between blockchains, breaking down data information silos, and improving the value of data utilization; and the above-mentioned subscription contract code is constructed based on the data description determined by the data source blockchain, and because the subscription contract is deployed and called and executed within the data source blockchain, it can effectively prevent the leakage of privacy-sensitive information and maintain the privacy security of users of the data source blockchain. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment;
[0047] Figure 2 is a schematic diagram of calling a smart contract provided by an exemplary implementation;
[0048] Figure 3is a schematic diagram of creating and calling a smart contract provided by an exemplary embodiment;
[0049] Figure 4 It is a flowchart of a cross-chain data subscription method provided by an exemplary embodiment;
[0050] Figure 5 It is a schematic diagram of a cross-chain traceability data subscription method provided by an exemplary embodiment;
[0051] Figure 6 is a schematic diagram of a cross-chain data subscription device provided by an exemplary embodiment;
[0052] Figure 7 It is a hardware structure diagram for running the cross-chain data subscription device implementation method provided in this specification. DETAILED DESCRIPTION
[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0054] It should be noted that: in other implementations, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other implementations, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other implementations; and multiple steps described in this specification may be combined into a single step for description in other implementations.
[0055] As the alliance chain application business matures, the data in the alliance is becoming more and more abundant; the abundant data not only provides a strong guarantee for the normal operation of the business, but also its data value is becoming increasingly prominent. However, since the alliance chain is a blockchain that requires authorized access, its account book data is only accessible to members within the alliance; this creates data islands, and its data can only be used within the entire alliance; and if other alliance members are invited to join indefinitely in order to utilize its data value, on the one hand, it will cause data privacy leakage to the alliance parties involved in the business, causing certain damage to their rights and interests; on the other hand, the introduction of other businesses will also violate the original agreement to create the alliance, causing data chaos within the alliance chain and making it difficult to manage.
[0056] In view of the above problems, one or more embodiments of this specification provide a cross-chain data subscription method, which is applied to a multi-chain system including a data source blockchain and a subscription blockchain.
[0057] The blockchain or blockchain network described in one or more embodiments of this specification may specifically refer to a P2P network system with a distributed data storage structure in which each node device reaches a consensus mechanism. The ledger data in the blockchain is distributed in "blocks" that are connected in time. The latter block may contain a data summary of the previous block, and according to the specific consensus mechanism (such as POW, POS, DPOS or PBFT, etc.), a full backup of the data of all or part of the nodes is achieved.
[0058] The real data generated in the physical world can be constructed into a standard transaction format supported by the blockchain, and then published to the blockchain. The node devices in the blockchain will perform consensus processing on the received transactions. After reaching a consensus, the node devices in the blockchain that serve as accounting nodes will package the transaction into blocks and store it persistently in the blockchain.
[0059] Regardless of the consensus algorithm adopted by the blockchain, the accounting node can package the received transactions to generate the latest block, and send the generated latest block or the block header of the latest block to other node devices for consensus verification. If other node devices receive the latest block or the block header of the latest block and verify that there is no problem, the latest block can be appended to the end of the original blockchain, thereby completing the accounting process of the blockchain. When other nodes verify the new block or block header sent by the accounting node, they can also execute the transactions contained in the block.
[0060] Blockchain is generally divided into three types: public blockchain, private blockchain and consortium blockchain. In addition, there can also be a combination of the above types, such as private blockchain + consortium blockchain, consortium blockchain + public blockchain, etc.
[0061] Among them, the public chain has the highest degree of decentralization. Participants who join the public chain (also known as nodes in the blockchain) can read data records on the chain, participate in transactions, and compete for the right to record new blocks. Moreover, each node can freely join or exit the network and perform related operations.
[0062] On the contrary, the private chain has a network whose write permission is controlled by a certain organization or institution, and the data read permission is regulated by the organization. In simple terms, a private chain can be a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for use within a specific institution.
[0063] The consortium chain is a blockchain between the public chain and the private chain, which can achieve "partial decentralization". Each node in the consortium chain usually has a corresponding entity or organization; the nodes join the network through authorization and form a stakeholder alliance to jointly maintain the operation of the blockchain.
[0064] It is expected that the implementation methods provided in this specification can be implemented in any suitable type of blockchain network.
[0065] In practical applications, whether it is a public chain, a private chain or a consortium chain, it may provide the function of smart contract. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain. Smart contracts can be defined in the form of code.
[0066] It supports users to create and call some complex logic in the blockchain network. The core of the programmable blockchain is the blockchain virtual machine (EVM), and each blockchain node can run EVM. EVM is a Turing-complete virtual machine that can implement various complex logics. Users publish and call smart contracts in the blockchain on EVM. In fact, EVM directly runs virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so the smart contracts deployed on the blockchain can be bytecode.
[0067] like Figure 1 As shown in the figure, after Bob sends a transaction containing the information of creating a smart contract to the blockchain network, each node can execute this transaction in the EVM. Among them, the From field of the transaction in the figure is used to record the address of the account that initiated the creation of the smart contract, the contract code stored in the field value of the Data field of the transaction can be bytecode, and the field value of the To field of the transaction is a null account. When the nodes reach an agreement through the consensus mechanism, the smart contract is successfully created, and subsequent users can call this smart contract.
[0068] After a smart contract is created, a contract account corresponding to the smart contract appears on the blockchain and has a specific address; for example, Figure 1The "0x68e12cf284..." in each node represents the address of the created contract account; the contract code (Code) and account storage (Storage) will be saved in the account storage of the contract account. The behavior of the smart contract is controlled by the contract code, and the account storage of the smart contract saves the state of the contract. In other words, the smart contract generates a virtual account on the blockchain that contains the contract code and account storage.
[0069] As mentioned above, the Data field of the transaction that creates a smart contract can store the bytecode of the smart contract. The bytecode consists of a series of bytes, each of which can identify an operation. Based on development efficiency, readability and other considerations, developers can choose a high-level language to write smart contract code instead of writing bytecode directly. For example, high-level languages can be Solidity, Serpent, LLL, etc. For smart contract code written in a high-level language, it can be compiled by a compiler to generate bytecode that can be deployed on the blockchain.
[0070] Taking Solidity as an example, the contract code written in it is very similar to the class in object-oriented programming language. In a contract, multiple members can be declared, including state variables, functions, function modifiers, events, etc. State variables are values permanently stored in the account storage field of the smart contract, which are used to save the state of the contract.
[0071] like Figure 2 As shown in the figure, after Bob sends a transaction containing the information of calling a smart contract to the blockchain network, each node can execute the transaction in the EVM. Among them, the From field of the transaction in the figure is used to record the address of the account that initiates the call to the smart contract, the To field is used to record the address of the called smart contract, and the Data field of the transaction is used to record the method and parameters of calling the smart contract. After calling a smart contract, the account status of the contract account may change. Later, a client can view the account status of the contract account through the connected blockchain node.
[0072] Smart contracts can be executed independently on each node in the blockchain network in a prescribed manner, and all execution records and data are stored on the blockchain. Therefore, when such a transaction is executed, the blockchain will store transaction credentials that cannot be tampered with or lost.
[0073] The schematic diagram of creating and calling smart contracts is as follows: Figure 3To create a smart contract in the blockchain, you need to go through the process of writing the smart contract, converting it into bytecode, and deploying it to the blockchain. To call a smart contract in the blockchain, you initiate a transaction pointing to the smart contract address. The EVM of each node can execute the transaction separately, and the smart contract code is distributed and run in the virtual machine of each node in the blockchain network.
[0074] In one or more embodiments provided in this specification, the data source blockchain is a blockchain that stores data information that the subscription blockchain expects to obtain, and the subscription blockchain is cross-chain connected with the data source blockchain. This specification does not specifically limit the cross-chain connection method between the subscription blockchain and the data source blockchain. For example, the subscription blockchain can achieve cross-chain docking through a cross-chain relay.
[0075] Among them, the cross-chain relay can be connected to multiple blockchains through a bridge interface, and based on the implemented data transfer logic, complete the cross-chain data synchronization between the multiple blockchains. The cross-chain technology used to implement the above-mentioned cross-chain relay is not specifically limited in this specification; for example, in actual applications, multiple blockchains can be connected through cross-chain mechanisms such as side chain technology and notary technology. After multiple blockchains are connected through cross-chain relays, the blockchains can read and authenticate data on other blockchains, and can also call smart contracts deployed on other blockchains through cross-chain relays.
[0076] It should be noted that the cross-chain relay is only used to transfer data between multiple blockchains, and does not require persistent storage of the transferred data, nor does it need to maintain the data status of the transferred data. In practical applications, the cross-chain relay can be configured on devices, nodes, or platforms other than the multiple blockchains it is connected to, or on node devices of the multiple blockchains it is connected to, and is not specifically limited in this specification.
[0077] exist Figure 4 In the illustrated implementation manner, a first smart contract is deployed on the data source blockchain to manage the subscription contract code that is published cross-chain from the subscription blockchain to the data source blockchain; the execution logic corresponding to the contract code of the first smart contract includes the review logic of the subscription contract code.
[0078] Figure 4 The exemplary implementation of the cross-chain data subscription method may be performed by a node device of a data source blockchain, including:
[0079] Step 402, in response to a data query request sent across the chain from a node device in the subscription blockchain, a data description of the source data related to the target business stored in the data source blockchain is sent across the chain to the subscription blockchain.
[0080] The data source blockchain stores source data information related to the target business operating on the subscription chain.
[0081] In an illustrated embodiment, the data description of the above-mentioned source data may be included in a data query request sent by a node device of a subscribing blockchain, and the data source node device queries whether the source data corresponding to the above-mentioned data description can be subscribed to by the above-mentioned subscribing blockchain, and after determining that it can be subscribed, the above-mentioned data description (or a confirmation message of the above-mentioned data description) is returned to the subscribing blockchain.
[0082] In another illustrated embodiment, the data description of the above-mentioned source data can also be provided by the data source blockchain node device in response to the above-mentioned data query request, obtaining the source data related to the target business through query, and generating a data description of the source data based on the source data obtained by the query, and sending the above-mentioned data description to the subscription blockchain to inform the subscription blockchain of the subscription data content that can be provided to it.
[0083] It is worth noting that in order to protect the privacy and security of some specific information in the source data, the above-mentioned data source blockchain node device can desensitize the source data obtained from the query, that is, eliminate sensitive information related to privacy and security, and then generate corresponding data descriptions based on the desensitized source data.
[0084] Step 404, receiving the subscription contract code that is cross-chain published by the node device in the subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes filtering out the source data related to the target business stored in the data source blockchain, and determining the target data based on the data description. Data filtering logic.
[0085] After receiving the data description of the source data related to the target business sent by the data source blockchain, the subscription blockchain can customize a smart contract for obtaining the target data corresponding to the data description based on the data description, namely, the subscription contract. The execution logic corresponding to the subscription contract code includes filtering out the source data related to the target business stored in the data source blockchain, and the data filtering logic of the target data determined based on the data description. This embodiment does not limit the specific process of specifying the above subscription contract on the subscription blockchain. The node devices of the above subscription blockchain can reach a consensus on the subscription contract generated based on the data description, and send the code of the subscription contract obtained by consensus across the chain to the data source blockchain.
[0086] Step 406, calling the first smart contract, executing the audit logic of the subscription contract code, auditing the subscription contract code, and when the audit passes, publishing the subscription contract code to the data source blockchain to deploy the subscription contract corresponding to the subscription contract code on the data source blockchain.
[0087] A first smart contract for managing the subscription contract code is deployed on the data source blockchain. In response to a call transaction containing the subscription contract code published on the data source blockchain, the first smart contract is called to execute the audit logic for the subscription contract code, and the subscription contract code is audited. When the audit is passed, the subscription contract code is published to the data source blockchain.
[0088] Figure 1 The related descriptions have illustrated in detail the specific process of creating a smart contract based on a smart contract creation transaction published by a user; in this embodiment, the subscription contract is created by a first smart contract that manages the subscription contract code. Therefore, the creation transaction of the subscription contract is published to the blockchain by the first smart contract after the subscription contract code is reviewed and approved; after the node devices of the blockchain reach an agreement on the creation transaction of the subscription contract through a consensus mechanism, the subscription contract is successfully created, and the node devices of the subsequent data source blockchain can call this subscription contract.
[0089] After the subscription contract is created, a contract account corresponding to the subscription contract appears on the blockchain and has a specific address, namely the subscription contract identifier. The data source blockchain can send the above subscription contract identifier back to the subscription blockchain across the chain to facilitate the subscription blockchain to register and manage the subscription contract.
[0090] Step 408: calling the subscription contract, executing the data screening logic, screening the target data from the source data, and returning the screened target data to the subscription blockchain to execute the target business based on the target data.
[0091] The call to the subscription contract by the node device on the above-mentioned data source blockchain can be triggered by a call transaction including the above-mentioned subscription contract address sent by the node device of the data source blockchain, or it can be triggered by other smart contracts sending a call message to the above-mentioned subscription contract during the process of other smart contracts (such as the first smart contract that manages the subscription contract code mentioned above) being called and executed.
[0092] The above subscription contract can read source data from a specified address (such as a transaction address or account address specified by the contract code) and execute the data filtering logic on the read source data, for example, filtering out target data corresponding to the data description information included in the above subscription contract.
[0093] After the subscription contract is called and executed, the target data filtered out by the subscription contract can be saved in the account space of the subscription contract in the data source blockchain. The node device of the data source blockchain obtains the execution result of the subscription contract - the target data - by monitoring the account content of the subscription contract. The node device in the data source blockchain that is responsible for cross-chain communication with the subscription blockchain can push the target data it obtains to the node device of the subscription blockchain.
[0094] The cross-chain data subscription method provided in the above implementation method uses a subscription contract to customize the target data required by the subscription blockchain, and the data source blockchain calls and executes the subscription contract, and pushes the execution result to the subscription blockchain across the chain, which promotes the data circulation between blockchains, breaks the data information island, and improves the data utilization value; and the above subscription contract code is constructed based on the data description determined by the data source blockchain, and the above data description can be generated based on the desensitized data source, and because the subscription contract is deployed and called and executed in the data source blockchain, it can effectively prevent the leakage of privacy-sensitive information and maintain the privacy security of users of the data source blockchain.
[0095] The following content of this specification applies the cross-chain data subscription method described in the above implementation to the commodity information traceability query scenario, and expands more exemplary implementations.
[0096] In this embodiment, the data source blockchain is a consortium chain, which stores the origin information, production process information, logistics information, distributor information, etc. of various commodities; the subscription blockchain operates an e-commerce business of designated commodities. In the existing e-commerce business, in order to prove the authenticity of commodities, the origin and logistics traceability of commodities have become the needs of more and more users. Since the data source blockchain is rich in information and contains some privacy-sensitive information (such as production process, distributor information, or uploader information and upload location information of the above-mentioned various information to the data source blockchain), the data source blockchain has strict access requirements for its alliance member node devices. Randomly adding other nodes as alliance member nodes will damage the rights and interests of existing alliance members; at this time, the node devices of the subscription chain cannot obtain the authority to join the above-mentioned data source blockchain, and it is difficult to obtain information related to the designated commodities it operates.
[0097] In this embodiment, the subscription blockchain can be cross-chain connected with the data source blockchain through a relay node, and a smart contract for managing the subscription contract is deployed in the data source blockchain. The execution logic corresponding to the contract code of the above smart contract may include multiple logics such as the subscription contract code review logic, the subscription chain qualification review result statistics logic, and the subscription interface authorization logic. Those skilled in the art should know that the above subscription contract code review logic, subscription chain qualification review result statistics logic, and subscription interface authorization logic can be included in the execution logic of the same smart contract and called for execution based on different calling interfaces; they can also be allocated in the execution logic of different smart contracts (such as the first smart contract and the second smart contract), and the node devices call different smart contracts for execution respectively, which is not limited in this specification.
[0098] In order to perform traceability services for designated commodities, the node device subscribing to the blockchain expects that the data source blockchain can execute the cross-chain data subscription method provided in the above implementation mode to obtain traceability information related to the production or circulation of the designated commodities. Figure 5 The process steps of the cross-chain data subscription method used in the cross-chain traceability information query scenario are illustrated, including:
[0099] Step 501, the node device of the data source blockchain receives the qualification review application for traceability information subscription sent across the chain by the subscription blockchain; based on the qualification review application, performs a qualification review of the subscription blockchain, and sends the qualification review result to the data source blockchain.
[0100] Since the data source blockchain is a consortium chain, in order to protect the interests of each consortium member, in this implementation, each consortium member of the data source blockchain may review the qualifications of the subscription blockchain to decide whether to agree to provide product traceability information for the subscription blockchain.
[0101] The qualification authentication application sent by the above-mentioned subscription blockchain may specifically include the user or enterprise name, identity, data usage, etc. related to each node device in the subscription blockchain.
[0102] After obtaining the above-mentioned qualification review application sent across the subscribing blockchain, the node device in the data source blockchain that is responsible for cross-chain communication with the subscribing blockchain can send the above-mentioned qualification review application to the data source blockchain in the form of a transaction, so that other node devices in the data source blockchain can obtain the above-mentioned qualification review application and conduct qualification review.
[0103] Step 502: Call the second smart contract, execute the qualification review result statistical logic declared by the second smart contract, and obtain the qualification review result of the subscribed blockchain.
[0104] In another illustrated embodiment, the transaction including the above-mentioned qualification review application can be used as a third smart contract call transaction, so that each node device of the data source blockchain can review the qualifications of the subscribed blockchain by calling the qualification review logic of the third smart contract, and send the review results to the second smart contract to facilitate the second smart contract to execute the qualification review result statistical logic and obtain the qualification review results of the above-mentioned subscribed blockchain.
[0105] Optionally, the qualification review result may be set in the permission control list of the second smart contract in the form of subscribable permissions.
[0106] Step 503, in response to a data query request sent across the chain from a node device in the subscription blockchain, when it is determined that the qualification review result of the subscription blockchain is passed or has subscription authority, the data description of the traceability information data of the specified product stored in the data source blockchain is sent to the subscription blockchain.
[0107] The above data query request is used to request the data description of the traceability information data of the specified commodity stored in the data source blockchain. The above data description can be the content name (summary) of the traceability information of the specified commodity that the data source blockchain can provide to the subscription blockchain, such as the commodity name, origin, origin report, logistics transfer station, etc. It is worth noting that when the data source blockchain generates data descriptions for the traceability information data of the above specified commodity, it can choose to generate data descriptions for information data that is not privacy-sensitive and more suitable for public disclosure, and exclude privacy information such as the uploader or upload address of the above traceability information data.
[0108] Step 504, receiving the subscription contract code that is cross-chain published by the node device in the subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes filtering out the traceability information data of the specified commodity stored in the data source blockchain, and the data screening logic of the target data determined based on the above data description.
[0109] After receiving the data description described in step 503, the subscription blockchain can start to write and formulate the subscription contract. This embodiment does not limit the way in which the subscription blockchain writes and formulates the subscription contract. For example, a smart contract for formulating a subscription contract deployed on the subscription blockchain can be called to formulate a corresponding subscription contract based on the above data description.
[0110] Step 505, calling the first smart contract, executing the audit logic of the subscription contract code, auditing the subscription contract code, and when the audit passes, publishing the subscription contract code to the data source blockchain, so as to deploy the subscription contract corresponding to the subscription contract code on the data source blockchain.
[0111] The specific content of the above-mentioned review of the subscription contract code may include reviewing whether the data description included in the subscription contract is consistent with the data description content determined by the data source blockchain in step 503, thereby preventing the subscription contract from obtaining information beyond the scope of the above-mentioned data description content.
[0112] Step 506: Receive a subscription interface authorization application from a node device in the subscription blockchain to which the data source blockchain is cross-chain published; call the first smart contract, execute the subscription interface authorization logic, and set interface call permissions for the subscription contract for the subscription blockchain.
[0113] After the subscription contract is deployed on the data source blockchain, the data source blockchain can send the subscription contract identifier (contract address) to the subscription blockchain across the chain; in order to facilitate the subscription blockchain to call the subscription contract, or to facilitate the association of the subscription blockchain with the subscription contract, the interface calling permission for the subscription contract can be set for the subscription blockchain.
[0114] Specifically, the above-mentioned subscription interface authorization application may include the system identifier of the above-mentioned subscription blockchain, the certificate of the node device responsible for cross-chain calls in the subscription blockchain, the identifier of the subscription contract, the name of the subscription interface, etc., which is not limited in this embodiment.
[0115] Step 507, calling the subscription contract, executing the data screening logic, and screening out the traceability information data of the specified product corresponding to the above data description from the traceability information data;
[0116] Step 508: Return the traceability information data of the specified commodity that has been screened out to the subscribed blockchain, so that the subscribed blockchain can perform the traceability service of the specified commodity based on the traceability information data of the specified commodity.
[0117] In one illustrated embodiment, the node device of the above-mentioned data source blockchain can send a call transaction for the above-mentioned subscription contract to the data source blockchain to trigger the above-mentioned subscription contract to execute data screening logic.
[0118] In another illustrated embodiment, the node device of the above-mentioned data source blockchain can send a call transaction to the above-mentioned first smart contract. After determining that the subscription blockchain has the interface call authority for the subscription contract, the above-mentioned first smart contract further sends a call message to the subscription contract, thereby triggering the above-mentioned subscription contract to execute data screening logic.
[0119] In another illustrated embodiment, the subscription blockchain may send a subscription contract call request message to the data source blockchain across the chain. The call request message may include a call timing requirement for the subscription contract, for example, calling the subscription contract once every preset time period, or calling the subscription contract when a preset trigger condition is met, so as to facilitate the node device of the data source blockchain to send a call transaction to the subscription contract or the first smart contract in accordance with the above-mentioned call timing requirement.
[0120] Correspondingly, each time the data screening logic of the subscription contract is called, the traceability information data of the specified commodity screened by the above subscription contract can be saved in the account space of the subscription contract in the above data source blockchain, and the node device of the above data source blockchain obtains the traceability information data of the above specified commodity by monitoring the account content of the above subscription contract; the node device in the data source blockchain that is responsible for cross-chain communication with the subscription blockchain can push the traceability information data of the above specified commodity it obtains to the above subscription blockchain, thereby pushing the subscription information data in a form that meets the above call cycle requirements.
[0121] Corresponding to the above process implementation, the implementation method of this specification also provides a cross-chain data subscription device 60. The device 60 can be implemented by software, hardware, or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the CPU (Central Process Unit) of the device reading the corresponding computer program instructions into the memory and running them. From the hardware level, in addition to Figure 7 In addition to the CPU, memory and storage shown, the device where the above-mentioned device is located usually also includes other hardware such as chips for sending and receiving wireless signals, and / or other hardware such as boards for realizing network communication functions.
[0122] like Figure 6 As shown, this specification also provides a cross-chain data subscription device 60, which is applied to a multi-chain system including a data source blockchain and a subscription blockchain; wherein the data source blockchain is cross-chain connected to the subscription blockchain; a first smart contract for managing the subscription contract code of the subscription blockchain cross-chain published to the data source blockchain is deployed on the data source blockchain; the execution logic corresponding to the contract code of the first smart contract includes the review logic of the subscription contract code; the device 60 is applied to the node device end of the data source blockchain, including:
[0123] A sending unit 602, in response to a data query request sent across the chain from a node device in the subscription blockchain, sends a data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain across the chain;
[0124] The receiving unit 604 receives a subscription contract code that is cross-chain published by a node device in a subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes a data screening logic for screening out the source data related to the target business stored in the data source blockchain and determining the target data based on the data description;
[0125] The smart contract execution unit 606 calls the first smart contract, executes the audit logic of the subscription contract code, audits the subscription contract code, and publishes the subscription contract code to the data source blockchain when the audit is passed, so as to deploy the subscription contract corresponding to the subscription contract code on the data source blockchain;
[0126] The smart contract execution unit 606 is further used to call the subscription contract, execute the data screening logic, filter out the target data from the source data, and send the filtered target data to the subscription blockchain, so that the subscription blockchain executes the target business based on the target data.
[0127] In another illustrated embodiment, the data source blockchain is further deployed with a second smart contract for performing qualification review result statistics on the subscription chain;
[0128] The receiving unit 604 is further configured to receive a qualification review application from a node device in the subscription blockchain to the data source blockchain that is cross-chain published to the data source blockchain before sending a data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain;
[0129] The review unit 608 performs a review of the qualifications of the subscription blockchain based on the qualification review application, and sends the qualification review result to the data source blockchain;
[0130] The smart contract execution unit 606 is further used to call the second smart contract, execute the qualification review result statistical logic declared by the second smart contract, and obtain the qualification review result of the subscribed blockchain.
[0131] In yet another illustrated embodiment, the execution logic corresponding to the contract code of the first smart contract further includes a subscription interface authorization logic;
[0132] The receiving unit 604 is further configured to receive a subscription interface authorization application from the data source blockchain to which the node device in the subscription blockchain publishes cross-chain;
[0133] The smart contract execution unit 606 further calls the first smart contract, executes the subscription interface authorization logic, and sets the interface calling permission for the subscription contract for the subscription blockchain.
[0134] In another illustrated embodiment, the smart contract execution unit 606 is further configured to:
[0135] Calling the first smart contract, and after determining that the subscription blockchain has the interface calling authority for the subscription contract, further calling the subscription contract, executing the data screening logic, and screening the target data from the source data;
[0136] The sending unit 602 is further used to send the filtered target data to the subscribing blockchain, so that the subscribing blockchain executes the target business based on the target data.
[0137] In another illustrated embodiment, the receiving unit 604 is further used to receive a subscription contract call request message sent across the subscription blockchain, and the subscription contract call request message is used to request the node device of the data source blockchain to call the subscription contract based on a preset time period or a preset trigger condition.
[0138] In yet another illustrated embodiment, the data description is generated based on the desensitized source data.
[0139] In another illustrated embodiment, the target business is a traceability business for a target commodity, and the target data is traceability information related to the production or circulation of the target commodity.
[0140] In yet another illustrated embodiment, the data source blockchain is a consortium chain.
[0141] The implementation process of the functions and effects of each unit in the above-mentioned device 60 is specifically detailed in the implementation process of the corresponding steps in the cross-chain data subscription method executed by the node device of the above-mentioned data source blockchain. For relevant matters, please refer to the partial description of the method implementation method, which will not be repeated here.
[0142] The device implementation described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the units or modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.
[0143] The devices, units, and modules described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0144] Corresponding to the above method implementation, the implementation of this specification also provides a computer device, such as Figure 7 As shown, the computer device includes a memory and a processor. The memory stores a computer program that can be run by the processor; when the processor runs the stored computer program, it executes the various steps of the cross-chain data subscription method executed by the node device of the data source blockchain in the implementation mode of this specification. For a detailed description of the various steps of the cross-chain data subscription method executed by the node device of the above-mentioned data source blockchain, please refer to the previous content and will not be repeated.
[0145] Corresponding to the above method implementation, the implementation of this specification also provides a computer-readable storage medium, on which a computer program is stored. When these computer programs are executed by the processor, they execute the various steps of the cross-chain data subscription method executed by the node device of the data source blockchain in the implementation of this specification. For a detailed description of the various steps of the cross-chain data subscription method executed by the node device of the above data source blockchain, please refer to the previous content and will not be repeated.
[0146] The above description is only a preferred implementation of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0148] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0149] Computer readable media include permanent and non-permanent, removable and non-removable media and can store information by any method or technology. The information can be computer readable instructions, data structures, program modules or other data.
[0150] Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0151] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0152] It will be appreciated by those skilled in the art that the embodiments of the present specification may be provided as methods, systems or computer program products. Therefore, the embodiments of the present specification may be implemented in the form of a complete hardware implementation, a complete software implementation or an implementation combining software and hardware. Moreover, the embodiments of the present specification may be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
Claims
1. A cross-chain data subscription method, applied to a multi-chain system including a data source blockchain and a subscription blockchain; a first smart contract is deployed on the data source blockchain for managing the subscription contract code published by the subscription blockchain to the data source blockchain across chains; The method is performed by a node device of the data source blockchain, and includes: Receiving a subscription contract code that is cross-chain published by a node device in a subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes data screening logic for screening out target data determined based on a data description of the source data related to the target business stored in the data source blockchain from the source data related to the target business stored in the data source blockchain; Calling the first smart contract, executing the audit logic of the subscription contract code, auditing the subscription contract code, and deploying the subscription contract corresponding to the subscription contract code on the data source blockchain when the audit passes; The subscription contract is called, the data screening logic is executed, the target data is screened out from the source data, and the screened target data is sent across the chain to the subscription blockchain, so that the subscription blockchain executes the target business based on the target data.
2. The method according to claim 1, further comprising: Before receiving the subscription contract code that is cross-chain published by a node device in the subscription blockchain to the data source blockchain, in response to a data query request sent cross-chain from a node device in the subscription blockchain, a data description of the source data related to the target business stored in the data source blockchain is sent cross-chain to the subscription blockchain.
3. The method according to claim 2, further comprising: Before sending the data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain, receiving a qualification review application from a node device in the subscription blockchain to which the data source blockchain is cross-chain published; Based on the qualification review application, perform a qualification review of the subscribed blockchain; When the data source blockchain passes the qualification review of the subscription blockchain, the data description of the source data related to the target business stored in the data source blockchain is sent to the subscription blockchain.
4. According to the method of claim 1, 2 or 3, the execution logic corresponding to the contract code of the first smart contract also includes a subscription interface authorization logic; the method further includes: Receive a subscription interface authorization application from a node device in the subscription blockchain to which the data source blockchain is cross-chain published; The first smart contract is called, the subscription interface authorization logic is executed, and the interface calling permission for the subscription contract is set for the subscription blockchain.
5. According to the method of claim 4, calling the subscription contract, executing the data screening logic, screening the target data from the source data, and sending the screened target data to the subscription blockchain across chains so that the subscription blockchain executes the target business based on the target data, comprises: Calling the first smart contract, and after determining that the subscription blockchain has the interface calling authority for the subscription contract, further calling the subscription contract, executing the data screening logic, and screening the target data from the source data; The filtered target data is sent to the subscribing blockchain so that the subscribing blockchain executes the target business based on the target data.
6. The method according to claim 1, further comprising: Receive a subscription contract call request message sent across the subscription blockchain, where the subscription contract call request message is used to request a node device of the data source blockchain to call the subscription contract based on a preset time period or a preset trigger condition.
7. According to the method of claim 1, the data description is generated based on the source data after being desensitized.
8. According to the method of claim 1, the target business is a traceability business for a target commodity, and the target data is traceability information related to the production or circulation of the target commodity.
9. According to the method of claim 1, the data source blockchain is a consortium chain.
10. A cross-chain data subscription device, applied to a multi-chain system including a data source blockchain and a subscription blockchain; a first smart contract is deployed on the data source blockchain for managing the subscription contract code of the subscription blockchain cross-chain published to the data source blockchain; The device is applied to a node device end of the data source blockchain, and includes: A receiving unit receives a subscription contract code that is cross-chain published by a node device in a subscription blockchain to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes a data screening logic for screening out target data determined based on a data description of the source data related to the target business stored in the data source blockchain from the source data related to the target business stored in the data source blockchain; A smart contract execution unit calls the first smart contract, executes the audit logic of the subscription contract code, audits the subscription contract code, and deploys a subscription contract corresponding to the subscription contract code on the data source blockchain when the audit passes; The smart contract execution unit is further used to execute the data screening logic, filter out the target data from the source data, and send the filtered target data to the subscribing blockchain, so that the subscribing blockchain executes the target business based on the target data.
11. The apparatus according to claim 10, further comprising: The sending unit, before receiving the subscription contract code that is cross-chain published by the node device in the subscription blockchain to the data source blockchain, responds to the data query request sent cross-chain from the node device in the subscription blockchain, and sends the data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain across the chain.
12. The device according to claim 11, The receiving unit is further configured to receive a qualification review application from a node device in the subscription blockchain to the data source blockchain that is cross-chain published to the data source blockchain before sending a data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain; The audit unit performs a qualification audit on the subscription blockchain based on the qualification audit application; and when the qualification audit result of the subscription blockchain by the data source blockchain is passed, the qualification audit result is sent to the data source blockchain.
13. The device according to claim 10, 11 or 12, wherein the execution logic corresponding to the contract code of the first smart contract further includes a subscription interface authorization logic; The receiving unit is further configured to receive a subscription interface authorization application from the data source blockchain to which the node device in the subscription blockchain publishes cross-chain; The smart contract execution unit further calls the first smart contract, executes the subscription interface authorization logic, and sets interface call permissions for the subscription contract for the subscription blockchain.
14. The device according to claim 13, wherein the smart contract execution unit is further configured to: Calling the first smart contract, and after determining that the subscription blockchain has the interface calling authority for the subscription contract, further calling the subscription contract, executing the data screening logic, and screening the target data from the source data; A sending unit is used to send the filtered target data to the subscribing blockchain, so that the subscribing blockchain executes the target business based on the target data.
15. According to the device according to claim 10, the receiving unit is further used to receive a subscription contract call request message sent across the subscription blockchain, and the subscription contract call request message is used to request the node device of the data source blockchain to call the subscription contract based on a preset time period or a preset trigger condition.
16. The apparatus according to claim 10, wherein the data description is generated based on the desensitized source data. 17 . The device according to claim 10 , wherein the target business is a tracing business for a target commodity, and the target data is tracing information related to production or circulation of the target commodity.
18. The device according to claim 10, wherein the data source blockchain is a consortium chain.
19. A computer device comprising: Memory and processor; The memory stores a computer program executable by the processor; When the processor runs the computer program, the processor performs the method according to any one of claims 1 to 9.
20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Cross-data-block data access method, apparatus and system, and computer readable medium
CN108366105A
Inter-blockchain interaction method, device, system and electronic device
CN108848119A