WO2022237123A1 - Method and apparatus for acquiring blockchain data, electronic device, and storage medium - Google Patents

Method and apparatus for acquiring blockchain data, electronic device, and storage medium Download PDF

Info

Publication number
WO2022237123A1
WO2022237123A1 PCT/CN2021/133167 CN2021133167W WO2022237123A1 WO 2022237123 A1 WO2022237123 A1 WO 2022237123A1 CN 2021133167 W CN2021133167 W CN 2021133167W WO 2022237123 A1 WO2022237123 A1 WO 2022237123A1
Authority
WO
WIPO (PCT)
Prior art keywords
service program
blockchain
oracle
data
block
Prior art date
Application number
PCT/CN2021/133167
Other languages
French (fr)
Chinese (zh)
Inventor
吴行行
余逸荣
邱鸿霖
陈辰
Original Assignee
蚂蚁区块链科技(上海)有限公司
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司, 支付宝(杭州)信息技术有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2022237123A1 publication Critical patent/WO2022237123A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/44Program or device authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Definitions

  • One or more embodiments of this specification relate to the field of blockchain technology, and in particular to a method, device, electronic device, and storage medium for acquiring blockchain data.
  • TEE Trusted Execution Environment
  • TEE Trusted Execution Environment
  • system call interfaces such as network call interfaces are generally not provided, which leads to Trusted applications in TEE cannot securely access and obtain relevant data on the blockchain.
  • one or more embodiments of this specification provide a method, device, electronic device, and storage medium for acquiring blockchain data.
  • a method for acquiring blockchain data is proposed, and the method is applied to the first A trusted computing node, where a trusted application runs in a first trusted execution environment deployed by the first trusted computing node, the method includes: obtaining a remote authentication report for an oracle service program, and the oracle service The program runs in the second trusted execution environment; when the oracle service program is determined to be credible according to the remote authentication report, send the blockchain data query request obtained from the trusted application to the oracle machine service program, so that the oracle machine service program responds to the block chain data query request, and obtains the block data on the target block chain; receives the block data and the block data returned by the oracle machine service program If the digital signature corresponding to the block data is successfully verified through the public key corresponding to the oracle service program, the block data is returned to the trusted application.
  • a device for acquiring blockchain data is proposed, the device is applied to a first trusted computing node, and the first trusted computing node deployed by the first
  • a trusted application running in the trusted execution environment
  • the device includes: a report obtaining unit, configured to obtain a remote authentication report for the oracle service program, and the oracle service program runs in the second trusted execution environment; request to send A unit, configured to send a blockchain data query request obtained from the trusted application to the oracle service program when it is determined that the oracle service program is credible according to the remote authentication report, so that The oracle service program obtains the block data on the target block chain in response to the block chain data query request; the data receiving unit is used to receive the block data and the block data returned by the oracle service program. If the digital signature corresponding to the block data is successfully verified through the public key corresponding to the oracle service program, the block data is returned to the trusted application.
  • an electronic device including: a processor; a memory for storing processor-executable instructions; wherein, the processor executes the executable instructions In order to realize the above steps of the method for obtaining blockchain data.
  • a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by a processor, the above-mentioned acquisition of blockchain data is realized. method steps.
  • Fig. 1 is a schematic diagram of a blockchain-related network environment provided in this specification.
  • Fig. 2 is a network architecture diagram provided in this specification according to an exemplary embodiment.
  • Fig. 3 is a flow chart of a method for acquiring blockchain data provided in this specification according to an exemplary embodiment.
  • Fig. 4 is an interaction flowchart of a method for acquiring blockchain data according to an exemplary embodiment provided in this specification.
  • Fig. 5 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Fig. 6 is a block diagram of a device for acquiring blockchain data according to an exemplary embodiment provided in this specification.
  • the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification.
  • the method may include more or less steps than those described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
  • FIG. 1 is a schematic diagram of a blockchain-related network environment shown in this specification.
  • it may include a client-side computing device 101, a server-side 102, and at least one blockchain system; for example, a blockchain system 103, a blockchain system 104, and a blockchain system 105.
  • a blockchain system 103 for example, a blockchain system 103, a blockchain system 104, and a blockchain system 105.
  • the client-side computing device 101 may include various types of client-side computing devices; for example, the client-side terminal device may include PC terminal devices, mobile terminal devices, Internet of Things devices, and Other forms of smart devices with some computing power, and so on.
  • the client-side terminal device may include PC terminal devices, mobile terminal devices, Internet of Things devices, and Other forms of smart devices with some computing power, and so on.
  • At least part of the computing devices in the client terminal device 101 can be connected to the server end 102 through various communication networks; for example, the device 1 and device 2 shown in FIG. connected.
  • terminal devices in the client-side terminal device 101 may not be connected to the server 102, but directly connected to the blockchain system as a blockchain node through various communication networks; for example, Fig. 1
  • the device 4 shown in can be connected to the blockchain system as a blockchain node.
  • the above-mentioned communication network may include a wired and/or wireless communication network; for example, it may be a local area network (Local Area Network, LAN) implemented based on a wired access network or a wireless access network (such as a mobile cellular network) provided by an operator, Wide Area Network (Wide Area Network, WAN), the Internet, or a combination thereof.
  • LAN Local Area Network
  • WAN Wide Area Network
  • the client-side computing device 101 may further include one or more user-side servers; for example, the device 5 shown in FIG. 1 . At least part of the computing devices in the client-side terminal device 101 can be connected to the user-side server, and the user-side server can be further connected to the above-mentioned server 102; for example, the connection between device 1 and device 2 shown in FIG. 1 To the device 5, the device 5 is further connected to the server end 102.
  • the above-mentioned user-side server may be implemented by a service entity that has established a user account system; the above-mentioned service entity may include an operating entity that provides various online and/or offline service carriers for users;
  • the above-mentioned service carrier may include a service carrier in the form of software, and may also include a service carrier in the form of hardware.
  • the above-mentioned service carrier may include various client softwares that provide online Internet services; for example, websites, webpages, APPs, and the like.
  • the above-mentioned service carrier may also include various smart devices deployed offline and capable of providing offline services; for example, smart express cabinets deployed in residential areas, office areas, and public places.
  • the above-mentioned operating entity may include the operator corresponding to the above-mentioned service carrier; for example, the above-mentioned operating entity may include individuals, organizations, companies, enterprises, etc. that operate and manage the above-mentioned service carrier.
  • the server end 102 can also be connected to one or more blockchain systems through various communication networks; for example, the server end 102 shown in FIG. Block chain system 104 and block chain system 105, and so on.
  • each blockchain system can maintain one or more blockchains (for example, public blockchains, private blockchains, consortium blockchains, etc.), and includes a or multiple blockchain nodes of multiple blockchains; for example, blockchain node 1, blockchain node 2, blockchain node 3, blockchain node 4, blockchain Node i, etc. can jointly host one or more blockchains.
  • Cross-chain data access can also be performed between the blockchains contained in each blockchain system and between each blockchain system.
  • blockchain nodes may include full nodes and light nodes.
  • the full node can fully download the blockchain transactions contained in each block in the blockchain, and can perform consensus verification on the blockchain transactions contained in each blockchain according to the blockchain consensus algorithm carried .
  • the light node does not need to download the complete blockchain, but can only download the block header data of each block in the blockchain, and use the data contained in the block header as the verification root to verify the blockchain authenticity of the transaction.
  • Light nodes can attach to full nodes to access more functions of the blockchain.
  • each blockchain node in the blockchain system 103 shown in Figure 1 can be used as a full node; and the device 4 directly connected to the blockchain system shown in Figure 1 can be used as a light node, Attached to each full node in the blockchain system 103.
  • the blockchain node can be a physical device, or a virtual device implemented in a server or a server cluster; for example, a blockchain node device can be a physical host in a server cluster, or it can be It is a virtual machine created after virtualizing the hardware resources carried by a server or server cluster based on virtualization technology.
  • Each blockchain node can be connected together through various types of communication methods (such as TCP/IP) to form a network to carry one or more blockchains.
  • the server end 102 may include a BaaS platform (also referred to as a BaaS cloud) for providing Blockchain as a Service (BaaS, Blockchain as a Service).
  • the BaaS platform can provide a simple way for client-side computing devices connected to the BaaS platform by providing pre-written software for activities that occur on the blockchain (such as subscriptions and notifications, user verification, database management, and remote updates). Easy to use, one-click deployment, fast verification, flexible and customizable blockchain services, which can accelerate the development, testing, and launch of blockchain business applications, and help the implementation of blockchain business application scenarios in various industries.
  • the BaaS platform can provide software such as MQ (Message Queue, message queue) service; the client-side computing device connected to the BaaS platform can subscribe to a block chain system connected to the BaaS platform.
  • MQ Message Queue, message queue
  • a smart contract deployed on a block chain generates contract events on the block chain after the execution is triggered; and the BaaS platform can monitor the events generated by the smart contract on the block chain after the execution is triggered, and then based on the MQ service related
  • the software of the contract adds the contract event to the message queue in the form of a notification message, so that the client side computing device subscribed to the message queue can get the notification related to the above contract event.
  • the BaaS platform can also provide enterprise-level platform services based on blockchain technology to help enterprise-level customers build a safe and stable blockchain environment and easily manage the deployment, operation, and maintenance of blockchain and development.
  • the BaaS platform can implement rich security policies and a multi-tenant isolation environment based on cloud technology, provide advanced security protection based on chip encryption technology, and provide rapid expansion based on highly reliable data storage. End-to-end high-availability services that will not be interrupted; in another example, enhanced management capabilities can be provided to help customers build enterprise-level blockchain network environments; and local Support, support mainstream open source blockchain technologies such as Hyperledger Fabric and Enterprise Ethereum-Quorum to build an open and inclusive technology ecosystem.
  • the device 5 as the client-side computing device 101 provides trusted computing services, and its deployed TEE runs trusted applications that can provide users with trusted computing services, while the server-side 102 includes BaaS
  • the oracle service is provided on the platform, and the oracle service program corresponding to the oracle service runs in the TEE deployed on the server side 102. From another perspective, this is equivalent to the client-side computing device 101 shown in FIG. 1
  • the device 5 directly connected to the server 102 can be regarded as the first trusted computing node involved in this specification, and the server 102 can be regarded as the second trusted computing node running the oracle service program involved in this specification.
  • Fig. 2 is a network architecture diagram shown in this specification according to an exemplary embodiment, the network architecture includes a first trusted computing node, a second trusted computing node and a target block chain, wherein the first trusted computing node may be The second trusted computing node, or the first trusted computing node is different from the second trusted computing node, the first trusted computing node is deployed with a first trusted execution environment, and the first trusted execution environment runs a trusted application, a second trusted execution environment is deployed in the second trusted computing node, and an oracle service program runs in the second trusted execution environment.
  • the target blockchain refers to the blockchain data query request sent by the trusted application. Indicates the blockchain system where the acquired block data is located, including several blockchain nodes.
  • the oracle service program can establish a network with the blockchain node corresponding to a blockchain system (the target blockchain shown in Figure 2)
  • the connection realizes information interaction, and it is also possible to establish network connections with multiple blockchain nodes corresponding to different blockchain systems at the same time to realize information interaction.
  • a communication service program is also running in the first trusted execution environment.
  • the first trusted computing node can realize information interaction through the local call between the communication service program and the trusted application;
  • the oracle service program establishes a network connection to realize information interaction, and when the first trusted computing node and the second trusted computing node are the same hardware node, it can be considered that the first trusted execution environment and the second trusted
  • the execution environment is deployed on the first trusted computing node, that is, the communication service program and the oracle service program run on the same hardware node, so the communication service program and the oracle service program can be directly called locally to realize information interaction without Establishing a network connection, of course, communication can also be performed in the form of establishing a network connection.
  • the second trusted execution environment and the first trusted execution environment may be the same trusted execution environment, or The second trusted execution environment is different from the first trusted execution environment, which is not limited in this specification.
  • the trusted execution environment (TEE) involved in the embodiments of this specification can provide a secure execution environment for software.
  • the TEE is a secure extension based on CPU hardware and is a trusted execution environment completely isolated from the outside.
  • TEE was first proposed by Global Platform to solve the security isolation of resources on mobile devices, and parallel to the operating system to provide applications with a trusted and secure execution environment.
  • Global Platform Global Platform to solve the security isolation of resources on mobile devices, and parallel to the operating system to provide applications with a trusted and secure execution environment.
  • TEE was very concerned about TEE solutions. Almost all mainstream chip and software alliances have their own TEE solutions, such as TPM (Trusted Platform Module) in software and Intel SGX and ARM Trustzone (Trusted Platform Module) in hardware. Trust Zone) and AMD PSP (Platform Security Processor, Platform Security Processor), etc.
  • Trusted computing nodes can create enclaves (enclaves or enclaves) based on SGX technology as TEEs for executing blockchain transactions.
  • the blockchain node uses the newly added processor instructions in the CPU to allocate a part of the EPC (Enclave Page Cache, enclave page cache or enclave page cache) in the memory to reside in the above enclave.
  • the memory area corresponding to the above EPC is encrypted by the memory encryption engine MEE (Memory Encryption Engine) inside the CPU.
  • MEE Memory Encryption Engine
  • the content in the memory area can only be decrypted in the CPU core and is used for encryption and decryption.
  • the key is only generated and stored in the CPU when the EPC starts up.
  • the security boundary of the enclave only includes itself and the CPU, and neither privileged nor non-privileged software can access the enclave, even the operating system administrator and VMM (virtual machine monitor, virtual machine monitor; or called, Hypervisor). It cannot affect the code and data in the enclave, so it has extremely high security, and under the premise of the above security guarantee, the CPU can process the blockchain transactions in plain text in the enclave, which has extremely high computing efficiency. Thus taking into account the data security and computing efficiency.
  • the trusted application involved in the embodiment of this specification refers to the application that runs in the TEE and is implemented using verifiable computing technology.
  • WASM WebAssembly, web page assembly
  • the bytecode is uploaded to the TEE, and the WASM code is invoked by the WASM virtual machine to form a trusted application.
  • the WASM virtual machine further executes the trusted application and obtains the execution result. Since the trusted application runs in the TEE, it can be proved to anyone through the remote authentication process that the trusted application is indeed running in the TEE, and the internal code has not been tampered with, and it is indeed executed according to the user's expectations.
  • Fig. 3 is a flowchart of a method for invoking a trusted computing program shown in this specification according to an exemplary embodiment, the method is applied to the first trusted computing node shown in Fig. 2 , where the first trusted computing node A trusted application runs in the deployed first trusted execution environment, and the method includes the following steps:
  • S301 Obtain a remote authentication report for an oracle service program, where the oracle service program runs in a second trusted execution environment.
  • the communication service program is a trusted application in the first trusted execution environment. Provide a local call interface to realize information interaction with trusted applications.
  • it provides a network interface to the outside world to realize external information interaction.
  • the communication service program and the oracle service program can be realized through this network interface. network communication.
  • the communication service program can also call other programs in the first trusted execution environment, such as a remote authentication report verification program, a digital signature verification program, etc., to realize corresponding functions.
  • the first trusted computing node before the first trusted computing node sends a blockchain data query request to the oracle service program running in the second trusted execution environment, it needs to obtain the remote authentication report for the oracle service program, To ensure that the oracle service program runs in the second trusted execution environment and the corresponding program code has not been tampered with, that is, to ensure that the oracle service program is credible.
  • the first trusted computing node can obtain the remote authentication report for the oracle service program through multiple ways, for example, by sending a remote authentication challenge for the oracle service program to the oracle service program to obtain the remote authentication report, in this
  • the first trusted computing node may receive the remote authentication report sent by the oracle service program and returned by the authentication server after completing the authentication of the self-recommendation information, and the self-recommendation information includes The first hash value corresponding to the program code, and the second hash value corresponding to the public key of the oracle service program; or,
  • the remote authentication report involved in the embodiment of this specification is generated in the remote authentication process for the oracle service program in the second trusted execution environment.
  • the oracle service program receives the remote authentication challenge sent by the first trusted computing node, it responds to the remote authentication challenge and invokes the remote authentication service in the oracle service program to execute the remote authentication process.
  • the oracle service program First, all program codes contained in the oracle service program running in the second trusted execution environment will be extracted. These programs include the network interface program, blockchain interface program, blockchain verification program, etc. in the oracle service program.
  • these program codes are hashed to obtain a program hash value (the first hash value), and similarly, the public key maintained by the oracle service program to indicate the identity of the oracle service program is also obtained by hashing A public key hash value (the second hash value), and finally encapsulate the program hash value and the public key hash value to obtain self-recommendation information.
  • the oracle service program When the self-recommendation information passes the verification of the authentication server, the oracle service program will receive To the remote authentication report provided by the authentication server for the self-recommendation information, the remote authentication report is used to indicate that the oracle service program running in the second trusted execution environment is credible, and the self-recommendation information can further include the public key of the program developer The hash value of the program version number, etc., this manual does not make any restrictions on this.
  • the second trusted execution environment is an enclave created on the second trusted computing node to run the oracle service program, and the remote authentication process also involves another A special enclave, namely quoting enclave (QE for short), QE is an architectural enclave (Architectural Enclave) provided and signed by Intel.
  • QE quoting enclave
  • Intel architectural Enclave
  • the enclave running the oracle service program first needs to generate a REPORT (report) structure for local authentication, and QE verifies whether the enclave is on the same platform as itself based on the REPORT structure, and then QE combines the REPORT structure with the program
  • the hash value and the public key hash value are encapsulated into a structure QUOTE (that is, self-recommended information), and signed using the EPID (enhanced privacy identification) key.
  • the EPID key not only represents the platform of private computing nodes under the chain, but also represents the credibility of the underlying hardware of the second trusted computing node. It can also bind information such as the version of the processor firmware, and only QE can access the EPID key.
  • the above-mentioned authentication server can be an IAS (Intel Attestation Service) server provided by Intel Corporation.
  • the oracle service program sends the signed QUOTE structure to the IAS server, so that the IAS server can verify the signature and send The oracle service program returns the corresponding remote authentication report.
  • the oracle service program After the oracle service program obtains the remote authentication report, it can directly send the remote authentication report to the first trusted computing node, thereby assisting the first trusted computing node to obtain the remote authentication report.
  • the first trusted computing node initiates The remote authentication challenge is used to perform remote authentication, thereby assisting the first trusted computing node to obtain the remote authentication report, so as to prove to the first trusted computing node that the oracle service program has not been tampered with and is running in a trusted execution environment, and the oracle service
  • the callee public key maintained by the program is authentic, thereby anchoring trust in the oracle service program to the first trusted computing node, and using the remote authentication report for the oracle service program as a corresponding trust certificate.
  • the oracle service program after obtaining the remote authentication challenge, will only calculate the self-recommendation information in the above manner without sending the self-recommendation information to the authentication server, but first send the self-recommendation information to the first trusted computer node, so that the first trusted computing node completes the subsequent remote authentication process, sends self-recommendation information to the authentication server, and receives the remote authentication report returned by the authentication server after completing the authentication of the self-recommendation information.
  • the first trusted computing node can actively initiate a remote authentication process for the self-recommendation information, so that the first trusted computing node can obtain the latest remote authentication report, thereby enhancing the validity of the proof and the security of the system.
  • the first trusted computing node can also query the remote The authentication report library thus obtains the remote authentication report for the oracle service program.
  • the remote authentication report of the oracle service program and the corresponding update time are pre-stored in the remote authentication report library. Every time the first trusted computing node passes the remote authentication When obtaining the latest remote verification report in a challenge or other form, the remote verification report corresponding to the oracle service program in the remote verification report library will be updated, so that the remote verification report of each oracle service program in the remote verification report library can be obtained in time updated, thereby enhancing the validity of the proof.
  • the determination of the authenticity of the oracle service program according to the remote authentication report involved in the embodiment of this specification specifically includes: after the first trusted computing node obtains the remote authentication report, it authenticates the signature of the remote authentication report with the public key of the authentication server and then confirms that the remote The authentication report is issued by the authentication server, and then read out the program hash value and public key hash value recorded in the authentication report, and compare it with the program standard hash value and public key stored in the first trusted computing node. Compared with the standard hash value, if the program hash value is consistent with the program standard hash value, it can be proved that the oracle service program in the trusted computing node has not been tampered with and is running in the second trusted execution environment.
  • the public key If the public key If the hash value is consistent with the standard hash value of the public key, it can prove that the public key corresponding to the oracle service program held by the first trusted computing node is indeed a public key that can indicate the true identity of the oracle service program. If the comparisons are consistent, it can be determined that the oracle service program is credible.
  • the standard hash value of the program is obtained by hashing all the program codes in the public oracle service program, and the standard hash value of the public key is obtained through the It is considered that the public key corresponding to the oracle service program is obtained after hashing.
  • the hashing function for calculating the standard hash value of the program is consistent with the hashing function for calculating the hash value of the program.
  • the hash operation function of the standard hash value of the public key is consistent with the hash operation function used to calculate the hash value of the public key.
  • the first trusted computing node locally pre-stores the remote authentication report for the oracle service program, so the first trusted computing node can execute the corresponding remote authentication report verification in the first trusted execution environment at any time program to verify whether the remote authentication report indicates that the oracle service program is credible. For example, the first trusted computing node can verify the remote authentication report in advance so as to save the verification result.
  • a trusted application When a trusted application generates a blockchain data query requirement, it will actively initiate a blockchain data query request to the communication service program.
  • the request includes the blockchain domain name, block hash and transaction hash, etc.
  • the description information of the block data is required.
  • the communication service program After receiving the request, the communication service program will first check whether there is a remote authentication report for the oracle service program locally. In the case of a remote authentication report, the remote authentication report verification program will be called to verify the remote authentication report. If the verification result is untrustworthy, the blockchain data query request sent by the trusted application will be temporarily cached. And continue to search whether there are remote authentication reports of other oracle service programs locally.
  • the first trusted computing node It will use the communication service program to initiate a remote authentication report to the trusted computing node where one or more oracle service programs with public IP addresses are located to obtain the relevant remote authentication report, and then continue to verify it through the remote authentication report verification program. Verification, until the verification result of a certain remote certification report is credible, it can be determined that the oracle service program corresponding to the remote certification report is credible, and at this time the first trusted computing node can send the blockchain data The query request is sent to the trusted oracle service program through the communication service program.
  • the first node device does not find any trusted oracle service program after going through the above process, it will return the blockchain data query request sent by the trusted application through the communication service program, and inform the trusted application
  • the corresponding error code is used to remind the user corresponding to the trusted application that currently lacks a trusted agency (oracle service program), so the blockchain data query service cannot be completed.
  • the oracle service program When the oracle service program receives the blockchain data query request sent by the first trusted computing node, it will parse the blockchain domain name, block hash and transaction hash from the request to point to the specific required The description information of the block data, and then determine the address of the block data according to the above description information.
  • the oracle service program may maintain a network connection with the corresponding block chain nodes in one or more block chain systems, so as to Different blockchain systems are labeled with different blockchain domain names, and maintain the corresponding relationship between the blockchain domain name and the network address such as the IP address and port number of the blockchain node corresponding to the corresponding blockchain system, so the oracle service
  • the program can determine which blockchain system the required block data is in through the blockchain domain name, and use the determined blockchain system as the target blockchain, that is, the target blockchain involved in this manual refers specifically to The blockchain system pointed to by the blockchain domain name contained in the blockchain data query request.
  • the block hash can be used to determine which block the required block data is in on the target blockchain, and the determined block can be used as the target block, and finally the required block can be determined through the transaction hash
  • the data specifically corresponds to which transaction data on the target block.
  • the block data involved in this specification may include transaction data on the block, or other data on the block such as transaction receipt data, block header data, etc. This specification does not make any restrictions on this.
  • the oracle service program involved in this manual has the ability to access the blockchain system. Therefore, the oracle server can continuously access multiple blockchain systems to obtain block data on each blockchain system in advance. After the block chain system generates a new block, it will trigger the proxy block chain node in any block chain system that has established a network connection with the oracle service program to provide the updated information of the block to the oracle service program, and then , the oracle service program can obtain the latest added block by calling the blockchain data access interface provided by the proxy blockchain node, so that the complete area of any blockchain system can be maintained locally in the oracle service program block data.
  • the oracle service program when the oracle service program receives the blockchain data query request and determines that the target blockchain is obtained, it will check whether each block on the local pre-stored corresponding to the target blockchain contains a block The block data corresponding to the block hash in the chain data query request and the transaction hash, the block data is obtained under the condition that the block data is pre-stored locally.
  • the oracle service program can pass The complete block data on the target block chain is stored in advance, so that when a block chain data query request is received, the block data corresponding to the block chain data query request can be directly obtained without accessing the target block chain.
  • the oracle service program when the oracle service program receives the block chain data query request and determines to obtain the target block chain, it will access the target block chain in real time to obtain the corresponding block data.
  • the oracle service program does not need to pre-store the complete block data of the target blockchain, thus reducing the storage burden on the device, and even if the oracle service program pre-stores the complete block data of the target blockchain, Since the oracle service program may not be able to update the blocks of the target blockchain in a timely manner, there may be block data corresponding to the blockchain data query request that cannot be queried locally but is indeed in the latest block of the target blockchain Therefore, when receiving the blockchain data query request, accessing the target blockchain in real time can also ensure that the latest block data on the target blockchain can be obtained, avoiding the oracle service program due to Failure to update the complete block data on the local pre-stored target blockchain in time may lead to the possibility of failure to obtain block data.
  • the oracle service program can obtain the block data by calling the blockchain data access interface provided by the blockchain node corresponding to the target blockchain, wherein the oracle service program is established with
  • the blockchain node corresponding to any blockchain system that is connected to the network and can be accessed by the oracle service program is used as the proxy blockchain node corresponding to the target blockchain, and will have a trust relationship with the oracle service program in advance. That is, the proxy blockchain node obtains and verifies the remote authentication report for the oracle service program in advance to confirm that the oracle service program is credible.
  • the corresponding verification process is the same as the verification method for the remote authentication report described above, and will not be repeated here. .
  • the proxy blockchain node can provide a blockchain data access interface that only allows the oracle service program to access when it is determined that the oracle service program is credible, and the oracle service program can access the proxy area safely and barrier-free through this interface
  • the database information on the blockchain node includes all the blocks stored and maintained on the proxy blockchain node, the contract code and contract status of each smart contract, etc.
  • the oracle service program can also initiate a block data acquisition transaction to the oracle contract on the target blockchain, and monitor the block data acquisition transaction generated by the oracle contract.
  • the block data acquisition event contained in the receipt acquires the block data.
  • the corresponding block data can be obtained by initiating a cross-chain transaction to the target blockchain and monitoring events.
  • the oracle service program can pass the proxy blockchain node on the target blockchain Initiate a block data acquisition transaction to the oracle contract on the target blockchain, the transaction contains block hash and transaction hash, so that the oracle contract executes the transaction, and obtains the block hash contained in the transaction
  • the transaction data pointed to by Xihe transaction hash is written into the block data acquisition event contained in the transaction receipt, and the oracle service program obtains the block by further listening to the proxy block chain node on the target block chain
  • the data captures the receipt of the transaction and reads the required transaction data from the receipt.
  • the behavior of accessing block data can be stored on the target block chain to ensure the process of obtaining block data Transparent and traceable, the subsequent first trusted computing node can also verify whether the block data acquisition transaction is executed on the target block chain through a third party, so as to ensure that the obtained block data does come from the target block chain and improve the system security.
  • S303 Receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and if the digital signature is successfully verified by the public key corresponding to the oracle service program , returning the block data to the trusted application.
  • the oracle service program After the oracle service program obtains the block data on the target blockchain in response to the blockchain data query request, it will first perform a hash operation on the block data to obtain the block data hash, and then use the oracle service
  • the private key maintained by the program itself to indicate the true identity of the oracle service program signs the hash of the block data to obtain the digital signature corresponding to the block data, and finally returns the obtained block data and the corresponding digital signature To the communication service program in the first trusted computing node.
  • the communication service program After the communication service program receives the block data returned by the oracle service program and the digital signature corresponding to the block data, it will call the digital signature verification program in the first trusted execution environment to verify the digital signature, specifically
  • the communication service program takes the block data and the corresponding digital signature as input parameters to the digital signature verification program, and the digital signature verification program performs hash operation on the received block data to obtain the standard block data hash, and then uses The previously verified public key that can indicate the true identity of the oracle service program decrypts the digital signature to obtain the block data hash to be verified, and compares the block data hash to be verified with the standard block data hash.
  • the communication service program determines that the block data is indeed from the verified
  • the trusted oracle service program returns the block data, and returns the block data to the trusted application as the callback result of the previous blockchain data query request sent by the trusted application.
  • the first trusted computing node anchors the trust in the oracle service program by obtaining the remote authentication report for the oracle service program
  • the trusted application running in the first trusted execution environment deployed by the first trusted computing node can securely access and acquire block data on the blockchain by means of a trusted oracle service program.
  • the block data and the digital signature corresponding to the block data are returned by the oracle service program when the authenticity verification of the block data is successful.
  • the oracle service program After the oracle service program obtains the block data, it will further verify the authenticity of the block data, and only when the authenticity verification is successful will the block data be signed, and the block data and the corresponding The digital signature is returned to the communication service program in the first trusted computing node.
  • the oracle service program needs to verify the authenticity of the obtained block data, and will return to the first trusted computing node only when the verification is successful, so that the block data obtained by the oracle service program can be guaranteed
  • the source of the block data is credible and has not been tampered with, so that the first trusted computing node does not need to repeatedly verify the authenticity of the block data at the block level (because the first trusted computing node is verifying In the remote authentication report, it can be determined that the oracle service program contains the code segment of the block chain verification program that verifies the block data), and only needs to verify the digital signature corresponding to the block data, and after the verification is successful, due to It can ensure that the block data comes from a trusted oracle service program, so it can be directly sent back to the trusted application for user use.
  • the verification of the authenticity of the block data is successful, including: the verification result corresponding to the target blockchain locally maintained by the oracle service program indicates that all blocks on the target blockchain are legal And if the verification of the corresponding Merkle roots is successful, it is determined that the authenticity verification of the block data is successful.
  • the oracle service program needs to verify the authenticity of the block data obtained in real time, Specifically, the oracle service program will not only obtain the block data pointed to by the blockchain data query request, but also obtain all the blocks of the target blockchain, so as to maintain all the blocks of the target blockchain locally , and verify the Merkle root and block hash of each block in block order from the genesis block, perform hash operations on all transactions contained in any block to obtain multiple transaction hashes, and follow Recalculate the Merkle root by finding the Merkle root, compare the recalculated Merkle root with the Merkle root recorded in the block header of any block, and explain the transaction on any block if the comparison is consistent It has not been tampered with, so any block is credible, so it is determined that the Merkle root verification of any block is successful, and in the case of inconsistency, it means that the transaction on any block has been tampered with, so any block is not
  • the block is legal, and if the comparison is inconsistent, it means that the block and the blocks after the block are not legal.
  • a verification result will be generated to record the credible part in all the blocks of the target blockchain (at the same time through Merkle root and block hash verification to prove credible and legal block) as the verification result of the target blockchain, the verification result shows that all blocks on the target blockchain are legal and the corresponding Merkle root is If the verification is successful, it is determined that the authenticity verification of the block data is successful.
  • the oracle service program has pre-stored the complete block data corresponding to the target blockchain locally. Block data, so all blocks on the target blockchain can be verified in advance with Merkle root and block hash.
  • the oracle service program can The Merkle root verification of the block is performed in a timely manner, and the block is also used to prove the legitimacy of its corresponding parent block (using the block hash for verification, the method is the same as the above), so that there is a timely update in the local maintenance
  • the verification result of the target blockchain the verification result records the credible part of all blocks in the target blockchain, that is, the oracle service program does not need to verify all the blocks on the target blockchain every time Instead, only newly added blocks are verified each time, which enables the oracle service program to determine whether all blocks on the target blockchain are legal by reading the verification results of the locally maintained target blockchain at any time. And whether the verification of the corresponding Merkle root is successful.
  • the latest block received by the oracle service program proves that its parent block is not legal, it will no longer receive subsequent updated blocks of the blockchain system where the block is located. .
  • the oracle service program can also only pre-store the block headers of all blocks on the target blockchain locally, so that the legitimacy of the block can be pre-proved while retaining the Merkle root verification process.
  • the oracle After the service program determines the block data on the target blockchain according to the blockchain data query request, it needs to request the block data from the target blockchain.
  • the target blockchain can only request the target blockchain to obtain the block (according to the block hash carried in the block chain data query request) instead of all blocks on the target block chain, after obtaining the block, determine the block data as transaction data according to the transaction hash,
  • Merkle root verification is performed on the acquired block, and the Merkle root obtained by recalculation is not only compared with the Merkle root recorded on the block header of the acquired block, but also with the block header of the block where the locally maintained block data is located. Compare the Merkle root recorded above, and if the comparison is consistent, it is determined that the obtained block data conforms to the block header of the target blockchain maintained locally as a trust certificate, that is, it can be determined that the block data has not been tampered with.
  • the oracle service program can also pre-store the transaction hashes of all blocks on the target blockchain. Specifically, after obtaining the complete block data corresponding to the target blockchain, each of them The transaction hash calculated by the transaction is saved according to the order between the blocks and the order in the block (that is, the execution order of the transaction). After the verification of the Merkle root and the block hash is completed and the verification result is maintained locally , the block body part of all blocks can be deleted locally, so that after the oracle service program determines the block data on the target blockchain according to the blockchain data query request, it only sends Just request the block data itself. This is because all the verification processes at the block level have been completed in advance and the verification results maintained locally are used as certificates.
  • the oracle service program only needs to check the verification results and the obtained block data. Perform a hash operation, and the verification result can show that all blocks on the target blockchain are legal and the corresponding Merkle roots are verified successfully, and the received block data provided by the target blockchain is obtained by hashing
  • the hash value of the block chain data query request is consistent with the transaction hash contained in the block chain data query request, it can be determined that the authenticity verification of the block data is successful.
  • the verification of the authenticity of the block data must be confirmed only when all blocks on the target block chain are legal and the corresponding Merkle roots are successfully verified.
  • This strict verification method can maximize This guarantees the legitimacy and credibility of the block data source.
  • the verification result corresponding to the target blockchain maintained locally by the oracle service program indicates that the block where the block data is located is legal and the corresponding Merkle root verification is successful
  • Quantitative verification methods can reduce the calculation cost and time cost of verifying all blocks as much as possible on the premise of ensuring the legitimacy and credibility of block data sources, improve verification efficiency and obtain block data. Success rate.
  • the sending the blockchain data query request to the oracle service program includes: using the public key corresponding to the oracle service program to encrypt the blockchain data query request to obtain a blockchain A data query request ciphertext; sending the block chain data query request ciphertext to the oracle service program.
  • the encrypted channel between the first trusted computing node and the oracle service program is realized by using asymmetric encryption, so that only the oracle service program can decrypt and obtain the zone sent by the first trusted computing node.
  • Block chain data query request so as to ensure the privacy of the process of obtaining block chain data.
  • the public key corresponding to the oracle service program used here can be the public key that has been verified through the remote authentication report and can indicate the real identity of the oracle service program, or it can be other public keys used to indicate the real identity of the oracle service program. It is necessary to ensure that the private key corresponding to the public key used to encrypt the blockchain data query request is indeed held by the oracle service program. Therefore, when the oracle service program receives the blockchain data query request key After the text, you can use the private key you maintain to decrypt the ciphertext of the blockchain data query request to get the corresponding blockchain data query request.
  • the blockchain data query request includes a public key corresponding to the first trusted computing node, and receiving the block data returned by the oracle service program and the digital signature corresponding to the block data , including: receiving the block data ciphertext and the digital signature ciphertext returned by the oracle service program, and using the private key of the first trusted computing node to decrypt the block data ciphertext and the digital signature ciphertext respectively Obtain the block data and the digital signature corresponding to the block data; wherein, the block data ciphertext and the digital signature ciphertext are respectively used by the oracle service program using the public key of the first trusted computing node Obtained after encrypting the block data and the digital signature corresponding to the block data.
  • the encrypted channel between the first trusted computing node and the oracle service program is realized by using asymmetric encryption, so that only the communication service program on the first trusted computing node can decrypt to obtain the oracle The block data sent by the service program and the corresponding digital signature, thus ensuring the privacy of the process of obtaining the block chain data.
  • the subsequent oracle service program prepares to return the block to the first trusted computing node
  • the public key contained in the blockchain data query request can be used to encrypt, so that the encrypted block data ciphertext and digital signature ciphertext are sent to the communication service program on the first trusted computing node , so that the communication service program uses the private key maintained by itself to decrypt and obtain the corresponding block data and digital signature.
  • the first trusted computing node maintains parsing plug-ins corresponding to each blockchain type, and the returning the block data to the trusted application includes: according to the zone of the target blockchain
  • the parsing plug-in corresponding to the block chain type parses the block data, and returns the parsed block data to the trusted application. Since the data structure and form definitions of the blocks corresponding to different types of blockchains are quite different, for example, the transaction format of the blockchain based on UXTO (Unspent Transaction Output) is different from that of the blockchain based on Ethereum. are not the same, so different parsing methods need to be adopted according to different versions and types of obtained blocks to obtain the available data in the data part.
  • UXTO Unspent Transaction Output
  • the analysis plug-ins corresponding to various blockchain types are maintained on the first trusted computing node, the obtained block data corresponding to each blockchain type can be correctly analyzed and processed. In this way, the parsed block data that can be recognized by trusted applications is obtained, so that optional applications running off-chain can access the on-chain data on various heterogeneous chains in a credible and compatible manner.
  • the trusted application runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes: a virtual machine based on a stack structure of binary operation instructions.
  • the trusted application running in the first trusted execution environment actually runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes a WASM virtual machine.
  • the WASM virtual machine involved in the embodiment of this specification is a virtual machine with a stack structure based on binary operation instructions, and only supports running program code written in WASM language.
  • WASM language is another language other than JavaScript that can run on web pages.
  • WASM can run in modern web browsers. It belongs to a low-level assembly-like code with a compact binary format and can directly operate CPU instruction codes, such as x86 instructions.
  • the assembly code on the set has instruction sets, registers, stacks, etc., so it can run with near-native performance, and provides a compilation target for high-level languages such as C/C+, so that these high-level languages can run on browsers.
  • the WASM language is designed to coexist with JavaScript, so the two can run concurrently and are compatible with each other.
  • Fig. 4 is an interactive flowchart of a method for obtaining blockchain data provided by this specification according to an exemplary embodiment. Please refer to Fig. 4.
  • the scheme for obtaining blockchain data involved in this specification can be based on the first trusted computing Nodes, the second trusted computing node and the blockchain node are realized through cooperation, wherein the blockchain node belongs to the target blockchain, and the method may include the following steps: S401: the trusted computing node in the first trusted computing node
  • the letter application constructs a blockchain data query request, wherein the blockchain domain name, block hash and transaction hash contained in the blockchain data query request.
  • the trusted application sends a blockchain data query request to the communication service program in the first trusted computing node, and the communication service program caches the received blockchain data query request, and sends the request to the oracle machine in the second trusted computing node
  • the server program issues a remote authentication challenge.
  • S403 The oracle service program randomly generates and maintains a public-private key pair in response to the remote authentication challenge, and performs hash operations on its own program code and the generated public key to obtain the program hash value and public key hash value Then use your own CPU private key to sign to get the program hash signature and public key hash signature. Finally, the program hash value, public key hash value, program hash signature and public key hash signature are encapsulated to get self-recommendation information and sent to IAS server, so that the IAS server can receive the remote authentication report returned by the IAS server after the authentication is completed.
  • S404 The oracle service program returns the obtained remote authentication report for the oracle service program and the generated public key to the communication service program in the first trusted computing node.
  • the communication service program invokes the remote authentication report verification program in the first trusted execution environment to verify the received verification report, and first uses the public key of the IAS server to verify the signature of the remote authentication report, and then confirms the remote authentication report If it is indeed issued by the IAS server, check the authentication result recorded by it.
  • the authentication result shows that the oracle service program is indeed running in the second trusted execution environment, then continue to parse the program hash from the self-recommendation information contained in the remote authentication report Value and public key hash value, the hash value calculated in real time by all the program codes of the oracle service program in the public second trusted computing node stored in the database, or directly searched from the network to obtain the second trusted computing node
  • the hash value corresponding to all program codes of the oracle service program in the letter computing node is compared with the program hash value, and at the same time, the hash value calculated from the public key received from the oracle service program is compared with the public key hash If the two comparison results are consistent, it can be proved that the program code of the oracle service program has not been tampered with and the obtained public key corresponding to the oracle service program is authentic, that is, Prove that the oracle service program is trustworthy.
  • S406 The communication service program in the first trusted computing node sends the cached blockchain data query request to the oracle service program in the second trusted computing node.
  • the oracle service program responds to the blockchain data query request, and parses it to obtain the corresponding blockchain domain name, block hash and transaction hash, and determines the block where the required transaction data is located through the blockchain domain name
  • the chain system is the target blockchain, so as to call the blockchain data access interface of the corresponding blockchain node in the target blockchain known in advance, and initiate a blockchain data access request to the blockchain node.
  • S409 The oracle service program determines and obtains the corresponding blockchain data query request required by the application from all blocks on the target blockchain according to the block hash and transaction hash in the blockchain data query request At the same time, all the blocks received on the target blockchain are verified one by one by Merkle root and block hash, and the verification results corresponding to the target blockchain are generated and maintained locally.
  • S411 The oracle service program returns the transaction data and the digital signature corresponding to the transaction data to the communication service program in the first trusted computing node.
  • the communication service program After the communication service program receives the transaction data returned by the oracle service program and the digital signature corresponding to the transaction data, it will call the digital signature verification program in the first trusted execution environment to verify the digital signature.
  • the digital signature verification program will first The received transaction data is hashed to obtain the standard transaction data hash, and then the digital signature is decrypted using the public key corresponding to the oracle service program that has been proved through the remote authentication report to obtain the transaction data hash to be verified. Verify that the transaction data hash is compared with the standard transaction data hash. If the comparison is consistent, it is determined that the digital signature verification is successful. After receiving the callback result of successful signature verification, the communication service program determines that the transaction data is indeed It is returned from the verified oracle service program, thus trusting the transaction data.
  • the communication service program uses the corresponding parsing plug-in to parse the transaction data according to the block chain type to obtain the parsed transaction data, and returns the parsed transaction data to the trusted application as the area sent by the trusted application.
  • the first trusted computing node anchors the trust relationship of the oracle service program by obtaining the remote authentication report for the oracle service program, so that the first trusted computing node obtains the remote authentication report through the oracle service program.
  • this specification also provides embodiments of apparatuses, electronic equipment, and storage media.
  • Fig. 5 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • the device includes a processor 502 , an internal bus 504 , a network interface 506 , a memory 508 and a non-volatile memory 510 , and of course it may also include hardware required by other services.
  • the processor 502 reads a corresponding computer program from the non-volatile memory 510 into the memory 508 and executes it.
  • one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
  • Figure 6 is a block diagram of a device for acquiring blockchain data according to an exemplary embodiment of this specification, which can be applied to the device shown in Figure 5 to implement the technology of this specification solution, the device is applied to a first trusted computing node, and a trusted application runs in the first trusted execution environment deployed by the first trusted computing node, and the device includes: a report obtaining unit 601, configured to obtain the The remote authentication report of the oracle service program, the oracle service program runs in the second trusted execution environment; the request sending unit 602 is configured to determine that the oracle service program is credible according to the remote authentication report, Sending the block chain data query request obtained from the trusted application to the oracle service program, so that the oracle service program responds to the block chain data query request to obtain the data on the target block chain block data; a data receiving unit 603, configured to receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and pass the public key corresponding to the oracle service program to the If the verification
  • the blockchain data query request includes a blockchain domain name and a transaction hash
  • the target blockchain is determined by the blockchain domain name in the blockchain data query request
  • the Block data on the target blockchain is determined by the transaction hash in the blockchain data query request.
  • the block data on the target block chain is obtained from the target block chain in real time by the oracle service program, or the block data is obtained from the target block chain in advance by the oracle service program Obtain.
  • the oracle service program in the request sending unit 602 to obtain the block data includes:
  • the oracle service program obtains the block data by calling the blockchain data access interface provided by the blockchain node corresponding to the target blockchain;
  • the oracle contract on the block chain initiates a block data acquisition transaction, and monitors the block data acquisition event contained in the receipt of the block data acquisition transaction generated by the oracle contract to acquire the block data.
  • the block data and the digital signature corresponding to the block data are returned by the oracle service program when the authenticity verification of the block data is successful.
  • the verification of the authenticity of the block data is successful, including: the verification result corresponding to the target blockchain locally maintained by the oracle service program indicates that all blocks on the target blockchain are legal And if the verification of the corresponding Merkle roots is successful, it is determined that the authenticity verification of the block data is successful.
  • the request sending unit 602 sends the blockchain data query request to the oracle service program, including: using the public key corresponding to the oracle service program to encrypt the blockchain data query request Obtaining the ciphertext of the blockchain data query request; sending the ciphertext of the blockchain data query request to the oracle service program.
  • the blockchain data query request includes a public key corresponding to the first trusted computing node
  • the data receiving unit 603 receives the block data returned by the oracle service program and the block data
  • the corresponding digital signature includes: receiving the block data ciphertext and the digital signature ciphertext returned by the oracle service program, and using the private key of the first trusted computing node to respectively write the block data ciphertext and the digital signature Decrypting the signature ciphertext to obtain the block data and the digital signature corresponding to the block data; wherein, the block data ciphertext and the digital signature ciphertext are used by the oracle service program using the first trusted computing
  • the node public key is obtained after encrypting the block data and the digital signature corresponding to the block data respectively.
  • the first trusted computing node maintains parsing plug-ins corresponding to each blockchain type, and the data receiving unit 603 returns the block data to the trusted application, including: The parsing plug-in corresponding to the block chain type of the block chain parses the block data, and returns the parsed block data to the trusted application.
  • the trusted application runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes: a virtual machine based on a stack structure of binary operation instructions.
  • the second trusted execution environment is deployed on a second trusted computing node; or, the second trusted execution environment is deployed on a first trusted computing node; wherein, the second trusted execution environment The same trusted execution environment as the first trusted execution environment, or the second trusted execution environment is different from the first trusted execution environment.
  • the report obtaining unit 601 is specifically configured to: receive the remote authentication report for the oracle service program sent by the oracle service program and returned by the authentication server after completing the authentication of the self-recommendation information,
  • the self-recommendation information includes the first hash value corresponding to the program code of the oracle service program, and the second hash value corresponding to the public key of the oracle service program; or, receiving the message sent by the oracle service program the self-recommendation information, send the self-recommendation information to the authentication server, and receive the remote authentication report for the oracle service program returned by the authentication server after completing the authentication of the self-recommendation information.
  • the request sending unit 602 can determine that the oracle service program is credible:
  • the first hash value in the self-recommendation information is consistent with the third hash value
  • the second hash value in the self-recommendation information is consistent with the fourth hash value
  • the third hash value It is obtained by performing a hash operation on the program code contained in the disclosed oracle service program
  • the fourth hash value is obtained by the corresponding to the oracle currently held by the first trusted computing node
  • the public key of the service program is obtained after performing a hash operation.
  • this specification also provides a device, the device includes a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the credible implementation provided by all the above method embodiments. Calculation method steps.
  • this specification also provides a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by a processor, the steps for implementing the trusted computing method provided by all the above method embodiments are implemented.
  • the device embodiment since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment.
  • the device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
  • a typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
  • a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word “if” as used herein may be interpreted as “at” or "when” or "in response to a determination.”

