HK40017317B - Off-chain smart contract service based on trusted execution environment - Google Patents
Off-chain smart contract service based on trusted execution environment Download PDFInfo
- Publication number
- HK40017317B HK40017317B HK62020007770.4A HK62020007770A HK40017317B HK 40017317 B HK40017317 B HK 40017317B HK 62020007770 A HK62020007770 A HK 62020007770A HK 40017317 B HK40017317 B HK 40017317B
- Authority
- HK
- Hong Kong
- Prior art keywords
- smart contract
- service provider
- cross
- client
- chain data
- Prior art date
Links
Description
背景技术Background Technology
分布式账本系统(DLS),也可称为共识网络和/或区块链网络,使参与的实体能够安全地、不可篡改地存储数据。在不引用任何特定用例的情况,DLS通常被称为区块链网络。区块链网络的示例类型可包括公有区块链网络、私有区块链网络和联盟区块链网络。公有区块链网络向所有实体开放以使用DLS,并开放参与共识过程。私有区块链网络针对特定实体提供,该实体集中控制读写权限。联盟区块链网络针对选定的实体组群提供,这些实体组群控制共识过程并包括访问控制层。Distributed ledger systems (DLS), also known as consensus networks and/or blockchain networks, enable participating entities to securely and immutably store data. Without referencing any specific use case, DLS is often simply referred to as a blockchain network. Example types of blockchain networks can include public, private, and consortium blockchain networks. Public blockchain networks are open to all entities to use the DLS and participate in the consensus process. Private blockchain networks are provided for specific entities that centrally control read and write permissions. Consortium blockchain networks are provided for selected groups of entities that control the consensus process and include an access control layer.
区块链是一种去中心化且防篡改的分布式数据存储技术。用户数据和合约被以公开的方式在链上进行逻辑操作和存储。在许多场景下,用户需要满足隐私保护要求,并且不希望自己的数据和逻辑被泄露给未经授权的各方。Blockchain is a decentralized and tamper-proof distributed data storage technology. User data and contracts are logically operated and stored on the chain in a public manner. In many scenarios, users need to meet privacy protection requirements and do not want their data and logic to be disclosed to unauthorized parties.
尽管密码学可被用于为某些特定场景设计增强隐私保护,但期望更通用和高效的解决方案来解决区块链操作中的现有隐私问题。While cryptography can be used to design enhanced privacy protections for certain specific scenarios, a more general and efficient solution is expected to address existing privacy issues in blockchain operations.
发明内容Summary of the Invention
本文的实施例包括用于基于区块链技术的链外智能合约服务(称为区块链链外智能合约服务,或者简称为智能合约服务)的计算机实施的方法。更具体地,本文的实施例旨在提供能够在可信执行环境(TEE)下操作跨链数据的链外智能合约服务。The embodiments described herein include a computer-implemented method for off-chain smart contract services based on blockchain technology (referred to as blockchain off-chain smart contract services, or simply smart contract services). More specifically, the embodiments described herein aim to provide off-chain smart contract services capable of operating cross-chain data within a trusted execution environment (TEE).
在一些实施例中,动作包括由包括可信计算执行环境(TEE)的智能合约服务提供者从与目标区块链网络相关联的客户端接收用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,该智能合约服务提供者处于目标区块链网络之外;由智能合约服务提供者将针对跨链数据的请求发送至数据访问服务提供者;由智能合约服务提供者从数据访问服务提供者接收跨链数据;由TEE利用跨链数据生成结果;以及由智能合约服务提供者将结果返回至客户端。其他实施例包括相应的系统、装置和计算机程序,该计算机程序被编码在计算机存储设备上,并且被配置为执行所述方法的动作。In some embodiments, the actions include: a smart contract service provider, including a Trusted Computing Execution Environment (TEE), receiving from a client associated with a target blockchain network a request for cross-chain data to operate on one or more blockchain networks different from the target blockchain network, the smart contract service provider being located outside the target blockchain network; the smart contract service provider sending the request for the cross-chain data to a data access service provider; the smart contract service provider receiving the cross-chain data from the data access service provider; the TEE generating a result using the cross-chain data; and the smart contract service provider returning the result to the client. Other embodiments include corresponding systems, apparatuses, and computer programs encoded on a computer storage device and configured to perform the actions of the method.
在一些实施例中,一种非暂时性计算机可读存储介质耦接至一台或多台计算机,并且配置有可由一台或多台计算机执行以实现以下的指令:由包括可信计算执行环境(TEE)的智能合约服务提供者从与目标区块链网络相关联的客户端接收用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中智能合约服务提供者处于目标区块链网络之外;由智能合约服务提供者向数据访问服务提供者发送对跨链数据的请求;由智能合约服务提供者从数据访问服务提供者接收跨链数据;通过TEE利用跨链数据生成结果;以及由智能合约服务提供者将结果返回给客户端。In some embodiments, a non-transitory computer-readable storage medium is coupled to one or more computers and configured to execute instructions executable by one or more computers to perform the following: receiving, from a client associated with a target blockchain network, a smart contract service provider including a Trusted Computing Execution Environment (TEE) requesting cross-chain data for operating one or more blockchain networks different from the target blockchain network, wherein the smart contract service provider is outside the target blockchain network; sending the request for the cross-chain data to a data access service provider; receiving the cross-chain data from the data access service provider; generating a result using the cross-chain data via the TEE; and returning the result to the client.
在一些实施例中,一种用于提供智能合约服务的系统包括:接口,配置为从与目标区块链网络相关联的客户端接收用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求;其中该系统处于目标区块链网络之外;以及可信计算执行环境(TEE),其中TEE包括:一台或多台计算机;以及一个或多个计算机可读存储器,耦接至一台或多台计算机并且配置有可由一台或多台计算机执行以实现以下的指令:向数据访问服务提供者发送对跨链数据的请求;从数据访问服务提供者接收跨链数据;以及利用跨链数据生成结果;以及其中接口配置为将结果返回至客户端。In some embodiments, a system for providing smart contract services includes: an interface configured to receive, from a client associated with a target blockchain network, a request for cross-chain data to operate on one or more blockchain networks different from the target blockchain network; wherein the system is located outside the target blockchain network; and a trusted computing execution environment (TEE), wherein the TEE includes: one or more computers; and one or more computer-readable storage devices coupled to the one or more computers and configured to execute instructions executable by the one or more computers to: send a request for cross-chain data to a data access service provider; receive cross-chain data from the data access service provider; and generate a result using the cross-chain data; and wherein the interface is configured to return the result to the client.
这些和其他实施例可各自可选地包括一个或多个以下特征:These and other embodiments may each optionally include one or more of the following features:
第一特征,可与以下任一特征结合,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑。The first feature can be combined with any of the following features, wherein the request for manipulating cross-chain data includes smart contract computation logic for manipulating cross-chain data.
第二特征,可与以下任一特征结合,其中用于操作跨链数据的智能合约计算逻辑是由客户端自行设计的。The second feature can be combined with any of the following features, wherein the smart contract computation logic used to manipulate cross-chain data is designed by the client itself.
第三特征,可与以下任一特征结合,其中结果是由TEE利用跨链数据执行智能合约计算逻辑而生成的。The third feature can be combined with any of the following features, where the result is generated by the TEE using cross-chain data to execute smart contract computation logic.
第四特征,可与以下任一特征结合,还包括由智能合约服务提供者向客户端证明TEE包括虚拟机,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。The fourth feature, which may be combined with any of the following features, also includes the smart contract service provider certifying to the client that the TEE includes a virtual machine operable to execute the smart contract computation logic in a request for manipulating cross-chain data.
第五特征,可与以下任一特征结合,还包括在从客户端接收用于操作跨链数据的请求之前,由智能合约服务提供者向客户端证明智能合约服务提供者包括TEE。The fifth feature, which may be combined with any of the following features, also includes the smart contract service provider certifying to the client that the smart contract service provider includes a TEE before receiving a request from the client for manipulating cross-chain data.
第六特征,可与以下任一特征结合,还包括由智能合约服务提供者向数据访问服务提供者证明智能合约服务提供者包括TEE;以及由智能合约服务提供者验证数据访问服务提供者包括TEE。The sixth feature, which may be combined with any of the following features, also includes the smart contract service provider proving to the data access service provider that the smart contract service provider includes the TEE; and the smart contract service provider verifying that the data access service provider includes the TEE.
第七特征,可与以下任一特征结合,还包括由智能合约服务提供者将结果上传至目标区块链网络。The seventh feature, which may be combined with any of the following features, also includes the upload of the results to the target blockchain network by the smart contract service provider.
第八特征,可与以下任一特征结合,还包括将结果上传至目标区块链网络,由智能合约服务提供者向目标区块链网络证明智能合约服务提供者包括TEE。The eighth feature, which may be combined with any of the following features, also includes uploading the result to the target blockchain network, whereby the smart contract service provider proves to the target blockchain network that the smart contract service provider includes a TEE.
第九特征,可与以下任一特征结合,其中智能合约服务提供者包括基于云的服务器。The ninth feature can be combined with any of the following features, wherein the smart contract service provider includes cloud-based servers.
第十特征,可与以下任一特征结合,其中结果是由TEE利用私钥签名的。The tenth feature can be combined with any of the following features, where the result is signed by the TEE using a private key.
第十一特征,可与以下任一特征结合,其中跨链数据是从两个或更多个区块链网络获得的。The eleventh feature can be combined with any of the following features, where cross-chain data is obtained from two or more blockchain networks.
在一些实施例中,动作包括由与目标区块链网络相关联的客户端生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑;从客户端发送用于操作跨链数据的请求至包括可信计算执行环境(TEE)的智能合约服务提供者,其中智能合约服务提供者处于目标区块链网络之外;以及由客户端从智能合约服务提供者接收结果,其中结果是由TEE利用由智能合约服务提供者获得的跨链数据而生成的。其他实施例包括相应的系统、装置和计算机程序,该计算机程序被编码在计算机存储设备上,并且被配置为执行所述方法的动作。In some embodiments, the actions include: a client associated with a target blockchain network generating a request for operating cross-chain data on one or more blockchain networks different from the target blockchain network, wherein the request for operating the cross-chain data includes smart contract computation logic for operating the cross-chain data; sending the request for operating the cross-chain data from the client to a smart contract service provider including a Trusted Computing Execution Environment (TEE), wherein the smart contract service provider is located outside the target blockchain network; and the client receiving a result from the smart contract service provider, wherein the result is generated by the TEE using the cross-chain data obtained by the smart contract service provider. Other embodiments include corresponding systems, apparatuses, and computer programs encoded on a computer storage device and configured to perform the actions of the method.
在一些实施例中,一种非暂时性计算机可读存储介质耦接至一台或多台计算机,并且配置有可由一台或多台计算机执行以实现以下的指令:由与目标区块链网络相关联的客户端生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑;从客户端发送用于操作跨链数据的请求至包括可信计算执行环境(TEE)的智能合约服务提供者,其中智能合约服务提供者处于目标区块链网络之外;以及由客户端从智能合约服务提供者接收结果,其中结果是由TEE利用由智能合约服务提供者获得的跨链数据而生成的。In some embodiments, a non-transitory computer-readable storage medium is coupled to one or more computers and configured to execute instructions executable by the one or more computers to implement the following: generating a request from a client associated with a target blockchain network for operating cross-chain data on one or more blockchain networks different from the target blockchain network, wherein the request for operating the cross-chain data includes smart contract computation logic for operating the cross-chain data; sending the request for operating the cross-chain data from the client to a smart contract service provider including a Trusted Computing Execution Environment (TEE), wherein the smart contract service provider is located outside the target blockchain network; and receiving a result from the smart contract service provider by the client, wherein the result is generated by the TEE using the cross-chain data obtained by the smart contract service provider.
在一些实施例中,一种系统包括:一台或多台计算机;以及一个或多个计算机可读存储器,其耦接至一台或多台计算机并且配置有可由一台或多台计算机执行以实现以下的指令:由与目标区块链网络相关联的客户端生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑;从客户端发送用于操作跨链数据的请求至包括可信计算执行环境(TEE)的智能合约服务提供者,其中智能合约服务提供者处于目标区块链网络之外;以及由客户端从智能合约服务提供者接收结果,其中结果是由TEE利用由智能合约服务提供者获得的跨链数据而生成的。In some embodiments, a system includes: one or more computers; and one or more computer-readable storage devices coupled to the one or more computers and configured to execute instructions executable by the one or more computers to implement: generating a request from a client associated with a target blockchain network for operating cross-chain data on one or more blockchain networks different from the target blockchain network, wherein the request for operating the cross-chain data includes smart contract computation logic for operating the cross-chain data; sending the request for operating the cross-chain data from the client to a smart contract service provider including a trusted computing execution environment (TEE), wherein the smart contract service provider is located outside the target blockchain network; and receiving a result from the smart contract service provider by the client, wherein the result is generated by the TEE using the cross-chain data obtained by the smart contract service provider.
这些和其他实施例可各自可选地包括一个或多个以下特征:These and other embodiments may each optionally include one or more of the following features:
第一特征,可与以下任一特征结合,还包括由客户端发送接收到的结果至目标区块链网络。The first feature, which may be combined with any of the following features, also includes the client sending the received result to the target blockchain network.
第二特征,可与以下任一特征结合,还包括在将用于操作跨链数据的请求发送至智能合约服务提供者之前,由客户端验证智能合约服务提供者包括TEE。The second feature, which may be combined with any of the following features, also includes the client verifying that the smart contract service provider includes a TEE before sending a request for manipulating cross-chain data to the smart contract service provider.
第三特征,可与以下任一特征结合,还包括由客户端验证TEE包括虚拟机,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。The third feature, which may be combined with any of the following features, also includes client-verified TEE comprising a virtual machine operable to execute smart contract computation logic in requests for manipulating cross-chain data.
第四特征,可与以下任一特征结合,还包括由客户端设计用于操作跨链数据的智能合约计算逻辑。The fourth feature, which can be combined with any of the following features, also includes smart contract computation logic designed by the client to manipulate cross-chain data.
第五特征,可与以下任一特征结合,其中客户端包括软件开发工具包(SDK)。The fifth feature can be combined with any of the following features, wherein the client includes a software development kit (SDK).
第六特征,可与以下任一特征结合,其中结果是由TEE利用私钥签名的,该方法还包括由客户端利用与私钥相应的公钥来解密接收到的结果。The sixth feature can be combined with any of the following features, wherein the result is signed by the TEE using a private key, and the method also includes the client decrypting the received result using a public key corresponding to the private key.
第七特征,可与以下任一特征结合,还包括在将用于操作跨链数据的请求发送至智能合约服务提供者之前,由客户端加密用于操作跨链数据的请求。The seventh feature, which may be combined with any of the following features, also includes having the client encrypt the request for manipulating cross-chain data before sending the request to the smart contract service provider.
第八特征,可与以下任一特征结合,其中跨链数据是从两个或更多个区块链网络获得的。The eighth feature can be combined with any of the following features, where cross-chain data is obtained from two or more blockchain networks.
本文还提供一个或多个非暂时性计算机可读存储介质,其耦接至一个或多个处理器并且其上存储有指令,这些指令在由一个或多个处理器执行时,导致一个或多个处理器按照本文提供的方法的实施例来执行操作。This document also provides one or more non-transitory computer-readable storage media coupled to one or more processors and storing instructions thereon that, when executed by the one or more processors, cause the one or more processors to perform operations in accordance with embodiments of the methods provided herein.
本文还提供用于实施本文提供的方法的系统。该系统包括一个或多个处理器以及计算机可读存储介质,该计算机可读存储介质耦接至一个或多个处理器并且其上存储有指令,这些指令在由一个或多个处理器执行时,导致一个或多个处理器按照本文提供的方法的实施例来执行操作。This document also provides a system for implementing the methods provided herein. The system includes one or more processors and a computer-readable storage medium coupled to and storing instructions thereon that, when executed by the one or more processors, cause the one or more processors to perform operations according to embodiments of the methods provided herein.
所描述的链外智能合约服务提供者没有耦接至任何特定的区块链网络,因此所提供的服务不限于特定形式的合约(例如,为特定区块链网络配置),而是支持用户定义的链外计算。此外,所描述的链外智能合约服务提供者可支持跨链数据访问,并且允许互不信任的各方对来自一个或多个区块链网络的私有数据运行智能合约。所描述的技术可实现几个优点。例如,使用TEE作为执行计算的临时介质可以保护数据的隐私。此外,将计算任务从区块链网络卸载到链外TEE可以节省区块链网络的计算时间和资源。此外,由于用户可以根据需要和需求的计算自行设计计算逻辑,因此TEE使用这些计算逻辑执行计算,并且可以以更灵活的方式执行各种计算。The described off-chain smart contract service provider is not coupled to any specific blockchain network, therefore the services offered are not limited to specific types of contracts (e.g., configured for a specific blockchain network), but rather support user-defined off-chain computation. Furthermore, the described off-chain smart contract service provider supports cross-chain data access and allows untrusted parties to run smart contracts on private data from one or more blockchain networks. The described technology offers several advantages. For example, using a TEE as a temporary medium for performing computations can protect data privacy. Additionally, offloading computational tasks from the blockchain network to an off-chain TEE can save computation time and resources on the blockchain network. Moreover, since users can design their own computational logic according to their needs and requirements, the TEE uses this logic to perform computations, and can execute various computations in a more flexible manner.
应理解的是,按照本文的方法可包括本文描述的方面和特征的任何结合。也就是,按照本文的方法不限于本文具体描述的方面和特征的结合,而是也包括所提供的方面和特征的任意结合。It should be understood that the method described herein may include any combination of the aspects and features described herein. That is, the method described herein is not limited to the specific combination of aspects and features described herein, but also includes any combination of aspects and features provided.
在附图和以下的描述中阐述了本文的一个或多个实施例的细节。根据说明书和附图以及权利要求,本文的其他特征和优点将显而易见。Details of one or more embodiments thereof are set forth in the accompanying drawings and the following description. Other features and advantages of this document will become apparent from the specification, the drawings, and the claims.
附图说明Attached Figure Description
图1描绘了可被用于执行本文的实施例的环境的示例。Figure 1 illustrates an example of an environment that can be used to perform the embodiments described herein.
图2描绘了根据本文的实施例的概念结构的示例。Figure 2 illustrates an example of a conceptual structure according to an embodiment of this document.
图3描绘了根据本文的实施例为客户端提供跨链数据服务的过程的示例。Figure 3 illustrates an example of a process for providing cross-chain data services to a client according to embodiments of this document.
图4描绘了可根据本文的实施例执行的过程的示例。Figure 4 illustrates an example of a process that can be performed according to embodiments of this document.
图5描绘了示出根据本文的实施例的跨链数据操作装置的模块的图示的示例。Figure 5 illustrates an example of a module of a cross-chain data manipulation apparatus according to an embodiment of this document.
图6描绘了示出根据本文的实施例的另一跨链数据操作装置的模块的图示的示例。Figure 6 depicts an example illustration of a module showing another cross-chain data manipulation device according to an embodiment of this document.
在各图中相同的附图标记表示相同的元件。The same reference numerals in each figure represent the same elements.
具体实施方式Detailed Implementation
本文的实施例包括用于基于区块链技术的链外智能合约服务(称为区块链链外智能合约服务,或者简称为智能合约服务)的计算机实施的方法。更具体地,本文的实施例旨在提供能够在可信执行环境中操作跨链数据的链外智能合约服务。The embodiments described herein include a computer-implemented method for an off-chain smart contract service based on blockchain technology (referred to as a blockchain off-chain smart contract service, or simply a smart contract service). More specifically, the embodiments described herein aim to provide off-chain smart contract services capable of operating cross-chain data in a trusted execution environment.
为本文的实施例提供进一步背景,并且如上所述,分布式账本系统(DLS),也可以称为共识网络(例如,由点对点(peer-to-peer)节点组成)和区块链网络,使参与的实体能够安全地、不可篡改地进行交易和存储数据。本文中使用的术语区块链一般指在不参照任何特定用例的情况下的DLS。To provide further background for the embodiments described herein, and as stated above, a distributed ledger system (DLS), also known as a consensus network (e.g., composed of peer-to-peer nodes) and a blockchain network, enables participating entities to securely and immutably transact and store data. The term blockchain, as used herein, generally refers to a DLS without reference to any particular use case.
区块链是以交易不可改变并且随后可被验证的方式存储交易的数据结构。区块链包括一个或多个区块。链中的每个区块通过包括在链中紧邻其前的前一个区块的加密哈希值(cryptographic hash)而链接到该前一个区块。每个区块还包括时间戳、其自身的加密哈希值以及一笔或多笔交易。已经由区块链网络的节点验证的交易经哈希处理并编码到Merkle树中。Merkle树是一种数据结构,在树的叶节点处的数据是经哈希处理的,并且在树的每个分支中的全部哈希值可以连接到分支的根处。这个过程沿着树持续一直到整个树的根,在整个树的根处存储了代表树中全部数据的哈希值。声称是存储在树中的交易的哈希值可通过确定其是否与树的结构一致而被快速验证。A blockchain is a data structure that stores transactions in a way that makes them immutable and subsequently verifiable. A blockchain consists of one or more blocks. Each block in the chain is linked to the preceding block by including its cryptographic hash. Each block also includes a timestamp, its own cryptographic hash, and one or more transactions. Transactions verified by nodes in the blockchain network are hashed and encoded into a Merkle tree. A Merkle tree is a data structure where data at the leaf nodes is hashed, and all hashes in each branch of the tree are linked to the root of that branch. This process continues along the tree to the root, where hashes representing all the data in the tree are stored. Hashes claiming to be stored in the tree can be quickly verified by determining if they are consistent with the tree's structure.
虽然区块链是用于存储交易的数据结构,但区块链网络是管理、更新和维护一个或多个区块链的计算节点的网络。如上所述,区块链网络可以作为公有区块链网络、私有区块链网络或联盟区块链网络而提供。While a blockchain is a data structure used to store transactions, a blockchain network is a network of computing nodes that manage, update, and maintain one or more blockchains. As mentioned above, blockchain networks can be provided as public, private, or consortium blockchain networks.
在公有区块链网络中,共识过程由共识网络的节点来控制。例如,数百、数千、甚至数百万的实体可协同运作公有区块链网络,每个实体在公有区块链网络中至少操作一个节点。因此,就参与实体而言,公有区块链网络可以被视为公有网络。在一些示例中,大多数实体(节点)必须签名每个区块,以使得该区块有效并被添加到区块链网络的区块链(分布式账本)中。示例性公有区块链网络包括利用分布式账本(称为区块链)的特定点对点支付网络。然而,如上所述,术语区块链通常用于指分布式账本,而不特指任何特定的区块链网络。In public blockchain networks, the consensus process is controlled by the nodes of the consensus network. For example, hundreds, thousands, or even millions of entities can collaboratively operate a public blockchain network, with each entity operating at least one node within the network. Therefore, a public blockchain network can be considered a public network in terms of the participating entities. In some examples, a majority of entities (nodes) must sign each block for it to be valid and added to the blockchain (distributed ledger) of the blockchain network. Exemplary public blockchain networks include specific peer-to-peer payment networks that utilize distributed ledgers (called blockchains). However, as mentioned above, the term blockchain is generally used to refer to a distributed ledger and not specifically to any particular blockchain network.
一般来说,公有区块链网络支持公开交易。公开交易为公有区块链网络内的所有节点共享,并存储在全局区块链中。全局区块链是跨所有节点复制的区块链。也就是说,对于全局区块链,所有节点都处于完全状态共识。为了达成共识(例如,同意向区块链添加区块),在公有区块链网络内实施共识协议。共识协议的示例包括但不限于工作量证明(POW)、权益证明(POS)和权限证明(POA)。在本文中进一步引用POW作为非限制性示例。Generally, public blockchain networks support public transactions. Public transactions are shared by all nodes within the public blockchain network and stored in the global blockchain. The global blockchain is a blockchain replicated across all nodes. That is, for the global blockchain, all nodes are in full state consensus. To reach consensus (e.g., agreeing to add a block to the blockchain), a consensus protocol is implemented within the public blockchain network. Examples of consensus protocols include, but are not limited to, Proof-of-Work (PoW), Proof-of-Stake (PoS), and Proof-of-Authority (PoA). PoW is further cited in this document as a non-restrictive example.
一般来说,私有区块链网络是为特定实体而提供的,该特定实体集中控制读写权限。实体控制哪些节点能够参与到区块链网络中。因此,私有区块链网络通常被称为许可网络,其对谁被允许参与网络及其参与水平(例如,仅在某些交易中)加以限制。可以采用各种类型的访问控制机制(例如,现有参与者投票添加新实体,监管机构可以控制许可)。Generally, private blockchain networks are provided for a specific entity that centrally controls read and write permissions. This entity controls which nodes can participate in the blockchain network. Therefore, private blockchain networks are often referred to as permissioned networks, which restrict who is allowed to participate in the network and their level of participation (e.g., only in certain transactions). Various types of access control mechanisms can be employed (e.g., existing participants vote to add new entities, and regulatory bodies can control permissions).
一般来说,联盟区块链网络在参与的实体之间是私有的。在联盟区块链网络中,共识过程由授权的节点集控制,一个或多个节点由各自的实体(例如,金融机构、保险公司)操作。例如,十(10)个实体(例如,金融机构、保险公司)的联盟可操作一个联盟区块链网络,每个实体操作联盟区块链网络中的至少一个节点。因此,联盟区块链网络可被视为与参与的实体相关联的私有网络。在一些示例中,每个实体(节点)必须签名每个区块,以使得该区块有效并被添加到区块链。在一些示例中,至少实体(节点)的子集(例如,至少7个实体)必须签名每个区块,以使得该区块有效并被添加到区块链。Generally, consortium blockchain networks are private among the participating entities. In a consortium blockchain network, the consensus process is controlled by an authorized set of nodes, one or more of which are operated by their respective entities (e.g., financial institutions, insurance companies). For example, a consortium of ten (10) entities (e.g., financial institutions, insurance companies) can operate a consortium blockchain network, with each entity operating at least one node in the network. Therefore, a consortium blockchain network can be viewed as a private network associated with the participating entities. In some examples, each entity (node) must sign each block for it to be valid and added to the blockchain. In some examples, at least a subset of the entities (nodes) (e.g., at least seven entities) must sign each block for it to be valid and added to the blockchain.
区块链是一种防篡改的、共享的数字账本,其用于记录公有或私有的点对点网络中的交易。账本被分发到网络中的所有成员节点,网络中发生的资产交易的历史被永久记录在区块中。在参与交易之前,区块链上的节点可能需要使用各种技术来执行计算。在目前的解决方案下,由于每个区块链都是独立的,一个区块链的节点不能与其他链通信。例如,节点不能从其他区块链读取数据或者与其他区块链交换数据。此外,如果需要复杂的计算逻辑和协议,即使节点不需要来自其他区块链的数据来执行计算,完全在区块链上执行此类计算也会耗费区块链的计算资源和大量的时间。A blockchain is a tamper-proof, shared digital ledger used to record transactions in public or private peer-to-peer networks. The ledger is distributed to all member nodes in the network, and the history of asset transactions occurring within the network is permanently recorded in blocks. Before participating in a transaction, nodes on a blockchain may need to perform computations using various technologies. Under current solutions, because each blockchain is independent, a node on one blockchain cannot communicate with other chains. For example, a node cannot read data from or exchange data with other blockchains. Furthermore, if complex computational logic and protocols are required, performing such computations entirely on the blockchain itself can consume significant computational resources and time, even if the node does not require data from other blockchains to perform the computation.
在本文中参照联盟区块链网络进一步详细描述本文的实施例,联盟区块链网络在参与的实体之间是公开的。然而,可预期的是,本文的实施例可在任何适当类型的区块链网络中实现。The embodiments described herein are further described in detail with reference to consortium blockchain networks, which are public among the participating entities. However, it is contemplated that the embodiments described herein can be implemented in any suitable type of blockchain network.
在本文中鉴于上述背景进一步详细描述本文的实施例。更具体地,如上所述,本文的实施例旨在提供能够在可信执行环境下操作跨链数据的链外智能合约服务。In light of the above background, the embodiments described herein are further described in detail. More specifically, as stated above, the embodiments described herein aim to provide off-chain smart contract services capable of operating cross-chain data in a trusted execution environment.
解决这些问题的技术可包括使用链外智能合约服务来执行计算并操作跨链数据。智能合约可以是为了以信息方式传播、验证或施行合约而设计的计算机协议。智能合约允许在没有第三方参与的情况下执行可信交易。这些交易是可追踪且不可逆的。智能合约包括体现交易的协议或规则的逻辑或计算机程序。例如,智能合约可包括在特定条件下控制各方之间的数字货币或资产的转移的逻辑。智能合约可以以编程语言编码并部署到区块链网络运行时平台。Technologies for addressing these issues may include using off-chain smart contract services to perform computations and manipulate cross-chain data. Smart contracts can be computer protocols designed to disseminate, verify, or enforce contracts in an informational manner. Smart contracts allow for the execution of trusted transactions without the involvement of third parties. These transactions are traceable and irreversible. Smart contracts include logic or computer programs that embody the protocols or rules of the transaction. For example, a smart contract may include logic that controls the transfer of digital currency or assets between parties under specific conditions. Smart contracts can be coded in programming languages and deployed to a blockchain network runtime platform.
在一些实施例中,链外处理可被用来执行或施行智能合约。例如,智能合约中包括的逻辑可以在区块链网络的边界之外,例如,由链外智能合约服务提供者执行,同时仍然保持区块链网络的信任和透明度。例如,链外智能合约服务提供者可以是独立于区块链网络的计算机、服务器或其他类型的数据处理装置。通过链外处理,智能合约逻辑可以在可信执行环境(TEE)下执行,以保持区块链网络的信任和透明度。TEE可被用于在区块链网络之外执行智能合约中的逻辑并执行智能合约中包括的其他操作和交易。TEE可将代码绑定到智能合约并且提供多种服务,诸如身份验证、密钥管理、cerographical服务以及与外部世界的交互。TEE的可信环境确保仅允许授权代码访问数据,并且这种保护施行于在其内的代码的整个执行过程中。在一些实施例中,链外智能合约服务返回的智能合约的执行结果可被上传或以其他方式传送到区块链网络,例如,以更新区块链网络的状态。因此,链外智能合约服务提供者可以从区块链网络卸载计算负载,并且在执行不同的、复杂的计算逻辑和协议方面具有更大的灵活性。In some embodiments, off-chain processing can be used to execute or enforce smart contracts. For example, the logic included in a smart contract can be executed outside the boundaries of the blockchain network, for instance, by an off-chain smart contract service provider, while still maintaining the trust and transparency of the blockchain network. For example, the off-chain smart contract service provider can be a computer, server, or other type of data processing device independent of the blockchain network. Through off-chain processing, smart contract logic can be executed in a Trusted Execution Environment (TEE) to maintain the trust and transparency of the blockchain network. A TEE can be used to execute the logic in a smart contract and perform other operations and transactions included in the smart contract outside the blockchain network. A TEE can bind code to a smart contract and provide various services such as authentication, key management, cerographical services, and interaction with the outside world. The trusted environment of the TEE ensures that only authorized code is allowed to access data, and this protection is enforced throughout the execution of the code within it. In some embodiments, the execution results of a smart contract returned by an off-chain smart contract service can be uploaded or otherwise transmitted to the blockchain network, for example, to update the state of the blockchain network. Therefore, off-chain smart contract service providers can offload computational loads from the blockchain network and have greater flexibility in executing different, complex computational logics and protocols.
在一些实施例中,所描述的链外智能合约服务提供者不与任何特定的区块链网络耦接,因此所提供的服务不限于指定形式的合约(例如,为特定的区块链网络配置),而是支持用户定义的链外计算。In some embodiments, the described off-chain smart contract service provider is not coupled to any specific blockchain network, and therefore the services provided are not limited to a specified form of contract (e.g., configured for a specific blockchain network), but support user-defined off-chain computation.
此外,所描述的链外智能合约服务提供者可支持跨链数据访问,并且允许相互不信任的各方对来自一个或多个区块链网络的私有数据运行智能合约。例如,区块链网络A的客户端可定义智能合约,该智能合约不仅对来自区块链网络A的客户端数据进行操作,而且也对来自不同区块链网络、区块链网络B的数据进行操作。在一些实施例中,客户端调用链外合约服务来执行其定义的智能合约。链外合约服务可从区块链网络A和区块链网络B获取所请求的数据,在区块链网络A和区块链网络B之外执行客户端定义的智能合约以获得结果,然后将结果提交给区块链网络A以更新客户端的状态。Furthermore, the described off-chain smart contract service provider supports cross-chain data access and allows mutually distrustful parties to run smart contracts on private data from one or more blockchain networks. For example, a client on blockchain network A can define a smart contract that operates not only on client data from blockchain network A but also on data from a different blockchain network, blockchain network B. In some embodiments, the client invokes an off-chain contract service to execute its defined smart contract. The off-chain contract service can obtain the requested data from blockchain networks A and B, execute the client-defined smart contract outside of blockchain networks A and B to obtain the result, and then submit the result to blockchain network A to update the client's state.
为使区块链网络节点可以并且更容易地执行复杂的计算并使用来自一个或多个其他区块链网络的数据来执行这些计算,描述了示例性技术。示例性技术可基于可信执行环境(TEE)。TEE是主机处理器上的安全区域,该主机处理器确保加载到环境中的代码和数据的安全性、机密性和完整性。TEE提供隔离的执行环境(例如,使用专用和隔离的硬件),其具有多个安全特征,诸如隔离执行、可信应用的完整性、可信数据的机密性和安全存储。所描述的链外智能合约服务提供者可包括TEE以及在TEE中实施区块链网络计算。所描述的技术可具有若干优势。例如,使用TEE作为临时介质来执行计算可保护数据的隐私。例如,区块链网络A的用户需要来自区块链网络B和区块链网络C的数据来执行计算。通常,区块链网络B和C各自都是封闭的链,并且由于隐私顾虑而不愿意将其数据共享给区块链网络A的用户。通过利用TEE,可以在不将来自区块链网络B和C的数据的详细信息公开给区块链网络A的情况下进行计算,并且仍然可实现基于跨链数据的跨链数据访问和智能合约的执行。此外,如前所述,在区块链网络上进行复杂的计算会耗费链的计算资源。将计算任务从区块链网络卸载到链外TEE可节省区块链网络的计算时间和资源。此外,由于用户可为其需要和请求的计算自行设计计算逻辑,因此TEE使用这些计算逻辑执行计算,并且可以更灵活和更广泛的方式执行各种计算。Exemplary techniques are described to enable blockchain network nodes to perform complex computations and use data from one or more other blockchain networks to perform these computations more easily. These exemplary techniques may be based on a Trusted Execution Environment (TEE). A TEE is a secure area on a host processor that ensures the security, confidentiality, and integrity of code and data loaded into the environment. A TEE provides an isolated execution environment (e.g., using dedicated and isolated hardware) with multiple security features such as isolated execution, integrity of trusted applications, confidentiality of trusted data, and secure storage. The described off-chain smart contract service providers may include TEEs and the implementation of blockchain network computations within TEEs. The described techniques may offer several advantages. For example, using a TEE as a temporary medium to perform computations can protect data privacy. For instance, a user of blockchain network A needs data from blockchain networks B and C to perform computations. Typically, blockchain networks B and C are each closed chains and are unwilling to share their data with users of blockchain network A due to privacy concerns. By utilizing a TEE, computations can be performed without exposing detailed information about data from blockchain networks B and C to blockchain network A, while still enabling cross-chain data access and smart contract execution based on cross-chain data. Furthermore, as mentioned earlier, performing complex calculations on a blockchain network consumes the chain's computing resources. Offloading computational tasks from the blockchain network to an off-chain TEE can save the blockchain network's computation time and resources. Moreover, since users can design their own computational logic for the computations they need and request, the TEE uses this logic to execute computations, and can perform various computations in a more flexible and broader manner.
在一些实施例中,所提出的技术可提供具有隐私保护的通用智能合约服务。例如,由于隐私顾虑,用于金融交易的智能合约需要隐藏转账金额和交易方(诸如发送方和收款方)。在所提出的方法下,发送方可以首先对交易内容进行加密,然后调用链外智能合约服务。链外智能合约服务可以在TEE中对交易内容进行解密,在TEE中执行交易,然后以密文的形式将交易结果返回到链(例如,具有交易是以正确的逻辑执行的证据)。在区块链网络验证返回的结果后,结果可被更新以反映区块链网络上的最新状态。In some embodiments, the proposed technology can provide a general smart contract service with privacy protection. For example, due to privacy concerns, smart contracts used for financial transactions need to hide the transfer amount and the transacting parties (such as the sender and receiver). Under the proposed method, the sender can first encrypt the transaction content and then invoke an off-chain smart contract service. The off-chain smart contract service can decrypt the transaction content in the TEE, execute the transaction in the TEE, and then return the transaction result to the blockchain in ciphertext (e.g., with evidence that the transaction was executed with correct logic). After the blockchain network verifies the returned result, the result can be updated to reflect the latest state on the blockchain network.
在一些实施例中,所提出的技术可提供跨链数据计算服务。作为示例,所提出的技术可被用于计算个人信用评分。在现实中,人们需要参与各种涉及信用评估的服务。例如,银行贷款申请、房地产租赁和汽车租赁。每个服务都可以由独立的联盟区块链网络或私有区块链网络来运行和维护。每个服务可能不希望与其他服务共享数据,在某些情况下,他们会加密其所拥有的个人数据。为了从不同的领域获得个人的综合信用评估,可以使用所提出的解决方案。在一些实施例中,用户可提供信用计算逻辑(代码)、数据请求授权(例如,使用签名或私钥)以使用私有通道来启动信用评估请求。所提出的解决方案中的服务从多个链请求数据,并在TEE中对数据进行解密,确保在正确的计算逻辑下生成结果。结果和结果证书返回给用户,用户可通过验证证明来保证数据和逻辑的机密性和完整性。然后,用户可使用此结果和证明向其区块链网络上的其他节点提供经认证的个人信用评分。In some embodiments, the proposed technology can provide cross-chain data computation services. As an example, the proposed technology can be used to calculate personal credit scores. In reality, people need to participate in various services involving credit assessment, such as bank loan applications, real estate leasing, and car rentals. Each service can be operated and maintained by an independent consortium blockchain network or a private blockchain network. Each service may not want to share data with other services, and in some cases, they may encrypt the personal data they possess. To obtain a comprehensive credit assessment of an individual from different domains, the proposed solution can be used. In some embodiments, the user can provide credit calculation logic (code) and data request authorization (e.g., using a signature or private key) to initiate a credit assessment request using a private channel. The services in the proposed solution request data from multiple chains and decrypt the data in a TEE, ensuring that results are generated under the correct computational logic. The results and a result certificate are returned to the user, who can verify the proof to guarantee the confidentiality and integrity of the data and logic. The user can then use this result and proof to provide a certified personal credit score to other nodes on their blockchain network.
在一些实施例中,当用户需要执行区块链网络合约下的交易时,可以提前将合约中复杂的计算交给链外智能合约服务,然后将结果上传并存储到区块链网络中。在一些实施例中,结果可直接被用作在区块链网络上执行的交易的输入,减少区块链网络合约的运行时间,并提高效率。在这些实施例中,如果用户不想公开在区块链网络上施行的私人合约或安全协议,则可使用链外智能合约服务来进行计算,区块链网络的数据可被可靠地访问。In some embodiments, when a user needs to execute a transaction under a blockchain network contract, the complex calculations in the contract can be pre-processed by an off-chain smart contract service, and the results can then be uploaded and stored in the blockchain network. In some embodiments, the results can be directly used as input for transactions executed on the blockchain network, reducing the runtime of the blockchain network contract and improving efficiency. In these embodiments, if a user does not want to publicly disclose private contracts or security protocols implemented on the blockchain network, they can use an off-chain smart contract service for computation, and the data on the blockchain network can be reliably accessed.
图1描绘了可被用于执行本文的实施例的环境100的示例。在一些示例中,环境100使得实体能够参与到区块链网络102中。环境100包括计算设备106、108和网络110。在一些示例中,网络110包括局域网(LAN)、广域网(WAN)、因特网或其组合,并连接网站、用户设备(例如,计算设备)和后端系统。在一些示例中,可通过有线和/或无线通信链接来访问网络110。在一些示例中,网络110能够与区块链网络102通信,并且能够在区块链网络102之内通信。通常,网络110表示一个或多个通信网络。在一些情况下,计算设备106、108可以是云计算系统的节点(未示出),或者计算设备106、108可各自是单独的云计算系统,其包括由网络互连并用作分布式处理系统的多台计算机。Figure 1 illustrates an example of an environment 100 that can be used to perform the embodiments described herein. In some examples, environment 100 enables entities to participate in blockchain network 102. Environment 100 includes computing devices 106, 108 and network 110. In some examples, network 110 includes a local area network (LAN), a wide area network (WAN), the Internet, or a combination thereof, and connects websites, user devices (e.g., computing devices), and backend systems. In some examples, network 110 can be accessed via wired and/or wireless communication links. In some examples, network 110 is capable of communicating with blockchain network 102 and is capable of communicating within blockchain network 102. Typically, network 110 represents one or more communication networks. In some cases, computing devices 106, 108 may be nodes (not shown) of a cloud computing system, or computing devices 106, 108 may each be a separate cloud computing system comprising multiple computers interconnected by a network and used as a distributed processing system.
在所描述的示例中,计算系统106、108可各自包括能够作为节点参与到区块链网络102中的任何适当的计算系统。计算设备的示例包括但不限于服务器、台式计算机、笔记本电脑、平板电脑和智能手机。在一些示例中,计算系统106、108承载用于与区块链网络102交互的一个或多个由计算机实施的服务。例如,计算系统106可承载第一实体(例如,参与者A)的由计算机实施的、诸如交易管理系统的服务,第一实体使用该交易管理系统管理其与一个或多个其他实体(例如,其他参与者)的交易。计算系统108可承载第二实体(例如,参与者B)的由计算机实施的、诸如交易管理系统的服务,第二实体使用该交易管理系统管理其与一个或多个其他实体(例如,其他参与者)的交易。在图1的示例中,区块链网络102表示为节点的点对点网络,计算系统106、108分别提供参与区块链网络102中的第一实体和第二实体的节点。In the described example, computing systems 106 and 108 may each include any suitable computing system capable of participating as a node in the blockchain network 102. Examples of computing devices include, but are not limited to, servers, desktop computers, laptops, tablets, and smartphones. In some examples, computing systems 106 and 108 host one or more computer-implemented services for interacting with the blockchain network 102. For example, computing system 106 may host a computer-implemented service, such as a transaction management system, for a first entity (e.g., participant A), which uses the transaction management system to manage its transactions with one or more other entities (e.g., other participants). Computing system 108 may host a computer-implemented service, such as a transaction management system, for a second entity (e.g., participant B), which uses the transaction management system to manage its transactions with one or more other entities (e.g., other participants). In the example of Figure 1, the blockchain network 102 is represented as a peer-to-peer network of nodes, and computing systems 106 and 108 provide nodes for the first and second entities, respectively, to participate in the blockchain network 102.
图2描绘了根据本文的实施例的概念架构200的示例。概念架构200的示例包括分别对应于参与者A、参与者B和参与者C的参与者系统202、204、206。每个参与者(例如,用户、企业)参与到区块链网络212中,区块链网络212被提供为点对点网络,其包括多个节点214,其中至少一些节点将信息不可篡改地记录在区块链216中。尽管在区块链网络212中示意性地描绘了单个区块链216,但在整个区块链网络212中提供并维护了区块链216的多个副本,如本文中进一步详细描述的。Figure 2 illustrates an example of a conceptual architecture 200 according to embodiments herein. The example of conceptual architecture 200 includes participant systems 202, 204, and 206 corresponding to participant A, participant B, and participant C, respectively. Each participant (e.g., a user, enterprise) participates in a blockchain network 212, which is provided as a peer-to-peer network comprising multiple nodes 214, wherein at least some nodes immutably record information in a blockchain 216. Although a single blockchain 216 is schematically depicted in blockchain network 212, multiple copies of blockchain 216 are provided and maintained throughout blockchain network 212, as described further in detail herein.
在所描述的示例中,每个参与者系统202、204、206分别由参与者A、参与者B和参与者C提供,或代表参与者A、参与者B和参与者C,并用作区块链网络中的各个节点214。如本文中所使用的,节点通常指连接到区块链网络212并且使各参与者能够参与到区块链网络中的独立系统(如计算机、服务器)。在图2的示例中,参与者对应于每个节点214。然而,可预期的是,一个参与者可以在区块链网络212内操作多个节点214,和/或多个参与者可以共享一个节点214。在一些示例中,参与者系统202、204、206使用协议(例如,超文本传输协议安全(HTTPS))和/或使用远程过程调用(RPC)来与区块链网络212通信或经由区块链网络212通信。In the described example, each participant system 202, 204, 206 is provided by, or represents, participant A, participant B, and participant C, respectively, and serves as a node 214 in the blockchain network. As used herein, a node generally refers to an independent system (such as a computer or server) connected to the blockchain network 212 and enabling participants to engage in the blockchain network. In the example of Figure 2, a participant corresponds to each node 214. However, it is contemplated that a participant may operate multiple nodes 214 within the blockchain network 212, and/or multiple participants may share a single node 214. In some examples, participant systems 202, 204, 206 communicate with or via the blockchain network 212 using protocols (e.g., Hypertext Transfer Protocol Security (HTTPS)) and/or using Remote Procedure Calls (RPC).
节点214可在区块链网络212之内具有不同的参与度。例如,一些节点214可以参与共识过程(例如,作为向区块链216添加区块的矿工节点(miner node)),而其他节点214不参与共识过程。作为另一示例,一些节点214存储区块链216的完整副本,而其他节点214只存储区块链216的部分副本。例如,数据访问权限可限制各参与者在其各自系统内存储的区块链数据。在图2的示例中,参与者系统202、204、206存储各自的区块链216的完整副本216'、216”、216”'。Node 214 can have different levels of participation within the blockchain network 212. For example, some nodes 214 may participate in the consensus process (e.g., as miner nodes adding blocks to blockchain 216), while other nodes 214 may not participate. As another example, some nodes 214 may store a complete copy of blockchain 216, while other nodes 214 may store only a partial copy of blockchain 216. For example, data access permissions may restrict the amount of blockchain data that each participant stores within its respective system. In the example of Figure 2, participant systems 202, 204, and 206 store their respective complete copies 216', 216”, and 216”' of blockchain 216.
区块链(例如,图2的区块链216)由一系列区块组成,每个区块存储数据。数据的示例包括代表两个或更多个参与者之间的交易的交易数据。虽然在本文中“交易”被以非限制性示例的方式使用,但可预期的是,任何适当的数据都可被存储在区块链中(例如,文档、图像、视频、音频)。交易的示例可包括但不限于交换有价物(例如,资产、产品、服务和货币)。交易数据不可篡改地存储在区块链之内。也就是说,交易数据不能被改变。A blockchain (e.g., blockchain 216 in Figure 2) consists of a series of blocks, each storing data. Examples of data include transaction data representing a transaction between two or more participants. While "transaction" is used herein in a non-limiting manner, it is contemplated that any suitable data can be stored in a blockchain (e.g., documents, images, videos, audio). Examples of transactions may include, but are not limited to, the exchange of goods of value (e.g., assets, products, services, and currencies). Transaction data is stored immutably within the blockchain. That is, transaction data cannot be altered.
在存储到区块中之前,交易数据被哈希处理。哈希处理是将交易数据(被提供为字符串数据)转换为固定长度的哈希值(也被提供为字符串数据)的过程。将哈希值进行去哈希处理(un-hash)来获得交易数据是不可能的。哈希处理确保即使交易数据微小变化也会导致完全不同的哈希值。此外,如上所述,哈希值具有固定长度。也就是说,不管交易数据的大小如何,哈希值的长度都是固定的。哈希处理包括通过哈希函数处理交易数据以生成哈希值。哈希函数的示例包括但不限于安全哈希算法(SHA)-256,其输出256位哈希值。Before being stored in a block, transaction data is hashed. Hash processing is the process of converting transaction data (provided as string data) into a fixed-length hash value (also provided as string data). It is impossible to de-hash the hash value to obtain the transaction data. Hash processing ensures that even small changes to the transaction data will result in completely different hash values. Furthermore, as mentioned above, hash values have a fixed length. That is, regardless of the size of the transaction data, the length of the hash value is fixed. Hash processing involves processing the transaction data using a hash function to generate a hash value. Examples of hash functions include, but are not limited to, the Secure Hash Algorithm (SHA)-256, which outputs a 256-bit hash value.
多笔交易的交易数据被哈希处理并存储在区块中。例如,两笔交易的哈希值被提供并且其自身被哈希处理以提供另一个哈希值。重复进行这个过程,直到针对要存储在区块中的所有交易提供单个哈希值为止。这个哈希值被称为Merkle根哈希值,并存储在区块的头中。任何交易中的改变都将导致其哈希值的改变,并最终导致Merkle根哈希值的改变。Transaction data for multiple transactions is hashed and stored in a block. For example, the hashes of two transactions are provided, and each transaction is hashed to provide another hash. This process is repeated until a single hash is provided for all transactions to be stored in the block. This hash is called the Merkle root hash and is stored in the block header. Any change in a transaction will result in a change to its hash, and ultimately, a change to the Merkle root hash.
区块通过共识协议被添加到区块链。区块链网络中的多个节点参与到共识协议中,并竞相将区块添加到区块链。这些节点被称为矿工(或矿工节点)。上面介绍的POW被用作非限制性示例。Blocks are added to the blockchain via a consensus protocol. Multiple nodes in the blockchain network participate in the consensus protocol and compete to add blocks to the blockchain. These nodes are called miners (or miner nodes). The Proof-of-Work (PoW) described above is used as a non-restricted example.
矿工节点执行共识过程以将交易添加到区块链中。虽然多个矿工节点参与到共识过程中,但只有一个矿工节点可以将区块写入区块链。也就是说,矿工节点在共识过程中竞相将其区块添加到区块链。更详细地,矿工节点从交易池中周期性地收集待处理的交易(例如,最多达到区块中可包括的交易数量的预定限制,如果有的话)。交易池包括来自区块链网络中的参与者的交易消息。矿工节点构造区块并将交易添加到该区块。在将多个交易添加到区块之前,矿工节点检查所述多个交易中是否有任一交易已经被包括在区块链的区块中。如果有交易已经被包括在另一区块中,则该交易被丢弃。Miner nodes execute a consensus process to add transactions to the blockchain. While multiple miner nodes participate in the consensus process, only one can write a block to the blockchain. That is, miner nodes compete to add their blocks to the blockchain during the consensus process. More specifically, miner nodes periodically collect pending transactions from a transaction pool (e.g., up to a predetermined limit on the number of transactions that can be included in a block, if any). The transaction pool includes transaction messages from participants in the blockchain network. Miner nodes construct blocks and add transactions to those blocks. Before adding multiple transactions to a block, a miner node checks if any of those transactions has already been included in a block on the blockchain. If a transaction has already been included in another block, it is discarded.
矿工节点生成区块头,对区块中的所有交易进行哈希处理,并成对组合哈希值以生成进一步的哈希值,直到为区块中的所有交易提供单个哈希值(Merkle根哈希值)。此哈希值被添加到区块头中。矿工还确定区块链中的最新区块的哈希值(即添加到区块链中的最后区块)。矿工节点还向区块头添加随机数(nonce)和时间戳。在挖矿过程中,矿工节点尝试寻找满足所需参数的哈希值。矿工节点不断改变随机数,直到找到满足所需参数的哈希值。Miner nodes generate block headers, hash all transactions within a block, and combine hash values in pairs to generate further hash values until a single hash value (the Merkle root hash value) is provided for all transactions in the block. This hash value is added to the block header. Miners also determine the hash value of the most recent block in the blockchain (i.e., the last block added to the blockchain). Miner nodes also add a nonce and a timestamp to the block header. During mining, miner nodes attempt to find hash values that satisfy the required parameters. Miner nodes continuously change the nonce until they find a hash value that meets the required parameters.
区块链网络中的每个矿工都试图找到满足所需参数的哈希值,并以这种方式相互竞争。最后,矿工节点之一找到满足所需参数的哈希值,并将其通告给区块链网络中的所有其他矿工节点。其他矿工节点验证该哈希值,如果确定正确,则验证区块中的每笔交易,接受该区块,并将该区块附加到其区块链副本中。以这种方式,区块链的全局状态在区块链网络中的所有矿工节点上是一致的。上述过程是POW共识协议。In a blockchain network, each miner competes with others to find a hash value that meets the required parameters. Finally, one miner node finds the hash value and announces it to all other miner nodes in the network. The other miner nodes verify the hash value, and if it is correct, they verify every transaction in the block, accept the block, and append it to their copy of the blockchain. In this way, the global state of the blockchain is consistent across all miner nodes in the network. This process is the Proof-of-Work (PoW) consensus protocol.
参照图2提供了非限制性示例。在此示例中,参与者A希望向参与者B发送一笔资金。参与者A生成交易消息(例如,包括发送方、接收方和数值字段),并将交易消息发送到区块链网络,从而将交易消息添加到交易池中。区块链网络中的每个矿工节点创建一个区块并从交易池获取所有交易(例如,最多达到可添加到区块的交易数量的预定限制,如果有的话),并将交易添加到区块。通过这种方式,参与者A发布的交易被添加到矿工节点的区块中。A non-limiting example is provided with reference to Figure 2. In this example, participant A wishes to send funds to participant B. Participant A generates a transaction message (e.g., including sender, recipient, and numeric fields) and sends it to the blockchain network, thereby adding the transaction message to the transaction pool. Each miner node in the blockchain network creates a block and retrieves all transactions from the transaction pool (e.g., up to a predetermined limit on the number of transactions that can be added to a block, if any), and adds the transactions to the block. In this way, the transaction published by participant A is added to the block of the miner node.
在一些区块链网络中,用密码学来维护交易的隐私。例如,如果两个节点想要保持交易隐私,以使得区块链网络中的其他节点无法了解交易的细节,则这两个节点可对交易数据进行加密处理。加密处理的示例包括但不限于对称加密和非对称加密。对称加密是指使用单个密钥既进行加密(从明文生成密文)又进行解密(从密文生成明文)的加密过程。在对称加密中,同一密钥可用于多个节点,因此每个节点可对交易数据进行加密/解密。In some blockchain networks, cryptography is used to maintain transaction privacy. For example, if two nodes want to keep transaction privacy so that other nodes in the blockchain network cannot know the details of the transaction, these two nodes can encrypt the transaction data. Examples of encryption include, but are not limited to, symmetric and asymmetric encryption. Symmetric encryption refers to an encryption process that uses a single key to both encrypt (generate ciphertext from plaintext) and decrypt (generate plaintext from ciphertext). In symmetric encryption, the same key can be used by multiple nodes, so each node can encrypt/decrypt the transaction data.
非对称加密使用各包括私钥和公钥的密钥对,私钥仅为相应的节点所知,而公钥为区块链网络中的任何或所有其他节点所知。节点可使用另一个节点的公钥来加密数据,而该加密的数据可使用其他节点的私钥被解密。例如,再次参照图2,参与者A可使用参与者B的公钥来加密数据,并将加密的数据发送给参与者B。参与者B可使用其私钥来解密该加密的数据(密文),并提取原始数据(明文)。使用节点的公钥加密的消息只能使用该节点的私钥来解密。Asymmetric encryption uses key pairs, each consisting of a private key and a public key. The private key is known only to the corresponding node, while the public key is known to any or all other nodes in the blockchain network. A node can use another node's public key to encrypt data, and that encrypted data can be decrypted using another node's private key. For example, referring again to Figure 2, participant A can use participant B's public key to encrypt data and send the encrypted data to participant B. Participant B can use their private key to decrypt the encrypted data (ciphertext) and retrieve the original data (plaintext). A message encrypted using a node's public key can only be decrypted using that node's private key.
非对称加密被用于提供数字签名,这使得交易中的参与者能够确认交易中的其他参与者和交易的有效性。例如,节点可对消息进行数字签名,另一节点可基于参与者A的该数字签名确认该消息是由该节点发送的。数字签名还可被用于确保消息在传送中不被篡改。例如,再次参照图2,参与者A将向参与者B发送消息。参与者A生成该消息的哈希值,然后使用其私钥对该哈希值进行加密以提供为加密哈希值的数字签名。参与者A将该数字签名附加到该消息上,并将该带有数字签名的消息发送给参与者B。参与者B使用参与者A的公钥解密该数字签名,并提取哈希值。参与者B对该消息进行哈希处理并比较哈希值。如果哈希值相同,则参与者B可确认该消息确实来自参与者A,且没有被篡改。Asymmetric encryption is used to provide digital signatures, enabling participants in a transaction to verify the validity of the transaction and the other participants in the transaction. For example, a node can digitally sign a message, and another node can verify that the message was sent by that node based on participant A's digital signature. Digital signatures can also be used to ensure that messages are not tampered with during transmission. For example, referring again to Figure 2, participant A sends a message to participant B. Participant A generates a hash value for the message and then encrypts the hash value using its private key to provide a digital signature for the encrypted hash value. Participant A attaches this digital signature to the message and sends the digitally signed message to participant B. Participant B decrypts the digital signature using participant A's public key and extracts the hash value. Participant B hashes the message and compares the hash values. If the hash values are the same, participant B can verify that the message did indeed come from participant A and has not been tampered with.
图3描绘了根据本文的实施例的向客户端提供跨链数据服务的过程300的示例。在一些实施例中,客户端302表示与诸如目标区块链网络306的区块链网络有关的应用(例如,客户端应用)。例如,客户端302可包括用于访问目标区块链网络306和与目标区块链网络306通信的客户端软件开发工具包(SDK)。客户端302可安装在用户的设备(也称为客户终端或节点)上(图3中未示出)。在一些实施例中,用户可通过使用客户端302发起交易来参与目标区块链网络306的交易。在一些实施例中,用户的账号信息可存储在目标区块链网络306上,用户有在目标区块链网络上执行交易的授权。客户端302可访问和读取存储在目标区块链网络306上的数据。在一些实施例中,为了获得跨链数据,例如,来自一个或多个不同的区块链网络(例如,图3中的316、318和320)的数据,客户端302可需要中继或可信数据访问服务提供者312以桥接目标区块链网络306的客户端302与其他不同的区块链网络之间的通信间隙。Figure 3 illustrates an example of a process 300 for providing cross-chain data services to a client according to embodiments of this document. In some embodiments, client 302 represents an application (e.g., a client application) associated with a blockchain network such as target blockchain network 306. For example, client 302 may include a client software development kit (SDK) for accessing and communicating with target blockchain network 306. Client 302 may be installed on a user's device (also referred to as a client terminal or node) (not shown in Figure 3). In some embodiments, a user can participate in transactions on target blockchain network 306 by initiating transactions using client 302. In some embodiments, the user's account information may be stored on target blockchain network 306, and the user has authorization to execute transactions on the target blockchain network. Client 302 can access and read data stored on target blockchain network 306. In some embodiments, to obtain cross-chain data, such as data from one or more different blockchain networks (e.g., 316, 318, and 320 in Figure 3), client 302 may require a relay or trusted data access service provider 312 to bridge communication gaps between client 302 on target blockchain network 306 and other different blockchain networks.
在一些实施例中,客户端302可在目标区块链网络的合约下发起保密交易,并且此交易信息仅对客户端302的用户以及该交易的可能的其他参与者或当事方可见,而不对区块链网络上或区块链网络外的任何其他当事方可见。在一些实施例中,客户端302需要将结果呈现给目标区块链网络306上或目标区块链网络外的另一实体。In some embodiments, client 302 may initiate a confidential transaction under a contract on the target blockchain network, and this transaction information is visible only to the user of client 302 and other possible participants or parties to the transaction, and not to any other parties on or outside the blockchain network. In some embodiments, client 302 needs to present the result to another entity on or outside the target blockchain network.
在一些实施例中,目标区块链网络306的客户端302的交易可包括使用来自目标区块链网络306的数据和/或跨链数据(例如,来自一个或多个不同的区块链网络316、318或320的数据)进行的各种计算操作。在一些实施例中,目标区块链网络306的客户端302的交易可包括使用来自目标区块链网络306的数据和/或跨链数据计算得到的结果。在一些实施例中,交易可包括各种计算逻辑和协议。在一些实施例中,计算可是复杂的,并且可耗费区块链网络的计算资源。在一些实施例中,可在客户端302设计的智能合约中指定交易。In some embodiments, transactions by client 302 of target blockchain network 306 may include various computational operations using data from target blockchain network 306 and/or cross-chain data (e.g., data from one or more different blockchain networks 316, 318, or 320). In some embodiments, transactions by client 302 of target blockchain network 306 may include results computed using data from target blockchain network 306 and/or cross-chain data. In some embodiments, transactions may include various computational logics and protocols. In some embodiments, the computations may be complex and may consume the computational resources of the blockchain network. In some embodiments, transactions may be specified in a smart contract designed by client 302.
例如,如图3所示,客户端302可例如使用客户端SDK 304来准备包括自行设计的计算逻辑和协议的智能合约,以基于跨链数据(例如,来自一个或多个不同的区块链网络316、318或320的数据)来执行交易。客户端302可将智能合约发送到智能合约服务提供者308来执行。智能合约服务提供者308处于目标区块链网络306之外,使得智能合约服务提供者308可独立于目标区块链网络306地执行智能合约中定义的计算逻辑和协议。For example, as shown in Figure 3, client 302 can use client SDK 304 to prepare a smart contract including its own designed computational logic and protocols to execute transactions based on cross-chain data (e.g., data from one or more different blockchain networks 316, 318, or 320). Client 302 can send the smart contract to smart contract service provider 308 for execution. Smart contract service provider 308 is located outside the target blockchain network 306, allowing smart contract service provider 308 to execute the computational logic and protocols defined in the smart contract independently of the target blockchain network 306.
一旦接收并分析了智能合约,智能合约服务提供者308就确定执行智能合约需要跨链数据。智能合约服务提供者308可以向可信数据访问服务提供者312发送对跨链数据的请求,以获取跨链数据。例如,客户端302可能想要执行“a加b”的计算,其中a是来自目标区块链网络306的数据,b是来自区块链网络316的私有数据。在这种情况下,从客户端302发送的智能合约包含将a和b加到一起的计算逻辑以及数据a和b的位置指示符。智能合约服务提供者308可向可信数据访问服务提供者312发送请求,以获取区块链网络316的私有数据b。在一些实施例中,智能合约可被加密以保护用户的隐私。Once the smart contract is received and analyzed, the smart contract service provider 308 determines that cross-chain data is required to execute the smart contract. The smart contract service provider 308 can send a request for cross-chain data to the trusted data access service provider 312 to obtain the cross-chain data. For example, the client 302 might want to perform a calculation of "a plus b", where a is data from the target blockchain network 306 and b is private data from blockchain network 316. In this case, the smart contract sent from the client 302 contains the computational logic for adding a and b together, as well as location indicators for the data a and b. The smart contract service provider 308 can then send a request to the trusted data access service provider 312 to obtain the private data b from blockchain network 316. In some embodiments, the smart contract may be encrypted to protect user privacy.
在一些实施例中,链外智能合约服务提供者308可以是基于云的服务器提供者。在一些实施例中,这样的云服务器提供者可以是独立的第三方服务提供者,诸如在一些实施例中,多个实体是跨链数据的数据资源,他们中的任一方都不想将他们自己的数据上传到第三方服务提供者。在这种情况下,这些实体可自己构建智能合约服务提供者。In some embodiments, the off-chain smart contract service provider 308 can be a cloud-based server provider. In some embodiments, such a cloud server provider can be an independent third-party service provider, such as in some instances where multiple entities are data resources for cross-chain data, and none of them want to upload their own data to a third-party service provider. In this case, these entities can build their own smart contract service provider.
链外智能合约服务提供者308包括可信计算执行环境(TEE)310,其提供安全的计算执行环境。在一些实施例中,计算TEE 310是独立的硬件模块,其独立性确保了TEE 310内部执行的数据的安全性。在一些实施例中,为了配置用于区块链网络操作的TEE 310,虚拟机、应用接口或操作系统中的一个或多个可被编程、硬编码或以其他方式配置到TEE 310中,以使TEE 310适合执行智能合约中定义的计算逻辑。在一些实施例中,在将智能合约发送给链外智能合约服务提供者308之前,客户端302可以验证链外智能合约服务提供者308是否包括TEE 310,以及TEE 310是否包括与客户端302对应的执行程序或环境。例如,如果目标区块链网络306是基于以太坊的区块链网络,并且客户端302的SDK 304是基于以太坊的客户端SDK(例如,使用Solidity语言),则在客户端302向链外智能合约服务提供者308发送执行智能合约的请求之前,客户端302可验证TEE 310是否包括用于执行基于以太坊的计算逻辑的以太坊虚拟机(EVM)(例如,其支持Solidity语言)。The off-chain smart contract service provider 308 includes a Trusted Execution Environment (TEE) 310, which provides a secure computing execution environment. In some embodiments, the computing TEE 310 is a standalone hardware module, and its independence ensures the security of data executed within the TEE 310. In some embodiments, to configure the TEE 310 for blockchain network operation, one or more of a virtual machine, application interface, or operating system may be programmed, hard-coded, or otherwise configured into the TEE 310 to make the TEE 310 suitable for executing the computational logic defined in the smart contract. In some embodiments, before sending the smart contract to the off-chain smart contract service provider 308, the client 302 may verify whether the off-chain smart contract service provider 308 includes the TEE 310, and whether the TEE 310 includes an executor or environment corresponding to the client 302. For example, if the target blockchain network 306 is an Ethereum-based blockchain network, and the client 302's SDK 304 is an Ethereum-based client SDK (e.g., using the Solidity language), then before the client 302 sends a request to the off-chain smart contract service provider 308 to execute the smart contract, the client 302 may verify whether the TEE 310 includes an Ethereum Virtual Machine (EVM) for executing Ethereum-based computational logic (e.g., it supports the Solidity language).
在接收到执行智能合约的请求后,如果该请求被加密,则TEE 310首先解密该请求,解析智能合约,并识别执行智能合约所需的数据。TEE 310可以调用可信数据访问服务提供者312,以例如通过可信数据访问服务提供者312的应用程序接口(API)314从一个或多个不同的源获取数据。可信数据访问服务提供者312是可检索一个或多个不同的区块链网络的私有数据的可信方。可信数据访问服务提供者312可以向链外智能合约服务提供者308的TEE 310提供可信数据,并确保数据的隐私性和准确性。Upon receiving a request to execute a smart contract, if the request is encrypted, TEE 310 first decrypts the request, parses the smart contract, and identifies the data required to execute it. TEE 310 can invoke Trusted Data Access Service Provider 312 to retrieve data from one or more different sources, for example, through Trusted Data Access Service Provider 312's Application Programming Interface (API) 314. Trusted Data Access Service Provider 312 is a trusted party capable of retrieving private data from one or more different blockchain networks. Trusted Data Access Service Provider 312 can provide trusted data to TEE 310 of Off-Chain Smart Contract Service Provider 308, ensuring the privacy and accuracy of the data.
在一些实施例中,可信数据访问服务提供者312还可以包含TEE,例如,以从一个或多个不同的区块链网络的正确位置检索数据。在一些实施例中,可信数据访问服务提供者312中包括的TEE的逻辑比链外智能合约服务提供者308中的TEE 310的逻辑简单,因为前者主要被用于数据检索,不需要对检索到的数据进行计算。In some embodiments, the Trusted Data Access Service Provider 312 may also include a TEE, for example, to retrieve data from the correct location on one or more different blockchain networks. In some embodiments, the logic of the TEE included in the Trusted Data Access Service Provider 312 is simpler than that of the TEE 310 in the Off-Chain Smart Contract Service Provider 308, because the former is primarily used for data retrieval and does not require computation on the retrieved data.
在一些实施例中,在TEE 310调用API 314之前,在链外智能合约服务提供者308与可信数据访问服务提供者312之间执行双向验证过程。在一些实施例中,在验证过程期间,他们中的每个都向另一方证明其包括TEE。In some embodiments, a two-way verification process is performed between the off-chain smart contract service provider 308 and the trusted data access service provider 312 before the TEE 310 calls API 314. In some embodiments, during the verification process, each of them proves to the other that it includes the TEE.
在一些实施例中,可信数据访问服务提供者312可以从一个或多个不同的源检索数据,该一个或多个不同的源包括区块链网络、区块链网络集或区块链网络平台中的一个或多个(统称为一个或多个区块链网络)。区块链网络的示例被示出为图3中的我链(Mychain)316、超级账本(Hyperleger)318和以太坊(Ethereum)320。所获得的数据被送回TEE 310,TEE 310使用所获得的数据执行计算逻辑。In some embodiments, the Trusted Data Access Service Provider 312 may retrieve data from one or more different sources, including one or more blockchain networks, blockchain network sets, or blockchain network platforms (collectively, one or more blockchain networks). Examples of blockchain networks are shown as Mychain 316, Hyperleger 318, and Ethereum 320 in Figure 3. The obtained data is sent back to the TEE 310, which uses the obtained data to perform computational logic.
在一些实施例中,在计算TEE 310中生成计算结果之后,TEE 310使用私钥对结果进行签名,以证明结果的完整性和准确性。在一些实施例中,签名是表明计算结果是由TEE310根据客户端302发送的智能合约中包括的计算逻辑执行的证明。因此,结果可被目标区块链网络306的其他节点信任。In some embodiments, after the computation result is generated in the computational TEE 310, the TEE 310 signs the result using its private key to prove the completeness and accuracy of the result. In some embodiments, the signature is proof that the computation result was executed by the TEE 310 according to the computational logic included in the smart contract sent by the client 302. Therefore, the result can be trusted by other nodes of the target blockchain network 306.
在一些实施例中,TEE 310将结果返回给客户端302。例如,客户端302使用与TEE310的私钥对应的公钥来解密结果。在一些实施例中,客户端302将结果上传到目标区块链网络306,使得该结果可被用于更新客户端302的状态或作为目标区块链网络306的交易的输入。在一些实施例中,客户端302可将结果用于与区块链网络无关的用途,诸如计算用户的平均信用分数。例如,用户可从不同的链(每个链代表相应的服务提供者,诸如汽车租赁、银行贷款或房屋租赁)获取数据信息,并使用该数据来计算用户的平均信用分数。用户可将结果呈现给商家,而无需将结果上传到任何区块链网络。In some embodiments, TEE 310 returns the result to client 302. For example, client 302 decrypts the result using the public key corresponding to the private key of TEE 310. In some embodiments, client 302 uploads the result to target blockchain network 306, making the result usable for updating the state of client 302 or as input for transactions on target blockchain network 306. In some embodiments, client 302 may use the result for purposes unrelated to the blockchain network, such as calculating a user's average credit score. For example, a user may obtain data from different chains (each chain representing a corresponding service provider, such as car rental, bank loan, or home rental) and use that data to calculate the user's average credit score. The user may present the result to merchants without uploading it to any blockchain network.
在一些实施例中,TEE 310可将结果直接返回到目标区块链网络306。在这种实施例中,在返回结果之前,目标区块链网络306可以验证链外智能合约服务提供者308是否包括在链外智能合约服务提供者308和目标区块链网络306之间建立信任所需的TEE。In some embodiments, the TEE 310 can return the result directly to the target blockchain network 306. In this embodiment, before returning the result, the target blockchain network 306 can verify whether the off-chain smart contract service provider 308 includes the TEE required to establish trust between the off-chain smart contract service provider 308 and the target blockchain network 306.
图4描绘了可根据本文的实施例执行的过程400的示例。在一些实施例中,可以使用一个或多个计算机可执行程序(其使用一个或多个计算设备来执行)来执行示例性过程400。为了表达得清楚,下面的描述概括地描述在本文中其他附图的背景下的方法400。例如,客户端420可以是客户端302,智能合约服务提供者430可以是链外智能合约服务提供者308,可信数据访问服务提供者440可以是可信数据访问服务提供者312,区块链网络450可以是Mychain 316、Hyperleger 318和/或以太坊320,并且目标区块链网络410可以是目标区块链网络306,如针对图3所述。然而,可以理解的是,方法400可例如由任何适当的系统、环境、软件和硬件或系统、环境、软件和硬件的组合(适当地)来执行。在一些实施例中,方法400的各个步骤可以并行、组合、循环或以任何顺序运行。Figure 4 illustrates an example of a process 400 that can be performed according to embodiments herein. In some embodiments, the exemplary process 400 may be performed using one or more computer-executable programs (which execute using one or more computing devices). For clarity, the following description generally describes method 400 in the context of the other figures herein. For example, client 420 may be client 302, smart contract service provider 430 may be off-chain smart contract service provider 308, trusted data access service provider 440 may be trusted data access service provider 312, blockchain network 450 may be Mychain 316, Hyperleger 318, and/or Ethereum 320, and target blockchain network 410 may be target blockchain network 306, as described with respect to Figure 3. However, it is understood that method 400 may be performed, for example, by any suitable system, environment, software, and hardware, or a combination of systems, environments, software, and hardware (appropriately). In some embodiments, the various steps of method 400 may be run in parallel, in combination, in cycles, or in any order.
在412,与目标区块链网络410相关联的客户端420生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求。用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑。在一些实施例中,用于操作跨链数据的请求可以被写成智能合约。用于操作跨链数据的请求可以是如关于图3所述的用于执行智能合约的请求的示例。At 412, a client 420 associated with the target blockchain network 410 generates a request for operating cross-chain data on one or more blockchain networks different from the target blockchain network. The request for operating the cross-chain data includes smart contract computation logic for operating the cross-chain data. In some embodiments, the request for operating the cross-chain data can be written as a smart contract. The request for operating the cross-chain data can be an example of a request for executing a smart contract as described with respect to Figure 3.
在一些实施例中,用于操作跨链数据的智能合约计算逻辑是由客户端自行设计的,允许用户自由和灵活地指定智能合约计算逻辑以实现用户的目的,而不限于由目标区块链网络410定义的计算逻辑。在这些实施例中,生成所述请求包括由客户端设计用于操作跨链数据的智能合约计算逻辑。在一些实施例中,客户端包括允许用户编写智能合约计算逻辑的软件开发工具包(SDK)。在一些实施例中,可以用Solidity语言编写计算逻辑。在一些实施例中,用于操作跨链数据的请求被客户端加密。In some embodiments, the smart contract computation logic used to manipulate cross-chain data is designed by the client, allowing users to freely and flexibly specify the smart contract computation logic to achieve their purposes, and is not limited to the computation logic defined by the target blockchain network 410. In these embodiments, generating the request includes smart contract computation logic designed by the client for manipulating cross-chain data. In some embodiments, the client includes a software development kit (SDK) that allows users to write smart contract computation logic. In some embodiments, the computation logic can be written in the Solidity language. In some embodiments, the request for manipulating cross-chain data is encrypted by the client.
在414,与目标区块链网络410相关联的客户端420向智能合约服务提供者430发送用于操作不同于目标区块链网络410的一个或多个区块链网络的跨链数据的请求。智能合约服务提供者430包括可信计算执行环境(TEE)。智能合约服务提供者430处于目标区块链网络410之外。在一些实施例中,跨链数据是从两个或更多个区块链网络获得的。在一些实施例中,智能合约服务提供者430包括基于云的服务器。At 414, a client 420 associated with the target blockchain network 410 sends a request to the smart contract service provider 430 for cross-chain data operations on one or more blockchain networks different from the target blockchain network 410. The smart contract service provider 430 includes a Trusted Computing Execution Environment (TEE). The smart contract service provider 430 is located outside the target blockchain network 410. In some embodiments, the cross-chain data is obtained from two or more blockchain networks. In some embodiments, the smart contract service provider 430 includes a cloud-based server.
在一些实施例中,用于跨链数据访问的请求是数据访问请求。在这些实施例中,TEE检索数据并且将数据返回至客户端420。In some embodiments, the request for cross-chain data access is a data access request. In these embodiments, the TEE retrieves the data and returns it to the client 420.
在一些实施例中,除了从多个区块链网络检索数据之外,TEE还基于请求中包括的智能合约计算逻辑对数据进行操作。在一些实施例中,智能合约服务提供者430可以配置TEE,例如,通过将EVM嵌入TEE以使TEE适当地执行请求中包括的智能合约计算逻辑。In some embodiments, in addition to retrieving data from multiple blockchain networks, the TEE also operates on the data based on the smart contract computation logic included in the request. In some embodiments, the smart contract service provider 430 may configure the TEE, for example, by embedding the EVM into the TEE to enable the TEE to appropriately execute the smart contract computation logic included in the request.
在一些实施例中,在发送用于操作跨链数据的请求之前,在426,客户端420验证智能合约服务提供者430是否能够以安全方式执行智能合约计算逻辑。在一些实施例中,此验证过程包括:智能合约服务提供者430向客户端420证明智能合约服务提供者430包括TEE;智能合约服务提供者430向客户端420证明TEE包括如下的虚拟机,该虚拟机可操作用来执行用于操作跨链数据的请求中的智能合约计算逻辑。In some embodiments, before sending a request to manipulate cross-chain data, at 426, client 420 verifies whether smart contract service provider 430 can securely execute smart contract computation logic. In some embodiments, this verification process includes: smart contract service provider 430 proving to client 420 that smart contract service provider 430 includes a TEE; smart contract service provider 430 proving to client 420 that the TEE includes a virtual machine operable to execute the smart contract computation logic in the request to manipulate cross-chain data.
例如,TEE可以是 SGX。在本示例中,利用由提供的签名和验证服务来证明智能合约服务提供者430是否包括SGX。此外,为了证明TEE包括所需的EVM,TEE计算被调用的EVM的脚本和代码的哈希值,然后将该哈希值发送到客户端420用于验证。因为客户端420也具有一套完整的EVM代码,所以其还可以计算其所具有的EVM的脚本和代码的哈希值,并比较两个哈希值是否一致。For example, the TEE could be SGX. In this example, the provided signing and verification service is used to prove whether the smart contract service provider 430 includes SGX. Furthermore, to prove that the TEE includes the required EVM, the TEE calculates the hash of the script and code of the invoked EVM and then sends that hash to the client 420 for verification. Because the client 420 also has a complete set of EVM code, it can also calculate the hash of the script and code of its own EVM and compare the two hashes to see if they match.
在一些实施例中,在生成请求之前,客户端420和智能合约服务提供者430可以设置一对密钥。因此,在智能合约服务提供者430接收到利用密钥之一签名的请求之后,其可以利用该对密钥中的另一密钥解密该请求。在428,智能合约服务提供者430解密并解析接收到的请求。在一些实施例中,该请求被写成开发期间预定的数据格式,在这种情况下,基于每个数据段来解析请求。In some embodiments, the client 420 and the smart contract service provider 430 may set up a key pair before generating the request. Therefore, after the smart contract service provider 430 receives a request signed using one of the keys, it can decrypt the request using the other key in the key pair. At 428, the smart contract service provider 430 decrypts and parses the received request. In some embodiments, the request is written in a data format predetermined during development, in which case the request is parsed based on each data segment.
在435,智能合约服务提供者430向数据访问服务提供者440发送跨链数据的请求,以获取在用于操作跨链数据的请求中指定的跨链数据。在一些实施例中,在向数据访问服务提供者440发送请求之前,在432,智能合约服务提供者430验证可信数据访问服务提供者440是否能够提供不同于目标区块链网络的一个或多个区块链网络的可信跨链数据。在一些实施例中,此验证过程包括智能合约服务提供者430验证数据访问服务提供者440是否包括TEE。At 435, the smart contract service provider 430 sends a request for cross-chain data to the data access service provider 440 to obtain the cross-chain data specified in the request for manipulating the cross-chain data. In some embodiments, before sending the request to the data access service provider 440, at 432, the smart contract service provider 430 verifies whether the trusted data access service provider 440 is capable of providing trusted cross-chain data from one or more blockchain networks different from the target blockchain network. In some embodiments, this verification process includes the smart contract service provider 430 verifying whether the data access service provider 440 includes a TEE.
在一些实施例中,在向数据访问服务提供者440发送请求之前,在434,数据访问服务提供者440和智能合约服务提供者430可以执行验证过程以在两者之间建立信任。在一些实施例中,此验证过程包括智能合约服务提供者430向数据访问服务提供者440证明智能合约服务提供者430包括TEE。在一些实施例中,在432和434两个步骤中,可通过与如在步骤426中所述的相同的方法来验证/证明TEE的存在。In some embodiments, prior to sending a request to data access service provider 440, at 434, data access service provider 440 and smart contract service provider 430 may perform a verification process to establish trust between them. In some embodiments, this verification process includes smart contract service provider 430 proving to data access service provider 440 that smart contract service provider 430 includes a TEE. In some embodiments, in both steps 432 and 434, the existence of the TEE can be verified/proven using the same method as described in step 426.
在436,数据访问服务提供者440从不同于目标区块链网络410的一个或多个区块链网络450请求数据。At 436, the data access service provider 440 requests data from one or more blockchain networks 450 that are different from the target blockchain network 410.
在438,数据访问服务提供者440从不同于目标区块链网络410的一个或多个区块链网络450接收数据。At 438, the data access service provider 440 receives data from one or more blockchain networks 450 that are different from the target blockchain network 410.
在439,智能合约服务提供者430从数据访问服务提供者440接收跨链数据。在一些实施例中,从两个或更多个区块链网络获得跨链数据。At 439, the smart contract service provider 430 receives cross-chain data from the data access service provider 440. In some embodiments, cross-chain data is obtained from two or more blockchain networks.
在441,智能合约服务提供者430的TEE通过使用接收到的跨链数据执行智能合约计算逻辑而生成结果。在一些实施例中,结果是由使用跨链数据执行智能合约计算逻辑的TEE生成的。在一些实施例中,包括在TEE中的EVM执行代码,以使用计算逻辑和接收到的数据执行计算。At 441, the TEE of the smart contract service provider 430 generates a result by executing smart contract computation logic using the received cross-chain data. In some embodiments, the result is generated by the TEE that executes smart contract computation logic using cross-chain data. In some embodiments, the EVM execution code included in the TEE performs computations using the computation logic and the received data.
在442,智能合约服务提供者430签名结果。在一些实施例中,结果通过私钥来签名。例如,TEE包括与TEE的外部和其他部件隔离的私钥。在一些实施例中,由私钥签名了的签名是结果在TEE之内生成的证据。在一些实施例中,在智能合约服务提供者430签名结果之后,最终的输出结果包括:由TEE生成的结果和通过私钥签名了的结果的哈希值。At 442, the smart contract service provider 430 signs the result. In some embodiments, the result is signed with a private key. For example, the TEE includes a private key isolated from the outside and other components of the TEE. In some embodiments, the signature signed with the private key is evidence that the result was generated within the TEE. In some embodiments, after the smart contract service provider 430 signs the result, the final output includes: the hash value of the result generated by the TEE and the result signed with the private key.
在443,智能合约服务提供者430将结果返回至客户端420。At 443, the smart contract service provider 430 returns the result to the client 420.
在444,客户端420解密接收到的结果。在一些实施例中,客户端420利用与私钥对应的公钥来解密接收到的结果。在这些实施例中,接收到的结果包含由TEE生成的结果和该结果的签名的哈希值。在这些实施例中,客户端420计算由TEE利用私钥生成的结果的哈希值,并且将其与该结果的签名的哈希值进行比较,以确认他们是否一致。At 444, client 420 decrypts the received result. In some embodiments, client 420 uses the public key corresponding to the private key to decrypt the received result. In these embodiments, the received result includes the result generated by the TEE and the hash value of the signature of the result. In these embodiments, client 420 calculates the hash value of the result generated by the TEE using the private key and compares it with the hash value of the signature of the result to confirm whether they match.
在446,客户端420基于接收到的结果将交易发送到目标区块链网络410。在一些实施例中,客户端420将交易上传到目标区块链网络410,以更新客户端420的状态或者在目标区块链网络410上执行交易。At 446, client 420 sends the transaction to target blockchain network 410 based on the received result. In some embodiments, client 420 uploads the transaction to target blockchain network 410 to update the state of client 420 or to execute the transaction on target blockchain network 410.
在一些实施例中,在452,智能合约服务提供者430将结果上传至目标区块链网络410。在一些实施例中,在将结果上传到目标区块链网络之前,在448,智能合约服务提供者向目标区块链网络证明智能合约服务提供者包括TEE。这里用于证明的方法可以与步骤426中使用的方法相同。In some embodiments, at 452, the smart contract service provider 430 uploads the result to the target blockchain network 410. In some embodiments, before uploading the result to the target blockchain network, at 448, the smart contract service provider proves to the target blockchain network that the smart contract service provider includes a TEE. The method used for proof here can be the same as the method used in step 426.
参照图5,图5描绘了示出根据本文的实施例的装置500的模块的图示的示例。装置500可以是包括可信计算执行环境(TEE)的智能合约服务提供者的示例性实施例,其中该智能合约服务提供者处于目标区块链网络之外。用于跨链数据操作的装置500可用于基于区块链网络技术的链外智能合约系统中。装置500可相应于图3和图4所示的实施例,装置500包括以下:第一接收器或第一接收单元510,配置为从与目标区块链网络相关联的客户端接收用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求;发送器或发送单元520,配置为发送对跨链数据的请求;第二接收器或第二接收单元530,配置为从数据访问服务提供者接收跨链数据;生成器或生成单元540,配置为基于来自数据访问服务提供者的跨链数据生成结果;以及用户接口550,配置为将结果返回到客户端。Referring to FIG5, FIG5 depicts an example illustration of the modules of an apparatus 500 according to an embodiment herein. Apparatus 500 may be an exemplary embodiment of a smart contract service provider including a Trusted Computing Execution Environment (TEE), wherein the smart contract service provider is located outside the target blockchain network. Apparatus 500 for cross-chain data operations can be used in off-chain smart contract systems based on blockchain network technology. Apparatus 500 may correspond to the embodiments shown in FIG3 and FIG4, and includes: a first receiver or first receiving unit 510 configured to receive a request from a client associated with the target blockchain network for operating cross-chain data on one or more blockchain networks different from the target blockchain network; a transmitter or sending unit 520 configured to send the request for cross-chain data; a second receiver or second receiving unit 530 configured to receive cross-chain data from a data access service provider; a generator or generating unit 540 configured to generate a result based on the cross-chain data from the data access service provider; and a user interface 550 configured to return the result to the client.
在可选实施例中,用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑。In an optional embodiment, the request for manipulating cross-chain data includes smart contract computation logic for manipulating cross-chain data.
在可选实施例中,用于操作跨链数据的智能合约计算逻辑是由客户端自行设计的。In an optional embodiment, the smart contract computation logic used to manipulate cross-chain data is designed by the client itself.
在可选实施例中,装置500还包括以下:第一提供子单元,配置为提供包括虚拟机的TEE,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。In an optional embodiment, the apparatus 500 further includes: a first providing subunit configured to provide a TEE including a virtual machine operable to execute smart contract computation logic in a request for manipulating cross-chain data.
在可选实施例中,装置500还包括以下:第二提供子单元,配置为在从客户端接收用于操作跨链数据的请求之前,提供包括TEE的智能合约服务提供者。In an optional embodiment, the device 500 further includes: a second providing subunit configured to provide a smart contract service provider including a TEE before receiving a request from a client for operating cross-chain data.
在可选实施例中,装置500还包括以下:第三提供子单元,配置为提供包括TEE的智能合约服务提供者;以及验证子单元,配置为验证数据访问服务提供者包括TEE。In an optional embodiment, the apparatus 500 further includes: a third providing subunit configured to provide a smart contract service provider including a TEE; and a verification subunit configured to verify that the data access service provider includes a TEE.
在可选实施例中,装置500还包括以下:上传子单元,配置为将结果上传至目标区块链网络。In an optional embodiment, the device 500 further includes an uploading subunit configured to upload the result to the target blockchain network.
在可选实施例中,装置500还包括以下:第四提供子单元,配置为在将结果上传到目标区块链网络之前,提供包括TEE的智能合约服务提供者。In an optional embodiment, the device 500 further includes: a fourth providing subunit configured to provide a smart contract service provider including a TEE before uploading the results to the target blockchain network.
在可选实施例中,智能合约服务提供者包括基于云的服务器。In an alternative embodiment, the smart contract service provider includes a cloud-based server.
在可选实施例中,跨链数据是从两个或更多个区块链网络获得的。In an alternative embodiment, cross-chain data is obtained from two or more blockchain networks.
参照图6,图6描绘了示出根据本文的实施例的另一装置600的模块的图示的示例。装置600可以是与目标区块链网络相关联的客户端的示例性实施例。装置600可用于基于区块链网络技术的链外智能合约系统中。装置600可相应于图3和图4中所示的实施例,装置600包括以下:生成器或生成单元610,配置为生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑;发送器或发送单元620,配置为发送用于操作跨链数据的请求至包括可信计算执行环境(TEE)的智能合约服务提供者,其中智能合约服务提供者处于目标区块链网络之外;以及接收器或者接收单元630,配置为从智能合约服务提供者接收结果,其中该结果由TEE利用通过智能合约服务提供者获得的跨链数据而生成。Referring to FIG6, FIG6 depicts an example illustration of modules of another device 600 according to an embodiment herein. Device 600 may be an exemplary embodiment of a client associated with a target blockchain network. Device 600 may be used in an off-chain smart contract system based on blockchain network technology. Device 600 may correspond to the embodiments shown in FIG3 and FIG4, and device 600 includes: a generator or generation unit 610 configured to generate a request for operating cross-chain data of one or more blockchain networks different from the target blockchain network, wherein the request for operating the cross-chain data includes smart contract computation logic for operating the cross-chain data; a sender or sending unit 620 configured to send the request for operating the cross-chain data to a smart contract service provider including a trusted computing execution environment (TEE), wherein the smart contract service provider is outside the target blockchain network; and a receiver or receiving unit 630 configured to receive a result from the smart contract service provider, wherein the result is generated by the TEE using cross-chain data obtained through the smart contract service provider.
在可选实施例中,装置600还包括以下:第一发送子单元,配置为将接收到的结果发送到目标区块链网络。In an optional embodiment, the device 600 further includes: a first sending subunit configured to send the received result to a target blockchain network.
在可选实施例中,装置600还包括以下:验证子单元,配置为在发送用于操作跨链数据的请求至智能合约服务提供者之前,验证TEE包括如下的虚拟机,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。In an optional embodiment, the apparatus 600 further includes a verification subunit configured to verify that the TEE includes a virtual machine operable to execute the smart contract computation logic in the request for manipulating cross-chain data before sending a request for manipulating cross-chain data to the smart contract service provider.
在可选实施例中,装置600还包括以下:设计子单元,配置为设计用于操作跨链数据的智能合约计算逻辑。In an optional embodiment, device 600 further includes: a design subunit configured to design smart contract computation logic for manipulating cross-chain data.
在可选实施例中,客户端包括软件开发工具包(SDK)。In an alternative embodiment, the client includes a software development kit (SDK).
在可选实施例中,结果由TEE利用私钥来签名,装置600还包括以下:解密子单元,配置为利用与私钥对应的公钥来解密接收到的结果。In an optional embodiment, the result is signed by the TEE using a private key, and the device 600 further includes a decryption subunit configured to decrypt the received result using a public key corresponding to the private key.
在可选实施例中,装置600还包括以下:加密单元,配置为在发送用于操作跨链数据的请求至智能合约服务提供者之前,加密用于操作跨链数据的请求。In an optional embodiment, the device 600 further includes: an encryption unit configured to encrypt the request for manipulating cross-chain data before sending the request to the smart contract service provider.
在可选实施例中,跨链数据是从两个或更多个区块链网络获得的。In an alternative embodiment, cross-chain data is obtained from two or more blockchain networks.
在前面的实施例中示出的系统、装置、模块或者单元可通过使用计算机芯片或实体来实施,也可以通过使用具有特定功能的产品来实施。典型的实施设备是计算机,计算机可以是个人计算机、笔记本电脑、移动电话、照相手机、智能手机、个人数字助理、媒体播放器、导航设备、电子邮件接收和发送设备、游戏控制台、平板电脑、可穿戴设备或这些设备的任何组合。The systems, apparatus, modules, or units illustrated in the preceding embodiments may be implemented using computer chips or entities, or by using products with specific functions. A typical implementation device is a computer, which may be a personal computer, laptop computer, mobile phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email receiving and sending device, game console, tablet computer, wearable device, or any combination of these devices.
对于装置中每个单元的功能和作用的实施过程,可以参照前面方法中相应步骤的实施过程。为了简单起见,这里省略了细节。The implementation process for the function and role of each unit in the device can be referred to the corresponding steps in the preceding method. For simplicity, details are omitted here.
由于装置实施基本上对应于方法实施,所以对于相关部件,可以参照方法实施中的相关描述。前面描述的装置实施只是示例性的。描述为分离部件的单元可以是或可以不是物理独立的,并且显示为单元的部件可以是或可以不是物理单元,可以位于一个位置,或者可以分布在多个网络单元上。可以基于实际需求来选择部分或全部模块,以实现本文的解决方案的目标。本领域的普通技术人员而无需创造性的努力就可以理解和实现本申请的实施例。Since the apparatus implementation essentially corresponds to the method implementation, the relevant descriptions in the method implementation can be referenced for related components. The apparatus implementations described above are merely exemplary. Units described as separate components may or may not be physically independent, and components shown as units may or may not be physical units, may be located in one location, or may be distributed across multiple network units. Some or all modules can be selected based on actual needs to achieve the objectives of the solutions described herein. Those skilled in the art can understand and implement the embodiments of this application without inventive effort.
图5是示出跨链数据操作装置的内部功能模块和结构的示意图。跨链数据操作装置可以是包括可信计算执行环境(TEE)的智能合约服务提供者的示例。执行主体本质上可以是电子设备,电子设备包括以下部分:一个或多个处理器;以及存储器,配置为存储一个或多个处理器的可执行指令。Figure 5 is a schematic diagram illustrating the internal functional modules and structure of a cross-chain data manipulation device. The cross-chain data manipulation device can be an example of a smart contract service provider that includes a Trusted Computing Execution Environment (TEE). The execution entity can essentially be an electronic device, which includes: one or more processors; and memory configured to store executable instructions from the one or more processors.
一个或多个处理器被配置为:从与目标区块链网络相关联的客户端接收用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中智能合约服务提供者处于目标区块链网络之外;将对跨链数据的请求发送至数据访问服务提供者;从数据访问服务提供者接收跨链数据;通过TEE利用跨链数据来生成结果;以及将结果返回至客户端。One or more processors are configured to: receive from a client associated with a target blockchain network a request for cross-chain data to operate on one or more blockchain networks different from the target blockchain network, wherein the smart contract service provider is outside the target blockchain network; send the request for cross-chain data to a data access service provider; receive the cross-chain data from the data access service provider; utilize the cross-chain data to generate a result via a TEE; and return the result to the client.
可选地,用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑。Optionally, the request for manipulating cross-chain data includes smart contract computation logic for manipulating cross-chain data.
可选地,用于操作跨链数据的智能合约计算逻辑是由客户端自行设计的。Optionally, the smart contract computation logic used to manipulate cross-chain data is designed by the client itself.
可选地,结果通过TEE利用跨链数据执行智能合约计算逻辑而生成。Optionally, the result is generated by the TEE using cross-chain data to execute smart contract computation logic.
可选地,一个或多个处理器被配置为向客户端证明TEE包括虚拟机,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。Optionally, one or more processors are configured to prove to the client that the TEE includes a virtual machine operable to execute smart contract computation logic in requests for manipulating cross-chain data.
可选地,一个或多个处理器被配置为在从客户端接收用于操作跨链数据的请求之前,向客户端证明智能合约服务提供者包括TEE。Optionally, one or more processors are configured to prove to the client that the smart contract service provider includes a TEE before receiving a request from the client for manipulating cross-chain data.
可选地,一个或多个处理器被配置为向数据访问服务提供者证明智能合约服务提供者包括TEE;以及验证数据访问服务提供者包括TEE。Optionally, one or more processors are configured to prove to the data access service provider that the smart contract service provider includes a TEE; and to verify that the data access service provider includes a TEE.
可选地,一个或多个处理器被配置为将结果上传到目标区块链网络。Optionally, one or more processors are configured to upload the results to the target blockchain network.
可选地,一个或多个处理器被配置为在将结果上传到目标区块链网络之前,向目标区块链网络证明智能合约服务提供者包括TEE。Optionally, one or more processors are configured to prove to the target blockchain network that the smart contract service provider includes a TEE before uploading the results to the target blockchain network.
可选地,智能合约服务提供者包括基于云的服务器。Optionally, smart contract service providers may include cloud-based servers.
可选地,结果通过TEE利用私钥来签名。Optionally, the result is signed using a private key via a TEE.
可选地,跨链数据是从两个或更多个区块链网络获得的。Optionally, cross-chain data is obtained from two or more blockchain networks.
图6为示出另一跨链数据操作装置的内部功能模块和结构的示意图。另一跨链数据操作装置可以是与目标区块链网络相关联的客户端的示例。执行主体本质上可以是电子设备,电子设备包括以下:一个或多个处理器;以及存储器,配置为存储一个或多个处理器的可执行指令。Figure 6 is a schematic diagram illustrating the internal functional modules and structure of another cross-chain data manipulation device. This other cross-chain data manipulation device can be an example of a client associated with a target blockchain network. The execution entity can essentially be an electronic device, which includes: one or more processors; and memory configured to store executable instructions from the one or more processors.
一个或多个处理器被配置为生成用于操作不同于目标区块链网络的一个或多个区块链网络的跨链数据的请求,其中用于操作跨链数据的请求包括用于操作跨链数据的智能合约计算逻辑;将用于操作跨链数据的请求发送至包括可信计算执行环境(TEE)的智能合约服务提供者,其中智能合约服务提供者处于目标区块链网络之外;从智能合约服务提供者接收结果,其中该结果是通过TEE利用由智能合约服务提供者获得的跨链数据而生成。One or more processors are configured to generate requests for operating cross-chain data on one or more blockchain networks different from the target blockchain network, wherein the requests for operating the cross-chain data include smart contract computation logic for operating the cross-chain data; send the requests for operating the cross-chain data to a smart contract service provider including a Trusted Computing Execution Environment (TEE), wherein the smart contract service provider is located outside the target blockchain network; and receive a result from the smart contract service provider, wherein the result is generated by the TEE using the cross-chain data obtained by the smart contract service provider.
可选地,一个或多个处理器被配置为将接收到的结果发送到目标区块链网络。Optionally, one or more processors are configured to send the received results to the target blockchain network.
可选地,一个或多个处理器被配置为在将用于操作跨链数据的请求发送到智能合约服务提供者之前,验证智能合约服务提供者包括TEE。Optionally, one or more processors are configured to verify that the smart contract service provider includes a TEE before sending a request for manipulating cross-chain data to the smart contract service provider.
可选地,一个或多个处理器被配置为验证TEE包括虚拟机,该虚拟机可操作以执行用于操作跨链数据的请求中的智能合约计算逻辑。Optionally, one or more processors are configured to verify that the TEE includes a virtual machine operable to execute smart contract computation logic in requests for manipulating cross-chain data.
可选地,客户端包括软件开发工具包(SDK)。Optionally, the client includes a software development kit (SDK).
可选地,结果通过TEE利用私钥来签名。一个或多个处理器被配置为利用与私钥相应的公钥来解密接收到的结果。Optionally, the result is signed using a private key via a TEE. One or more processors are configured to decrypt the received result using the public key corresponding to the private key.
可选地,一个或多个处理器被配置为在将用于操作跨链数据的请求发送至智能合约服务提供者之前,加密用于操作跨链数据的请求。Optionally, one or more processors are configured to encrypt the request for manipulating cross-chain data before sending the request to the smart contract service provider.
可选地,跨链数据是从两个或更多个区块链网络获得的。Optionally, cross-chain data is obtained from two or more blockchain networks.
本文中描述的主题、动作以及操作的实施例可在数字电子电路、有形体现的计算机软件或固件、计算机硬件中实施,包括本文中公开的结构及其结构等同物,或者它们中的一个或多个的组合。本文中描述的主题的实施例可以实施为一个或多个计算机程序,例如,编码在计算机程序载体上的一个或多个计算机程序指令的模块,用以通过数据处理装置执行或者控制数据处理装置的操作。载体可以是有形的非暂时性计算机存储介质。可选地或者附加地,载体可以是人工产生的传播信号,例如,机器产生的电信号、光信号或电磁信号,其被产生以编码信息,用以传输到适当的接收器装置而由数据处理装置执行。计算机存储介质可以是或者部分是机器可读存储设备、机器可读存储基板、随机或串行存取存储设备或其中一个或多个的组合。计算机存储介质不是传播信号。The embodiments of the subjects, actions, and operations described herein can be implemented in digital electronic circuits, tangibly embodied computer software or firmware, computer hardware, including the structures disclosed herein and their structural equivalents, or combinations thereof. Embodiments of the subjects described herein can be implemented as one or more computer programs, for example, modules of one or more computer program instructions encoded on a computer program carrier for executing or controlling the operation of a data processing apparatus. The carrier can be a tangible, non-transitory computer storage medium. Optionally or additionally, the carrier can be an artificially generated propagation signal, such as a machine-generated electrical, optical, or electromagnetic signal, generated to encode information for transmission to a suitable receiver device for execution by the data processing apparatus. The computer storage medium can be, or is in part, a machine-readable storage device, a machine-readable storage substrate, a random or serial access storage device, or a combination thereof. The computer storage medium is not a propagation signal.
术语“数据处理装置”包括用于处理数据的各种类型的装置、设备和机器,包括例如可编程处理器、计算机或者多处理器或计算机。数据处理装置可包括专用逻辑电路,例如,现场可编程门阵列(FPGA)、专用集成电路(ASIC)或图形处理单元(GPU)。除了硬件,该装置还可以包括为计算机程序创建执行环境的代码,例如,构成处理器固件、协议栈、数据库管理系统、操作系统或其中一个或多个的组合的代码。The term "data processing apparatus" includes various types of devices, apparatuses, and machines for processing data, including, for example, programmable processors, computers, or multiprocessors or computers. Data processing apparatuses may include special-purpose logic circuitry, such as field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), or graphics processing units (GPUs). In addition to hardware, the apparatus may also include code that creates an execution environment for computer programs, such as code that constitutes processor firmware, protocol stacks, database management systems, operating systems, or combinations thereof.
计算机程序,也可以被称为或描述为程序、软件、软件应用程序、app、模块、软件模块、引擎、脚本或代码,可以以任何形式的编程语言编写,包括编译或解释性语言、说明性或程序性语言;其可以配置为任何形式,包括作为独立程序或者作为模块、组件、引擎、子程序或适合在计算环境下执行的其他单元,该环境可包括由数据通信网络互联的在一个或多个位置的一台或多台计算机。A computer program, also referred to or described as a program, software, software application, app, module, software module, engine, script, or code, may be written in any form of programming language, including compiled or interpreted languages, descriptive or procedural languages; it may be configured in any form, including as a standalone program or as a module, component, engine, subroutine, or other unit suitable for execution in a computing environment, which may include one or more computers interconnected by a data communication network at one or more locations.
计算机程序可以但非必须与文件系统中的文件相对应。计算机程序可被存储在保存其他程序或数据的文件的一部分(例如,存储在标记语言文档中的一个或多个脚本)中、存储在专用于所讨论的程序的单个文件中、或者存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的多个文件)中。A computer program may, but is not required to, correspond to a file in a file system. A computer program may be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document), in a single file dedicated to the program in question, or in multiple co-located files (e.g., multiple files storing one or more modules, subroutines, or code sections).
本文中描述的过程和逻辑流程可由一台或多台计算机执行一个或多个计算机程序进行,以进行通过对输入数据进行运算并产生输出的操作。过程和逻辑流程也可以通过专用逻辑电路(例如,FPGA、ASIC或GPU)或专用逻辑电路与一台或多台编程计算机的组合来执行。The processes and logical flows described herein can be executed by one or more computers executing one or more computer programs to perform operations by processing input data and producing outputs. The processes and logical flows can also be executed by dedicated logic circuitry (e.g., FPGA, ASIC, or GPU) or a combination of dedicated logic circuitry and one or more programmed computers.
适用于执行计算机程序的计算机可以基于通用和/或专用微处理器,或任何其他类型的中央处理单元。一般而言,中央处理单元将从只读存储器和/或随机存取存储器接收指令和数据。计算机元件可以包括用于执行指令的中央处理单元以及用于存储指令和数据的一个或多个存储器设备。中央处理单元和存储器可以补充有专用逻辑电路或集成在专用逻辑电路中。A computer suitable for executing computer programs can be based on a general-purpose and/or special-purpose microprocessor, or any other type of central processing unit (CPU). Generally, the CPU receives instructions and data from read-only memory and/or random access memory. Computer elements may include a CPU for executing instructions and one or more memory devices for storing instructions and data. The CPU and memory may be supplemented with or integrated into special-purpose logic circuitry.
通常,计算机将耦接到至少一个非暂时性计算机可读存储介质(也称为计算机可读存储器)。耦接到计算机的存储介质可以是计算机的内部组件(例如,集成硬盘驱动器)或外部组件(例如,通用串行总线(USB)硬盘驱动器或通过网络访问的存储系统)。存储介质的示例可以包括,例如,磁盘、磁光盘或光盘、固态驱动器、诸如云存储系统的网络存储资源或其他类型的存储介质。然而,计算机不需要具有这些设备。此外,计算机可以嵌入其他设备中,例如移动电话、个人数字助理(PDA)、移动音频或视频播放器、游戏控制台、全球定位系统(GPS)接收器或例如通用串行总线(USB)闪存驱动器的便携式存储设备,仅举几个例子。Typically, a computer is coupled to at least one non-transitory computer-readable storage medium (also known as a computer-readable memory). The storage medium coupled to the computer can be an internal component of the computer (e.g., an integrated hard disk drive) or an external component (e.g., a Universal Serial Bus (USB) hard disk drive or a storage system accessed via a network). Examples of storage media can include, for example, disks, magneto-optical or optical disks, solid-state drives, network storage resources such as cloud storage systems, or other types of storage media. However, the computer does not need to have these devices. Furthermore, the computer can be embedded in other devices such as mobile phones, personal digital assistants (PDAs), mobile audio or video players, game consoles, GPS receivers, or portable storage devices such as Universal Serial Bus (USB) flash drives, to name just a few.
为了提供与用户的交互,本文中描述的主题的实施例可在计算机上实现或者配置为与该计算机通信,该计算机具有显示设备和输入设备,该显示设备用于向用户显示信息,例如LCD(液晶显示器)监视器,用户可通过该输入设备提供输入至该计算机,例如键盘和例如鼠标、轨迹球或触摸板等的指向设备。其他类型的设备也可用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的感官反馈,例如视觉反馈、听觉反馈或触觉反馈;并且可以接收来自用户的任何形式的输入,包括声音、语音或触觉输入。此外,计算机可通过发送文件至由用户使用的设备以及从由用户使用的设备接收文件来与用户交互;例如,通过发送web页面至用户设备上的web浏览器以响应从web浏览器接收到的请求,或者通过与用户设备(例如,智能电话或者电子平板电脑)上运行的应用程序(app)进行交互。另外,计算机可通过向个人设备(例如,运行消息应用的智能电话)轮流发送文本信息或者其他形式的信息并且接收来自用户的响应信息来与用户交互。To provide interaction with a user, embodiments of the subject matter described herein can be implemented or configured to communicate with a computer having a display device for displaying information to the user, such as an LCD (liquid crystal display) monitor, and an input device through which the user provides input to the computer, such as a keyboard and pointing devices such as a mouse, trackball, or touchpad. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback, such as visual, auditory, or tactile feedback; and any form of input from the user can be received, including sound, speech, or tactile input. Furthermore, the computer can interact with the user by sending files to and receiving files from a device used by the user; for example, by sending web pages to a web browser on the user's device in response to a request received from the web browser, or by interacting with an application (app) running on the user's device (e.g., a smartphone or tablet). Additionally, the computer can interact with the user by sending text messages or other forms of information to a personal device (e.g., a smartphone running a messaging application) in turn and receiving responses from the user.
本文使用与系统、装置和计算机程序组件有关的术语“配置为”。对于一台或多台计算机的系统,被配置为执行特定操作或动作是指该系统已经在其上安装了在运行中促使该系统执行所述操作或动作的软件、固件、硬件或其组合。对于一个或多个计算机程序,被配置为执行特定操作或动作是指该一个或多个程序包括当被数据处理装置执行时促使该装置执行所述操作或动作的指令。对于专用逻辑电路,配置为执行特定操作或动作是指该电路具有执行所述操作或动作的电子逻辑。This document uses the term "configured as" in relation to systems, devices, and computer program components. For a system of one or more computers, being configured to perform a specific operation or action means that the system has software, firmware, hardware, or a combination thereof installed thereon that, during operation, causes the system to perform said operation or action. For one or more computer programs, being configured to perform a specific operation or action means that the one or more programs include instructions that, when executed by a data processing device, cause that device to perform said operation or action. For a dedicated logic circuit, being configured to perform a specific operation or action means that the circuit has electronic logic that performs said operation or action.
虽然本文包含许多具体实施例细节,但是这些不应理解为对由权利要求自身限定的对要求保护的范围的限制,而应理解为对特定实施例的具体特征的描述。在本文多个单独实施例的上下文中描述的多个特定特征也可以在单个实施例中的组合实现。反之,在单个实施例的上下文中描述的不同特征也可以单独地或者以任何适合的子组合在多个实施例中实现。此外,尽管上述特征可以描述为在某些组合中起作用,并且甚至最初这样要求保护,但在某些情况下,可以从该组合中删除要求保护的组合中的一个或多个特征,并且可以要求保护指向子组合或子组合的变体。While this document contains numerous details of specific embodiments, these should not be construed as limiting the scope of the claims as defined by the claims themselves, but rather as descriptions of specific features of particular embodiments. The multiple specific features described in the context of several individual embodiments herein may also be implemented in combinations of single embodiments. Conversely, different features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments. Furthermore, although the foregoing features may be described as functioning in certain combinations, and even initially claimed in this way, in some cases one or more features from the claimed combination may be removed, and claims may be made pointing to sub-combinations or variations thereof.
类似地,虽然以特定顺序在附图中绘出了操作并且在权利要求中陈述了操作,但不应理解为:为了达到期望的结果,要求按照所示的特定顺序或依次执行这些操作,或要求执行所有示出的操作。在某些情况下,多任务并行处理会是有利的。此外,上述实施例中的各种系统模块和组件的划分不应理解为所有实施例中都要求如此划分,而应理解,所描述的程序组件和系统通常可以一起集成在单个软件产品中或打包成多个软件产品。Similarly, although the operations are depicted in the accompanying drawings in a specific order and are stated in the claims, it should not be construed as requiring that these operations be performed in the specific order or sequentially shown, or that all of the shown operations be performed, in order to achieve the desired result. In some cases, multitasking in parallel may be advantageous. Furthermore, the division of various system modules and components in the above embodiments should not be construed as requiring such division in all embodiments, but rather should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
主题的特定实施例已经被描述。其他实施例在随附的权利要求的范围之内。例如,权利要求中陈述的动作可以按照不同的顺序执行并且仍实现所需的结果。作为一个示例,在附图中绘出的过程无需要求所示的特定顺序或次序以实现所需的结果。在一些情况下,多任务并行处理会是有利的。Specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. For example, the actions stated in the claims can be performed in a different order and still achieve the desired result. As an example, the processes depicted in the drawings do not require a specific order or sequence to achieve the desired result. In some cases, multitasking in parallel may be advantageous.
Claims (54)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK40017317A HK40017317A (en) | 2020-09-18 |
| HK40017317B true HK40017317B (en) | 2023-12-29 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110520884B (en) | Off-chain smart contract services based on trusted execution environment | |
| US10691835B1 (en) | Verifying integrity of data stored in a consortium blockchain using a public sidechain | |
| EP3577853B1 (en) | Smart contract whitelists | |
| WO2019179542A2 (en) | Improving integrity of communications between blockchain networks and external data sources | |
| CN111066019B (en) | Process data elements stored in the blockchain network | |
| JP2020528224A (en) | Secure execution of smart contract operations in a reliable execution environment | |
| CN110462621A (en) | Manage sensitive data elements in a blockchain network | |
| JP6921266B2 (en) | Verifying the integrity of the data stored on the consortium blockchain using the public sidechain | |
| HK40017317B (en) | Off-chain smart contract service based on trusted execution environment | |
| HK40017317A (en) | Off-chain smart contract service based on trusted execution environment | |
| HK40036090A (en) | Verifying integrity of data stored in a consortium blockchain using a public sidechain | |
| HK40036090B (en) | Verifying integrity of data stored in a consortium blockchain using a public sidechain | |
| HK40028812B (en) | Processing data elements stored in blockchain networks | |
| HK40028812A (en) | Processing data elements stored in blockchain networks |