WO2021197097A1 - 跨链数据订阅 - Google Patents

跨链数据订阅 Download PDF

Info

Publication number
WO2021197097A1
WO2021197097A1 PCT/CN2021/081798 CN2021081798W WO2021197097A1 WO 2021197097 A1 WO2021197097 A1 WO 2021197097A1 CN 2021081798 W CN2021081798 W CN 2021081798W WO 2021197097 A1 WO2021197097 A1 WO 2021197097A1
Authority
WO
WIPO (PCT)
Prior art keywords
subscription
data
blockchain
contract
chain
Prior art date
Application number
PCT/CN2021/081798
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 WO2021197097A1 publication Critical patent/WO2021197097A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • 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
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/103Workflow collaboration or project management
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • One or more implementations of this specification relate to the field of blockchain technology, in particular to a cross-chain data subscription.
  • Blockchain technology also known as distributed ledger technology, is an emerging technology in which several computing devices participate in "bookkeeping" and jointly maintain a complete distributed database. Because the blockchain technology has the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and the rapid data synchronization between computing devices, the blockchain technology has been widely used in many fields. To apply. The cross-chain interaction technology between multiple blockchains allows information to circulate between different blockchains.
  • 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 block chain is connected to the subscription block chain across chains; the data source block chain is deployed on the data source block chain for cross-chain publishing of the subscription block chain to the data source block chain
  • the first smart contract managed by the subscription contract code; 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 the node device of the data source blockchain and includes: In response to the cross-chain data query request sent from the node device in 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 block across the chain Chain; receiving the subscription contract code that the node device in the subscription block chain publishes to the data source block chain across the chain; wherein the execution logic corresponding to the subscription contract code includes, stored from the data source block chain The data filtering logic of the target data determined based
  • the data source blockchain is further deployed with a second smart contract for performing statistics on the qualification audit results of the subscription chain
  • the method further includes: connecting the data source area to the Before sending the data description of the source data related to the target business stored in the block chain to the subscribing block chain, receive the qualification review of the data source block chain published by the node device in the subscribing block chain across the chain Application; Based on the qualification review application, perform the qualification review of the subscription blockchain, and send the qualification review results to the data source blockchain; call the second smart contract to execute the second smart The statistical logic of the qualification audit result of the contract statement is obtained, and the qualification audit result of the subscription blockchain is obtained; when the qualification audit result of the subscription blockchain is passed, the data source blockchain stored and the target The data description of the business-related source data is sent to the subscription blockchain.
  • the execution logic corresponding to the contract code of the first smart contract further includes subscription interface authorization logic; the method further includes: receiving a cross-chain release from a node device in the subscription blockchain The subscription interface authorization application of the data source block chain to the data source; call the first smart contract, execute the subscription interface authorization logic, and set the interface call authority for the subscription contract for the subscription block chain.
  • the subscription contract is invoked, the data filtering logic is executed, the target data is filtered out from the source data, and the filtered target data is sent to all
  • the subscription blockchain so that the subscription blockchain executes the target service based on the target data, includes: invoking the first smart contract, and when it is determined that the subscription blockchain has access to the subscription contract
  • the subscription contract is further invoked, the data filtering logic is executed, and the target data is filtered out from the source data; the filtered target data is sent to the subscription blockchain to Enabling the subscription blockchain to execute the target business based on the target data.
  • the method further includes: receiving a subscription contract invocation request message sent by the subscription blockchain cross-chain, where the subscription contract invocation request message is used to request the data source area
  • the node device of the block chain invokes the subscription contract based on a preset time period or a preset trigger condition.
  • the data description is generated based on source data that has been desensitized.
  • the target business is a traceability business of the target commodity
  • the target data is traceability information related to the production or circulation of the target commodity.
  • the data source blockchain is a consortium chain.
  • 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 and the subscription blockchain Cross-chain connection; the data source blockchain is deployed with a first smart contract for managing the subscription contract code that the subscription blockchain publishes to the data source blockchain cross-chain; the first smart The execution logic corresponding to the contract code of the contract includes the audit logic of the subscription contract code; the device is applied to the node device end of the data source blockchain, and includes: a sending unit, which responds to the node in the subscription blockchain The data query request sent by the device across the chain is to send the data description of the source data related to the target business stored in the data source block chain to the subscription block chain across the chain; the receiving unit receives the data in the subscription block chain The node device cross-chain publishes the subscription contract code to the data source blockchain; wherein the execution logic corresponding to the subscription contract code includes source data related to the target business stored from the data source blockchain
  • the data source block chain is also deployed with a second smart contract for performing statistics on the qualification review results of the subscription chain; the receiving unit is further configured to transfer the data Before sending the data description of the source data related to the target business stored in the source blockchain to the subscribing block chain, receive the data source block chain that the node device in the subscribing block chain publishes across the chain to the data source block chain.
  • Qualification review application the review unit, based on the qualification review application, executes the qualification review of the subscription blockchain, and sends the qualification review results to the data source blockchain;
  • the smart contract execution unit further uses After invoking the second smart contract, execute the qualification audit result statistical logic declared by the second smart contract to obtain the qualification audit result of the subscription blockchain.
  • the execution logic corresponding to the contract code of the first smart contract further includes subscription interface authorization logic; the receiving unit is further configured to receive the node device cross-connect in the subscription blockchain The subscription interface authorization application of the data source blockchain published by the chain; the smart contract execution unit further invokes the first smart contract, executes the subscription interface authorization logic, and sets a pair for the subscription blockchain The interface calling authority of the subscription contract.
  • the smart contract execution unit is further configured to: call the first smart contract, and after it is determined that the subscription blockchain has the authority to call the interface of the subscription contract, further Call the subscription contract, execute the data filtering logic, and filter the target data from the source data; the sending unit is further configured to send the filtered target data to the subscription blockchain , So that the subscription blockchain executes the target business based on the target data.
  • the receiving unit is further configured to receive a subscription contract invocation request message sent by the subscription blockchain cross-chain, and the subscription contract invocation request message is used to request the data source area
  • the node device of the block chain invokes the subscription contract based on a preset time period or a preset trigger condition.
  • the data description is generated based on source data that has been desensitized.
  • the target business is a traceability business of the target commodity
  • the target data is traceability information related to the production or circulation of the target commodity.
  • the data source blockchain is a consortium chain.
  • this specification also provides a computer device, including: a memory and a processor; the memory stores a computer program that can be run by the processor; when the processor runs the computer program, it executes as described above The cross-chain data subscription method executed by the node device of the data source blockchain described in each embodiment.
  • this specification also provides a computer-readable storage medium on which a computer program is stored.
  • the computer program When the computer program is run by a processor, it executes the nodes of the data source blockchain as described in the above embodiments.
  • the cross-chain data subscription method executed by the device.
  • the cross-chain data subscription methods, devices, computer equipment, and computer-readable storage media use subscription contracts to customize the target data required by the subscription blockchain, and the data source blockchain performs subscription contracts Call execution, and push the execution result to the subscription blockchain across the chain, which promotes data circulation between blockchains, breaks data information islands, and improves the value of data utilization; and the above subscription contract code is determined based on the data source blockchain.
  • Fig. 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment
  • Fig. 2 is a schematic diagram of invoking a smart contract provided by an exemplary embodiment
  • Fig. 3 is a schematic diagram of creating a smart contract and invoking a smart contract provided by an exemplary embodiment
  • FIG. 4 is a schematic flowchart of a cross-chain data subscription method provided by an exemplary embodiment
  • FIG. 5 is a schematic diagram of a method for subscribing to cross-chain traceability data provided by an exemplary embodiment
  • Fig. 6 is a schematic diagram of a cross-chain data subscription device provided by an exemplary embodiment
  • FIG. 7 is a hardware structure diagram for running the implementation of the cross-chain data subscription device provided in this specification.
  • the steps of the corresponding method are not necessarily executed in the order shown and described in this specification.
  • the method may include more or fewer steps than described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • the alliance chain application business As the alliance chain application business matures, the data in the alliance becomes more and more abundant; the rich data not only provides a strong guarantee for the normal operation of the business, but the value of its data is also increasingly prominent.
  • the alliance chain is a blockchain that requires authorization to access, its ledger data can only be accessed by members of its alliance; this creates a data island, and its data can only be used in the entire alliance; and if it is to use the value of its data , Unlimited invitation of other alliance members to join, on the one hand, will cause the data privacy of the alliance parties participating in the business to be leaked and cause certain harm to their rights and interests; on the other hand, the introduction of other businesses will also violate the original agreement created by the alliance. Cause data confusion in the alliance chain and difficult to manage.
  • 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 blockchain or blockchain network described in one or more embodiments of this specification can specifically refer to a P2P network system with a distributed data storage structure reached by each node device through a consensus mechanism.
  • Ledger data is distributed in time-connected "blocks".
  • the next block can contain the data summary of the previous block and is based on the specific consensus mechanism (such as POW, POS, DPOS or PBFT, etc.) ) To achieve full backup of all or part of the node data.
  • the real data generated in the physical world it can be constructed into a standard transaction format supported by the blockchain, and then published to the blockchain, and the node devices in the blockchain will perform consensus processing on the received transactions , And after reaching a consensus, the node device as the bookkeeping node in the block chain will package the transaction into the block and carry out persistent storage in the block chain.
  • the accounting node can package the received transaction 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 equipment receives the latest block or the block header of the latest block, it is verified that there is no problem, and the latest block can be appended to the end of the original blockchain to complete the accounting process of the blockchain. In the process of other nodes verifying the new block or block header sent by the accounting node, the transactions contained in the block can also be executed.
  • Blockchain is generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • Public Blockchain Private Blockchain
  • Consortium Blockchain there can also be a combination of the above types, such as private chain + consortium chain, consortium chain + public chain, and so on.
  • the public chain is represented by Bitcoin and Ethereum. Participants who join the public chain (also called nodes in the blockchain) can read the data records on the chain, participate in transactions, and compete for the accounting rights of new blocks, etc. . Moreover, each node can freely join or exit the network, and perform related operations.
  • the private chain is the opposite.
  • the write permission of the network is controlled by an organization or institution, and the data read permission is regulated by the organization.
  • 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 internal use by specific institutions.
  • Each node in the alliance chain usually has a corresponding entity or organization; nodes are authorized to join the network and form a stakeholder alliance to jointly maintain the operation of the blockchain.
  • 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 codes.
  • Ethereum Taking Ethereum as an example, it supports users to create and call some complex logic in the Ethereum network.
  • Ethereum is a programmable blockchain, and its core is the Ethereum Virtual Machine (EVM), and each Ethereum node can run the EVM.
  • EVM is a Turing complete virtual machine, through which various complex logic can be realized. Users who publish and call smart contracts in Ethereum run on the EVM.
  • EVM directly runs virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode”), so the smart contract deployed on the blockchain can be bytecode.
  • bytecode virtual machine code
  • each node can execute the transaction in the EVM.
  • 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 field value of the Data field of the transaction can be stored as a bytecode
  • the field value of the To field of the transaction is a null (empty). Account.
  • a contract account corresponding to the smart contract appears on the blockchain and has a specific address; for example, "0x68e12cf284" in each node in Figure 1 represents the address of the created contract account ; Contract code (Code) and account storage (Storage) will be stored 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.
  • smart contracts enable virtual accounts containing contract codes and account storage to be generated on the blockchain.
  • the Data field containing the transaction that created the smart contract can store the bytecode of the smart contract.
  • the bytecode consists of a series of bytes, and each byte can identify an operation.
  • developers can choose a high-level language to write smart contract code instead of directly writing bytecode.
  • high-level languages such as Solidity, Serpent, and LLL languages can be used.
  • 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.
  • the contract code written with it is very similar to the class in the object-oriented programming language.
  • a variety of members can be declared in a contract, including state variables, functions, function modifiers, and events.
  • the state variable is a value permanently stored in the storage (Storage) field of the smart contract, and is used to save the state of the contract.
  • each node can execute the transaction in the EVM.
  • the From field of the transaction in the figure is used to record the address of the account that initiated the invocation of the smart contract
  • the To field is used to record the address of the smart contract being called
  • the Data field of the transaction is used to record the method and parameters of invoking the 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.
  • Smart contracts can be executed independently on each node in the blockchain network in a prescribed manner. All execution records and data are stored on the blockchain, so when such a transaction is executed, the blockchain cannot be saved. A transaction certificate that is tampered with and will not be lost.
  • FIG. 3 The schematic diagram of creating a smart contract and invoking a smart contract is shown in Figure 3.
  • Invoking a smart contract in Ethereum is to initiate a transaction pointing to a smart contract address.
  • the EVM of each node can execute the transaction separately, and the smart contract code can be distributed in the virtual machine of each node in the Ethereum network.
  • the data source blockchain is a blockchain that stores the data information that the subscription blockchain expects to obtain, and the subscription blockchain is connected to the data source blockchain across chains.
  • This manual does not specifically limit the cross-chain connection between the subscription blockchain and the data source blockchain.
  • the subscription blockchain can realize cross-chain docking through cross-chain relay.
  • the cross-chain relay can be connected to multiple blockchains through the bridge interface, and based on the implemented data handling logic, the synchronization of the cross-chain data between the multiple blockchains can be completed.
  • the cross-chain technology used in the implementation of the above-mentioned cross-chain relay is not particularly limited in this specification; for example, in practical applications, multiple blocks can be combined through cross-chain mechanisms such as side-chain technology and notary technology.
  • the chains are connected.
  • the data on other blockchains can be read and authenticated between the blockchains, and they can also be deployed on other blockchains through cross-chain relays. Smart contract.
  • 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.
  • cross-chain relays can be configured on devices, nodes, or platforms other than multiple blockchains to which they are connected, and can also be configured on node devices of multiple blockchains to which they are connected. It is not particularly limited in this specification.
  • the data source blockchain is deployed with a first smart contract for managing the subscription contract code that the subscription blockchain publishes to the data source blockchain across chains
  • the execution logic corresponding to the contract code of the first smart contract includes the audit logic of the subscription contract code.
  • the implementation of the cross-chain data subscription method shown in FIG. 4 can be executed by the node device of the data source blockchain, including:
  • Step 402 In response to a cross-chain data query request sent from a node device in the subscribing blockchain, the data description of the source data related to the target business stored in the data source blockchain is sent to the cross-chain Subscribe to the blockchain.
  • the source data information related to the target business operated on the subscription chain is stored on the data source blockchain.
  • the data description of the aforementioned source data can be included in the data query request sent by the node device subscribing to the blockchain, and the data source node device queries whether the source data corresponding to the aforementioned data description can be Subscribe to the blockchain subscription, and after confirming that it can be subscribed, return the above data description (or the confirmation message for the above data description) to the subscription blockchain.
  • the data description of the above source data may also be obtained by the data source blockchain node device in response to the above data query request by querying to obtain source data related to the target business, and based on the source data obtained from the query
  • the data description of the source data is generated, and the above data description is sent to the subscription blockchain to inform the subscription blockchain of the subscription data content that the subscription blockchain can provide.
  • the above-mentioned data source blockchain node device can desensitize the source data obtained from the query, that is, to eliminate sensitive information related to privacy and security, and then based on The source data after being desensitized generates the corresponding data description.
  • Step 404 Receive the subscription contract code that the node device in the subscription block chain publishes to the data source block chain across the chain; wherein the execution logic corresponding to the subscription contract code includes data stored from the data source block chain.
  • the data filtering logic of the target data determined based on the data description is filtered out from the source data related to the target business.
  • the subscription blockchain After the subscription blockchain receives the data description of the source data related to the target business sent by the data source blockchain, it can customize the smart contract for obtaining the target data corresponding to the data description based on the data description—the subscription contract.
  • the execution logic corresponding to the subscription contract code includes filtering from the source data related to the target business stored in the data source blockchain, and data filtering logic for the target data determined based on the data description.
  • This embodiment does not limit the specific process of subscribing to the blockchain to specify the subscription contract.
  • the node device subscribing to the blockchain can agree on the subscription contract generated based on the data description, and cross-chain the code of the subscription contract obtained from the consensus. Send to the data source blockchain.
  • Step 406 Invoke the first smart contract, execute the audit logic for the subscription contract code, audit the subscription contract code, and publish the subscription contract code to the data source area when the audit is passed.
  • the first smart contract for managing the above subscription contract code is deployed on the data source blockchain, and in response to the calling transaction containing the above subscription contract code published on the data source blockchain, the above first smart contract is invoked to execute the
  • the audit logic of the subscription contract code reviews the subscription contract code, and when the audit is passed, publishes the subscription contract code to the data source blockchain.
  • Figure 1 and related descriptions have exemplified the specific process of creating a smart contract based on the smart contract creation transaction issued by the user; in this embodiment, the subscription contract is created by the first smart contract that manages the subscription contract code. Therefore, the creation transaction of the subscription contract is released to the blockchain by the first smart contract after reviewing the subscription contract code; after the node devices of the blockchain reach an agreement on the creation transaction of the subscription contract through the consensus mechanism, the subscription contract After successful creation, the node device of the subsequent data source blockchain can call this subscription contract.
  • a contract account corresponding to the subscription contract appears on the blockchain and has a specific address, that is, the subscription contract identifier.
  • the data source blockchain can send the above-mentioned subscription contract identifier across the chain back to the subscription blockchain to facilitate the registration and management of the subscription contract by the subscription blockchain.
  • Step 408 Invoke the subscription contract, execute the data filtering logic, filter out the target data from the source data, and return the filtered target data to the subscription blockchain to be based on all the data.
  • the target data executes the target business.
  • the invocation of the subscription contract by the node device on the above data source blockchain can be triggered by the invocation transaction including the address of the above subscription contract sent by the node device of the data source blockchain, or in other smart contracts (such as the above subscription contract).
  • the first smart contract managed by the code is called and executed, it is triggered by another smart contract sending a call message to the subscription contract.
  • the above subscription contract can read source data from a specified address (such as the transaction address or account address specified by the contract code), and execute the data filtering logic on the read source data, for example, filter out the data included in the above subscription contract
  • a specified address such as the transaction address or account address specified by the contract code
  • the target data filtered by the subscription contract can be stored in the account space of the subscription contract in the data source blockchain, and the node device of the data source blockchain monitors the account content of the subscription contract.
  • the node device responsible for cross-chain communication with the subscription blockchain can push the above target data obtained to the above subscription blockchain. Node device.
  • the cross-chain data subscription method uses the subscription contract to customize the target data required by the subscription blockchain, the data source blockchain calls and executes the subscription contract, and pushes the execution result to the subscription area across the chain Blockchain promotes data circulation between blockchains, breaks data information islands, and enhances the value of data utilization; 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 based on being desensitized
  • the processed data source is generated, and because the subscription contract is deployed and invoked in the data source blockchain, it can effectively prevent the leakage of privacy-sensitive information and maintain the privacy and security of users of the data source blockchain.
  • the data source blockchain is a consortium chain, which stores the origin information, production process information, logistics information, distributor information, etc. of a variety of commodities; the subscription blockchain operates e-commerce with designated commodities Business, in the existing e-commerce business, in order to prove the authenticity of the product, the origin and logistics traceability of the product has become the demand of more and more users. Since the information on the data source blockchain is rich and contains some privacy-sensitive information (such as production process, distributor information, or uploader information and upload location information of the above various information uploaded to the data source blockchain), the data source area The block chain has stricter access requirements for its alliance member node equipment.
  • the subscription block chain can be connected to the data source block chain through a relay node across the chain, and the data source block chain is deployed with a smart contract for managing subscription contracts.
  • the contract code of the above smart contract corresponds to
  • the execution logic may include multiple logics such as subscription contract code review logic, subscription chain qualification review result statistical logic, subscription interface authorization logic, and so on.
  • subscription contract code review logic can be included in the execution logic of the same smart contract and be invoked and executed based on different calling interfaces; also It can be allocated in the execution logic of different smart contracts (such as the first smart contract, the second smart contract), and the node devices call different smart contracts to execute them, which is not limited in this specification.
  • FIG. 5 illustrates the process steps of the cross-chain data subscription method used in the cross-chain traceability information query scenario, including:
  • Step 501 The node device of the data source blockchain receives a qualification review application for traceability information subscription sent across the subscribing blockchain; Qualification review, and the qualification review result is sent to the data source blockchain.
  • each consortium of the data source blockchain can review the qualification of subscribing to the blockchain to decide whether to agree to the subscription area.
  • Blockchain provides product traceability information.
  • the qualification certification application sent by the subscription blockchain may specifically include the user or company name, identity, data usage, etc. related to each node device in the subscription blockchain.
  • the node device responsible for cross-chain communication with the subscription blockchain in the data source blockchain can send the above qualification review application to the data source block in the form of a transaction after obtaining the above qualification review application sent by the subscription blockchain cross-chain Chain, so that other node devices of the data source blockchain can obtain the above-mentioned qualification review application and conduct a qualification review.
  • Step 502 Invoke 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 subscription blockchain.
  • the transaction containing the above-mentioned qualification review application can be used as the third smart contract call transaction, so that each node device of the data source blockchain can call the qualification review logic of the third smart contract to subscribe
  • the qualification of the blockchain is reviewed, and the audit result is sent to the second smart contract to facilitate the second smart contract to execute the qualification audit result statistical logic, and obtain the qualification audit result of the above subscription blockchain.
  • the above-mentioned qualification review result can be set in the above-mentioned second smart contract authority control list in the form of subscribeable authority.
  • Step 503 In response to a data query request sent from a node device in the subscribing block chain across the chain, when it is determined that the qualification review result of the subscribing block chain is passed or has subscription authority, the data source area The data description of the traceability information data of the designated commodity stored in the block chain is sent to the subscription block chain.
  • 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 traceability information of the specified commodity that the data source blockchain can provide to the subscription blockchain.
  • the content name (summary), such as product name, place of origin, report of origin, logistics transfer station, etc. It is worth noting that when the data source block chain generates data descriptions for the traceability information data of the above-mentioned designated commodities, it can choose non-privacy sensitive and more suitable for public information data to generate data descriptions, and eliminate the above traceability information data. Private information such as uploader or upload address.
  • Step 504 Receive the subscription contract code that the node device in the subscription block chain publishes to the data source block chain across the chain; wherein the execution logic corresponding to the subscription contract code includes data stored from the data source block chain.
  • the data of the traceability information of the designated commodity is screened out, based on the data screening logic of the target data determined based on the above data description.
  • the subscription blockchain After the subscription blockchain receives the data description described in step 503, it can start writing and formulating the subscription contract.
  • This embodiment does not limit the way the subscription blockchain writes and formulates the subscription contract. For example, you can call the subscription area.
  • the smart contract deployed on the block chain is used to formulate the subscription contract, and the corresponding subscription contract is formulated based on the above data description.
  • Step 505 Invoke the first smart contract, execute the audit logic for the subscription contract code, audit the subscription contract code, and publish the subscription contract code to the data source blockchain when the audit is passed. , To deploy a subscription contract corresponding to the subscription contract code on the data source blockchain.
  • the specific content of the above 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 in step 503 by the data source blockchain, thereby preventing the subscription contract from obtaining beyond the scope of the above data description content Information.
  • Step 506 Receive the subscription interface authorization application of the data source blockchain that the node device in the subscription blockchain publishes to the data source blockchain; call the first smart contract to execute the subscription interface authorization logic.
  • the subscription blockchain sets the interface calling authority for the subscription contract.
  • the data source block chain can send the above subscription contract identifier (contract address) to the subscription block chain across the chain; in order to facilitate the subscription block chain to call the above subscription contract, or for convenience
  • the above-mentioned subscription blockchain can be set with the interface calling authority for the above-mentioned subscription contract.
  • the subscription interface authorization application may include the system identification of the subscription blockchain, the certificate of the node device responsible for cross-chain calls in the subscription blockchain, the identification of the subscription contract, the name of the subscription interface, etc. Not limited.
  • Step 507 Invoke the subscription contract, execute the data screening logic, and filter the traceability information data of the specified commodity corresponding to the above data description from the traceability information data;
  • Step 508 Return the selected product traceability information data to the subscription blockchain, so that the subscription blockchain can execute the traceability service of the designated product based on the traceability information data of the designated product.
  • the node device of the data source blockchain may send a call transaction to the subscription contract to the data source blockchain to trigger the subscription contract to execute the data filtering logic.
  • the node device of the data source blockchain may send a call transaction to the first smart contract, and after it is determined that the subscription blockchain has the authority to call the interface of the subscription contract, Further, the above-mentioned first smart contract sends a call message to the subscription contract, thereby triggering the above-mentioned subscription contract to execute data filtering logic.
  • the subscription blockchain may send a subscription contract invocation request message to the data source blockchain across the chain, and the invocation request message may include the timing requirements for the subscription contract invocation, for example, every pre-order Set the time period to make a call to the subscription contract, or to call the subscription contract when the preset trigger conditions are met, so as to facilitate the node device of the data source blockchain to send the subscription contract or the first call according to the above-mentioned call timing requirements.
  • a call transaction of a smart contract may be used to send the subscription contract or the first call according to the above-mentioned call timing requirements.
  • the traceability information data of the specified commodity filtered by the subscription contract can be stored in the account space of the subscription contract in the data source blockchain.
  • the data source area The node device of the block chain obtains the traceability information data of the specified commodity by monitoring the account content of the subscription contract; the node device responsible for the cross-chain communication with the subscription block chain in the data source block chain can obtain the specified specified product.
  • the traceability information data of the commodity is pushed to the above-mentioned subscription block chain, so as to meet the above-mentioned call cycle demand, and the subscription information data is pushed.
  • the embodiment of this specification also provides a cross-chain data subscription device 60.
  • the device 60 can be implemented by software, or can be implemented by hardware or a combination of software and hardware.
  • Taking software implementation as an example as a logical device, it is formed by reading the corresponding computer program instructions into the memory by the CPU (Central Process Unit, central processing unit) of the device where it is located.
  • the CPU Central Process Unit, central processing unit
  • the device where the above-mentioned device is located usually also includes other hardware such as chips for wireless signal transmission and reception, and/or for implementing network communication functions. Other hardware such as boards.
  • this specification also provides a cross-chain data subscription device 60, which is applied to a multi-chain system including a data source block chain and a subscription block chain; wherein, the data source block chain and the The subscription block chain is connected across the chain; the data source block chain is deployed with a first smart contract for managing the subscription contract code that the subscription block chain publishes to the data source block chain across the chain; so
  • the execution logic corresponding to the contract code of the first smart contract includes the audit logic of the subscription contract code;
  • the device 60 is applied to the node device end of the data source blockchain, and includes: a sending unit 602, in response to the subscription from the The data query request sent by the node device in the blockchain across the chain is to send 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; the receiving unit 604, Receive the subscription contract code that the node device in the subscription block chain publishes to the data source block chain across the chain; wherein, the execution logic corresponding to the subscription contract code includes: The data filtering
  • the data source blockchain is also deployed with a second smart contract for performing qualification audit results statistics on the subscription chain;
  • the receiving unit 604 is further configured to Before sending the data description of the source data related to the target business stored in the data source blockchain to the subscription blockchain, receive the data source blockchain to which the node devices in the subscription blockchain are published across chains The qualification review application; the review unit 608, based on the qualification review application, executes the qualification review of the subscription blockchain, and sends the qualification review results to the data source blockchain; the smart contract execution unit 606 , And 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 on the subscription blockchain.
  • the execution logic corresponding to the contract code of the first smart contract further includes subscription interface authorization logic;
  • the receiving unit 604 is further configured to receive node devices in the subscription blockchain The subscription interface authorization application of the data source blockchain published to the cross-chain;
  • the smart contract execution unit 606 further calls the first smart contract, executes the subscription interface authorization logic, and is the subscription blockchain Set the interface calling authority for the subscription contract.
  • the smart contract execution unit 606 is further configured to: call the first smart contract, and after it is determined that the subscription blockchain has the authority to call the interface of the subscription contract, The subscription contract is further called, the data screening logic is executed, and the target data is filtered out from the source data; the sending unit 602 is further configured to send the screened target data to the subscription area Block chain, so that the subscription block chain executes the target business based on the target data.
  • the receiving unit 604 is further configured to receive a subscription contract invocation request message sent by the subscription blockchain cross-chain, and the subscription contract invocation request message is used to request the data source
  • the node device of the blockchain invokes the subscription contract based on a preset time period or a preset trigger condition.
  • the data description is generated based on source data that has been desensitized.
  • the target business is a traceability business of the target commodity
  • the target data is traceability information related to the production or circulation of the target commodity.
  • the data source blockchain is a consortium chain.
  • the device implementations described above are merely illustrative, where the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement it without creative work.
  • a typical implementation device is a computer.
  • the specific form of the computer can be 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 receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the implementation manners of this specification also provide a computer device.
  • 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 steps of the cross-chain data subscription method executed by the node device of the data source blockchain in the embodiment of this specification. .
  • the steps of the cross-chain data subscription method executed by the node device of the data source blockchain please refer to the previous content, and will not be repeated.
  • the implementation of this specification also provides a computer-readable storage medium on which computer programs are stored. These computer programs, when run by a processor, execute the data in the implementation of this specification.
  • Each step of the cross-chain data subscription method executed by the node device of the source blockchain When a detailed description of the steps of the cross-chain data subscription method executed by the node device of the data source blockchain, please refer to the previous content, and will not be repeated.
  • the computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-permanent memory in computer readable media, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • Information can be computer-readable instructions, data structures, program modules, or other data.
  • 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, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • CD-ROM compact disc
  • DVD digital versatile disc
  • Magnetic cassettes magnetic tape magnetic disk storage or other magnetic storage devices or any other non
  • the implementation of this specification can be provided as a method, a system or a computer program product. Therefore, the implementation manners in this specification may adopt the form of a complete hardware implementation, a complete software implementation, or a combination of software and hardware implementations. Moreover, the implementation of this specification can take 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. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Strategic Management (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Human Resources & Organizations (AREA)
  • General Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Technology Law (AREA)
  • Development Economics (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

提供了一种跨链数据订阅方法和装置,包括:接收订阅区块链中的节点设备跨链发布至数据源区块链的订阅合约代码;其中,订阅合约代码对应的执行逻辑包括,从数据源区块链存储的与目标业务相关的源数据中筛选出、基于数据描述确定的目标数据的数据筛选逻辑(404);调用第一智能合约,执行对订阅合约代码的审核逻辑,对订阅合约代码进行审核,并在审核通过时,将订阅合约代码发布至数据源区块链,以在数据源区块链上部署与订阅合约代码对应的订阅合约(406);调用订阅合约,执行数据筛选逻辑,从源数据中筛选出目标数据,并将目标数据发送给订阅区块链。

Description

跨链数据订阅 技术领域
本说明书一个或多个实施方式涉及区块链技术领域,尤其涉及一种跨链数据订阅。
背景技术
区块链技术,也被称之为分布式账本技术,是一种由若干台计算设备共同参与“记账”,共同维护一份完整的分布式数据库的新兴技术。由于区块链技术具有去中心化、公开透明、每台计算设备可以参与数据库记录、并且各计算设备之间可以快速的进行数据同步的特性,使得区块链技术已在众多的领域中广泛的进行应用。多区块链间的跨链交互技术使得信息可以在不同的区块链间流通起来。
发明内容
有鉴于此,本说明书一个或多个实施方式提供了一种跨链数据订阅方法,应用于包括数据源区块链和订阅区块链的多链系统。其中,所述数据源区块链与所述订阅区块链跨链连接;所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑;所述方法由所述数据源区块链的节点设备执行,包括:响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链;接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括,从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出、基于所述数据描述确定的目标数据的数据筛选逻辑;调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约;调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述数据源区块链还部署有用于对所述订阅链进行资质审核结果统计的第二智能合约,所述方法还包括:在将所述数据源区块链存储的与目标 业务相关的源数据的数据描述发送至所述订阅区块链之前,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的资质审核申请;基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链;调用所述第二智能合约,执行所述第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果;在对所述订阅区块链的资质审核结果为通过时,将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链。
在又一示出的实施方式中,所述第一智能合约的合约代码对应的执行逻辑还包括订阅接口授权逻辑;所述方法还包括:接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授权申请;调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
在又一示出的实施方式中,所述调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务,包括:调用所述第一智能合约,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据;将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述的方法,还包括:接收所述订阅区块链跨链发送的订阅合约调用请求消息,所述订阅合约调用请求消息用于请求所述数据源区块链的节点设备基于预设的时间周期或预设的触发条件调用所述订阅合约。
在又一示出的实施方式中,所述数据描述是基于被脱敏处理后的源数据而生成的。
在又一示出的实施方式中,所述目标业务为对目标商品的溯源业务,所述目标数据为与目标商品的生产或流通相关的溯源信息。
在又一示出的实施方式中,所述数据源区块链为联盟链。
相应地,本说明书还提供了一种跨链数据订阅装置,应用于包括数据源区块链和订阅区块链的多链系统;其中,所述数据源区块链与所述订阅区块链跨链连接;所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑;所述装置应用于所述数据源区块链的节点设备端,包括:发送单元, 响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链;接收单元,接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括,从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出、基于所述数据描述确定的目标数据的数据筛选逻辑;智能合约执行单元,调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约;所述智能合约执行单元,进一步用于调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述数据源区块链还部署有用于对所述订阅链进行资质审核结果统计的第二智能合约;所述接收单元,进一步用于在将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链之前,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的资质审核申请;审核单元,基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链;所述智能合约执行单元,进一步用于调用所述第二智能合约,执行所述第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果。
在又一示出的实施方式中,所述第一智能合约的合约代码对应的执行逻辑还包括订阅接口授权逻辑;所述接收单元,进一步用于接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授权申请;所述智能合约执行单元,进一步调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
在又一示出的实施方式中,所述智能合约执行单元,进一步用于:调用所述第一智能合约,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据;所述发送单元,进一步用于将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述接收单元,进一步用于接收所述订阅区块链跨链发送的订阅合约调用请求消息,所述订阅合约调用请求消息用于请求所述数据源区块链的 节点设备基于预设的时间周期或预设的触发条件调用所述订阅合约。
在又一示出的实施方式中,所述数据描述是基于被脱敏处理后的源数据而生成的。
在又一示出的实施方式中,所述目标业务为对目标商品的溯源业务,所述目标数据为与目标商品的生产或流通相关的溯源信息。
在又一示出的实施方式中,所述数据源区块链为联盟链。
相应地,本说明书还提供了一种计算机设备,包括:存储器和处理器;所述存储器上存储有可由所述处理器运行的计算机程序;所述处理器运行所述计算机程序时,执行如上述各实施方式所述的、数据源区块链的节点设备所执行的跨链数据订阅方法。
相应地,本说明书还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时,执行如上述各实施方式所述的、数据源区块链的节点设备所执行的跨链数据订阅方法。
本说明书各个实施方式提供的跨链数据订阅方法、装置、计算机设备及计算机可读存储介质,利用订阅合约对订阅区块链需求的目标数据进行定制化,由数据源区块链对订阅合约进行调用执行,并将执行结果跨链推送给订阅区块链,促进了区块链间的数据流通,打破数据信息孤岛,提升了数据利用价值;而且上述订阅合约代码基于数据源区块链确定出的数据描述构建,且由于订阅合约在数据源区块链内部署及调用执行,可有效防止隐私敏感信息的泄露,维护数据源区块链的用户的隐私安全。
附图说明
图1是一示例性实施方式提供的创建智能合约的示意图;
图2是一示例性实施方式提供的一种调用智能合约的示意图;
图3是一示例性实施方式提供的创建智能合约和调用智能合约的示意图;
图4是一示例性实施方式提供的跨链数据订阅方法的流程示意图;
图5是一示例性实施方式提供的跨链溯源数据订阅方法的示意图;
图6是一示例性实施方式提供的跨链数据订阅装置的示意图;
图7是运行本说明书所提供的跨链数据订阅装置实施方式的一种硬件结构图。
具体实施方式
这里将详细地对示例性实施方式进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施方式中所描述的实施方式并不代表与本说明书一个或多个实施方式相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施方式的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施方式中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施方式中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施方式中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施方式中也可能被合并为单个步骤进行描述。
随着联盟链应用业务日渐成熟,联盟内的数据越来越丰富;丰富的数据不仅为业务的正常运行提供有力保证,其数据价值也日渐凸显。而由于联盟链为需要授权准入的区块链,因此其账本数据只有其联盟内的成员可访问;这就造成数据孤岛,其数据只能在整个联盟内使用;而如果为利用其数据价值,无限邀请其他联盟成员的加入,一方面会对业务参与的联盟方造成数据隐私的泄露,对其权益造成一定的危害;另一方面,引入其他业务,也会违背当初创建联盟创建的约定,造成联盟链内数据混乱,不易管理。
鉴于以上的问题,本说明书的一个或多个实施方式提供了一种跨链数据订阅方法,应用于包括数据源区块链和订阅区块链的多链系统。
本说明书一个或多个实施方式所述的区块链或区块链网络,具体可指一个各节点设备通过共识机制达成的、具有分布式数据存储结构的P2P网络系统,该区块链内的账本数据分布在时间上相连的一个个“区块(block)”之内,后一区块可包含前一区块的数据摘要,且根据具体的共识机制(如POW、POS、DPOS或PBFT等)的不同,达成全部或部分节点的数据全备份。
对于物理世界产生的真实数据,可以将其构建成区块链所支持的标准的交易(transaction)格式,然后发布至区块链,由区块链中的节点设备对收到的交易进行共识处理,并在达成共识后,由区块链中作为记账节点的节点设备,将这笔交易打包进区块,在区块链中进行持久化存证。
无论区块链采用哪种共识算法,记账节点均可以将接收到的交易打包以生成最新区 块,并将生成的最新区块或者该最新区块的区块头发送至其它节点设备进行共识验证。如果其它节点设备接收到最新区块或者该最新区块的区块头后,经验证没有问题,可以将该最新区块追加到原有的区块链末尾,从而完成区块链的记账过程。其它节点验证记账节点发来的新的区块或区块头的过程中,也可以执行该区块中的包含的交易。
区块链一般被划分为三种类型:公有链(Public Blockchain),私有链(Private Blockchain)和联盟链(Consortium Blockchain)。此外,还可以有上述多种类型的结合,比如私有链+联盟链、联盟链+公有链等。
其中,去中心化程度最高的是公有链。公有链以比特币、以太坊为代表,加入公有链的参与者(也可称为区块链中的节点)可以读取链上的数据记录、参与交易、以及竞争新区块的记账权等。而且,各节点可自由加入或者退出网络,并进行相关操作。
私有链则相反,该网络的写入权限由某个组织或者机构控制,数据读取权限受组织规定。简单来说,私有链可以为一个弱中心化系统,其对节点具有严格限制且节点数量较少。这种类型的区块链更适合于特定机构内部使用。
联盟链则是介于公有链以及私有链之间的区块链,可实现“部分去中心化”。联盟链中各个节点通常有与之相对应的实体机构或者组织;节点通过授权加入网络并组成利益相关联盟,共同维护区块链运行。
可以预期,本说明书所提供的实施方式能够在任何合适类型的区块链网络中实现。
在实际应用中,不论是公有链、私有链还是联盟链,都可能提供智能合约(Smart contract)的功能。区块链上的智能合约是在区块链上可以被交易触发执行的合约。智能合约可以通过代码的形式定义。
以以太坊为例,支持用户在以太坊网络中创建并调用一些复杂的逻辑。以太坊作为一个可编程区块链,其核心是以太坊虚拟机(EVM),每个以太坊节点都可以运行EVM。EVM是一个图灵完备的虚拟机,通过它可以实现各种复杂的逻辑。用户在以太坊中发布和调用智能合约就是在EVM上运行的。实际上,EVM直接运行的是虚拟机代码(虚拟机字节码,下简称“字节码”),所以部署在区块链上的智能合约可以是字节码。
如图1所示,Bob将一笔包含创建智能合约信息的交易(Transaction)发送到以太坊网络后,各节点均可以在EVM中执行这笔交易。其中,图中交易的From字段用于记录发起创建智能合约的账户的地址,交易的Data字段的字段值保存的合约代码可以是字节码,交易的To字段的字段值为一个null(空)的账户。当节点间通过共识机制 达成一致后,这个智能合约成功创建,后续用户可以调用这个智能合约。
智能合约创建后,区块链上出现一个与该智能合约对应的合约账户,并拥有一个特定的地址;比如,图1中各节点中的“0x68e12cf284…”就代表了创建的这个合约账户的地址;合约代码(Code)和账户存储(Storage)将保存在该合约账户的账户存储中。智能合约的行为由合约代码控制,而智能合约的账户存储则保存了合约的状态。换句话说,智能合约使得区块链上产生包含合约代码和账户存储的虚拟账户。
前述提到,包含创建智能合约的交易的Data字段保存的可以是该智能合约的字节码。字节码由一连串的字节组成,每一字节可以标识一个操作。基于开发效率、可读性等多方面考虑,开发者可以不直接书写字节码,而是选择一门高级语言编写智能合约代码。例如,高级语言可以采用诸如Solidity、Serpent、LLL语言等。对于采用高级语言编写的智能合约代码,可以经过编译器编译,生成可以部署到区块链上的字节码。
以Solidity语言为例,用其编写的合约代码与面向对象编程语言中的类(Class)很相似,在一个合约中可声明多种成员,包括状态变量、函数、函数修改器、事件等。状态变量是永久存储在智能合约的账户存储(Storage)字段中的值,用于保存合约的状态。
如图2所示,仍以以太坊为例,Bob将一笔包含调用智能合约信息的交易发送到以太坊网络后,各节点均可在EVM中执行这笔交易。其中,图中交易的From字段用于记录发起调用智能合约的账户的地址,To字段用于记录被调用的智能合约的地址,交易的Data字段用于记录调用智能合约的方法和参数。调用智能合约后,合约账户的账户状态可能改变。后续,某个客户端可通过接入的区块链节点查看合约账户的账户状态。
智能合约可以以规定的方式在区块链网络中每个节点独立的执行,所有执行记录和数据都保存在区块链上,所以当这样的交易执行完毕后,区块链上就保存了无法篡改、不会丢失的交易凭证。
创建智能合约和调用智能合约的示意图如图3所示。以太坊中要创建一个智能合约,需要经过编写智能合约、变成字节码、部署到区块链等过程。以太坊中调用智能合约,是发起一笔指向智能合约地址的交易,各个节点的EVM可以分别执行该交易,将智能合约代码分布式的运行在以太坊网络中每个节点的虚拟机中。
在本说明书提供的一个或多个实施方式中,数据源区块链是存储有订阅区块链期待获取的数据信息的区块链,订阅区块链与数据源区块链跨链连接。本说明书中对订阅区块链和数据源区块链的跨链连接方式不作具体限定。例如,订阅区块链可以通过跨链中 继实现跨链对接。
其中,跨链中继,可以通过桥接接口与多个区块链分别进行对接,并基于实现的数据搬运逻辑,完成该多个区块链之间的跨链数据同步。在实现上述跨链中继时所采用的跨链技术,在本说明书中不进行特别限定;例如,在实际应用中,可以通过侧链技术、公证人技术等跨链机制,将多个区块链连接起来。当多个区块链通过跨链中继实现对接之后,区块链之间就可以去读取并认证其它区块链上的数据,也可以通过跨链中继去调用其它区块链上部署的智能合约。
需要说明的是,跨链中继仅用于多个区块链之间搬运数据,并不需要对搬运的数据进行持久化存储,也不需要维护所搬运的数据的数据状态。在实际应用中,跨链中继可以配置在其所连接的多个区块链之外的设备、节点或平台等处,也可以配置在其所连接的多个区块链的节点设备上,在本说明书中不进行特别限定。
在图4所示例的实施方式中,所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑。
图4所示跨链数据订阅方法的实施方式可由数据源区块链的节点设备执行,包括:
步骤402,响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链。
数据源区块链上存储有与订阅链上运营的目标业务相关的源数据信息。
在一示出的实施方式中,上述源数据的数据描述可以被包含在订阅区块链的节点设备发送的数据查询请求中,由数据源节点设备查询上述数据描述对应的源数据是否可被上述订阅区块链订阅,并在确定可被订阅后,再将上述数据描述(或对上述数据描述的确定消息)返回至订阅区块链。
在又一示出的实施方式中,上述源数据的数据描述也可由数据源区块链节点设备响应于上述数据查询请求,通过查询获得与目标业务相关的源数据,并基于查询所得的源数据而生成源数据的数据描述,并将上述数据描述发送至订阅区块链,以告知订阅区块链可为其提供的订阅数据内容。
值得注意的是,为了保护源数据内一些特定信息的隐私安全性,上述数据源区块链节点设备可对查询所得的源数据进行脱敏处理,即摒除涉及隐私安全性的敏感信息,再 基于被脱敏处理后的源数据生成相应的数据描述。
步骤404,接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出,基于所述数据描述确定出的目标数据的数据筛选逻辑。
订阅区块链在收到数据源区块链发送的与目标业务相关的源数据的数据描述后,可以基于该数据描述定制用于获取与数据描述对应的目标数据的智能合约——订阅合约,所述订阅合约代码对应的执行逻辑包括从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出,基于所述数据描述确定出的目标数据的数据筛选逻辑。本实施方式对订阅区块链指定上述订阅合约的具体过程不做限定,上述订阅区块链的节点设备可对基于数据描述生成的订阅合约进行共识,并将共识所得的订阅合约的代码跨链发送至数据源区块链。
步骤406,调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约。
数据源区块链上部署用于对上述订阅合约代码进行管理的第一智能合约,响应于数据源区块链上发布的包含上述订阅合约代码的调用交易,调用上述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链。
图1及相关的描述已经详细例示了根据用户发布的智能合约创建交易创建智能合约的具体过程;在本实施方式中,订阅合约是由对订阅合约代码进行管理的第一智能合约来创建的,因此,对订阅合约的创建交易是由第一智能合约在对订阅合约代码审核通过后发布至区块链的;区块链的节点设备对订阅合约的创建交易通过共识机制达成一致后,订阅合约成功创建,后续数据源区块链的节点设备即可调用这个订阅合约。
订阅合约创建后,区块链上出现一个与该订阅合约对应的合约账户,并拥有一个特定的地址,即订阅合约标识。数据源区块链可将上述订阅合约标识跨链发送回订阅区块链,以方便订阅区块链对订阅合约进行登记管理。
步骤408,调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据返回给所述订阅区块链,以基于所述目标数据执行所述目标业务。
上述数据源区块链上的节点设备对订阅合约的调用,可由数据源区块链的节点设备发送的包括上述订阅合约地址的调用交易来触发,也可以在其他智能合约(如上述对订阅合约代码进行管理的第一智能合约)被调用执行的过程中,由其他智能合约发送对上述订阅合约的调用消息来触发。
上述订阅合约可从指定地址(如合约代码指定的交易地址或账户地址)读取源数据,并对读取到的源数据执行所述数据筛选逻辑,例如,筛选出与上述订阅合约包括的数据描述信息对应的目标数据。
经订阅合约的调用执行,上述订阅合约筛选出的目标数据可被保存在订阅合约在上述数据源区块链的账户空间内,上述数据源区块链的节点设备通过监听上述订阅合约的账户内容来获得上述订阅合约的执行结果——上述目标数据;在数据源区块链中负责与订阅区块链跨链通信的节点设备,可将其获得的上述目标数据推送至上述订阅区块链的节点设备。
上述实施方式提供的跨链数据订阅方法,利用订阅合约对订阅区块链需求的目标数据进行定制化,由数据源区块链对订阅合约进行调用执行,并将执行结果跨链推送给订阅区块链,促进了区块链间的数据流通,打破数据信息孤岛,提升了数据利用价值;而且上述订阅合约代码基于数据源区块链确定出的数据描述构建,上述数据描述可基于被脱敏处理的数据源生成,且由于订阅合约在数据源区块链内部署及调用执行,可有效防止隐私敏感信息的泄露,维护数据源区块链的用户的隐私安全。
本说明书以下内容将上述实施方式所描述的跨链数据订阅方法应用于商品信息溯源查询场景中,并扩展出更多示例性的实施方式。
在本实施方式中,数据源区块链为联盟链,其上存储有多种商品的产地信息、生产工艺信息、物流信息、分销商信息等;订阅区块链上运营有指定商品的电商业务,在现有电商业务中,为证明商品真实性,对商品进行产地及物流溯源成为越来越多用户的需求。由于数据源区块链上信息丰富且包含一些隐私敏感信息(如生产工艺、分销商信息,或者向数据源区块链中上传上述各种信息的上传者信息、上传地点信息),数据源区块链对其联盟成员节点设备的准入要求较为严格,随意加入其它节点作为联盟成员节点将会损害已有联盟成员的权益;此时,订阅链的节点设备无法获得加入上述数据源区块链的权限,而较难获知与其运营的指定商品相关的信息。
在本实施方式中,订阅区块链可与数据源区块链通过中继节点跨链连接,且数据源 区块链中部署有用于管理订阅合约的智能合约,上述智能合约的合约代码对应的执行逻辑可包括订阅合约代码审核逻辑、订阅链资质审核结果统计逻辑、订阅接口授权逻辑等多个逻辑。本领域技术人员应知,上述订阅合约代码审核逻辑、订阅链资质审核结果统计逻辑、订阅接口授权逻辑可被包括在同一个智能合约的执行逻辑中,并基于不同的调用接口被调用执行;也可被分配在不同的智能合约(如第一智能合约、第二智能合约)的执行逻辑内,由节点设备分别调用不同的智能合约来执行,在本说明书中不作限定。
为执行对指定商品的溯源业务,订阅区块链的节点设备期待数据源区块链可执行上述实施方式中提供的跨链数据订阅方法,来获取与指定商品的生产或流通相关的溯源信息。图5示意了在跨链溯源信息查询场景中使用的跨链数据订阅方法的流程步骤,包括:
步骤501,所述数据源区块链的节点设备接收所述订阅区块链跨链发送的用于溯源信息订阅的资质审核申请;基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链。
由于数据源区块链为联盟链,为了保护各联盟成员方的利益,在本实施方式中可由数据源区块链的各联盟方审核订阅区块链的资质,以决策是否同意为该订阅区块链提供商品溯源信息。
上述订阅区块链发送的资质认证申请具体可包括订阅区块链中各节点设备相关的用户或企业名称、身份标识、数据用途等等。
数据源区块链中负责与订阅区块链跨链通信的节点设备在获得订阅区块链跨链发送的上述资质审核申请后,可将上述资质审核申请以交易的形式发送到数据源区块链,以使数据源区块链的其他节点设备获取上述资质审核申请,并进行资质审核。
步骤502,调用第二智能合约,执行第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果。
在又一示出的实施方式中,包含上述资质审核申请的交易可以作为第三智能合约调用交易,以使数据源区块链的各个节点设备通过调用第三智能合约的资质审核逻辑,对订阅区块链的资质进行审核,并将审核结果发送至第二智能合约中,以方便第二智能合约执行资质审核结果统计逻辑,获得对上述订阅区块链的资质审核结果。
可选地,上述资质审核结果可以以可订阅权限的形式被设置在上述第二智能合约的权限控制名单内。
步骤503,响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,在 确定所述订阅区块链的资质审核结果为通过或具备订阅权限时,将所述数据源区块链存储的指定商品的溯源信息数据的数据描述发送至所述订阅区块链。
上述数据查询请求用于请求获取数据源区块链中存储的、指定商品的溯源信息数据的数据描述,上述数据描述可以为数据源区块链可提供给订阅区块链的、指定商品溯源信息的内容名称(摘要),如商品名称、产地、产地报告、物流中转站等。值得注意的是,数据源区块链在为上述指定商品的溯源信息数据生成数据描述时,可以选择不具有隐私敏感性的、更适于公开的信息数据生成数据描述,剔除上述溯源信息数据的上传者或上传地址等隐私信息。
步骤504,接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括从所述数据源区块链存储的指定商品的溯源信息数据中筛选出,基于上述数据描述确定的目标数据的数据筛选逻辑。
订阅区块链在收到步骤503中所述的数据描述后,可展开对订阅合约的编写制定,本实施方式并不限定订阅区块链对订阅合约的编写制定方式,例如,可调用订阅区块链上部署的用于制定订阅合约的智能合约,基于上述数据描述制定出对应的订阅合约。
步骤505,调用第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约。
上述对订阅合约代码进行审核的具体内容可包括,审核订阅合约所包括的数据描述是否与数据源区块链在步骤503中确定的数据描述内容相符,从而防止订阅合约获取超出上述数据描述内容范围的信息。
步骤506,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授权申请;调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
上述订阅合约被部署上数据源区块链后,数据源区块链可将上述订阅合约标识(合约地址)跨链发送给订阅区块链;为了方便订阅区块链调用上述订阅合约,或者方便将订阅区块链与订阅合约关联,可为上述订阅区块链设置对上述订阅合约的接口调用权限。
具体的,上述订阅接口授权申请可包括上述订阅区块链的系统标识、订阅区块链中负责跨链调用的节点设备的证书、订阅合约的标识、订阅接口的名称等,本实施方式对此不作限定。
步骤507,调用所述订阅合约,执行所述数据筛选逻辑,从溯源信息数据中筛选出与上述数据描述对应的、指定商品的溯源信息数据;
步骤508,将筛选出的所述指定商品的溯源信息数据返回给所述订阅区块链,以使订阅区块链可基于指定商品的溯源信息数据执行所述指定商品的溯源业务。
在一示出的实施方式中,上述数据源区块链的节点设备可向数据源区块链发送对上述订阅合约的调用交易,以触发上述订阅合约执行数据筛选逻辑。
在又一示出的实施方式中,上述数据源区块链的节点设备可向上述第一智能合约发送调用交易,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步由上述第一智能合约向订阅合约发送调用消息,从而触发上述订阅合约执行数据筛选逻辑。
在又一示出的实施方式中,订阅区块链可向数据源区块链跨链发送订阅合约调用请求消息,该调用请求消息中可包括对订阅合约的调用时机需求,例如,每隔预设的时间周期进行一次订阅合约的调用,或者在满足预设的触发条件时进行订阅合约的调用,以方便数据源区块链的节点设备按照上述的调用时机需求,发送对订阅合约、或第一智能合约的调用交易。
相应地,在每完成对订阅合约的数据筛选逻辑的调用,上述订阅合约筛选出的指定商品的溯源信息数据可被保存在订阅合约在上述数据源区块链的账户空间内,上述数据源区块链的节点设备通过监听上述订阅合约的账户内容来获得上述指定商品的溯源信息数据;在数据源区块链中负责与订阅区块链跨链通信的节点设备,可将其获得的上述指定商品的溯源信息数据推送至上述订阅区块链,从而以满足上述调用周期需求的形式,进行订阅信息数据的推送。
与上述流程实现对应,本说明书的实施方式还提供了一种跨链数据订阅装置60。装置60可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为逻辑意义上的装置,是通过所在设备的CPU(Central Process Unit,中央处理器)将对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,除了图7所示的CPU、内存以及存储器之外,上述装置所在的设备通常还包括用于进行无线信号收发的芯片等其他硬件,和/或用于实现网络通信功能的板卡等其他硬件。
如图6所示,本说明书还提供了一种跨链数据订阅装置60,应用于包括数据源区块链和订阅区块链的多链系统;其中,所述数据源区块链与所述订阅区块链跨链连接;所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅 合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑;所述装置60应用于所述数据源区块链的节点设备端,包括:发送单元602,响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链;接收单元604,接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括,从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出、基于所述数据描述确定的目标数据的数据筛选逻辑;智能合约执行单元606,调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约;所述智能合约执行单元606,进一步用于调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述数据源区块链还部署有用于对所述订阅链进行资质审核结果统计的第二智能合约;所述接收单元604,进一步用于在将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链之前,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的资质审核申请;审核单元608,基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链;所述智能合约执行单元606,进一步用于调用所述第二智能合约,执行所述第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果。
在又一示出的实施方式中,所述第一智能合约的合约代码对应的执行逻辑还包括订阅接口授权逻辑;所述接收单元604,进一步用于接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授权申请;所述智能合约执行单元606,进一步调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
在又一示出的实施方式中,所述智能合约执行单元606,进一步用于:调用所述第一智能合约,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据;所述发送单元602,进一步用于将筛选出的所述目标数据发送给所述订阅区块链,以使所 述订阅区块链基于所述目标数据执行所述目标业务。
在又一示出的实施方式中,所述接收单元604,进一步用于接收所述订阅区块链跨链发送的订阅合约调用请求消息,所述订阅合约调用请求消息用于请求所述数据源区块链的节点设备基于预设的时间周期或预设的触发条件调用所述订阅合约。
在又一示出的实施方式中,所述数据描述是基于被脱敏处理后的源数据生成的。
在又一示出的实施方式中,所述目标业务为对目标商品的溯源业务,所述目标数据为与目标商品的生产或流通相关的溯源信息。
在又一示出的实施方式中,所述数据源区块链为联盟链。
上述装置60中各个单元的功能和作用的实现过程具体详见上述数据源区块链的节点设备所执行的跨链数据订阅方法中对应步骤的实现过程,相关之处参见方法实施方式的部分说明即可,在此不再赘述。
以上所描述的装置实施方式仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部单元或模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
上述实施方式阐明的装置、单元、模块,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
与上述方法实施方式相对应,本说明书的实施方式还提供了一种计算机设备,如图7所示,该计算机设备包括存储器和处理器。其中,存储器上存储有能够由处理器运行的计算机程序;处理器在运行存储的计算机程序时,执行本说明书实施方式中数据源区块链的节点设备所执行的跨链数据订阅方法的各个步骤。对上述数据源区块链的节点设备所执行的跨链数据订阅方法的各个步骤的详细描述请参见之前的内容,不再重复。
与上述方法实施方式相对应,本说明书的实施方式还提供了一种计算机可读存储介质,该存储介质上存储有计算机程序,这些计算机程序在被处理器运行时,执行本说明书实施方式中数据源区块链的节点设备所执行的跨链数据订阅方法的各个步骤。对 上述数据源区块链的节点设备所执行的跨链数据订阅方法的各个步骤的详细描述请参见之前的内容,不再重复。
以上所述仅为本说明书的较佳实施方式而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可由任何方法或技术来实现信息存储。信息可是计算机可读指令、数据结构、程序的模块或其他数据。
计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本说明书的实施方式可提供为方法、系统或计算机程序产品。因此,本说明书的实施方式可采用完全硬件实施方式、完全软件实施方式或结合软件和硬件方面的实施方式的形式。而且,本说明书的实施方式可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。

Claims (18)

  1. 一种跨链数据订阅方法,应用于包括数据源区块链和订阅区块链的多链系统;其中,所述数据源区块链与所述订阅区块链跨链连接;所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑;所述方法由所述数据源区块链的节点设备执行,包括:
    响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链;
    接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括,从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出、基于所述数据描述确定的目标数据的数据筛选逻辑;
    调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约;
    调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
  2. 根据权利要求1所述的方法,所述数据源区块链还部署有用于对所述订阅链进行资质审核结果统计的第二智能合约,所述方法还包括:
    在将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链之前,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的资质审核申请;
    基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链;
    调用所述第二智能合约,执行所述第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果;
    在对所述订阅区块链的资质审核结果为通过时,将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链。
  3. 根据权利要求1或2所述的方法,所述第一智能合约的合约代码对应的执行逻辑还包括订阅接口授权逻辑;所述方法还包括:
    接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授 权申请;
    调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
  4. 根据权利要求3所述的方法,所述调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务,包括:
    调用所述第一智能合约,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据;
    将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
  5. 根据权利要求1所述的方法,还包括:
    接收所述订阅区块链跨链发送的订阅合约调用请求消息,所述订阅合约调用请求消息用于请求所述数据源区块链的节点设备基于预设的时间周期或预设的触发条件调用所述订阅合约。
  6. 根据权利要求1所述的方法,所述数据描述是基于被脱敏处理后的源数据而生成的。
  7. 根据权利要求1所述的方法,所述目标业务为对目标商品的溯源业务,所述目标数据为与目标商品的生产或流通相关的溯源信息。
  8. 根据权利要求1所述的方法,所述数据源区块链为联盟链。
  9. 一种跨链数据订阅装置,应用于包括数据源区块链和订阅区块链的多链系统;其中,所述数据源区块链与所述订阅区块链跨链连接;所述数据源区块链上部署有用于对所述订阅区块链跨链发布至所述数据源区块链的订阅合约代码进行管理的第一智能合约;所述第一智能合约的合约代码对应的执行逻辑包括订阅合约代码的审核逻辑;所述装置应用于所述数据源区块链的节点设备端,包括:
    发送单元,响应于来自所述订阅区块链中的节点设备跨链发送的数据查询请求,将所述数据源区块链存储的与目标业务相关的源数据的数据描述跨链发送至所述订阅区块链;
    接收单元,接收订阅区块链中的节点设备跨链发布至所述数据源区块链的订阅合约代码;其中,所述订阅合约代码对应的执行逻辑包括,从所述数据源区块链存储的与所述目标业务相关的源数据中筛选出、基于所述数据描述确定的目标数据的数据筛选逻辑;
    智能合约执行单元,调用所述第一智能合约,执行对所述订阅合约代码的审核逻辑,对所述订阅合约代码进行审核,并在审核通过时,将所述订阅合约代码发布至所述数据源区块链,以在所述数据源区块链上部署与所述订阅合约代码对应的订阅合约;
    所述智能合约执行单元,进一步用于调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据,并将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
  10. 根据权利要求9所述的装置,所述数据源区块链还部署有用于对所述订阅链进行资质审核结果统计的第二智能合约;
    所述接收单元,进一步用于在将所述数据源区块链存储的与目标业务相关的源数据的数据描述发送至所述订阅区块链之前,接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的资质审核申请;
    审核单元,基于所述资质审核申请,执行对所述订阅区块链的资质审核,并将资质审核结果发送至所述数据源区块链;
    所述智能合约执行单元,进一步用于调用所述第二智能合约,执行所述第二智能合约声明的资质审核结果统计逻辑,获得对所述订阅区块链的资质审核结果。
  11. 根据权利要求9或10所述的装置,所述第一智能合约的合约代码对应的执行逻辑还包括订阅接口授权逻辑;
    所述接收单元,进一步用于接收所述订阅区块链中的节点设备跨链发布至的所述数据源区块链的订阅接口授权申请;
    所述智能合约执行单元,进一步调用所述第一智能合约,执行所述订阅接口授权逻辑,为所述订阅区块链设置对所述订阅合约的接口调用权限。
  12. 根据权利要求11所述的装置,所述智能合约执行单元,进一步用于:
    调用所述第一智能合约,在确定所述订阅区块链具有对所述订阅合约的接口调用权限后,进一步调用所述订阅合约,执行所述数据筛选逻辑,从所述源数据中筛选出所述目标数据;
    所述发送单元,进一步用于将筛选出的所述目标数据发送给所述订阅区块链,以使所述订阅区块链基于所述目标数据执行所述目标业务。
  13. 根据权利要求9所述的装置,所述接收单元,进一步用于接收所述订阅区块链跨链发送的订阅合约调用请求消息,所述订阅合约调用请求消息用于请求所述数据源区块链的节点设备基于预设的时间周期或预设的触发条件调用所述订阅合约。
  14. 根据权利要求9所述的装置,所述数据描述是基于被脱敏处理后的源数据而生 成的。
  15. 根据权利要求9所述的装置,所述目标业务为对目标商品的溯源业务,所述目标数据为与目标商品的生产或流通相关的溯源信息。
  16. 根据权利要求9所述的装置,所述数据源区块链为联盟链。
  17. 一种计算机设备,包括:存储器和处理器;所述存储器上存储有可由所述处理器运行的计算机程序;所述处理器运行所述计算机程序时,执行如权利要求1至8任意一项所述的方法。
  18. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现如权利要求1至8中任一项所述方法的步骤。
PCT/CN2021/081798 2020-04-02 2021-03-19 跨链数据订阅 WO2021197097A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010254516.4 2020-04-02
CN202010254516.4A CN111159307B (zh) 2020-04-02 2020-04-02 跨链数据订阅方法及装置

Publications (1)

Publication Number Publication Date
WO2021197097A1 true WO2021197097A1 (zh) 2021-10-07

Family

ID=70567691

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/081798 WO2021197097A1 (zh) 2020-04-02 2021-03-19 跨链数据订阅

Country Status (2)

Country Link
CN (2) CN111159307B (zh)
WO (1) WO2021197097A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114519078A (zh) * 2022-04-19 2022-05-20 北京理工大学 一种基于区块链的跨链可信查询方法及系统
CN114553882A (zh) * 2022-01-18 2022-05-27 广西壮族自治区信息中心 一种基于区块链的政务数据治理平台
CN114726548A (zh) * 2022-05-19 2022-07-08 国网数字科技控股有限公司 一种支持跨链的绿电溯源方法及系统
CN114938392A (zh) * 2022-06-23 2022-08-23 成都质数斯达克科技有限公司 一种分布式订阅发布系统及方法

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159307B (zh) * 2020-04-02 2020-07-24 支付宝(杭州)信息技术有限公司 跨链数据订阅方法及装置
CN114116883A (zh) * 2020-08-28 2022-03-01 京东方科技集团股份有限公司 数据管理方法、数据管理装置、区块链网络和系统
US11848937B2 (en) * 2020-09-18 2023-12-19 Booz Allen Hamilton Inc. Secure communication using blockchain technology
CN112214802B (zh) * 2020-09-30 2023-04-28 电子科技大学 一种区块链智能合约消息发布订阅方法
CN112507028B (zh) * 2020-12-18 2023-02-21 杭州趣链科技有限公司 数据存储方法、装置、设备和存储介质
CN113077342B (zh) * 2021-04-06 2023-01-20 立旃(上海)科技有限公司 基于区块链进行跨境使用数据的方法及装置
CN113301132B (zh) * 2021-05-12 2022-07-08 苏州域乎区块链科技有限公司 一种基于联盟链的交易订阅系统及方法
CN113542435B (zh) * 2021-09-15 2021-12-14 支付宝(杭州)信息技术有限公司 一种用户服务使用方法及装置
CN116523518B (zh) * 2023-07-03 2023-09-15 中铱数字科技有限公司 一种基于区块链的跨通道数据访问方法、系统及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170223589A1 (en) * 2016-02-01 2017-08-03 Qualcomm Incorporated Managing Data Reception Following a Tune-Away
CN108366105A (zh) * 2018-01-30 2018-08-03 百度在线网络技术(北京)有限公司 跨区块链的数据访问方法、装置、系统及计算机可读介质
CN108848119A (zh) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 跨区块链的交互方法及装置、系统、电子设备
WO2019001214A1 (zh) * 2017-06-27 2019-01-03 华为技术有限公司 信息的传输方法、装置和系统
CN109981641A (zh) * 2019-03-26 2019-07-05 北京邮电大学 一种基于区块链技术的安全发布订阅系统及发布订阅方法
CN110417905A (zh) * 2019-08-02 2019-11-05 深圳市网心科技有限公司 一种合约发布方法、装置、设备和联盟链系统
CN111159307A (zh) * 2020-04-02 2020-05-15 支付宝(杭州)信息技术有限公司 跨链数据订阅方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018006072A1 (en) * 2016-06-30 2018-01-04 Clause, Inc. Systems and method for forming, storing, managing,and executing contracts
CN108415784B (zh) * 2018-02-27 2020-04-24 阿里巴巴集团控股有限公司 跨区块链的交互方法及装置、系统、电子设备
CN112003703B (zh) * 2019-06-28 2023-08-22 创新先进技术有限公司 一种跨链发送可认证消息的方法和装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170223589A1 (en) * 2016-02-01 2017-08-03 Qualcomm Incorporated Managing Data Reception Following a Tune-Away
WO2019001214A1 (zh) * 2017-06-27 2019-01-03 华为技术有限公司 信息的传输方法、装置和系统
CN108366105A (zh) * 2018-01-30 2018-08-03 百度在线网络技术(北京)有限公司 跨区块链的数据访问方法、装置、系统及计算机可读介质
CN108848119A (zh) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 跨区块链的交互方法及装置、系统、电子设备
CN109981641A (zh) * 2019-03-26 2019-07-05 北京邮电大学 一种基于区块链技术的安全发布订阅系统及发布订阅方法
CN110417905A (zh) * 2019-08-02 2019-11-05 深圳市网心科技有限公司 一种合约发布方法、装置、设备和联盟链系统
CN111159307A (zh) * 2020-04-02 2020-05-15 支付宝(杭州)信息技术有限公司 跨链数据订阅方法及装置

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553882A (zh) * 2022-01-18 2022-05-27 广西壮族自治区信息中心 一种基于区块链的政务数据治理平台
CN114553882B (zh) * 2022-01-18 2024-03-19 广西壮族自治区信息中心 一种基于区块链的政务数据治理平台
CN114519078A (zh) * 2022-04-19 2022-05-20 北京理工大学 一种基于区块链的跨链可信查询方法及系统
CN114519078B (zh) * 2022-04-19 2022-08-09 北京理工大学 一种基于区块链的跨链可信查询方法及系统
CN114726548A (zh) * 2022-05-19 2022-07-08 国网数字科技控股有限公司 一种支持跨链的绿电溯源方法及系统
CN114726548B (zh) * 2022-05-19 2022-11-11 国网数字科技控股有限公司 一种支持跨链的绿电溯源方法及系统
CN114938392A (zh) * 2022-06-23 2022-08-23 成都质数斯达克科技有限公司 一种分布式订阅发布系统及方法
CN114938392B (zh) * 2022-06-23 2023-06-30 成都质数斯达克科技有限公司 一种分布式订阅发布系统及方法

Also Published As

Publication number Publication date
CN111159307A (zh) 2020-05-15
CN112182096A (zh) 2021-01-05
CN111159307B (zh) 2020-07-24

Similar Documents

Publication Publication Date Title
WO2021197097A1 (zh) 跨链数据订阅
US11195231B2 (en) Transaction processing in a service blockchain
US11190342B2 (en) Transaction processing in a service blockchain
TWI719604B (zh) 基於區塊鏈的資源分配方法和裝置
WO2021042817A1 (zh) 一种基于区块链的违约资产处理方法、装置及电子设备
TW202022857A (zh) 基於區塊鏈的發票創建方法及裝置、電子設備
CN110458631B (zh) 基于区块链的票据号码分配方法、装置及电子设备
US20200175583A1 (en) Blockchain-based leasing
WO2020207093A1 (zh) 基于区块链的租赁方法和装置
CN110162470B (zh) 一种区块链的测试方法和装置
CN112101938B (zh) 基于区块链的数字印章使用方法、装置及电子设备
US11615078B2 (en) Blockchain-based transaction methods
CN110298755B (zh) 一种区块链交易方法和装置
EP3961453B1 (en) Method and apparatus for invoking smart contract, electronic device, and storage medium
CN111639125A (zh) 基于区块链的资源流通方法及装置
WO2021204044A1 (zh) 区块链数据的订正
CN112560114B (zh) 调用智能合约的方法及装置
CN112200569B (zh) 基于区块链的数字印章使用方法、装置及电子设备
CN112100588A (zh) 基于区块链的数字印章申领方法、装置及电子设备
WO2021017432A1 (zh) 一种基于区块链的报销费用分割方法、装置及电子设备
Garcia Bringas et al. BlockChain platforms in financial services: current perspective
CN111679902B (zh) 基于区块链的智能合约调用方法及装置、电子设备
CN116645061A (zh) 基于区块链系统的报关数据处理方法和共识节点
WO2022077181A1 (zh) 保护区块链上数据安全的方法及装置和电子设备
CN113469656A (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: 21778823

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21778823

Country of ref document: EP

Kind code of ref document: A1