Abstract

One or more of the embodiments of the present description provides a method and apparatus for acquiring blockchain data, an electronic device, and a storage medium. The method is applied to a first trusted computing node, and a trusted application runs in a first trusted execution environment (TEE) deployed by the first trusted computing node. The method comprises: acquiring a remote authentication report for an oracle machine service program, the oracle machine service program running in a second TEE; when determined according to the remote authentication report that the oracle machine service program is trustworthy, sending a blockchain data query request acquired from a trusted application to the oracle machine service program, so that the oracle machine service program acquires block data on a target blockchain in response to the blockchain data query request; and receiving block data returned by the oracle machine service program and a digital signature corresponding to the block data, and returning the block data to the trusted application when the digital signature is successfully verified by means of a public key corresponding to the oracle machine service program.

Description

一种获取区块链数据的方法、装置、电子设备及存储介质A method, device, electronic device and storage medium for acquiring blockchain data 技术领域technical field
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种获取区块链数据的方法、装置、电子设备及存储介质。One or more embodiments of this specification relate to the field of blockchain technology, and in particular to a method, device, electronic device, and storage medium for acquiring blockchain data.
背景技术Background technique
在相关技术中,为了保证TEE(Trusted Execution Environment,可信执行环境)中运行的可信应用在操作系统级别上的安全性,一般不会被提供如网络调用接口这类系统调用接口,这导致TEE中的可信应用无法安全地访问和获取区块链上的相关数据。In related technologies, in order to ensure the security of trusted applications running in TEE (Trusted Execution Environment, Trusted Execution Environment) at the operating system level, system call interfaces such as network call interfaces are generally not provided, which leads to Trusted applications in TEE cannot securely access and obtain relevant data on the blockchain.
发明内容Contents of the invention
有鉴于此,本说明书一个或多个实施例提供一种获取区块链数据的方法、装置、电子设备及存储介质。In view of this, one or more embodiments of this specification provide a method, device, electronic device, and storage medium for acquiring blockchain data.
为实现上述目的,本说明书一个或多个实施例提供技术方案如下:根据本说明书一个或多个实施例的第一方面,提出了一种获取区块链数据的方法,所述方法应用于第一可信计算节点,所述第一可信计算节点部署的第一可信执行环境中运行有可信应用,所述方法包括:获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境;在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据;接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。In order to achieve the above purpose, one or more embodiments of this specification provide technical solutions as follows: According to the first aspect of one or more embodiments of this specification, a method for acquiring blockchain data is proposed, and the method is applied to the first A trusted computing node, where a trusted application runs in a first trusted execution environment deployed by the first trusted computing node, the method includes: obtaining a remote authentication report for an oracle service program, and the oracle service The program runs in the second trusted execution environment; when the oracle service program is determined to be credible according to the remote authentication report, send the blockchain data query request obtained from the trusted application to the oracle machine service program, so that the oracle machine service program responds to the block chain data query request, and obtains the block data on the target block chain; receives the block data and the block data returned by the oracle machine service program If the digital signature corresponding to the block data is successfully verified through the public key corresponding to the oracle service program, the block data is returned to the trusted application.
根据本说明书一个或多个实施例的第二方面,提出了一种获取区块链数据的装置,所述装置应用于第一可信计算节点,所述第一可信计算节点部署的第一可信执行环境中运行有可信应用,所述装置包括:报告获取单元,用于获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境;请求发送单元,用于在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据;数据接收单元,用于接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。According to the second aspect of one or more embodiments of this specification, a device for acquiring blockchain data is proposed, the device is applied to a first trusted computing node, and the first trusted computing node deployed by the first There is a trusted application running in the trusted execution environment, and the device includes: a report obtaining unit, configured to obtain a remote authentication report for the oracle service program, and the oracle service program runs in the second trusted execution environment; request to send A unit, configured to send a blockchain data query request obtained from the trusted application to the oracle service program when it is determined that the oracle service program is credible according to the remote authentication report, so that The oracle service program obtains the block data on the target block chain in response to the block chain data query request; the data receiving unit is used to receive the block data and the block data returned by the oracle service program. If the digital signature corresponding to the block data is successfully verified through the public key corresponding to the oracle service program, the block data is returned to the trusted application.
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器通过运行所述可执行指令以实现上述获取区块链数据的方法的步骤。According to a third aspect of one or more embodiments of the present specification, an electronic device is provided, including: a processor; a memory for storing processor-executable instructions; wherein, the processor executes the executable instructions In order to realize the above steps of the method for obtaining blockchain data.
根据本说明书一个或多个实施例的第四方面,提出了一种计算机可读存储介质,其上储存有可执行指令;其中,该指令被处理器执行时,实现上述获取区块链数据的方法的步骤。According to a fourth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which executable instructions are stored; wherein, when the instructions are executed by a processor, the above-mentioned acquisition of blockchain data is realized. method steps.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本说明书的实施例,并与说明书一起用于解释本说明书的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and together with the description serve to explain the principles of the specification.
图1是本说明书提供的一种与区块链相关的网络环境的示意图。Fig. 1 is a schematic diagram of a blockchain-related network environment provided in this specification.
图2是本说明书根据一示例性实施例提供的一种网络架构图。Fig. 2 is a network architecture diagram provided in this specification according to an exemplary embodiment.
图3是本说明书根据一示例性实施例提供的一种获取区块链数据的方法的流程图。Fig. 3 is a flow chart of a method for acquiring blockchain data provided in this specification according to an exemplary embodiment.
图4是本说明书根据一示例性实施例提供的一种获取区块链数据的方法的交互流程图。Fig. 4 is an interaction flowchart of a method for acquiring blockchain data according to an exemplary embodiment provided in this specification.
图5是一示例性实施例提供的一种设备的结构示意图。Fig. 5 is a schematic structural diagram of a device provided by an exemplary embodiment.
图6是本说明书根据一示例性实施例提供的一种获取区块链数据的装置的框图。Fig. 6 is a block diagram of a device for acquiring blockchain data according to an exemplary embodiment provided in this specification.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. Implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with aspects of one or more embodiments of the present specification as recited in the appended claims.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or less steps than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
请参考图1,图1是本说明书示出的一种与区块链相关的网络环境的示意图。Please refer to FIG. 1, which is a schematic diagram of a blockchain-related network environment shown in this specification.
在如图1所示的网络环境中,可以包括客户端侧计算设备101、服务器端102,以及至少一个区块链系统;例如,区块链系统103、区块链系统104和区块链系统105。In the network environment shown in Figure 1, it may include a client-side computing device 101, a server-side 102, and at least one blockchain system; for example, a blockchain system 103, a blockchain system 104, and a blockchain system 105.
在一种实施方式中,客户端侧计算设备101,可以包括各种不同类型的客户端侧计算设备;例如,客户端侧终端设备可以包括诸如PC终端设备、移动终端设备、物联网设备,以及其它形式的具有一定的计算能力的智能设备,等等。In one embodiment, the client-side computing device 101 may include various types of client-side computing devices; for example, the client-side terminal device may include PC terminal devices, mobile terminal devices, Internet of Things devices, and Other forms of smart devices with some computing power, and so on.
在一种实施方式中,客户端侧终端设备101中的至少部分计算设备,可以通过各种通信网络连接到服务器端102;例如,图1中示出的设备1和设备2与服务器端102进行了连接。In one embodiment, at least part of the computing devices in the client terminal device 101 can be connected to the server end 102 through various communication networks; for example, the device 1 and device 2 shown in FIG. connected.
不难理解,客户端侧终端设备101中的部分终端设备,也可以不与服务器端102进行连接,而是作为区块链节点通过各种通信网络直接连接到区块链系统;例如,图1中示出的设备4,可以作为区块链节点连接到区块链系统。It is not difficult to understand that some of the terminal devices in the client-side terminal device 101 may not be connected to the server 102, but directly connected to the blockchain system as a blockchain node through various communication networks; for example, Fig. 1 The device 4 shown in , can be connected to the blockchain system as a blockchain node.
其中,上述通信网络可以包括有线和/或无线通信网络;例如,可以是基于运营商提供的有线接入网络或者无线接入网络(比如移动蜂窝网络)实现的局域网(Local Area Network,LAN)、广域网(Wide Area Network,WAN)、因特网或其组合。Wherein, the above-mentioned communication network may include a wired and/or wireless communication network; for example, it may be a local area network (Local Area Network, LAN) implemented based on a wired access network or a wireless access network (such as a mobile cellular network) provided by an operator, Wide Area Network (Wide Area Network, WAN), the Internet, or a combination thereof.
在一种实施方式中,客户端侧计算设备101,还可以包括一个或多个用户侧服务器;例如,图1中示出的设备5。客户端侧终端设备101中的至少部分计算设备,可以连接到该用户侧服务器,而该用户侧服务器可以进一步与上述服务端102进行连接;例如, 图1中示出的设备1和设备2连接到设备5,设备5进一步连接服务器端102。In one embodiment, the client-side computing device 101 may further include one or more user-side servers; for example, the device 5 shown in FIG. 1 . At least part of the computing devices in the client-side terminal device 101 can be connected to the user-side server, and the user-side server can be further connected to the above-mentioned server 102; for example, the connection between device 1 and device 2 shown in FIG. 1 To the device 5, the device 5 is further connected to the server end 102.
在一种实施方式中,上述用户侧服务器可以由搭建了用户账户体系的服务实体来实现;上述服务实体可以包括面向用户提供各种线上和/或线下服务的服务载体的运营实体;In one embodiment, the above-mentioned user-side server may be implemented by a service entity that has established a user account system; the above-mentioned service entity may include an operating entity that provides various online and/or offline service carriers for users;
其中,上述服务载体可以包括软件形式的服务载体,也可以包括硬件形式的服务载体。Wherein, the above-mentioned service carrier may include a service carrier in the form of software, and may also include a service carrier in the form of hardware.
在一种实施方式中,上述服务载体可以包括提供线上互联网服务的各种客户端软件;例如,网站、网页、APP等。In one embodiment, the above-mentioned service carrier may include various client softwares that provide online Internet services; for example, websites, webpages, APPs, and the like.
在一种实施方式中,上述服务载体也可以包括部署在线下的,能够提供线下服务的各种智能设备;例如,部署在居住区、办公区、公共场所的智能快递柜。In one embodiment, the above-mentioned service carrier may also include various smart devices deployed offline and capable of providing offline services; for example, smart express cabinets deployed in residential areas, office areas, and public places.
相应的,上述运营实体可以包括上述服务载体对应的运营方;例如,上述运营实体可以包括对上述服务载体进行运营和管理的个人、组织、公司和企业,等等。Correspondingly, the above-mentioned operating entity may include the operator corresponding to the above-mentioned service carrier; for example, the above-mentioned operating entity may include individuals, organizations, companies, enterprises, etc. that operate and manage the above-mentioned service carrier.
在一种实施方式中,服务器端102也可以通过各种通信网络连接到一个或者多个区块链系统;例如,图1中示出的服务器端102可以分别连接到区块链系统103、区块链系统104和区块链系统105,等等。In one embodiment, the server end 102 can also be connected to one or more blockchain systems through various communication networks; for example, the server end 102 shown in FIG. Block chain system 104 and block chain system 105, and so on.
在一种实施方式中,每个区块链系统都可以维护一个或多个区块链(例如,公有区块链、私有区块链、联盟区块链等),并包括用于承载上述一个或多个区块链的多个区块链节点;例如,如图1中示出的区块链节点1、区块链节点2、区块链节点3、区块链节点4、区块链节点i等可以共同承载一个或者多个区块链。各个区块链系统包含的区块链之间,以及各个区块链系统之间,还可以进行跨链的数据访问。In one embodiment, each blockchain system can maintain one or more blockchains (for example, public blockchains, private blockchains, consortium blockchains, etc.), and includes a or multiple blockchain nodes of multiple blockchains; for example, blockchain node 1, blockchain node 2, blockchain node 3, blockchain node 4, blockchain Node i, etc. can jointly host one or more blockchains. Cross-chain data access can also be performed between the blockchains contained in each blockchain system and between each blockchain system.
在一种实施方式中,区块链节点可以包括全节点和轻节点。全节点可以全量下载区块链中的每个区块所包含的区块链交易,并可以根据搭载的区块链共识算法,对每个区块链中所包含的区块链交易进行共识验证。In one embodiment, blockchain nodes may include full nodes and light nodes. The full node can fully download the blockchain transactions contained in each block in the blockchain, and can perform consensus verification on the blockchain transactions contained in each blockchain according to the blockchain consensus algorithm carried .
而轻节点可以不下载完整的区块链,而是可以只下载区块链中的每个区块的区块头数据,并将区块头所包含的数据作为验证根,用于以验证区块链交易的真实性。轻节点可以依附于全节点来访问区块链的更多功能。The light node does not need to download the complete blockchain, but can only download the block header data of each block in the blockchain, and use the data contained in the block header as the verification root to verify the blockchain authenticity of the transaction. Light nodes can attach to full nodes to access more functions of the blockchain.
例如,图1中示出的区块链系统103中的各个区块链节点都可以作为全节点;而图1中示出的直接连接到区块链系统的设备4,就可以作为轻节点,依附于区块链系统103中的各个全节点。For example, each blockchain node in the blockchain system 103 shown in Figure 1 can be used as a full node; and the device 4 directly connected to the blockchain system shown in Figure 1 can be used as a light node, Attached to each full node in the blockchain system 103.
在一种实施方式中,区块链节点可以是物理设备,也可以是在服务器或者服务器集群中实现的虚拟设备;例如,区块链节点设备可以是服务器集群中的一台物理主机,也可以是基于虚拟化技术对服务器或者服务器集群搭载的硬件资源进行虚拟化后,创建的虚拟机。每个区块链节点之间,可以通过各种类型的通信方法(比如TCP/IP)连接在一起形成网络,来承载一个或者多个区块链。In one embodiment, the blockchain node can be a physical device, or a virtual device implemented in a server or a server cluster; for example, a blockchain node device can be a physical host in a server cluster, or it can be It is a virtual machine created after virtualizing the hardware resources carried by a server or server cluster based on virtualization technology. Each blockchain node can be connected together through various types of communication methods (such as TCP/IP) to form a network to carry one or more blockchains.
在一种实施方式中,服务器端102可以包括用于提供区块链即服务(BaaS,Blockchain as a Service)的BaaS平台(也称之为BaaS云)。BaaS平台可以通过为区块链上发生的活动(诸如订阅和通知、用户验证、数据库管理和远程更新),提供预先编写的软件的方式,面向与BaaS平台连接的客户端侧计算设备,提供简单易用,一键部署,快速验证,灵活可定制的区块链服务,进而可以加速区块链业务应用开发、测试、上线,助力 各行业区块链商业应用场景的落地。In one embodiment, the server end 102 may include a BaaS platform (also referred to as a BaaS cloud) for providing Blockchain as a Service (BaaS, Blockchain as a Service). The BaaS platform can provide a simple way for client-side computing devices connected to the BaaS platform by providing pre-written software for activities that occur on the blockchain (such as subscriptions and notifications, user verification, database management, and remote updates). Easy to use, one-click deployment, fast verification, flexible and customizable blockchain services, which can accelerate the development, testing, and launch of blockchain business applications, and help the implementation of blockchain business application scenarios in various industries.
例如,在一个例子中,与BaaS平台可以提供诸如MQ(Message Queue,消息队列)服务之类的软件;与BaaS平台连接的客户端侧计算设备,可以订阅BaaS平台连接的区块链系统中某一区块链上部署的智能合约,在触发执行后在区块链上产生的合约事件;而BaaS平台可以监听该智能合约在触发执行后在区块链上产生的事件,再基于MQ服务相关的软件,将该合约事件以通知消息的形式添加到消息队列中,使得订阅该消息队列的客户端侧计算设备,能够得到与上述合约事件相关的通知。For example, in one example, the BaaS platform can provide software such as MQ (Message Queue, message queue) service; the client-side computing device connected to the BaaS platform can subscribe to a block chain system connected to the BaaS platform. A smart contract deployed on a block chain generates contract events on the block chain after the execution is triggered; and the BaaS platform can monitor the events generated by the smart contract on the block chain after the execution is triggered, and then based on the MQ service related The software of the contract adds the contract event to the message queue in the form of a notification message, so that the client side computing device subscribed to the message queue can get the notification related to the above contract event.
在一种实施方式中,BaaS平台还可以提供基于区块链技术的企业级平台服务,以帮助企业级客户构建安全且稳定的区块链环境,并轻松管理区块链的部署、操作、维护和开发。In one implementation, the BaaS platform can also provide enterprise-level platform services based on blockchain technology to help enterprise-level customers build a safe and stable blockchain environment and easily manage the deployment, operation, and maintenance of blockchain and development.
例如,在一个例子中,BaaS平台可以基于云技术实现丰富的安全策略和多租户的隔离环境、基于芯片加密技术来提供高级的安全保护、基于高度可靠的数据存储,提供可以快速扩展,而不会中断的端到端的高可用性服务;在另一个例子中,还可以提供增强的管理功能,以帮助客户构建企业级区块链网络环境;以及,还可以为标准区块链应用和数据提供本地支持,支持例如Hyperledger Fabric和Enterprise Ethereum-Quorum的主流开源区块链技术,以构建开放且包容的技术生态系统。For example, in one example, the BaaS platform can implement rich security policies and a multi-tenant isolation environment based on cloud technology, provide advanced security protection based on chip encryption technology, and provide rapid expansion based on highly reliable data storage. End-to-end high-availability services that will not be interrupted; in another example, enhanced management capabilities can be provided to help customers build enterprise-level blockchain network environments; and local Support, support mainstream open source blockchain technologies such as Hyperledger Fabric and Enterprise Ethereum-Quorum to build an open and inclusive technology ecosystem.
在本说明书实施例中,作为客户端侧计算设备101的设备5提供可信计算服务,其部署的TEE中运行有能够向用户提供可信计算服务的可信应用,而服务器端102包括的BaaS平台中提供预言机服务,且该预言机服务对应的预言机服务程序运行在服务器端102部署的TEE中,从另一角度上来说,这相当于图1中示出的客户端侧计算设备101中与服务器端102直接连接的设备5可以看作本说明书涉及的第一可信计算节点,而服务器端102可以看作本说明书涉及的运行有预言机服务程序的第二可信计算节点。In the embodiment of this specification, the device 5 as the client-side computing device 101 provides trusted computing services, and its deployed TEE runs trusted applications that can provide users with trusted computing services, while the server-side 102 includes BaaS The oracle service is provided on the platform, and the oracle service program corresponding to the oracle service runs in the TEE deployed on the server side 102. From another perspective, this is equivalent to the client-side computing device 101 shown in FIG. 1 The device 5 directly connected to the server 102 can be regarded as the first trusted computing node involved in this specification, and the server 102 can be regarded as the second trusted computing node running the oracle service program involved in this specification.
图2是本说明书根据一示例性实施例示出的网络架构图,该网络架构包括第一可信计算节点、第二可信计算节点和目标区块链,其中,第一可信计算节点可以为第二可信计算节点,或者第一可信计算节点区别于第二可信计算节点,第一可信计算节点中部署有第一可信执行环境,第一可信执行环境中运行有可信应用,第二可信计算节点中部署有第二可信执行环境,第二可信执行环境中运行有预言机服务程序,目标区块链是指可信应用发出的区块链数据查询请求所指示获取的区块数据所在的区块链系统,包含若干区块链节点,预言机服务程序可以与一个区块链系统(图2所示的目标区块链)对应的区块链节点建立网络连接实现信息交互,也可以同时与多个不同的区块链系统对应的区块链节点建立网络连接实现信息交互。Fig. 2 is a network architecture diagram shown in this specification according to an exemplary embodiment, the network architecture includes a first trusted computing node, a second trusted computing node and a target block chain, wherein the first trusted computing node may be The second trusted computing node, or the first trusted computing node is different from the second trusted computing node, the first trusted computing node is deployed with a first trusted execution environment, and the first trusted execution environment runs a trusted application, a second trusted execution environment is deployed in the second trusted computing node, and an oracle service program runs in the second trusted execution environment. The target blockchain refers to the blockchain data query request sent by the trusted application. Indicates the blockchain system where the acquired block data is located, including several blockchain nodes. The oracle service program can establish a network with the blockchain node corresponding to a blockchain system (the target blockchain shown in Figure 2) The connection realizes information interaction, and it is also possible to establish network connections with multiple blockchain nodes corresponding to different blockchain systems at the same time to realize information interaction.
第一可信执行环境中还运行有通讯服务程序,第一可信计算节点一方面可以通过通讯服务程序与可信应用之间的本地调用实现信息交互,另一方面可以通过该通讯服务程序与预言机服务程序建立网络连接从而实现信息交互,而在第一可信计算节点与第二可信计算节点为同一硬件节点的情况下,此时可以认为第一可信执行环境和第二可信执行环境均部署于第一可信计算节点,即通讯服务程序与预言机服务程序运行在同一硬件节点上,因此通讯服务程序与预言机服务程序之间可以直接进行本地调用从而实现信息交互而无需建立网络连接,当然,也可以通过建立网络连接的形式进行通讯。另外需要指出的是,在第一可信计算节点与第二可信计算节点为同一硬件节点的情况下,第二可信执行环境与第一可信执行环境可以为同一可信执行环境,或者第二可信执行环境区别于 第一可信执行环境,本说明书对此并不做任何限制。A communication service program is also running in the first trusted execution environment. On the one hand, the first trusted computing node can realize information interaction through the local call between the communication service program and the trusted application; The oracle service program establishes a network connection to realize information interaction, and when the first trusted computing node and the second trusted computing node are the same hardware node, it can be considered that the first trusted execution environment and the second trusted The execution environment is deployed on the first trusted computing node, that is, the communication service program and the oracle service program run on the same hardware node, so the communication service program and the oracle service program can be directly called locally to realize information interaction without Establishing a network connection, of course, communication can also be performed in the form of establishing a network connection. In addition, it should be pointed out that when the first trusted computing node and the second trusted computing node are the same hardware node, the second trusted execution environment and the first trusted execution environment may be the same trusted execution environment, or The second trusted execution environment is different from the first trusted execution environment, which is not limited in this specification.
本说明书实施例涉及的可信执行环境(TEE)可以为软件提供安全的执行环境,TEE是基于CPU硬件的安全扩展,且与外部完全隔离的可信执行环境。TEE最早是由Global Platform提出的概念,用于解决移动设备上资源的安全隔离,平行于操作系统为应用程序提供可信安全的执行环境。目前工业界十分关注TEE的方案,几乎所有主流的芯片和软件联盟都有自己的TEE解决方案,比如软件方面的TPM(Trusted Platform Module,可信赖平台模块)以及硬件方面的Intel SGX、ARM Trustzone(信任区)和AMD PSP(Platform Security Processor,平台安全处理器)等。The trusted execution environment (TEE) involved in the embodiments of this specification can provide a secure execution environment for software. The TEE is a secure extension based on CPU hardware and is a trusted execution environment completely isolated from the outside. TEE was first proposed by Global Platform to solve the security isolation of resources on mobile devices, and parallel to the operating system to provide applications with a trusted and secure execution environment. At present, the industry is very concerned about TEE solutions. Almost all mainstream chip and software alliances have their own TEE solutions, such as TPM (Trusted Platform Module) in software and Intel SGX and ARM Trustzone (Trusted Platform Module) in hardware. Trust Zone) and AMD PSP (Platform Security Processor, Platform Security Processor), etc.
以Intel SGX(以下简称SGX)技术为例。可信计算节点可以基于SGX技术创建enclave(围圈或飞地),以作为用于执行区块链交易的TEE。其中,区块链节点利用CPU中新增的处理器指令,在内存中可以分配一部分区域EPC(Enclave Page Cache,围圈页面缓存或飞地页面缓存),以用于驻留上述的enclave。上述EPC对应的内存区域被CPU内部的内存加密引擎MEE(Memory Encryption Engine)加密,该内存区域中的内容(enclave中的代码和数据)只有在CPU内核中才能够被解密,且用于加解密的密钥只有在EPC启动时生成并存储在CPU中。可见,enclave的安全边界只包含其自身和CPU,无论是特权或非特权软件都无法访问enclave,即便是操作系统管理员和VMM(virtual machine monitor,虚拟机监视器;或称为,Hypervisor)也无法影响enclave中的代码和数据,因而具有极高的安全性,并且在上述安全性保障的前提下,CPU能够在enclave中对明文形式的区块链交易进行处理,具有极高的运算效率,从而兼顾了数据安全性和计算效率。Take Intel SGX (hereinafter referred to as SGX) technology as an example. Trusted computing nodes can create enclaves (enclaves or enclaves) based on SGX technology as TEEs for executing blockchain transactions. Among them, the blockchain node uses the newly added processor instructions in the CPU to allocate a part of the EPC (Enclave Page Cache, enclave page cache or enclave page cache) in the memory to reside in the above enclave. The memory area corresponding to the above EPC is encrypted by the memory encryption engine MEE (Memory Encryption Engine) inside the CPU. The content in the memory area (code and data in the enclave) can only be decrypted in the CPU core and is used for encryption and decryption. The key is only generated and stored in the CPU when the EPC starts up. It can be seen that the security boundary of the enclave only includes itself and the CPU, and neither privileged nor non-privileged software can access the enclave, even the operating system administrator and VMM (virtual machine monitor, virtual machine monitor; or called, Hypervisor). It cannot affect the code and data in the enclave, so it has extremely high security, and under the premise of the above security guarantee, the CPU can process the blockchain transactions in plain text in the enclave, which has extremely high computing efficiency. Thus taking into account the data security and computing efficiency.
本说明书实施例涉及的可信应用是指运行在TEE中、使用可验证计算技术实现的应用,当可信应用运行在WASM(WebAssembly,网页程序集)虚拟机中时,任何人可以通过将WASM字节码上传到TEE中,并由WASM虚拟机调用该WASM代码从而构成一个可信应用,WASM虚拟机进一步执行该可信应用并获得执行结果。由于可信应用运行在TEE中,因此可以通过远程认证过程向任何人证明该可信应用的确运行在TEE中,且内部的代码未被篡改,的确是按照用户的预期所执行。The trusted application involved in the embodiment of this specification refers to the application that runs in the TEE and is implemented using verifiable computing technology. When the trusted application runs in the WASM (WebAssembly, web page assembly) virtual machine, anyone can use the WASM The bytecode is uploaded to the TEE, and the WASM code is invoked by the WASM virtual machine to form a trusted application. The WASM virtual machine further executes the trusted application and obtains the execution result. Since the trusted application runs in the TEE, it can be proved to anyone through the remote authentication process that the trusted application is indeed running in the TEE, and the internal code has not been tampered with, and it is indeed executed according to the user's expectations.
图3是本说明书根据一示例性实施例示出的一种可信计算程序调用方法的流程图,该方法应用于图2所示的第一可信计算节点,所述第一可信计算节点处部署的第一可信执行环境中运行有可信应用,所述方法包括以下步骤:Fig. 3 is a flowchart of a method for invoking a trusted computing program shown in this specification according to an exemplary embodiment, the method is applied to the first trusted computing node shown in Fig. 2 , where the first trusted computing node A trusted application runs in the deployed first trusted execution environment, and the method includes the following steps:
S301:获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境。S301: Obtain a remote authentication report for an oracle service program, where the oracle service program runs in a second trusted execution environment.
本说明书实施例所涉及的方法具体应用于第一可信计算节点部署的第一可信执行环境中运行的通讯服务程序,该通讯服务程序一方面为第一可信执行环境中的可信应用提供本地调用接口,以实现与可信应用之间的信息交互,另一方面对外部提供网络接口,以实现对外的信息交互,例如可以通过该网络接口实现通讯服务程序与预言机服务程序之间的网络通讯。另外,该通讯服务程序还能够调用第一可信执行环境中的如远程认证报告验证程序、数字签名验证程序等其他程序以实现相应的功能。The method involved in the embodiment of this specification is specifically applied to the communication service program running in the first trusted execution environment deployed by the first trusted computing node. On the one hand, the communication service program is a trusted application in the first trusted execution environment. Provide a local call interface to realize information interaction with trusted applications. On the other hand, it provides a network interface to the outside world to realize external information interaction. For example, the communication service program and the oracle service program can be realized through this network interface. network communication. In addition, the communication service program can also call other programs in the first trusted execution environment, such as a remote authentication report verification program, a digital signature verification program, etc., to realize corresponding functions.
本说明书实施例中,第一可信计算节点在向运行在第二可信执行环境中的预言机服务程序发送区块链数据查询请求之前,需要通过获取针对预言机服务程序的远程认证报告,以确保预言机服务程序运行在第二可信执行环境中且对应的程序代码未被篡改,即 确保预言机服务程序可信。In the embodiment of this specification, before the first trusted computing node sends a blockchain data query request to the oracle service program running in the second trusted execution environment, it needs to obtain the remote authentication report for the oracle service program, To ensure that the oracle service program runs in the second trusted execution environment and the corresponding program code has not been tampered with, that is, to ensure that the oracle service program is credible.
第一可信计算节点可以通过多种途径获取针对预言机服务程序的远程认证报告,例如可以通过向预言机服务程序发送针对预言机服务程序的远程认证挑战,以获取远程认证报告,在这种情况下,第一可信计算节点可以接收预言机服务程序发送的由认证服务器在完成对自荐信息的认证后返回的所述远程认证报告,所述自荐信息包含所述预言机服务程序中所含的程序代码对应的第一哈希值,以及所述预言机服务程序的公钥对应的第二哈希值;或者,The first trusted computing node can obtain the remote authentication report for the oracle service program through multiple ways, for example, by sending a remote authentication challenge for the oracle service program to the oracle service program to obtain the remote authentication report, in this In this case, the first trusted computing node may receive the remote authentication report sent by the oracle service program and returned by the authentication server after completing the authentication of the self-recommendation information, and the self-recommendation information includes The first hash value corresponding to the program code, and the second hash value corresponding to the public key of the oracle service program; or,
接收所述预言机服务程序发送的所述自荐信息,向所述认证服务器发送所述自荐信息,并接收由所述认证服务器在完成对所述自荐信息的认证后返回的针对所述预言机服务程序的所述远程认证报告。receiving the self-recommendation information sent by the oracle service program, sending the self-recommendation information to the authentication server, and receiving the service for the oracle machine returned by the authentication server after completing the authentication of the self-recommendation information Program the Remote Attestation Report.
具体而言,本说明书实施例涉及的远程认证报告产生于针对第二可信执行环境中预言机服务程序的远程认证过程。在预言机服务程序接收到第一可信计算节点发出的远程认证挑战后,响应该远程认证挑战,调用预言机服务程序中的远程认证服务从而执行远程认证过程,具体而言,预言机服务程序首先会提取出第二可信执行环境中运行的预言机服务程序中包含的全部程序代码,这些程序包含了预言机服务程序中的网络接口程序、区块链接口程序、区块链验证程序等,将这些程序代码通过哈希运算获得一个程序哈希值(第一哈希值),类似的,将预言机服务程序维护的用于表明预言机服务程序身份的公钥也通过哈希运算获得一个公钥哈希值(第二哈希值),最后将程序哈希值与公钥哈希值封装得到自荐信息,该自荐信息在通过认证服务器的验证的情况下,预言机服务程序会收到由认证服务器提供的针对该自荐信息的远程认证报告,该远程认证报告用于表明第二可信执行环境中运行的预言机服务程序可信,自荐信息中还可以进一步包含程序开发者公钥的哈希值、程序版本号的哈希值等,本说明书对此并不做任何限制。Specifically, the remote authentication report involved in the embodiment of this specification is generated in the remote authentication process for the oracle service program in the second trusted execution environment. After the oracle service program receives the remote authentication challenge sent by the first trusted computing node, it responds to the remote authentication challenge and invokes the remote authentication service in the oracle service program to execute the remote authentication process. Specifically, the oracle service program First, all program codes contained in the oracle service program running in the second trusted execution environment will be extracted. These programs include the network interface program, blockchain interface program, blockchain verification program, etc. in the oracle service program. , these program codes are hashed to obtain a program hash value (the first hash value), and similarly, the public key maintained by the oracle service program to indicate the identity of the oracle service program is also obtained by hashing A public key hash value (the second hash value), and finally encapsulate the program hash value and the public key hash value to obtain self-recommendation information. When the self-recommendation information passes the verification of the authentication server, the oracle service program will receive To the remote authentication report provided by the authentication server for the self-recommendation information, the remote authentication report is used to indicate that the oracle service program running in the second trusted execution environment is credible, and the self-recommendation information can further include the public key of the program developer The hash value of the program version number, etc., this manual does not make any restrictions on this.
例如,以Intel SGX技术为例,第二可信执行环境为第二可信计算节点上创建的用于运行预言机服务程序的enclave,远程认证过程还涉及到第二可信计算节点上另一个特殊的enclave,即quoting enclave(简称QE),QE是由英特尔提供并签名的架构型enclave(Architectural Enclave)。运行预言机服务程序的enclave首先需要生成一用于本地认证的REPORT(报告)结构,并由QE基于该REPORT结构验证该enclave是否与自身处于同一平台上,而后由QE将该REPORT结构联合程序哈希值与公钥哈希值封装为一结构体QUOTE(即自荐信息),并使用EPID(enhanced privacy identification)密钥进行签名。EPID密钥不仅代表链下隐私计算节点这一平台,还代表第二可信计算节点的底层硬件的可信度,还可以绑定处理器固件的版本等信息,并且只有QE才能访问到EPID密钥,以用于对上述的结构体QUOTE进行签名。在SGX技术中,上述的认证服务器可以为英特尔公司提供的IAS(Intel Attestation Service)服务器,预言机服务程序向IAS服务器发送经过签名的上述结构体QUOTE,使得IAS服务器可以对签名进行验证,并向预言机服务程序返回相应的远程认证报告。For example, taking Intel SGX technology as an example, the second trusted execution environment is an enclave created on the second trusted computing node to run the oracle service program, and the remote authentication process also involves another A special enclave, namely quoting enclave (QE for short), QE is an architectural enclave (Architectural Enclave) provided and signed by Intel. The enclave running the oracle service program first needs to generate a REPORT (report) structure for local authentication, and QE verifies whether the enclave is on the same platform as itself based on the REPORT structure, and then QE combines the REPORT structure with the program The hash value and the public key hash value are encapsulated into a structure QUOTE (that is, self-recommended information), and signed using the EPID (enhanced privacy identification) key. The EPID key not only represents the platform of private computing nodes under the chain, but also represents the credibility of the underlying hardware of the second trusted computing node. It can also bind information such as the version of the processor firmware, and only QE can access the EPID key. The key used to sign the above structure QUOTE. In SGX technology, the above-mentioned authentication server can be an IAS (Intel Attestation Service) server provided by Intel Corporation. The oracle service program sends the signed QUOTE structure to the IAS server, so that the IAS server can verify the signature and send The oracle service program returns the corresponding remote authentication report.
预言机服务程序获得远程认证报告后,可将远程认证报告直接发送给第一可信计算节点,从而协助第一可信计算节点获取远程认证报告,本实施例通过对第一可信计算节点发起的远程认证挑战进行远程认证,从而协助第一可信计算节点获取远程认证报告,以向第一可信计算节点证明预言机服务程序未被篡改且运行在可信执行环境下,以及预言机服务程序维护的被调用方公钥是真实的,从而向第一可信计算节点锚定对预言机服 务程序信任,并将针对预言机服务程序的远程认证报告作为相应的信任凭证。After the oracle service program obtains the remote authentication report, it can directly send the remote authentication report to the first trusted computing node, thereby assisting the first trusted computing node to obtain the remote authentication report. In this embodiment, the first trusted computing node initiates The remote authentication challenge is used to perform remote authentication, thereby assisting the first trusted computing node to obtain the remote authentication report, so as to prove to the first trusted computing node that the oracle service program has not been tampered with and is running in a trusted execution environment, and the oracle service The callee public key maintained by the program is authentic, thereby anchoring trust in the oracle service program to the first trusted computing node, and using the remote authentication report for the oracle service program as a corresponding trust certificate.
在一实施例中,预言机服务程序在获取远程认证挑战后,只会按照上述方式计算得到自荐信息而不会将自荐信息发送至认证服务器,而是先将自荐信息发送至第一可信计算节点,使得第一可信计算节点完成后续的远程认证过程,向认证服务器发送自荐信息,并接收由所述认证服务器在完成对所述自荐信息的认证后返回的所述远程认证报告,在该实施例中,第一可信计算节点可以主动对自荐信息发起远程认证过程,使第一可信计算节点获取最新的远程认证报告,从而增强证明的效度以及系统的安全性。In one embodiment, after obtaining the remote authentication challenge, the oracle service program will only calculate the self-recommendation information in the above manner without sending the self-recommendation information to the authentication server, but first send the self-recommendation information to the first trusted computer node, so that the first trusted computing node completes the subsequent remote authentication process, sends self-recommendation information to the authentication server, and receives the remote authentication report returned by the authentication server after completing the authentication of the self-recommendation information. In the embodiment, the first trusted computing node can actively initiate a remote authentication process for the self-recommendation information, so that the first trusted computing node can obtain the latest remote authentication report, thereby enhancing the validity of the proof and the security of the system.
除了通过向预言机服务程序中的预言机服务程序发送针对预言机服务程序的远程认证挑战,在一实施例中,第一可信计算节点还可以通过查询第一可信计算节点本地维护的远程认证报告库从而获取针对该预言机服务程序的远程认证报告,该远程认证报告库中预先存储有预言机服务程序的远程认证报告以及对应的更新时间,每次第一可信计算节点通过远程认证挑战或其他形式获取最新的远程认证报告时,会对远程认证报告库中预言机服务程序相应的远程认证报告进行更新,以使远程认证报告库中各个预言机服务程序的远程认证报告能够及时得到更新,从而增强了证明的效度。In addition to sending a remote authentication challenge for the oracle service program to the oracle service program in the oracle service program, in an embodiment, the first trusted computing node can also query the remote The authentication report library thus obtains the remote authentication report for the oracle service program. The remote authentication report of the oracle service program and the corresponding update time are pre-stored in the remote authentication report library. Every time the first trusted computing node passes the remote authentication When obtaining the latest remote verification report in a challenge or other form, the remote verification report corresponding to the oracle service program in the remote verification report library will be updated, so that the remote verification report of each oracle service program in the remote verification report library can be obtained in time updated, thereby enhancing the validity of the proof.
S302:在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据。S302: When it is determined according to the remote authentication report that the oracle service program is credible, send a blockchain data query request obtained from the trusted application to the oracle service program, so that the The oracle service program acquires block data on the target blockchain in response to the blockchain data query request.
本说明书实施例中涉及的根据远程认证报告确定预言机服务程序可信,具体包括:第一可信计算节点获取远程认证报告后,通过认证服务器公钥对远程认证报告的签名认证后确认该远程认证报告为认证服务器所颁发的,进而读取出该认证报告所记载的程序哈希值以及公钥哈希值,将其与第一可信计算节点自身保存的程序标准哈希值以及公钥标准哈希值进行对比,若程序哈希值与程序标准哈希值一致,则可以证明可信计算节点中的预言机服务程序未被篡改且运行在第二可信执行环境下,若公钥哈希值与公钥标准哈希值一致,则可以证明目前第一可信计算节点所持有的预言机服务程序对应的公钥的确是能够表明预言机服务程序真实身份的公钥,两次对比均一致的情况下,则可以确定预言机服务程序是可信的。其中,程序标准哈希值是通过将对外公开的预言机服务程序中的全部程序代码进行哈希运算后得到,公钥标准哈希值是通过对目前第一可信计算节点所持有的被认为是预言机服务程序对应的公钥进行哈希运算后得到,需要指出的是,计算出程序标准哈希值的哈希运算函数与计算出程序哈希值的哈希运算函数一致,计算出公钥标准哈希值的哈希运算函数与计算出公钥哈希值的哈希运算函数一致。The determination of the authenticity of the oracle service program according to the remote authentication report involved in the embodiment of this specification specifically includes: after the first trusted computing node obtains the remote authentication report, it authenticates the signature of the remote authentication report with the public key of the authentication server and then confirms that the remote The authentication report is issued by the authentication server, and then read out the program hash value and public key hash value recorded in the authentication report, and compare it with the program standard hash value and public key stored in the first trusted computing node. Compared with the standard hash value, if the program hash value is consistent with the program standard hash value, it can be proved that the oracle service program in the trusted computing node has not been tampered with and is running in the second trusted execution environment. If the public key If the hash value is consistent with the standard hash value of the public key, it can prove that the public key corresponding to the oracle service program held by the first trusted computing node is indeed a public key that can indicate the true identity of the oracle service program. If the comparisons are consistent, it can be determined that the oracle service program is credible. Among them, the standard hash value of the program is obtained by hashing all the program codes in the public oracle service program, and the standard hash value of the public key is obtained through the It is considered that the public key corresponding to the oracle service program is obtained after hashing. It should be pointed out that the hashing function for calculating the standard hash value of the program is consistent with the hashing function for calculating the hash value of the program. The hash operation function of the standard hash value of the public key is consistent with the hash operation function used to calculate the hash value of the public key.
在一实施例中,第一可信计算节点本地预先存储有针对预言机服务程序的远程认证报告,因此第一可信计算节点能够随时在第一可信执行环境中执行相应的远程认证报告验证程序以验证远程认证报告能否表明预言机服务程序可信,例如第一可信计算节点可以预先对该远程认证报告进行验证从而将验证结果保存下来,当需要确定预言机服务程序是否可信的需求时,则无需重复进行验证工作而只需要查看预先保存的验证结果,且当验证结果为可信的情况下就能够确定预言机服务程序可信,相当于第一节点设备锚定了对预言机服务程序信任,并直接将针对预言机服务程序的远程认证报告的验证结果作为相应的信任凭证;当然,当需要确定预言机服务程序是否可信的需求时,也可以重新对远程认证报告进行验证工作从而实时获取验证结果。In one embodiment, the first trusted computing node locally pre-stores the remote authentication report for the oracle service program, so the first trusted computing node can execute the corresponding remote authentication report verification in the first trusted execution environment at any time program to verify whether the remote authentication report indicates that the oracle service program is credible. For example, the first trusted computing node can verify the remote authentication report in advance so as to save the verification result. When it is necessary to determine whether the oracle service program is credible When required, there is no need to repeat the verification work, but only need to check the pre-saved verification results, and when the verification results are credible, it can be determined that the oracle service program is credible, which is equivalent to the first node device anchoring the prediction The trust of the oracle service program, and directly use the verification result of the remote authentication report for the oracle service program as the corresponding trust certificate; of course, when it is necessary to determine whether the oracle service program is credible, the remote authentication report can also be verified Verify the work to obtain the verification results in real time.
可信应用在产生区块链数据查询需求时,会主动向通讯服务程序发起区块链数据查 询请求,该请求中包含区块链域名、区块哈希和交易哈希等用于指向具体所需区块数据的描述信息,通讯服务程序在接收到该请求后,首先会查看本地是否保存有预言机服务程序的远程认证报告,例如在本地的远程认证报告库中存储有针对预言机服务程序的远程认证报告的情况下,将调用远程认证报告验证程序以验证该远程认证报告,在收到验证结果为不可信的情况下,将暂时缓存可信应用发来的区块链数据查询请求,并继续查找本地是否还保存有其他预言机服务程序的远程认证报告,在本地不存在预言机服务程序的远程认证报告或相应的远程认证报告均为不可信的情况下,第一可信计算节点则会通过通讯服务程序向对外公开IP地址的一个或多个预言机服务程序所在的可信计算节点发起远程认证报告,以获得相关的远程认证报告,进而继续通过远程认证报告验证程序对其进行验证,直到接收到某一远程认证报告的验证结果为可信的情况下,则可以确定该远程认证报告对应的预言机服务程序可信,此时第一可信计算节点可以将区块链数据查询请求通过通讯服务程序发送至被确定为可信的预言机服务程序。当然,在第一节点设备通过上述流程后也未找到任何可信的预言机服务程序的情况下,将通过通讯服务程序退回可信应用发来的区块链数据查询请求,并告知可信应用相应的错误代码,用于提醒该可信应用对应的用户目前缺少可信的代理机构(预言机服务程序),因此无法完成区块链数据查询服务。When a trusted application generates a blockchain data query requirement, it will actively initiate a blockchain data query request to the communication service program. The request includes the blockchain domain name, block hash and transaction hash, etc. The description information of the block data is required. After receiving the request, the communication service program will first check whether there is a remote authentication report for the oracle service program locally. In the case of a remote authentication report, the remote authentication report verification program will be called to verify the remote authentication report. If the verification result is untrustworthy, the blockchain data query request sent by the trusted application will be temporarily cached. And continue to search whether there are remote authentication reports of other oracle service programs locally. If there is no remote authentication report of the oracle service program locally or the corresponding remote authentication reports are untrustworthy, the first trusted computing node It will use the communication service program to initiate a remote authentication report to the trusted computing node where one or more oracle service programs with public IP addresses are located to obtain the relevant remote authentication report, and then continue to verify it through the remote authentication report verification program. Verification, until the verification result of a certain remote certification report is credible, it can be determined that the oracle service program corresponding to the remote certification report is credible, and at this time the first trusted computing node can send the blockchain data The query request is sent to the trusted oracle service program through the communication service program. Of course, if the first node device does not find any trusted oracle service program after going through the above process, it will return the blockchain data query request sent by the trusted application through the communication service program, and inform the trusted application The corresponding error code is used to remind the user corresponding to the trusted application that currently lacks a trusted agency (oracle service program), so the blockchain data query service cannot be completed.
当预言机服务程序接收到第一可信计算节点发送的区块链数据查询请求后,将从该请求中解析出区块链域名、区块哈希和交易哈希等用于指向具体所需区块数据的描述信息,然后根据上述描述信息确定区块数据的地址,具体而言,预言机服务程序可能与一个或多个区块链系统中相应的区块链节点保持网络连接,从而对不同的区块链系统冠以不同的区块链域名,且维护有区块链域名与相应区块链系统对应区块链节点的IP地址、端口号等网络地址的对应关系,因此预言机服务程序可以通过区块链域名确定所需的区块数据处于哪一个区块链系统,并将确定得到的区块链系统作为目标区块链,即本说明书涉及的目标区块链具体指的是区块链数据查询请求中包含的区块链域名所指向的区块链系统。以及,可以通过区块哈希确定所需的区块数据处于目标区块链上的哪一个区块,并将确定得到的区块作为目标区块,最后通过交易哈希确定所需的区块数据具体对应于目标区块上的哪一个交易数据。本说明书涉及的区块数据可以包括区块上的交易数据,也可以包括交易收据数据、区块的区块头数据等区块上的其他数据,本说明书对此并不做任何限制。When the oracle service program receives the blockchain data query request sent by the first trusted computing node, it will parse the blockchain domain name, block hash and transaction hash from the request to point to the specific required The description information of the block data, and then determine the address of the block data according to the above description information. Specifically, the oracle service program may maintain a network connection with the corresponding block chain nodes in one or more block chain systems, so as to Different blockchain systems are labeled with different blockchain domain names, and maintain the corresponding relationship between the blockchain domain name and the network address such as the IP address and port number of the blockchain node corresponding to the corresponding blockchain system, so the oracle service The program can determine which blockchain system the required block data is in through the blockchain domain name, and use the determined blockchain system as the target blockchain, that is, the target blockchain involved in this manual refers specifically to The blockchain system pointed to by the blockchain domain name contained in the blockchain data query request. And, the block hash can be used to determine which block the required block data is in on the target blockchain, and the determined block can be used as the target block, and finally the required block can be determined through the transaction hash The data specifically corresponds to which transaction data on the target block. The block data involved in this specification may include transaction data on the block, or other data on the block such as transaction receipt data, block header data, etc. This specification does not make any restrictions on this.
本说明书涉及的预言机服务程序具有访问区块链系统的能力,因此,预言机服务器可以持续访问多个区块链系统,从而预先获取各区块链系统上的区块数据,例如,任一区块链系统产生新的区块后,将触发所述任一区块链系统中与预言机服务程序建立有网络连接的代理区块链节点将区块更新的信息提供给预言机服务程序,然后,预言机服务程序能够通过调用该代理区块链节点提供的区块链数据访问接口,获取最新添加的区块,从而在预言机服务程序本地维护有所述任一区块链系统的完整区块数据。The oracle service program involved in this manual has the ability to access the blockchain system. Therefore, the oracle server can continuously access multiple blockchain systems to obtain block data on each blockchain system in advance. After the block chain system generates a new block, it will trigger the proxy block chain node in any block chain system that has established a network connection with the oracle service program to provide the updated information of the block to the oracle service program, and then , the oracle service program can obtain the latest added block by calling the blockchain data access interface provided by the proxy blockchain node, so that the complete area of any blockchain system can be maintained locally in the oracle service program block data.
在一实施例中,当预言机服务程序接收到区块链数据查询请求并确定得到目标区块链后,将查找本地预先存储的对应于目标区块链上的各个区块中是否包含区块链数据查询请求中的区块哈希与交易哈希对应的区块数据,在确定本地预先存储该区块数据的情况下获取该区块数据,在本实施例中,预言机服务程序可以通过预先在存储目标区块链上的完整区块数据,从而在接收到区块链数据查询请求的情况下无需访问目标区块链而直接获取所述区块链数据查询请求对应的区块数据。In one embodiment, when the oracle service program receives the blockchain data query request and determines that the target blockchain is obtained, it will check whether each block on the local pre-stored corresponding to the target blockchain contains a block The block data corresponding to the block hash in the chain data query request and the transaction hash, the block data is obtained under the condition that the block data is pre-stored locally. In this embodiment, the oracle service program can pass The complete block data on the target block chain is stored in advance, so that when a block chain data query request is received, the block data corresponding to the block chain data query request can be directly obtained without accessing the target block chain.
在另一实施例中,当预言机服务程序接收到区块链数据查询请求并确定得到目标区块链后,将实时地向目标区块链进行访问以获得相应的区块数据,在本实施例中,预言机服务程序可以无需预先存储目标区块链的完整区块数据,因此减小了所在设备的存储负担,并且即使预言机服务程序预先存储有目标区块链的完整区块数据,由于预言机服务程序可能无法及时地更新目标区块链的区块,所以可能存在区块链数据查询请求对应的区块数据无法在本地查询得到但确实已经处在目标区块链的最新区块的情况,因次在接收到区块链数据查询请求的情况下实时地向目标区块链进行访问,还能够保证获取到最新的目标区块链上的区块数据,避免预言机服务程序因未及时更新本地预存的目标区块链上的完整区块数据而导致区块数据获取失败的可能性。In another embodiment, when the oracle service program receives the block chain data query request and determines to obtain the target block chain, it will access the target block chain in real time to obtain the corresponding block data. In this example, the oracle service program does not need to pre-store the complete block data of the target blockchain, thus reducing the storage burden on the device, and even if the oracle service program pre-stores the complete block data of the target blockchain, Since the oracle service program may not be able to update the blocks of the target blockchain in a timely manner, there may be block data corresponding to the blockchain data query request that cannot be queried locally but is indeed in the latest block of the target blockchain Therefore, when receiving the blockchain data query request, accessing the target blockchain in real time can also ensure that the latest block data on the target blockchain can be obtained, avoiding the oracle service program due to Failure to update the complete block data on the local pre-stored target blockchain in time may lead to the possibility of failure to obtain block data.
在一实施例中,预言机服务程序可以通过调用所述目标区块链对应的区块链节点提供的区块链数据访问接口,获取所述区块数据,其中,与预言机服务程序建立有网络连接且能够被预言机服务程序所访问的任一区块链系统对应的区块链节点作为目标区块链对应的代理区块链节点,预先会与预言机服务程序锚定有信任关系,即代理区块链节点预先获取并验证针对预言机服务程序的远程认证报告以确定该预言机服务程序可信,相应的验证过程与前述的对远程认证报告的验证方式相同,此处不再赘述。代理区块链节点可以在确定预言机服务程序可信的情况下,提供仅允许预言机服务程序访问的区块链数据访问接口,预言机服务程序可以通过该接口安全、无障碍地访问代理区块链节点上的数据库信息,其中就包含代理区块链节点上所存储和维护的全部区块、各智能合约的合约代码和合约状态等。In an embodiment, the oracle service program can obtain the block data by calling the blockchain data access interface provided by the blockchain node corresponding to the target blockchain, wherein the oracle service program is established with The blockchain node corresponding to any blockchain system that is connected to the network and can be accessed by the oracle service program is used as the proxy blockchain node corresponding to the target blockchain, and will have a trust relationship with the oracle service program in advance. That is, the proxy blockchain node obtains and verifies the remote authentication report for the oracle service program in advance to confirm that the oracle service program is credible. The corresponding verification process is the same as the verification method for the remote authentication report described above, and will not be repeated here. . The proxy blockchain node can provide a blockchain data access interface that only allows the oracle service program to access when it is determined that the oracle service program is credible, and the oracle service program can access the proxy area safely and barrier-free through this interface The database information on the blockchain node includes all the blocks stored and maintained on the proxy blockchain node, the contract code and contract status of each smart contract, etc.
在另一实施例中,预言机服务程序还能够通过向所述目标区块链上的预言机合约发起区块数据获取交易,并监听所述预言机合约产生的所述区块数据获取交易的收据中所包含的区块数据获取事件,获取所述区块数据。在本实施例中,可以通过向目标区块链发起跨链交易并监听事件的方式获取相应的区块数据,具体而言,预言机服务程序可以通过目标区块链上的代理区块链节点向目标区块链上的预言机合约发起区块数据获取交易,该交易中包含区块哈希和交易哈希,使得预言机合约执行所述交易,查询得到所述交易中包含的区块哈希和交易哈希所指向的交易数据并将其写入该交易的收据包含的区块数据获取事件中,预言机服务程序通过进一步通过监听目标区块链上的代理区块链节点获取区块数据获取交易的收据,并从所述收据中读取得到所需的交易数据。在本实施例中,由于是通过跨链交易的形式获取相关的区块数据,因此可以将本次访问区块数据的行为在目标区块链上进行存证,从而保证获取区块数据的过程透明、可追溯,后续第一可信计算节点也可以通过第三方检验目标区块链上是否执行该区块数据获取交易,从而确保获得的区块数据的确来源于目标区块链,提高了系统的安全性。In another embodiment, the oracle service program can also initiate a block data acquisition transaction to the oracle contract on the target blockchain, and monitor the block data acquisition transaction generated by the oracle contract. The block data acquisition event contained in the receipt acquires the block data. In this embodiment, the corresponding block data can be obtained by initiating a cross-chain transaction to the target blockchain and monitoring events. Specifically, the oracle service program can pass the proxy blockchain node on the target blockchain Initiate a block data acquisition transaction to the oracle contract on the target blockchain, the transaction contains block hash and transaction hash, so that the oracle contract executes the transaction, and obtains the block hash contained in the transaction The transaction data pointed to by Xihe transaction hash is written into the block data acquisition event contained in the transaction receipt, and the oracle service program obtains the block by further listening to the proxy block chain node on the target block chain The data captures the receipt of the transaction and reads the required transaction data from the receipt. In this embodiment, since the relevant block data is obtained through cross-chain transactions, the behavior of accessing block data can be stored on the target block chain to ensure the process of obtaining block data Transparent and traceable, the subsequent first trusted computing node can also verify whether the block data acquisition transaction is executed on the target block chain through a third party, so as to ensure that the obtained block data does come from the target block chain and improve the system security.
S303:接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。S303: Receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and if the digital signature is successfully verified by the public key corresponding to the oracle service program , returning the block data to the trusted application.
预言机服务程序在响应于区块链数据查询请求从而获取目标区块链上的区块数据后,将首先对该区块数据进行哈希运算得到区块数据哈希,然后再使用预言机服务程序自身维护的用于表明预言机服务程序真实身份的私钥对该区块数据哈希进行签名以得到该区块数据对应的数字签名,最后将得到的区块数据和相应的数字签名一同返回给第一可信计算节点中的通讯服务程序。通讯服务程序在接收到预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名后,将调用第一可信执行环境中的数字签名验证 程序验证该数字签名,具体而言,通讯服务程序将区块数据以及对应的数字签名作为入参传入数字签名验证程序,数字签名验证程序将接收到的区块数据进行哈希运算以得到标准区块数据哈希,然后使用先前被验证能够表明预言机服务程序真实身份的公钥对数字签名进行解密得到待验证区块数据哈希,将待验证区块数据哈希与标准区块数据哈希进行比对,在比对一致的情况下确定所述数字签名验签成功,并向通讯服务程序返回验签成功的回调结果,通讯服务程序在接收到验签成功的回调结果后,确定该区块数据的确是从被验证可信的预言机服务程序处所返回的,从而信任该区块数据,并将该区块数据返回至可信应用,以作为先前可信应用发送的区块链数据查询请求的回调结果。After the oracle service program obtains the block data on the target blockchain in response to the blockchain data query request, it will first perform a hash operation on the block data to obtain the block data hash, and then use the oracle service The private key maintained by the program itself to indicate the true identity of the oracle service program signs the hash of the block data to obtain the digital signature corresponding to the block data, and finally returns the obtained block data and the corresponding digital signature To the communication service program in the first trusted computing node. After the communication service program receives the block data returned by the oracle service program and the digital signature corresponding to the block data, it will call the digital signature verification program in the first trusted execution environment to verify the digital signature, specifically In other words, the communication service program takes the block data and the corresponding digital signature as input parameters to the digital signature verification program, and the digital signature verification program performs hash operation on the received block data to obtain the standard block data hash, and then uses The previously verified public key that can indicate the true identity of the oracle service program decrypts the digital signature to obtain the block data hash to be verified, and compares the block data hash to be verified with the standard block data hash. Under the same situation, it is determined that the digital signature verification is successful, and the callback result of successful signature verification is returned to the communication service program. After receiving the callback result of successful signature verification, the communication service program determines that the block data is indeed from the verified The trusted oracle service program returns the block data, and returns the block data to the trusted application as the callback result of the previous blockchain data query request sent by the trusted application.
本说明书的实施例提供的技术方案可以包括以下有益效果:本说明书的实施例中,第一可信计算节点通过获取针对预言机服务程序的远程认证报告从而锚定对预言机服务程序的信任,使得第一可信计算节点部署的第一可信执行环境中运行的可信应用可以借助可信的预言机服务程序安全地访问并获取区块链上的区块数据。The technical solutions provided by the embodiments of this specification may include the following beneficial effects: In the embodiments of this specification, the first trusted computing node anchors the trust in the oracle service program by obtaining the remote authentication report for the oracle service program, The trusted application running in the first trusted execution environment deployed by the first trusted computing node can securely access and acquire block data on the blockchain by means of a trusted oracle service program.
可选的,所述区块数据以及所述区块数据对应的数字签名由所述预言机服务程序在对所述区块数据的真实性验证成功的情况下返回。预言机服务程序在获取区块数据后,还会进一步对区块数据的真实性进行验证,并在真实性验证成功的情况下才会对区块数据进行签名,并将区块数据和对应的数字签名返回给第一可信计算节点中的通讯服务程序。Optionally, the block data and the digital signature corresponding to the block data are returned by the oracle service program when the authenticity verification of the block data is successful. After the oracle service program obtains the block data, it will further verify the authenticity of the block data, and only when the authenticity verification is successful will the block data be signed, and the block data and the corresponding The digital signature is returned to the communication service program in the first trusted computing node.
本说明书实施例中,预言机服务程序需要对获取的区块数据进行真实性验证,并在验证成功的情况下才会返回给第一可信计算节点,从而可以确保预言机服务程序获取的区块数据来源可信且未被篡改,使得第一可信计算节点在信任预言机服务程序的情况下,无需重复验证区块数据在区块层面的真实性(因为第一可信计算节点在验证远程认证报告时可以确定预言机服务程序含有执行验证区块数据的区块链验证程序的代码段),而只需对区块数据对应的数字签名进行验签,并在验签成功的后由于能够确保该区块数据来源于可信的预言机服务程序,因此可以直接将其传回可信应用以提供用户使用。In the embodiment of this specification, the oracle service program needs to verify the authenticity of the obtained block data, and will return to the first trusted computing node only when the verification is successful, so that the block data obtained by the oracle service program can be guaranteed The source of the block data is credible and has not been tampered with, so that the first trusted computing node does not need to repeatedly verify the authenticity of the block data at the block level (because the first trusted computing node is verifying In the remote authentication report, it can be determined that the oracle service program contains the code segment of the block chain verification program that verifies the block data), and only needs to verify the digital signature corresponding to the block data, and after the verification is successful, due to It can ensure that the block data comes from a trusted oracle service program, so it can be directly sent back to the trusted application for user use.
可选的,所述区块数据的真实性验证成功,包括:在所述预言机服务程序本地维护的所述目标区块链对应的验证结果表明所述目标区块链上的所有区块合法且对应的Merkle根均验证成功的情况下,确定所述区块数据的真实性验证成功。Optionally, the verification of the authenticity of the block data is successful, including: the verification result corresponding to the target blockchain locally maintained by the oracle service program indicates that all blocks on the target blockchain are legal And if the verification of the corresponding Merkle roots is successful, it is determined that the authenticity verification of the block data is successful.
在所述目标区块链上的区块数据由所述预言机服务程序实时从所述目标区块链上获取的情况下,预言机服务程序需要对实时获取的区块数据进行真实性验证,具体而言,预言机服务程序不仅会获取区块链数据查询请求所指向的区块数据,还会获取目标区块链的所有区块,以在本地维护所述目标区块链的所有区块,并从创世块开始按照区块顺序对每一区块的Merkle根和区块哈希进行验证,将任一区块所包含的所有交易进行哈希运算得到多条交易哈希,并按照求Merkle根的方式重算Merkle根,将重算的Merkle根与该任一区块的区块头所记录的Merkle根进行比对,在比对一致的情况下说明该任一区块上的交易未被篡改因此该任一区块可信,从而确定该任一区块的Merkle根验证成功,而在不一致的情况下说明该任一区块上的交易被篡改因此该任一区块不可信,从而确定该任一区块的Merkle根验证失败;同时,还需要对区块哈希进行验证以证明区块本身的合法性,具体而言,除了创世块以外的每一区块的区块头均封装有其对应父块的区块哈希,因此需要验证目标区块链的所有区块是否按照其所定义的区块顺序所排列的,是否来自于同一条区块链,例如对于除最新区块以外的任一区块而言,若想验证该 区块是否被篡改,则需要将该区块的区块头合并后计算出该区块对应的区块哈希,将其与该区块对应的子块的区块头上记载的父块的区块哈希进行比对,在比对一致的情况下可以证明该区块与之前验证过的区块属于同一条区块链,该区块合法,而在对比不一致的情况下说明该区块以及区块顺序在该区块之后的区块均不合法。在对本地维护的目标区块链的所有区块完成上述Merkle根和区块哈希的验证后,会产生一个验证结果用于记录目标区块链的所有区块中的可信部分(同时通过Merkle根与区块哈希的验证而被证明可信及合法的区块)作为目标区块链的验证结果,在该验证结果表明目标区块链上的所有区块合法且对应的Merkle根均验证成功的情况下,确定所述区块数据的真实性验证成功。In the case that the block data on the target block chain is obtained from the target block chain in real time by the oracle service program, the oracle service program needs to verify the authenticity of the block data obtained in real time, Specifically, the oracle service program will not only obtain the block data pointed to by the blockchain data query request, but also obtain all the blocks of the target blockchain, so as to maintain all the blocks of the target blockchain locally , and verify the Merkle root and block hash of each block in block order from the genesis block, perform hash operations on all transactions contained in any block to obtain multiple transaction hashes, and follow Recalculate the Merkle root by finding the Merkle root, compare the recalculated Merkle root with the Merkle root recorded in the block header of any block, and explain the transaction on any block if the comparison is consistent It has not been tampered with, so any block is credible, so it is determined that the Merkle root verification of any block is successful, and in the case of inconsistency, it means that the transaction on any block has been tampered with, so any block is not credible , so as to determine that the Merkle root verification of any block has failed; at the same time, it is also necessary to verify the block hash to prove the legitimacy of the block itself, specifically, the block of each block except the genesis block The block header is encapsulated with the block hash of its corresponding parent block, so it is necessary to verify whether all the blocks of the target blockchain are arranged according to the order of the blocks defined by them, and whether they come from the same blockchain, for example, except For any block other than the latest block, if you want to verify whether the block has been tampered with, you need to merge the block header of the block to calculate the block hash corresponding to the block, and combine it with the block Compared with the block hash of the parent block recorded in the block header of the sub-block corresponding to the block, it can be proved that the block belongs to the same block chain as the previously verified block in the case of a consistent comparison. The block is legal, and if the comparison is inconsistent, it means that the block and the blocks after the block are not legal. After completing the verification of the above-mentioned Merkle root and block hash for all the blocks of the target blockchain maintained locally, a verification result will be generated to record the credible part in all the blocks of the target blockchain (at the same time through Merkle root and block hash verification to prove credible and legal block) as the verification result of the target blockchain, the verification result shows that all blocks on the target blockchain are legal and the corresponding Merkle root is If the verification is successful, it is determined that the authenticity verification of the block data is successful.
在所述目标区块链上的区块数据由所述预言机服务程序预先从所述目标区块链上获取的情况下,预言机服务程序已经在本地预先存储有目标区块链对应的完整区块数据,因此可以预先对目标区块链上的所有区块进行Merkle根与区块哈希的验证,例如,预言机服务程序可以在每获得一个目标区块链上的区块时,就及时地对该区块进行Merkle根验证,同时该区块也用于证明其对应的父块的合法性(利用区块哈希进行验证,方式与前述相同),从而在本地维护有一个及时更新的针对目标区块链的验证结果,该验证结果记录有目标区块链的所有区块中的可信部分,即预言机服务程序可以无需每次对目标区块链上的所有区块进行验证而是每次只验证新加入的区块,这使得任何时刻下预言机服务程序可以通过读取本地维护的目标区块链的验证结果,从而确定目标区块链上的所有区块是否合法,以及对应的Merkle根是否验证成功,作为一个特例,假如预言机服务程序最新接收到的区块证明其父块不合法时,就不再接收该区块所处区块链系统后续更新的区块。In the case that the block data on the target blockchain is pre-acquired from the target blockchain by the oracle service program, the oracle service program has pre-stored the complete block data corresponding to the target blockchain locally. Block data, so all blocks on the target blockchain can be verified in advance with Merkle root and block hash. For example, the oracle service program can The Merkle root verification of the block is performed in a timely manner, and the block is also used to prove the legitimacy of its corresponding parent block (using the block hash for verification, the method is the same as the above), so that there is a timely update in the local maintenance The verification result of the target blockchain, the verification result records the credible part of all blocks in the target blockchain, that is, the oracle service program does not need to verify all the blocks on the target blockchain every time Instead, only newly added blocks are verified each time, which enables the oracle service program to determine whether all blocks on the target blockchain are legal by reading the verification results of the locally maintained target blockchain at any time. And whether the verification of the corresponding Merkle root is successful. As a special case, if the latest block received by the oracle service program proves that its parent block is not legal, it will no longer receive subsequent updated blocks of the blockchain system where the block is located. .
事实上,预言机服务程序也可以只在本地预先存储目标区块链上所有区块的区块头,从而可以预先证明区块的合法性而保留Merkle根的验证过程,这种情况下,预言机服务程序根据区块链数据查询请求确定目标区块链上的区块数据后,需要向目标区块链请求区块数据,此时可以仅向目标区块链请求获取所述区块数据所在的区块(根据区块链数据查询请求中携带的区块哈希)而非目标区块链上的所有区块,在获取该区块后,根据交易哈希确定作为交易数据的区块数据,同时对获取的区块进行Merkle根验证,将重算得到的Merkle根不仅与获取的区块的区块头上记录的Merkle根进行对比,还会与本地维护的区块数据所在区块的区块头上记录的Merkle根进行比对,在比对均一致的情况下确定获得的区块数据符合本地维护的作为信任凭证的目标区块链的区块头,即可以确定区块数据未被篡改。In fact, the oracle service program can also only pre-store the block headers of all blocks on the target blockchain locally, so that the legitimacy of the block can be pre-proved while retaining the Merkle root verification process. In this case, the oracle After the service program determines the block data on the target blockchain according to the blockchain data query request, it needs to request the block data from the target blockchain. At this time, it can only request the target blockchain to obtain the block (according to the block hash carried in the block chain data query request) instead of all blocks on the target block chain, after obtaining the block, determine the block data as transaction data according to the transaction hash, At the same time, Merkle root verification is performed on the acquired block, and the Merkle root obtained by recalculation is not only compared with the Merkle root recorded on the block header of the acquired block, but also with the block header of the block where the locally maintained block data is located. Compare the Merkle root recorded above, and if the comparison is consistent, it is determined that the obtained block data conforms to the block header of the target blockchain maintained locally as a trust certificate, that is, it can be determined that the block data has not been tampered with.
除此之外,预言机服务程序还可以预先存储有目标区块链上所有区块的交易哈希,具体而言,在获取目标区块链对应的完整区块数据后,将其中的每个交易计算得到的交易哈希按照区块之间的顺序以及区块内的排列顺序(即交易的执行顺序)保存起来,在完成Merkle根与区块哈希的验证并将验证结果维护在本地后,可以将所有区块中区块体部分从本地全部删去,这样一来预言机服务程序在根据区块链数据查询请求确定目标区块链上的区块数据后,仅向目标区块链请求区块数据本身即可,这是由于有关区块层面的所有验证过程事先均已完成且以本地维护的验证结果作为凭证,因此预言机服务程序只需要检查验证结果以及对获取的区块数据进行哈希运算,在所述验证结果能够表明目标区块链上所有区块合法且对应的Merkle根均验证成功,以及接收到的由目标区块链提供的区块数据在进行哈希运算得到的哈希值与区块链数据查询请求包含的交易哈 希相一致的情况下,就能够确定所述区块数据的真实性验证成功。In addition, the oracle service program can also pre-store the transaction hashes of all blocks on the target blockchain. Specifically, after obtaining the complete block data corresponding to the target blockchain, each of them The transaction hash calculated by the transaction is saved according to the order between the blocks and the order in the block (that is, the execution order of the transaction). After the verification of the Merkle root and the block hash is completed and the verification result is maintained locally , the block body part of all blocks can be deleted locally, so that after the oracle service program determines the block data on the target blockchain according to the blockchain data query request, it only sends Just request the block data itself. This is because all the verification processes at the block level have been completed in advance and the verification results maintained locally are used as certificates. Therefore, the oracle service program only needs to check the verification results and the obtained block data. Perform a hash operation, and the verification result can show that all blocks on the target blockchain are legal and the corresponding Merkle roots are verified successfully, and the received block data provided by the target blockchain is obtained by hashing When the hash value of the block chain data query request is consistent with the transaction hash contained in the block chain data query request, it can be determined that the authenticity verification of the block data is successful.
在本实施例中,需要在目标区块链上所有区块合法且对应的Merkle根均验证成功的情况下才会确定区块数据的真实性验证成功,这种严格的验证方式能够在最大限度上保证了区块数据来源的合法性与可信度。In this embodiment, the verification of the authenticity of the block data must be confirmed only when all blocks on the target block chain are legal and the corresponding Merkle roots are successfully verified. This strict verification method can maximize This guarantees the legitimacy and credibility of the block data source.
在另一实施例中,可以在所述预言机服务程序本地维护的所述目标区块链对应的验证结果表明所述区块数据所在区块合法且对应的Merkle根均验证成功的情况下,确定所述区块数据的真实性验证成功,在本实施例中,只需要在区块数据所在区块被验证可信的情况下即可确定区块数据的真实性校验成功,这种轻量化的验证方式能够在保证区块数据来源的合法性与可信度的前提下,尽可能地减少对所有区块进行验证而产生的计算成本和时间成本,提高验证效率以及获取区块数据的成功率。In another embodiment, when the verification result corresponding to the target blockchain maintained locally by the oracle service program indicates that the block where the block data is located is legal and the corresponding Merkle root verification is successful, It is determined that the authenticity verification of the block data is successful. In this embodiment, it can be determined that the authenticity verification of the block data is successful only when the block where the block data is located is verified to be credible. Quantitative verification methods can reduce the calculation cost and time cost of verifying all blocks as much as possible on the premise of ensuring the legitimacy and credibility of block data sources, improve verification efficiency and obtain block data. Success rate.
可选的,所述将区块链数据查询请求发送至所述预言机服务程序,包括:使用所述预言机服务程序对应的公钥对所述区块链数据查询请求加密后得到区块链数据查询请求密文;将所述区块链数据查询请求密文发送至所述预言机服务程序。Optionally, the sending the blockchain data query request to the oracle service program includes: using the public key corresponding to the oracle service program to encrypt the blockchain data query request to obtain a blockchain A data query request ciphertext; sending the block chain data query request ciphertext to the oracle service program.
在本说明书实施例中,通过利用非对称加密来实现第一可信计算节点与预言机服务程序之间的加密信道,使得只有预言机服务程序才能后解密得到第一可信计算节点发出的区块链数据查询请求,从而保证获取区块链数据过程的隐私性。这里使用的预言机服务程序对应的公钥可以为先前通过远程认证报告被验证能够表明预言机服务程序真实身份的公钥,也可以为用于表明预言机服务程序真实身份的其他公钥,只需要确保这里用于加密区块链数据查询请求所使用的公钥所对应的私钥确实被预言机服务程序所持有即可,由此在预言机服务程序接收到区块链数据查询请求密文后,便能够通过自身维护的私钥对区块链数据查询请求密文进行解密后得到对应的区块链数据查询请求。In the embodiment of this specification, the encrypted channel between the first trusted computing node and the oracle service program is realized by using asymmetric encryption, so that only the oracle service program can decrypt and obtain the zone sent by the first trusted computing node. Block chain data query request, so as to ensure the privacy of the process of obtaining block chain data. The public key corresponding to the oracle service program used here can be the public key that has been verified through the remote authentication report and can indicate the real identity of the oracle service program, or it can be other public keys used to indicate the real identity of the oracle service program. It is necessary to ensure that the private key corresponding to the public key used to encrypt the blockchain data query request is indeed held by the oracle service program. Therefore, when the oracle service program receives the blockchain data query request key After the text, you can use the private key you maintain to decrypt the ciphertext of the blockchain data query request to get the corresponding blockchain data query request.
可选的,所述区块链数据查询请求包含第一可信计算节点对应的公钥,所述接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,包括:接收所述预言机服务程序返回的区块数据密文以及数字签名密文,并使用第一可信计算节点私钥分别对所述区块数据密文以及所述数字签名密文解密得到所述区块数据和所述区块数据对应的数字签名;其中,所述区块数据密文和所述数字签名密文由所述预言机服务程序使用第一可信计算节点公钥分别对所述区块数据和所述区块数据对应的数字签名加密后得到。Optionally, the blockchain data query request includes a public key corresponding to the first trusted computing node, and receiving the block data returned by the oracle service program and the digital signature corresponding to the block data , including: receiving the block data ciphertext and the digital signature ciphertext returned by the oracle service program, and using the private key of the first trusted computing node to decrypt the block data ciphertext and the digital signature ciphertext respectively Obtain the block data and the digital signature corresponding to the block data; wherein, the block data ciphertext and the digital signature ciphertext are respectively used by the oracle service program using the public key of the first trusted computing node Obtained after encrypting the block data and the digital signature corresponding to the block data.
在本说明书实施例中,通过利用非对称加密来实现第一可信计算节点与预言机服务程序之间的加密信道,使得只有第一可信计算节点上的通讯服务程序才能后解密得到预言机服务程序发出的区块数据和对应的数字签名,从而保证获取区块链数据过程的隐私性。由于在向预言机服务程序发送区块链数据查询请求中携带有用于表明第一可信计算节点真实身份的公钥,因此,在后续预言机服务程序准备向第一可信计算节点返回区块数据和数字签名时,可以利用区块链数据查询请求中包含的公钥进行加密,从而将加密后的区块数据密文和数字签名密文发送至第一可信计算节点上的通讯服务程序,以使通讯服务程序利用自身维护的私钥解密得到相应的区块数据和数字签名。In the embodiment of this specification, the encrypted channel between the first trusted computing node and the oracle service program is realized by using asymmetric encryption, so that only the communication service program on the first trusted computing node can decrypt to obtain the oracle The block data sent by the service program and the corresponding digital signature, thus ensuring the privacy of the process of obtaining the block chain data. Since the public key used to indicate the true identity of the first trusted computing node is carried in the blockchain data query request sent to the oracle service program, the subsequent oracle service program prepares to return the block to the first trusted computing node When data and digital signatures are used, the public key contained in the blockchain data query request can be used to encrypt, so that the encrypted block data ciphertext and digital signature ciphertext are sent to the communication service program on the first trusted computing node , so that the communication service program uses the private key maintained by itself to decrypt and obtain the corresponding block data and digital signature.
可选的,所述第一可信计算节点维护有各区块链类型对应的解析插件,所述将所述区块数据返回至所述可信应用,包括:根据所述目标区块链的区块链类型对应的解析插件对所述区块数据进行解析,并将解析后的所述区块数据返回至所述可信应用。由于不同类型的区块链对应的区块的数据结构和形式定义有较大区别,例如基于UXTO (Unspent Transaction Output)的区块链的交易格式就与基于以太坊的区块链的交易格式大不相同,因此需要根据所获得区块的不同版本、不同类型采用不同的解析方式,以获得其中data部分的可用数据。Optionally, the first trusted computing node maintains parsing plug-ins corresponding to each blockchain type, and the returning the block data to the trusted application includes: according to the zone of the target blockchain The parsing plug-in corresponding to the block chain type parses the block data, and returns the parsed block data to the trusted application. Since the data structure and form definitions of the blocks corresponding to different types of blockchains are quite different, for example, the transaction format of the blockchain based on UXTO (Unspent Transaction Output) is different from that of the blockchain based on Ethereum. are not the same, so different parsing methods need to be adopted according to different versions and types of obtained blocks to obtain the available data in the data part.
本说明书实施例中,由于第一可信计算节点上维护有各种区块链类型对应的解析插件,因此能够将获取得到的各个区块链类型对应的区块数据进行正确地解析和加工,从而获取解析后的能够被可信应用所识别的区块数据,使得链下运行的可选应用能够可信、兼容地访问多种异构链上的链上数据。In the embodiment of this specification, since the analysis plug-ins corresponding to various blockchain types are maintained on the first trusted computing node, the obtained block data corresponding to each blockchain type can be correctly analyzed and processed. In this way, the parsed block data that can be recognized by trusted applications is obtained, so that optional applications running off-chain can access the on-chain data on various heterogeneous chains in a credible and compatible manner.
可选的,所述可信应用运行于第一可信执行环境内封装的虚拟机中,所述虚拟机包括:基于二进制操作指令的栈式结构的虚拟机。以图1为例,第一可信执行环境中运行的可信应用其实是运行在第一可信执行环境内封装的虚拟机中,该虚拟机包括WASM虚拟机。Optionally, the trusted application runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes: a virtual machine based on a stack structure of binary operation instructions. Taking FIG. 1 as an example, the trusted application running in the first trusted execution environment actually runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes a WASM virtual machine.
本说明书实施例所涉及的WASM虚拟机是一种基于二进制操作指令的栈式结构的虚拟机,仅支持运行以WASM语言编写的程序代码,WASM语言是除了JavaScript以外的另一种可以运行于网页的编程语言,WASM作为一种新的编码方式,可以在现代的网络浏览器中运行,它属于一种低级的类汇编代码,具有紧凑的二进制格式,能够直接操作CPU的指令代码,比如x86指令集上的汇编代码有指令集、寄存器、栈等等,因此可以以接近原生的性能运行,并且为诸如C/C+等高级语言提供一个编译目标,以便使得这些高级语言能够在浏览器上运行。WASM语言被设计为可以与JavaScript共存,因此二者能够同时运行、彼此兼容。The WASM virtual machine involved in the embodiment of this specification is a virtual machine with a stack structure based on binary operation instructions, and only supports running program code written in WASM language. WASM language is another language other than JavaScript that can run on web pages. As a new coding method, WASM can run in modern web browsers. It belongs to a low-level assembly-like code with a compact binary format and can directly operate CPU instruction codes, such as x86 instructions. The assembly code on the set has instruction sets, registers, stacks, etc., so it can run with near-native performance, and provides a compilation target for high-level languages such as C/C+, so that these high-level languages can run on browsers. The WASM language is designed to coexist with JavaScript, so the two can run concurrently and are compatible with each other.
在本说明书实施例中,由于虚拟机程序理论上满足图灵完备,支持执行任意程序,因此可以通过在TEE中运行WASM虚拟机以满足对各类程序的可信计算需求。In the embodiment of this specification, since the virtual machine program theoretically satisfies Turing completeness and supports the execution of arbitrary programs, it is possible to meet the trusted computing requirements for various programs by running the WASM virtual machine in the TEE.
下面以图2中第一可信计算节点中的可信应用请求通过第二可信计算节点上的预言机服务程序获取目标区块链上的交易数据为例,对本说明书获取区块链数据的方案进行详细说明。图4是本说明书根据一示例性实施例提供的一种获取区块链数据的方法的交互流程图,请参考图4,本说明书涉及的获取区块链数据的方案可以基于第一可信计算节点、第二可信计算节点以及区块链节点之间的相互配合实现,其中,区块链节点属于目标区块链,该方法可以包括以下步骤:S401:第一可信计算节点中的可信应用构造出区块链数据查询请求,其中,区块链数据查询请求中包含的区块链域名、区块哈希以及交易哈希。Taking the trusted application request in the first trusted computing node in Figure 2 to obtain the transaction data on the target blockchain through the oracle service program on the second trusted computing node as an example, the description of how to obtain blockchain data in this manual The plan is described in detail. Fig. 4 is an interactive flowchart of a method for obtaining blockchain data provided by this specification according to an exemplary embodiment. Please refer to Fig. 4. The scheme for obtaining blockchain data involved in this specification can be based on the first trusted computing Nodes, the second trusted computing node and the blockchain node are realized through cooperation, wherein the blockchain node belongs to the target blockchain, and the method may include the following steps: S401: the trusted computing node in the first trusted computing node The letter application constructs a blockchain data query request, wherein the blockchain domain name, block hash and transaction hash contained in the blockchain data query request.
S402:可信应用向第一可信计算节点中的通讯服务程序区块链数据查询请求,通讯服务程序缓存接收到的区块链数据查询请求,并向第二可信计算节点中的预言机服务程序发出远程认证挑战。S402: The trusted application sends a blockchain data query request to the communication service program in the first trusted computing node, and the communication service program caches the received blockchain data query request, and sends the request to the oracle machine in the second trusted computing node The server program issues a remote authentication challenge.
S403:预言机服务程序响应于远程认证挑战,随机生成并维护一对公私钥对,并将自身的程序代码与生成的公钥分别进行哈希运算得到的程序哈希值和公钥哈希值再使用自身CPU私钥进行签名得到程序哈希签名以及公钥哈希签名,最后程序哈希值、公钥哈希值、程序哈希签名和公钥哈希签名封装得到自荐信息,发送给IAS服务器,以使IAS服务器完成认证后,接收IAS服务器返回的远程认证报告。S403: The oracle service program randomly generates and maintains a public-private key pair in response to the remote authentication challenge, and performs hash operations on its own program code and the generated public key to obtain the program hash value and public key hash value Then use your own CPU private key to sign to get the program hash signature and public key hash signature. Finally, the program hash value, public key hash value, program hash signature and public key hash signature are encapsulated to get self-recommendation information and sent to IAS server, so that the IAS server can receive the remote authentication report returned by the IAS server after the authentication is completed.
S404:预言机服务程序将获取的针对预言机服务程序的远程认证报告以及生成的公钥返回给第一可信计算节点中的通讯服务程序。S404: The oracle service program returns the obtained remote authentication report for the oracle service program and the generated public key to the communication service program in the first trusted computing node.
S405:通讯服务程序调用第一可信执行环境中的远程认证报告验证程序对接收到的验证报告进行验证,首先利用IAS服务器的公钥对远程认证报告的签名进行验证,在确定该远程认证报告确实为IAS服务器颁发的情况下,查看其记录的认证结果,若认证结果表明预言机服务程序的确运行于第二可信执行环境,然后继续从远程认证报告包含的自荐信息中解析得到程序哈希值和公钥哈希值,将数据库中存储的已公开的第二可信计算节点中的预言机服务程序的全部程序代码即时计算出的哈希值,或者从网络上直接查找得到第二可信计算节点中的预言机服务程序的全部程序代码对应的哈希值与程序哈希值进行比对,同时将从预言机服务程序接收到的公钥计算得到的哈希值与公钥哈希值进行比对,在两次比对结果均为比对一致的情况下,可以证明预言机服务程序的程序代码未被篡改以及所获得的预言机服务程序对应的公钥具有真实性,即可以证明预言机服务程序可信。S405: The communication service program invokes the remote authentication report verification program in the first trusted execution environment to verify the received verification report, and first uses the public key of the IAS server to verify the signature of the remote authentication report, and then confirms the remote authentication report If it is indeed issued by the IAS server, check the authentication result recorded by it. If the authentication result shows that the oracle service program is indeed running in the second trusted execution environment, then continue to parse the program hash from the self-recommendation information contained in the remote authentication report Value and public key hash value, the hash value calculated in real time by all the program codes of the oracle service program in the public second trusted computing node stored in the database, or directly searched from the network to obtain the second trusted computing node The hash value corresponding to all program codes of the oracle service program in the letter computing node is compared with the program hash value, and at the same time, the hash value calculated from the public key received from the oracle service program is compared with the public key hash If the two comparison results are consistent, it can be proved that the program code of the oracle service program has not been tampered with and the obtained public key corresponding to the oracle service program is authentic, that is, Prove that the oracle service program is trustworthy.
S406:第一可信计算节点中的通讯服务程序将缓存的区块链数据查询请求发送至第二可信计算节点中的预言机服务程序。S406: The communication service program in the first trusted computing node sends the cached blockchain data query request to the oracle service program in the second trusted computing node.
S407:预言机服务程序响应该区块链数据查询请求,并从中解析得到相应的区块链域名、区块哈希与交易哈希,通过区块链域名确定所需的交易数据所在的区块链系统为目标区块链,从而调用预先获知的目标区块链中对应的区块链节点的区块链数据访问接口,向区块链节点发起区块链数据访问请求。S407: The oracle service program responds to the blockchain data query request, and parses it to obtain the corresponding blockchain domain name, block hash and transaction hash, and determines the block where the required transaction data is located through the blockchain domain name The chain system is the target blockchain, so as to call the blockchain data access interface of the corresponding blockchain node in the target blockchain known in advance, and initiate a blockchain data access request to the blockchain node.
S408:区块链节点在接收到预言机服务程序发来的区块链数据访问请求后,通过事先获取的针对预言机服务程序的远程认证报告确定该预言机服务程序可信,然后响应于区块链数据访问请求将目标区块链上的所有区块均返回给预言机服务程序。S408: After the blockchain node receives the blockchain data access request sent by the oracle service program, it determines that the oracle service program is credible through the remote authentication report obtained in advance for the oracle service program, and then responds to the district The block chain data access request returns all blocks on the target block chain to the oracle service program.
S409:预言机服务程序根据区块链数据查询请求中的区块哈希与交易哈希从目标区块链上的所有区块中确定并获取应用程序所需的对应于区块链数据查询请求的交易数据,同时将接收到目标区块链上的所有区块逐一进行Merkle根和区块哈希的验证并生成目标区块链对应的验证结果维护在本地。S409: The oracle service program determines and obtains the corresponding blockchain data query request required by the application from all blocks on the target blockchain according to the block hash and transaction hash in the blockchain data query request At the same time, all the blocks received on the target blockchain are verified one by one by Merkle root and block hash, and the verification results corresponding to the target blockchain are generated and maintained locally.
S410:预言机服务程序在本地维护的验证结果表明所述目标区块链上的所有区块合法且对应的Merkle根均验证成功的情况下,对该交易数据使用先前生成的公私钥对中的私钥进行签名得到该交易数据对应的数字签名。S410: When the verification result maintained locally by the oracle service program shows that all blocks on the target blockchain are legal and the corresponding Merkle roots are verified successfully, use the previously generated public-private key pair for the transaction data. Sign with the private key to obtain the digital signature corresponding to the transaction data.
S411:预言机服务程序将交易数据与该交易数据对应的数字签名返回至第一可信计算节点中的通讯服务程序。S411: The oracle service program returns the transaction data and the digital signature corresponding to the transaction data to the communication service program in the first trusted computing node.
S412:通讯服务程序在接收到预言机服务程序返回的交易数据以及交易数据对应的数字签名后,将调用第一可信执行环境中的数字签名验证程序验证该数字签名,数字签名验证程序首先将接收到的交易数据进行哈希运算以得到标准交易数据哈希,然后使用先前通过远程认证报告被证明为预言机服务程序对应的公钥对数字签名进行解密得到待验证交易数据哈希,将待验证交易数据哈希与标准交易数据哈希进行比对,在比对一致的情况下确定所述数字签名验签成功,通讯服务程序在接收到验签成功的回调结果后,确定该交易数据的确是从被验证可信的预言机服务程序处所返回的,从而信任该交易数据。S412: After the communication service program receives the transaction data returned by the oracle service program and the digital signature corresponding to the transaction data, it will call the digital signature verification program in the first trusted execution environment to verify the digital signature. The digital signature verification program will first The received transaction data is hashed to obtain the standard transaction data hash, and then the digital signature is decrypted using the public key corresponding to the oracle service program that has been proved through the remote authentication report to obtain the transaction data hash to be verified. Verify that the transaction data hash is compared with the standard transaction data hash. If the comparison is consistent, it is determined that the digital signature verification is successful. After receiving the callback result of successful signature verification, the communication service program determines that the transaction data is indeed It is returned from the verified oracle service program, thus trusting the transaction data.
S413:通讯服务程序根据交易数据的区块链类型采用相应的解析插件进行解析以得到解析后的交易数据,并将解析后的该交易数据返回至可信应用,以作为可信应用发 送的区块链数据查询请求对应的请求结果。S413: The communication service program uses the corresponding parsing plug-in to parse the transaction data according to the block chain type to obtain the parsed transaction data, and returns the parsed transaction data to the trusted application as the area sent by the trusted application. The request result corresponding to the block chain data query request.
本说明书实施例中,第一可信计算节点通过获取针对预言机服务程序的远程认证报告,锚定对该预言机服务程序的信任关系,使得第一可信计算节点在通过预言机服务程序获取目标区块链上的交易数据后,只需要对获取的交易数据对应的数字签名进行验签以确保交易数据的确来源于可信的预言机服务程序,就能够证明交易数据的真实性,而无需在区块层面重复验证交易数据的真实性,从而给运行在第一可信执行环境中可信应用提供安全、可信的区块链信息查询服务。In the embodiment of this specification, the first trusted computing node anchors the trust relationship of the oracle service program by obtaining the remote authentication report for the oracle service program, so that the first trusted computing node obtains the remote authentication report through the oracle service program. After receiving the transaction data on the target blockchain, you only need to verify the digital signature corresponding to the acquired transaction data to ensure that the transaction data does come from a trusted oracle service program, and you can prove the authenticity of the transaction data without requiring The authenticity of transaction data is repeatedly verified at the block level, thereby providing safe and credible blockchain information query services for trusted applications running in the first trusted execution environment.
与前述方法的实施例相对应,本说明书还提供了装置、电子设备以及存储介质的实施例。Corresponding to the foregoing method embodiments, this specification also provides embodiments of apparatuses, electronic equipment, and storage media.
图5是一示例性实施例提供的一种设备的示意结构图。请参考图5,在硬件层面,该设备包括处理器502、内部总线504、网络接口506、内存508以及非易失性存储器510,当然还可能包括其他业务所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器502从非易失性存储器510中读取对应的计算机程序到内存508中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Fig. 5 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 5 , at the hardware level, the device includes a processor 502 , an internal bus 504 , a network interface 506 , a memory 508 and a non-volatile memory 510 , and of course it may also include hardware required by other services. One or more embodiments of this specification may be implemented based on software, for example, the processor 502 reads a corresponding computer program from the non-volatile memory 510 into the memory 508 and executes it. Of course, in addition to software implementations, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
如图6所示,图6是本说明书根据一示例性实施例示出的一种获取区块链数据的装置框图,该装置可以应用于如图5所示的设备中,以实现本说明书的技术方案,该装置应用于第一可信计算节点,所述第一可信计算节点部署的第一可信执行环境中运行有可信应用,该装置包括:报告获取单元601,用于获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境;请求发送单元602,用于在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据;数据接收单元603,用于接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。As shown in Figure 6, Figure 6 is a block diagram of a device for acquiring blockchain data according to an exemplary embodiment of this specification, which can be applied to the device shown in Figure 5 to implement the technology of this specification solution, the device is applied to a first trusted computing node, and a trusted application runs in the first trusted execution environment deployed by the first trusted computing node, and the device includes: a report obtaining unit 601, configured to obtain the The remote authentication report of the oracle service program, the oracle service program runs in the second trusted execution environment; the request sending unit 602 is configured to determine that the oracle service program is credible according to the remote authentication report, Sending the block chain data query request obtained from the trusted application to the oracle service program, so that the oracle service program responds to the block chain data query request to obtain the data on the target block chain block data; a data receiving unit 603, configured to receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and pass the public key corresponding to the oracle service program to the If the verification of the digital signature is successful, the block data is returned to the trusted application.
可选的,所述区块链数据查询请求包括区块链域名与交易哈希,所述目标区块链由所述区块链数据查询请求中的所述区块链域名所确定,所述目标区块链上的区块数据由所述区块链数据查询请求中的所述交易哈希所确定。Optionally, the blockchain data query request includes a blockchain domain name and a transaction hash, the target blockchain is determined by the blockchain domain name in the blockchain data query request, and the Block data on the target blockchain is determined by the transaction hash in the blockchain data query request.
可选的,所述目标区块链上的区块数据由所述预言机服务程序实时从所述目标区块链上获取,或者由所述预言机服务程序预先从所述目标区块链上获取。Optionally, the block data on the target block chain is obtained from the target block chain in real time by the oracle service program, or the block data is obtained from the target block chain in advance by the oracle service program Obtain.
可选的,所述请求发送单元602中所述预言机服务程序获取所述区块数据,包括:Optionally, the oracle service program in the request sending unit 602 to obtain the block data includes:
所述预言机服务程序通过调用所述目标区块链对应的区块链节点提供的区块链数据访问接口,获取所述区块数据;或者,所述预言机服务程序通过向所述目标区块链上的预言机合约发起区块数据获取交易,并监听所述预言机合约产生的所述区块数据获取交易的收据中所包含的区块数据获取事件,获取所述区块数据。The oracle service program obtains the block data by calling the blockchain data access interface provided by the blockchain node corresponding to the target blockchain; The oracle contract on the block chain initiates a block data acquisition transaction, and monitors the block data acquisition event contained in the receipt of the block data acquisition transaction generated by the oracle contract to acquire the block data.
可选的,所述区块数据以及所述区块数据对应的数字签名由所述预言机服务程序在对所述区块数据的真实性验证成功的情况下返回。Optionally, the block data and the digital signature corresponding to the block data are returned by the oracle service program when the authenticity verification of the block data is successful.
可选的,所述区块数据的真实性验证成功,包括:在所述预言机服务程序本地维护的所述目标区块链对应的验证结果表明所述目标区块链上的所有区块合法且对应的Merkle根均验证成功的情况下,确定所述区块数据的真实性验证成功。Optionally, the verification of the authenticity of the block data is successful, including: the verification result corresponding to the target blockchain locally maintained by the oracle service program indicates that all blocks on the target blockchain are legal And if the verification of the corresponding Merkle roots is successful, it is determined that the authenticity verification of the block data is successful.
可选的,所述请求发送单元602将区块链数据查询请求发送至所述预言机服务程序,包括:使用所述预言机服务程序对应的公钥对所述区块链数据查询请求加密后得到区块链数据查询请求密文;将所述区块链数据查询请求密文发送至所述预言机服务程序。Optionally, the request sending unit 602 sends the blockchain data query request to the oracle service program, including: using the public key corresponding to the oracle service program to encrypt the blockchain data query request Obtaining the ciphertext of the blockchain data query request; sending the ciphertext of the blockchain data query request to the oracle service program.
可选的,所述区块链数据查询请求包含第一可信计算节点对应的公钥,所述数据接收单元603接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,包括:接收所述预言机服务程序返回的区块数据密文以及数字签名密文,并使用第一可信计算节点私钥分别对所述区块数据密文以及所述数字签名密文解密得到所述区块数据和所述区块数据对应的数字签名;其中,所述区块数据密文和所述数字签名密文由所述预言机服务程序使用第一可信计算节点公钥分别对所述区块数据和所述区块数据对应的数字签名加密后得到。Optionally, the blockchain data query request includes a public key corresponding to the first trusted computing node, and the data receiving unit 603 receives the block data returned by the oracle service program and the block data The corresponding digital signature includes: receiving the block data ciphertext and the digital signature ciphertext returned by the oracle service program, and using the private key of the first trusted computing node to respectively write the block data ciphertext and the digital signature Decrypting the signature ciphertext to obtain the block data and the digital signature corresponding to the block data; wherein, the block data ciphertext and the digital signature ciphertext are used by the oracle service program using the first trusted computing The node public key is obtained after encrypting the block data and the digital signature corresponding to the block data respectively.
可选的,所述第一可信计算节点维护有各区块链类型对应的解析插件,所述数据接收单元603将所述区块数据返回至所述可信应用,包括:根据所述目标区块链的区块链类型对应的解析插件对所述区块数据进行解析,并将解析后的所述区块数据返回至所述可信应用。Optionally, the first trusted computing node maintains parsing plug-ins corresponding to each blockchain type, and the data receiving unit 603 returns the block data to the trusted application, including: The parsing plug-in corresponding to the block chain type of the block chain parses the block data, and returns the parsed block data to the trusted application.
可选的,所述可信应用运行于第一可信执行环境内封装的虚拟机中,所述虚拟机包括:基于二进制操作指令的栈式结构的虚拟机。Optionally, the trusted application runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes: a virtual machine based on a stack structure of binary operation instructions.
可选的,所述第二可信执行环境部署于第二可信计算节点;或者,所述第二可信执行环境部署于第一可信计算节点;其中,所述第二可信执行环境与第一可信执行环境为同一可信执行环境,或所述第二可信执行环境区别于第一可信执行环境。Optionally, the second trusted execution environment is deployed on a second trusted computing node; or, the second trusted execution environment is deployed on a first trusted computing node; wherein, the second trusted execution environment The same trusted execution environment as the first trusted execution environment, or the second trusted execution environment is different from the first trusted execution environment.
可选的,所述报告获取单元601具体用于:接收所述预言机服务程序发送的由认证服务器在完成对自荐信息的认证后返回的针对所述预言机服务程序的所述远程认证报告,所述自荐信息包含所述预言机服务程序的程序代码对应的第一哈希值,以及所述预言机服务程序的公钥对应的第二哈希值;或者,接收所述预言机服务程序发送的所述自荐信息,向所述认证服务器发送所述自荐信息,并接收由所述认证服务器在完成对所述自荐信息的认证后返回的针对所述预言机服务程序的所述远程认证报告。Optionally, the report obtaining unit 601 is specifically configured to: receive the remote authentication report for the oracle service program sent by the oracle service program and returned by the authentication server after completing the authentication of the self-recommendation information, The self-recommendation information includes the first hash value corresponding to the program code of the oracle service program, and the second hash value corresponding to the public key of the oracle service program; or, receiving the message sent by the oracle service program the self-recommendation information, send the self-recommendation information to the authentication server, and receive the remote authentication report for the oracle service program returned by the authentication server after completing the authentication of the self-recommendation information.
可选的,在所述远程认证报告由所述认证服务器签名,且所述远程认证报告中的自荐信息满足下述条件的情况下,请求发送单元602能够确定所述预言机服务程序可信:所述自荐信息中的第一哈希值与第三哈希值对比一致,且所述自荐信息中的第二哈希值与第四哈希值对比一致;其中,所述第三哈希值为通过对公开的所述预言机服务程序中所含的程序代码进行哈希运算后得到,所述第四哈希值为通过对第一可信计算节点当前持有的对应于所述预言机服务程序的公钥进行哈希运算后得到。Optionally, when the remote authentication report is signed by the authentication server, and the self-recommendation information in the remote authentication report satisfies the following conditions, the request sending unit 602 can determine that the oracle service program is credible: The first hash value in the self-recommendation information is consistent with the third hash value, and the second hash value in the self-recommendation information is consistent with the fourth hash value; wherein, the third hash value It is obtained by performing a hash operation on the program code contained in the disclosed oracle service program, and the fourth hash value is obtained by the corresponding to the oracle currently held by the first trusted computing node The public key of the service program is obtained after performing a hash operation.
相应的,本说明书还提供一种装置,所述装置包括有处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为实现上述全部方法实施例提供的实现可信计算方法的步骤。Correspondingly, this specification also provides a device, the device includes a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the credible implementation provided by all the above method embodiments. Calculation method steps.
相应的,本说明书还提供一种计算机可读存储介质,其上存储有可执行的指令;其中,该指令被处理器执行时,实现上述全部方法实施例提供的实现可信计算方法的步 骤。Correspondingly, this specification also provides a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by a processor, the steps for implementing the trusted computing method provided by all the above method embodiments are implemented.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚 地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。Terms used in one or more embodiments of the present specification are for the purpose of describing specific embodiments only, and are not intended to limit the one or more embodiments of the present specification. As used in one or more embodiments of this specification and the appended claims, the singular forms "a", "the", and "the" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in the scope of protection of one or more embodiments of this specification.

Claims (16)

  1. 一种获取区块链数据的方法,所述方法应用于第一可信计算节点,所述第一可信计算节点部署的第一可信执行环境中运行有可信应用,所述方法包括:A method for acquiring blockchain data, the method is applied to a first trusted computing node, and a trusted application runs in a first trusted execution environment deployed by the first trusted computing node, and the method includes:
    获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境;Obtaining a remote authentication report for the oracle service program, the oracle service program running in the second trusted execution environment;
    在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据;In the case that the oracle service program is determined to be credible according to the remote authentication report, a query request for blockchain data acquired from the trusted application is sent to the oracle service program, so that the oracle The service program obtains the block data on the target blockchain in response to the blockchain data query request;
    接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。Receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and if the digital signature is successfully verified by the public key corresponding to the oracle service program, send The block data is returned to the trusted application.
  2. 根据权利要求1所述的方法,所述区块链数据查询请求包括区块链域名与交易哈希,所述目标区块链由所述区块链数据查询请求中的所述区块链域名所确定,所述目标区块链上的区块数据由所述区块链数据查询请求中的所述交易哈希所确定。The method according to claim 1, the blockchain data query request includes a blockchain domain name and a transaction hash, and the target blockchain consists of the blockchain domain name in the blockchain data query request As determined, the block data on the target blockchain is determined by the transaction hash in the blockchain data query request.
  3. 根据权利要求1所述的方法,所述目标区块链上的区块数据由所述预言机服务程序实时从所述目标区块链上获取,或者由所述预言机服务程序预先从所述目标区块链上获取。According to the method according to claim 1, the block data on the target block chain is acquired from the target block chain in real time by the oracle service program, or the block data is obtained from the target block chain by the oracle service program in advance. Obtained on the target blockchain.
  4. 根据权利要求1所述的方法,所述预言机服务程序获取所述区块数据,包括:According to the method according to claim 1, the oracle service program obtaining the block data includes:
    所述预言机服务程序通过调用所述目标区块链对应的区块链节点提供的区块链数据访问接口,获取所述区块数据;或者,The oracle service program obtains the block data by calling the blockchain data access interface provided by the blockchain node corresponding to the target blockchain; or,
    所述预言机服务程序通过向所述目标区块链上的预言机合约发起区块数据获取交易,并监听所述预言机合约产生的所述区块数据获取交易的收据中所包含的区块数据获取事件,获取所述区块数据。The oracle service program initiates a block data acquisition transaction to the oracle contract on the target block chain, and monitors the blocks contained in the receipt of the block data acquisition transaction generated by the oracle contract A data acquisition event is used to acquire the block data.
  5. 根据权利要求1所述的方法,所述区块数据以及所述区块数据对应的数字签名由所述预言机服务程序在对所述区块数据的真实性验证成功的情况下返回。According to the method according to claim 1, the block data and the digital signature corresponding to the block data are returned by the oracle service program when the authenticity verification of the block data is successful.
  6. 根据权利要求5所述的方法,所述区块数据的真实性验证成功,包括:According to the method according to claim 5, the authenticity verification of the block data succeeds, comprising:
    在所述预言机服务程序本地维护的所述目标区块链对应的验证结果表明所述目标区块链上的所有区块合法且对应的Merkle根均验证成功的情况下,确定所述区块数据的真实性验证成功。When the verification result corresponding to the target block chain maintained locally by the oracle service program shows that all blocks on the target block chain are legal and the corresponding Merkle roots are verified successfully, determine the block The authenticity verification of the data was successful.
  7. 根据权利要求1所述的方法,所述将区块链数据查询请求发送至所述预言机服务程序,包括:The method according to claim 1, said sending the blockchain data query request to the oracle service program, comprising:
    使用所述预言机服务程序对应的公钥对所述区块链数据查询请求加密后得到区块链数据查询请求密文;Using the public key corresponding to the oracle service program to encrypt the block chain data query request to obtain the block chain data query request ciphertext;
    将所述区块链数据查询请求密文发送至所述预言机服务程序。Send the block chain data query request cipher text to the oracle machine service program.
  8. 根据权利要求1所述的方法,所述区块链数据查询请求包含第一可信计算节点对应的公钥,所述接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,包括:According to the method according to claim 1, the block chain data query request includes the public key corresponding to the first trusted computing node, and the block data and the block data returned by the oracle service program are received. The digital signature corresponding to the data, including:
    接收所述预言机服务程序返回的区块数据密文以及数字签名密文,并使用第一可信计算节点私钥分别对所述区块数据密文以及所述数字签名密文解密得到所述区块数据和所述区块数据对应的数字签名;其中,所述区块数据密文和所述数字签名密文由所述预言机服务程序使用第一可信计算节点公钥分别对所述区块数据和所述区块数据对应的数字签名加密后得到。receiving the block data ciphertext and the digital signature ciphertext returned by the oracle service program, and using the private key of the first trusted computing node to decrypt the block data ciphertext and the digital signature ciphertext respectively to obtain the Block data and digital signatures corresponding to the block data; wherein, the block data ciphertext and the digital signature ciphertext are respectively processed by the oracle service program using the first trusted computing node public key The block data and the digital signature corresponding to the block data are obtained after encryption.
  9. 根据权利要求1所述的方法,所述第一可信计算节点维护有各区块链类型对应的解析插件,所述将所述区块数据返回至所述可信应用,包括:According to the method according to claim 1, the first trusted computing node maintains a parsing plug-in corresponding to each blockchain type, and the returning the block data to the trusted application includes:
    根据所述目标区块链的区块链类型对应的解析插件对所述区块数据进行解析,并将解析后的所述区块数据返回至所述可信应用。The block data is parsed according to the parsing plug-in corresponding to the block chain type of the target block chain, and the parsed block data is returned to the trusted application.
  10. 根据权利要求1所述的方法,所述可信应用运行于第一可信执行环境内封装的虚拟机中,所述虚拟机包括:基于二进制操作指令的栈式结构的虚拟机。According to the method according to claim 1, the trusted application runs in a virtual machine encapsulated in the first trusted execution environment, and the virtual machine includes: a virtual machine based on a stack structure of binary operation instructions.
  11. 根据权利要求1所述的方法,The method according to claim 1,
    所述第二可信执行环境部署于第二可信计算节点;或者,The second trusted execution environment is deployed on a second trusted computing node; or,
    所述第二可信执行环境部署于第一可信计算节点;其中,所述第二可信执行环境与第一可信执行环境为同一可信执行环境,或所述第二可信执行环境区别于第一可信执行环境。The second trusted execution environment is deployed on the first trusted computing node; wherein, the second trusted execution environment and the first trusted execution environment are the same trusted execution environment, or the second trusted execution environment It is different from the first trusted execution environment.
  12. 根据权利要求1所述的方法,所述获取针对预言机服务程序的远程认证报告,包括:The method according to claim 1, said obtaining the remote authentication report for the oracle service program, comprising:
    接收所述预言机服务程序发送的由认证服务器在完成对自荐信息的认证后返回的针对所述预言机服务程序的所述远程认证报告,所述自荐信息包含所述预言机服务程序的程序代码对应的第一哈希值,以及所述预言机服务程序的公钥对应的第二哈希值;或者,receiving the remote authentication report sent by the oracle service program and returned by the authentication server after completing the authentication of the self-recommendation information for the oracle service program, the self-recommendation information including the program code of the oracle service program the corresponding first hash value, and the second hash value corresponding to the public key of the oracle service program; or,
    接收所述预言机服务程序发送的所述自荐信息,向所述认证服务器发送所述自荐信息,并接收由所述认证服务器在完成对所述自荐信息的认证后返回的针对所述预言机服务程序的所述远程认证报告。receiving the self-recommendation information sent by the oracle service program, sending the self-recommendation information to the authentication server, and receiving the service for the oracle machine returned by the authentication server after completing the authentication of the self-recommendation information The remote attestation report for the program.
  13. 根据权利要求12所述的方法,在所述远程认证报告由所述认证服务器签名,且所述远程认证报告中的自荐信息满足下述条件的情况下,确定所述预言机服务程序可信:According to the method according to claim 12, when the remote authentication report is signed by the authentication server, and the self-recommendation information in the remote authentication report meets the following conditions, it is determined that the oracle service program is credible:
    所述自荐信息中的第一哈希值与第三哈希值对比一致,且所述自荐信息中的第二哈希值与第四哈希值对比一致;其中,所述第三哈希值为通过对公开的所述预言机服务程序中所含的程序代码进行哈希运算后得到,所述第四哈希值为通过对第一可信计算节点当前持有的对应于所述预言机服务程序的公钥进行哈希运算后得到。The first hash value in the self-recommendation information is consistent with the third hash value, and the second hash value in the self-recommendation information is consistent with the fourth hash value; wherein, the third hash value It is obtained by performing a hash operation on the program code contained in the disclosed oracle service program, and the fourth hash value is obtained by the corresponding to the oracle currently held by the first trusted computing node The public key of the service program is obtained after performing a hash operation.
  14. 一种获取区块链数据的装置,所述装置应用于第一可信计算节点,所述第一可信计算节点部署的第一可信执行环境中运行有可信应用,所述装置包括:A device for acquiring blockchain data, the device is applied to a first trusted computing node, and a trusted application runs in a first trusted execution environment deployed by the first trusted computing node, and the device includes:
    报告获取单元,用于获取针对预言机服务程序的远程认证报告,所述预言机服务程序运行于第二可信执行环境;A report acquisition unit, configured to acquire a remote authentication report for the oracle service program, the oracle service program running in the second trusted execution environment;
    请求发送单元,用于在根据所述远程认证报告确定所述预言机服务程序可信的情况下,将从所述可信应用获取的区块链数据查询请求发送至所述预言机服务程序,以使所述预言机服务程序响应于所述区块链数据查询请求,获取目标区块链上的区块数据;A request sending unit, configured to send a query request for blockchain data obtained from the trusted application to the oracle service program when it is determined that the oracle service program is credible according to the remote authentication report, To make the oracle service program respond to the blockchain data query request to obtain block data on the target blockchain;
    数据接收单元,用于接收所述预言机服务程序返回的所述区块数据以及所述区块数据对应的数字签名,在通过所述预言机服务程序对应的公钥对所述数字签名验签成功的情况下,将所述区块数据返回至所述可信应用。A data receiving unit, configured to receive the block data returned by the oracle service program and the digital signature corresponding to the block data, and verify the digital signature through the public key corresponding to the oracle service program In case of success, the block data is returned to the trusted application.
  15. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    处理器;processor;
    用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-13中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-13 by running the executable instruction.
  16. 一种计算机可读存储介质,其上存储有计算机指令,其特征在于,该指令被处理器执行时实现如权利要求1-13中任一项所述方法的步骤。A computer-readable storage medium, on which computer instructions are stored, wherein, when the instructions are executed by a processor, the steps of the method according to any one of claims 1-13 are implemented.
PCT/CN2021/133167 2021-05-11 2021-11-25 Method and apparatus for acquiring blockchain data, electronic device, and storage medium WO2022237123A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110513055.2A CN113221166A (en) 2021-05-11 2021-05-11 Method and device for acquiring block chain data, electronic equipment and storage medium
CN202110513055.2 2021-05-11

Publications (1)

Publication Number Publication Date
WO2022237123A1 true WO2022237123A1 (en) 2022-11-17

Family

ID=77094741

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/133167 WO2022237123A1 (en) 2021-05-11 2021-11-25 Method and apparatus for acquiring blockchain data, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN113221166A (en)
WO (1) WO2022237123A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221166A (en) * 2021-05-11 2021-08-06 支付宝(杭州)信息技术有限公司 Method and device for acquiring block chain data, electronic equipment and storage medium
CN113472544B (en) * 2021-08-31 2021-12-14 北京微芯感知科技有限公司 Digital identity verification method and device, computer equipment and storage medium
CN113901498B (en) * 2021-10-15 2023-12-26 北京智融云河科技有限公司 Data sharing method, device, equipment and storage medium
CN114172689B (en) * 2021-11-11 2023-11-28 卓尔智联(武汉)研究院有限公司 Information processing method and equipment
CN113836147A (en) * 2021-11-26 2021-12-24 广东辰宜信息科技有限公司 Chain identifier generation method and device, chain cluster management method, system and medium
CN114338054B (en) * 2022-03-17 2022-06-07 北京笔新互联网科技有限公司 Block chain trusted data transmission, verification and acquisition method and device
CN117251883A (en) * 2023-11-02 2023-12-19 中国南方电网有限责任公司 Data reliability verification method, device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109670335A (en) * 2018-12-20 2019-04-23 众安信息技术服务有限公司 For in the method and device interacted between data outside block chain and chain
CN109981679A (en) * 2019-04-08 2019-07-05 上海点融信息科技有限责任公司 The method and apparatus of affairs are executed in block chain network
CN110598469A (en) * 2019-09-11 2019-12-20 腾讯科技(深圳)有限公司 Information processing method and device and computer storage medium
CN111429254A (en) * 2020-03-19 2020-07-17 腾讯科技(深圳)有限公司 Business data processing method and device and readable storage medium
CN113221166A (en) * 2021-05-11 2021-08-06 支付宝(杭州)信息技术有限公司 Method and device for acquiring block chain data, electronic equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110998581A (en) * 2019-03-26 2020-04-10 阿里巴巴集团控股有限公司 Program execution and data attestation scheme using multiple key pairs for signatures
CN111092914B (en) * 2020-03-18 2020-06-26 支付宝(杭州)信息技术有限公司 Method and device for accessing external data
CN111047450A (en) * 2020-03-18 2020-04-21 支付宝(杭州)信息技术有限公司 Method and device for calculating down-link privacy of on-link data
CN111090874B (en) * 2020-03-18 2020-09-01 支付宝(杭州)信息技术有限公司 Contract calling method and device
CN111090875B (en) * 2020-03-18 2020-10-02 支付宝(杭州)信息技术有限公司 Contract deployment method and device
CN112711774B (en) * 2021-03-25 2023-01-10 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109670335A (en) * 2018-12-20 2019-04-23 众安信息技术服务有限公司 For in the method and device interacted between data outside block chain and chain
CN109981679A (en) * 2019-04-08 2019-07-05 上海点融信息科技有限责任公司 The method and apparatus of affairs are executed in block chain network
CN110598469A (en) * 2019-09-11 2019-12-20 腾讯科技(深圳)有限公司 Information processing method and device and computer storage medium
CN111429254A (en) * 2020-03-19 2020-07-17 腾讯科技(深圳)有限公司 Business data processing method and device and readable storage medium
CN113221166A (en) * 2021-05-11 2021-08-06 支付宝(杭州)信息技术有限公司 Method and device for acquiring block chain data, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113221166A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
WO2022237123A1 (en) Method and apparatus for acquiring blockchain data, electronic device, and storage medium
US11520912B2 (en) Methods, media, apparatuses and computing devices of user data authorization based on blockchain
US20210328791A1 (en) Blockchain data processing methods and apparatuses based on cloud computing
CN108369622B (en) Software container registry service
US10116645B1 (en) Controlling use of encryption keys
US9584517B1 (en) Transforms within secure execution environments
US9712503B1 (en) Computing instance migration
US8837734B2 (en) Managing encrypted data and encryption keys
CN112948810B (en) Trusted computing program calling method and device, electronic equipment and storage medium
US9710664B2 (en) Security layer and methods for protecting tenant data in a cloud-mediated computing network
US20180020008A1 (en) Secure asynchronous communications
US11509636B2 (en) User and device onboarding
US10255089B2 (en) Self-deleting virtual machines
US11496302B2 (en) Securely processing secret values in application configurations
CN112989319B (en) Method, device, electronic equipment and storage medium for realizing trusted computing
US11489660B2 (en) Re-encrypting data on a hash chain
GB2514550A (en) System and method for providing access to a resource for a computer from within a restricted network and storage medium storing same
US11132449B2 (en) Incorporating at-rest data encryption into a cloud-based storage architecture
US20230094864A1 (en) System and method for end-to-end data trust management with real-time attestation
CN115580413B (en) Zero-trust multi-party data fusion calculation method and device
US11363012B1 (en) System and methods for using role credentials associated with a VM instance
US20170118197A1 (en) Sharing data between sandboxed applications with certificates
US20200220898A1 (en) Providing attributes of a network service
US20230403138A1 (en) Agentless single sign-on techniques
CN114386073A (en) Method and device for creating security certificate, electronic equipment and storage medium

Legal Events

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

Ref document number: 21941687

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE