WO2021208956A1 - 智能合约的部署 - Google Patents

智能合约的部署 Download PDF

Info

Publication number
WO2021208956A1
WO2021208956A1 PCT/CN2021/087204 CN2021087204W WO2021208956A1 WO 2021208956 A1 WO2021208956 A1 WO 2021208956A1 CN 2021087204 W CN2021087204 W CN 2021087204W WO 2021208956 A1 WO2021208956 A1 WO 2021208956A1
Authority
WO
WIPO (PCT)
Prior art keywords
device node
audit target
hash value
smart contract
node
Prior art date
Application number
PCT/CN2021/087204
Other languages
English (en)
French (fr)
Inventor
吴莹强
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021208956A1 publication Critical patent/WO2021208956A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing

Definitions

  • the embodiments of this specification relate to the field of information technology, in particular to the deployment of smart contracts.
  • the purpose of the embodiments of the present application is to provide a solution that can realize trusted startup of IoT devices.
  • the embodiment of this specification provides a smart contract deployment method, which is applied to a node of a blockchain system, the method includes: obtaining an audit target, a device node identifier, and a public key in a device node; and determining the The hash value of the audit target; establish the corresponding relationship between the public key of the device node, the device node identifier, and the hash value of the audit target; construct a smart contract that includes the corresponding relationship, and deploy the smart contract to the district In the nodes of the blockchain system.
  • the smart contract is used to verify the audit target contained in the transaction and the device in the smart contract when the node of the blockchain system receives a transaction containing the hash value of the audit target sent by the device node The consistency of the hash value of the node's audit target.
  • the embodiments of this specification provide a verification method based on the aforementioned smart contract, which is applied to a blockchain system that has pre-deployed the smart contract.
  • the method includes: device nodes determine audit targets, and determine the The hash value of the audit target of the device node; the device node uses the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generate a digital signature that includes the digital signature and the device node identifier Transaction; the device node broadcasts the transaction containing the digital signature and the device node identification to the blockchain system; any node that contains the transaction is received in the blockchain system, from the The smart contract obtains the hash value of the audit target corresponding to the device node identifier, and verifies the consistency of the hash value of the audit target contained in the transaction to obtain the verification result; in the blockchain system
  • the nodes in the node perform consensus based on their respective verification results, generate the consensus result and store it in the blockchain system, and send the consensus result to the device
  • the embodiments of this specification provide a device node startup method based on the aforementioned smart contract, which is applied to the device node of the blockchain system on which the smart contract has been pre-deployed, including: determining the audit target and determining the The hash value of the audit target of the device node; use the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generate a transaction containing the digital signature and the device node identifier; broadcast contains The digital signature and the transaction of the device node identification are sent to the blockchain system, so that the blockchain system can according to the hash value of the audit target contained in the smart contract and the target contained in the transaction
  • the hash value of the transaction undergoes consistency verification and consensus to return a consensus result; the consensus result is received, and when the consensus result indicates that the consistency verification is passed, the audit goal is executed.
  • the embodiment of this specification provides a smart contract deployment device, which is applied to a node of a blockchain system.
  • the device includes: an acquisition module to acquire the audit target, the device node identifier, and the device node identifier in the device node. Public key; determining module to determine the hash value of the audit target; establishing module to establish the correspondence relationship between the public key of the device node, the device node identifier and the hash value of the audit target; deploy the module to construct a The smart contract of the corresponding relationship is described, and the smart contract is deployed to the node of the blockchain system.
  • the smart contract is used to verify the audit target contained in the transaction and the device in the smart contract when the node of the blockchain system receives a transaction containing the hash value of the audit target sent by the device node The consistency of the hash value of the node's audit target.
  • the embodiment of this specification also provides a verification system based on the aforementioned smart contract.
  • the device node determines the audit target and determines the hash value of the audit target of the device node;
  • the device node uses the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature to generate a transaction containing the digital signature and the device node identifier;
  • the device node broadcasts the digital signature
  • the transaction with the device node ID is sent to the blockchain system; any node that contains the transaction is received in the blockchain system, and the device node ID corresponding to the device node ID is obtained from the smart contract
  • the hash value of the audit target is verified for the consistency of the hash value of the audit target contained in the transaction to obtain the verification result;
  • the nodes in the blockchain system perform consensus based on the respective verification results to generate
  • the consensus result is stored in the blockchain system, and the consensus result is sent to the device node; the device node receives the consensus result, and when the
  • the embodiment of this specification also provides a device node starting device based on the aforementioned smart contract, which is applied to the device node of the blockchain system on which the smart contract has been pre-deployed, and includes: a determination module, Determine the audit target, determine the hash value of the audit target of the device node; the signature module uses the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generate a digital signature and The transaction identified by the device node; a broadcasting module, which broadcasts the transaction containing the digital signature and the device node identification to the blockchain system, so that the blockchain system can follow the smart contract contained in The hash value of the audit target and the hash value of the target transaction contained in the transaction undergo consistency verification and consensus to return the consensus result; the execution module receives the consensus result, and executes when the consensus result indicates that the consistency verification is passed The audit objective.
  • a determination module Determine the audit target, determine the hash value of the audit target of the device node
  • the signature module uses the
  • FIG. 1 is a schematic flowchart of a method for deploying a smart contract provided by an embodiment of the specification
  • FIG. 2 is a schematic flowchart of a verification method provided by an embodiment of the specification
  • FIG. 3 is a schematic flowchart of a method for starting a device node according to an embodiment of the specification
  • FIG. 4 is a schematic structural diagram of a smart contract deployment device provided by an embodiment of this specification.
  • FIG. 5 is a schematic structural diagram of an apparatus for starting a device node according to an embodiment of the specification
  • Fig. 6 is a schematic structural diagram of a device for configuring the method of the embodiment of this specification.
  • the equipment of the Internet of Things is different from the central server, which is often in a distributed and edge environment, and the embedded systems are often used.
  • the bootloader usually built in the device
  • the embedded application program is installed in the memory and then jumps to the space where the operating system is located to start the operating system.
  • the system startup bootloader Bootloader is the first piece of code executed after the device is powered on, and because the hardware conditions of various devices are different, the system startup bootloader Bootloader is often different. In this process, if someone is illegally modified or injected with malicious code, it will cause the system kernel or firmware that depends on the Bootloader in the device to operate differently from the usual after startup, and the collected data may be maliciously modified or part of it. Lost.
  • the embodiments of the present specification provide a solution that can realize a trusted startup of an Internet of Things device. Specifically, it includes three aspects: the deployment of smart contracts, the audit based on smart contracts, and the trusted startup of devices.
  • Figure 1 is a schematic flow diagram of a smart contract deployment method provided by an embodiment of this specification, which is applied to a node of a blockchain system.
  • the method include:
  • S101 Acquire an audit target, a device node identifier, and a public key in a device node.
  • the nodes of the blockchain system may include the following: the manufacturer of the device node, the owner of the device node, the user of the device node, and the possibility of the data collected by the device node User and so on.
  • the nodes of the blockchain system can include: the camera device itself, the camera manufacturer, and the camera seller , Supermarkets and regulatory authorities, etc.
  • the node where the smart contract is deployed may be any party related to the collection of data by the device and the use of the data.
  • the audit target at this time includes at least one of the startup code, the system bootloader Bootloader, and the load object.
  • the load object includes the system kernel of the device node and the related firmware applied on the device node. In practical applications, there can of course also be multiple audit targets. Audit targets can be regarded as a piece of code.
  • any node in the blockchain system has obtained the relevant content of the audit target in advance, including the initial content of the code or the hash value of the audit target, and so on. Thereby, it is possible to reach a consensus on the smart contract that contains the relevant information of the device node.
  • S103 Determine the hash value of the audit target. If there are multiple audit targets, the hash value of each audit target needs to be determined separately.
  • S105 Establish a correspondence relationship between the public key of the device node, the device node identifier, and the hash value of the audit target.
  • the audit target includes the startup code and the system startup boot program, and the hash value of the startup code is hash1, the hash value of the system startup boot program is hash2, the device node ID is ID1, and the public key of the device node is key1, then The following correspondence can be established (ID1, key1, hash1, hash2).
  • each device can be given a device node identification and public key.
  • each type of device node can also be given a device node identification and public key. For example, based on the factory model of the device or the unique serial number of the product, given a device node ID and public key, the factory model/unique serial number has a one-to-one correspondence with the device node ID and public key.
  • S107 Construct a smart contract including the corresponding relationship, and deploy the smart contract to a node of the blockchain system.
  • a smart contract corresponding to the device node/type of device node can be generated.
  • the smart contract includes the aforementioned corresponding relationship and also includes audit logic. If there are multiple/multi-type device nodes, then multiple aforementioned correspondences can be included in the smart contract.
  • the deployment method is to publish the smart contract to the blockchain for multi-party consensus, and after the consensus is passed, it will be deployed in each node of the blockchain.
  • This smart contract is used to verify the audit target contained in the transaction and the audit of the device node in the smart contract when the node of the blockchain system receives a transaction containing the hash value of the audit target sent by the device node The consistency of the target's hash value.
  • the deployment node of the smart contract when it receives a transaction, it can find the corresponding public key and the hash value of the audit target according to the device node identification contained in the transaction, and use the public key to decrypt the digital signature in the transaction. Obtain a hash value (the digital signature is obtained by encrypting the hash value of the audit target by the device node using the private key corresponding to the public key), and use the hash value and the hash value in the smart contract for consistency verification .
  • the audit target may also be updated.
  • the firmware in the audit target may be updated remotely.
  • a smart contract needs to be redeployed. That is, when the audit target is updated, the hash value of the updated audit target needs to be determined; the corresponding relationship between the public key of the device node, the device node identifier and the hash value of the new audit target needs to be established; Another smart contract of the corresponding relationship, and deploy the other smart contract to the node of the blockchain system.
  • each smart contract can also carry a version number, and the later the deployed smart contract version number is, the newer, so that each node device can perform verification based on the latest version of the smart contract when verifying.
  • the device startup information can be verified based on the deployed smart contract, that is, the second aspect provided by the embodiment of this specification, as shown in Figure 2, which is provided by the embodiment of this specification
  • a verification method based on the startup information of the aforementioned smart contract is applied to a blockchain system in which the smart contract has been pre-deployed, and the method includes:
  • the device node determines the audit target, and determines the hash value of the audit target of the device node.
  • the device node may preset a read-only startup code in the BootROM of the device processor.
  • BootROM is a small piece of mask ROM or write-protected flash memory embedded in the processor chip, which contains the first code executed when the processor is powered on or reset.
  • the startup code since the startup code is always executed first (also before the system startup bootloader), the startup code can be used to controllably load the system startup bootloader on the external memory or update the firmware remotely, and the startup code can Control the subsequent device behavior, that is, determine the audit target, and determine the hash value of the audit target of the device node.
  • the audit objective here can be one or more.
  • the audit target is only the startup code
  • the hash value of the startup code is calculated and the follow-up audit is performed.
  • the device node encrypts the hash value of the audit target by using the private key of the device node to obtain a digital signature, and generates a transaction including the digital signature and the device node identifier.
  • the private key of the device node is the private key corresponding to the public key of the device node in the smart contract.
  • the device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system.
  • the block chain system receives any node that includes the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, and compares the hash value of the audit target included in the transaction.
  • the hash value of the audit target is verified for consistency, and the verification result is obtained.
  • the nodes in the blockchain that can receive the transaction containing the transaction may be determined based on the shape of the blockchain. For example, each node device can be used as a valid node to receive transactions and perform broadcasts and consensus after passing the trusted startup; another example, when the blockchain is a consortium chain, the ones that can receive transactions and perform consensus can be Several pre-defined nodes, ordinary device nodes cannot participate in the consensus.
  • each node in the blockchain system has deployed a smart contract containing correspondence and verification logic. Therefore, any node that receives a transaction can be based on the device node included in the transaction.
  • the identification finds the corresponding public key and the hash value of the audit target, and uses the public key to decrypt the digital signature in the transaction to obtain a hash value (the digital signature is the private key corresponding to the device node using the public key for the audit target).
  • the hash value is encrypted), and the hash value and the hash value in the smart contract are used for consistency verification.
  • a node contains the device node ID ID1 in the received transaction, it can find the corresponding hash values hash1 and hash2 and the public key key1 based on ID1 from the smart contract, and if the digital signature in the received transaction Use key1 to decrypt, and the obtained hash value is hash1, so that it can be determined that the verification is successful.
  • multiple smart contracts with different version numbers may be deployed in each node. Then, in actual applications, when verification is performed based on the smart contract, the blockchain system receives the transaction containing the transaction. Any node obtains the hash value of the audit target corresponding to the device node identifier from the latest version of the smart contract for verification, so as to ensure reliable verification after the audit target is updated (usually the firmware is updated).
  • S209 Perform a consensus among the nodes in the blockchain system based on their respective verification results, generate a consensus result and store it in the blockchain system, and send the consensus result to the device node.
  • the blockchain system After each device node has performed the verification, it is possible to initiate a consensus on the verification result in the blockchain, and the consensus mechanism for the verification result can also be predetermined in the smart contract (for example, if the verification result of any node is inconsistent , The verification result is not passed), and the final verification result is obtained.
  • the blockchain system After the verification result is determined, the blockchain system sends the verification result to the device node. Information such as the verification result and verification time can be stored on the blockchain for the relevant authorizers to query.
  • S211 The device node receives the consensus result, and when the consensus result indicates that the verification is passed, the audit target is executed.
  • the implementation of the audit target here includes the following aspects.
  • the audit target is the startup code
  • the startup code is executed, and the system startup boot program is loaded through the startup code; and when the audit target is the system startup boot program, the system startup is executed
  • the boot program loads the firmware or system kernel and transfers control to the firmware or system kernel.
  • the audit target is firmware or system kernel
  • the firmware or system kernel is executed, and the corresponding hardware function in the device node is started.
  • FIG. 3 is a schematic flow diagram of a method for starting a device node based on the aforementioned smart contract provided by the embodiment of this specification, which is applied to pre-deployed devices.
  • the device nodes of the smart contract blockchain system include:
  • S301 Determine the audit target, and determine the hash value of the audit target of the device node; the audit target has been explained in the foregoing, and will not be repeated here.
  • S303 Use the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generate a transaction including the digital signature and the device node identifier.
  • S305 Broadcast the transaction including the digital signature and the device node identification to the blockchain system, so that the blockchain system can process the transaction according to the hash value of the audit target contained in the smart contract
  • the hash value of the included target transaction is verified for consistency and consensus to return the consensus result.
  • the blockchain system can confirm and agree on the verification result based on the method described in the second aspect.
  • S307 Receive a consensus result, and execute the audit target when the consensus result indicates that the consistency verification is passed.
  • the audit target may include the startup code, the system startup boot program, and the load object at the same time.
  • each audit target needs to be audited in sequence at startup.
  • the audit result of the previous audit goal fails (the audit result fails or the audit result has not been received)
  • the next audit goal is not audited, and the latter audit goal is not executed.
  • the order of the audit is to proceed in order according to the order of the startup code, the system startup boot program, and the load object.
  • the startup code is executed to start the system startup boot program, and the system startup boot program is determined as the next audit target
  • the consensus result of the system booting program indicates that the consistency verification is passed
  • the system booting program is executed to start the loading object, and the loading object is determined as the next audit target.
  • the startup code is not audited, although the subsequent startup can be guaranteed, it may be modified by someone (for example, the hash value of the subsequent system startup boot program is written dead in the startup code, and it will be written The dead hash value is submitted for audit), and subsequent audits are meaningless; if the system startup boot program or loading object is not audited, the system startup boot program or loading object may be caused by people such as malicious code to cause the function of the device Distorted or held hostage, causing data distortion. In other words, based on the one-line verification from the startup code, the system startup boot program to the loaded object, it can be guaranteed that no process in the startup process will be tampered with, and a completely trusted startup can be realized.
  • the embodiment of this specification also provides a smart contract deployment device, which is applied to the nodes of the blockchain system, as shown in FIG. 4, which is a smart contract provided by the embodiment of this specification.
  • Schematic diagram of the deployment device including:
  • the obtaining module 401 obtains the audit target, the device node identifier and the public key in the device node;
  • the determining module 403 determines the hash value of the audit target
  • the establishment module 405 establishes the correspondence between the public key of the device node, the device node identifier, and the hash value of the audit target;
  • the deployment module 407 constructs a smart contract including the corresponding relationship, and deploys the smart contract to the nodes of the blockchain system.
  • the smart contract is used to verify the audit target contained in the transaction and the device in the smart contract when the node of the blockchain system receives a transaction containing the hash value of the audit target sent by the device node The consistency of the hash value of the node's audit target.
  • the determining module 403 is also used to determine the hash value of the updated audit target;
  • the establishing module 405 is also used to establish the device node The corresponding relationship between the public key of the public key, the device node identifier and the hash value of the new audit target;
  • the deployment module 407 is also used to construct another smart contract containing the corresponding relationship, and deploy the other Smart contracts to the nodes of the blockchain system.
  • the embodiment of this specification also provides a verification system based on the aforementioned smart contract.
  • the verification system includes a device node and other nodes.
  • the device node determines the audit target and determines the device The hash value of the audit target of the node; the device node uses the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generate a transaction containing the digital signature and the device node identifier
  • the device node broadcasts the transaction containing the digital signature and the device node identifier to the blockchain system; any node that contains the transaction is received in the blockchain system, from the smart Obtain the hash value of the audit target corresponding to the device node identifier in the contract, and verify the consistency of the hash value of the audit target contained in the transaction to obtain the verification result; in the blockchain system
  • the nodes carry out a consensus based on their respective verification results, generate the consensus result and store it in the blockchain system, and send the consensus result to the device no
  • any node containing the transaction is received in the system, and the hash value of the audit target corresponding to the device node identifier is obtained from the latest version of the smart contract.
  • an embodiment of this specification also provides a device node activation device based on the aforementioned smart contract, as shown in FIG. 5, which is a schematic structural diagram of a device node activation device provided by an embodiment of the specification , Applied to the device nodes of the blockchain system where the smart contract has been pre-deployed, including:
  • the determining module 501 determines the audit target, and determines the hash value of the audit target of the device node;
  • the signature module 503 uses the private key of the device node to encrypt the hash value of the audit target to obtain a digital signature, and generates a transaction including the digital signature and the device node identifier;
  • the broadcast module 505 broadcasts the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system can according to the hash value of the audit target contained in the smart contract and The hash value of the target transaction contained in the transaction undergoes consistency verification and consensus to return the consensus result;
  • the execution module 507 receives the consensus result, and executes the audit target when the consensus result indicates that the consistency verification is passed.
  • the determining module 501 is further configured to sequentially determine the audit goals in the order of the startup code, the system startup boot program, and the loading object.
  • the execution module 507 when the consensus result of the startup code indicates that the consistency verification is passed, execute the startup code to start the system startup boot program, and determine the system startup boot program as the next An audit target; and, when the consensus result of the system booting program indicates that the consistency verification is passed, the system booting program is executed to start the loading object, and the loading object is determined as the next audit target .
  • the embodiments of this specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the intelligence shown in FIG. 1 when the program is executed.
  • the deployment method of the contract is not limited to a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the intelligence shown in FIG. 1 when the program is executed.
  • the embodiments of this specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the device shown in FIG. 3 when the program is executed. Node startup method.
  • FIG. 6 shows a more specific hardware structure diagram of a computing device provided by an embodiment of this specification.
  • the device may include a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050.
  • the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040 realize the communication connection between each other in the device through the bus 1050.
  • the processor 1010 may be implemented by a general CPU (Central Processing Unit, central processing unit), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., for execution related Program to implement the technical solutions provided in the embodiments of this specification.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • the memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory, random access memory), static storage device, dynamic storage device, etc.
  • the memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, related program codes are stored in the memory 1020 and called and executed by the processor 1010.
  • the input/output interface 1030 is used to connect an input/output module to realize information input and output.
  • the input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions.
  • the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and an output device may include a display, a speaker, a vibrator, an indicator light, and the like.
  • the communication interface 1040 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices.
  • the communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
  • the bus 1050 includes a path to transmit information between various components of the device (for example, the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040).
  • the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include the equipment necessary for normal operation. Other components.
  • the above-mentioned device may also include only the components necessary to implement the solutions of the embodiments of the present specification, and not necessarily include all the components shown in the figures.
  • the embodiment of this specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the smart contract deployment method shown in FIG. 1 is implemented.
  • the embodiment of this specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the device node startup method shown in FIG. 3 is implemented.
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Accounting & Taxation (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

公开了一种智能合约的部署方法、装置及设备。基于预先部署用于验证的智能合约,在设备节点需要启动时,即对于启动时需要执行的审计目标生成哈希值并数字签名,并发送到区块链上通过多方共识的智能合约进行验证,并保存验证结果,在验证通过之后再执行审计目标的启动。

Description

智能合约的部署 技术领域
本说明书实施例涉及信息技术领域,尤其涉及智能合约的部署。
背景技术
随着物联网的广泛应用,大量的设备也需要通过这些物联网的终端设备进行采集。lieu摄像头采集的视频,温湿度传感器采集的环境信息,汽车ADAS系统的雷达数据等。如果这些终端设备在启动时或远程更新时就被加载了非法固件和非法内核系统,这些采集到的数据往往就会变得不可信或者有危害性。基于此,需要一种可以实现可信启动物联网设备的方案。
发明内容
本申请实施例的目的是提供一种可以实现可信启动物联网设备的方案。
为解决上述技术问题,本申请实施例是这样实现的:
第一方面,本说明书实施例提供一种智能合约的部署方法,应用于区块链系统的节点中,所述方法包括:获取设备节点中的审计目标、设备节点标识和公钥;确定所述审计目标的哈希值;建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系;构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中。其中,所述智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
第二方面,本说明书实施例提供一种基于前述智能合约的验证方法,应用于已经预先部署了所述智能合约的区块链系统中,所述方法包括:设备节点确定审计目标,确定所述设备节点的审计目标的哈希值;所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中;所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致 性验证,得到验证结果;在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点;所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
第三方面,本说明书实施例提供一种基于前述智能合约的设备节点启动方法,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:确定审计目标,确定所述设备节点的审计目标的哈希值;采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果;接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
与第一方面对应的,本说明书实施例提供一种智能合约的部署装置,应用于区块链系统的节点中,所述装置包括:获取模块,获取设备节点中的审计目标、设备节点标识和公钥;确定模块,确定所述审计目标的哈希值;建立模块,建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系;部署模块,构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中。其中,所述智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
与第二方面对应的,本说明书实施例还提供一种基于前述智能合约的验证系统,在所述系统中,设备节点确定审计目标,确定所述设备节点的审计目标的哈希值;所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中;所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致性验证,得到验证结果;在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点;所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
与第三方面对应的,本说明书实施例还提供一种基于前述智能合约的设备节点启动装置,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:确定模 块,确定审计目标,确定所述设备节点的审计目标的哈希值;签名模块,采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;广播模块,广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果;执行模块,接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
通过本说明书实施例所提供的方案,基于预先部署用于验证的智能合约,在设备节点需要启动时,即对于启动时需要执行的审计目标生成哈希值并数字签名,并发送到区块链上通过多方共识的智能合约进行验证,并保存验证结果,在验证通过之后再执行审计目标的启动,通过分布式的区块链智能合约方式审计设备节点启动过程中的信息,实现设备节点的可信启动。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,不能限制本说明书实施例。此外,本说明书实施例中的任一实施例无需达到上述的全部效果。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1为本说明书实施例所提供的一种智能合约的部署方法的流程示意图;
图2为本说明书实施例所提供的一种验证方法的流程示意图;
图3为本说明书实施例所提供的一种设备节点启动方法的流程示意图;
图4是本说明书实施例提供的一种智能合约的部署装置的结构示意图;
图5为本说明书实施例所提供的一种设备节点启动装置的结构示意图;
图6是用于配置本说明书实施例方法的一种设备的结构示意图。
具体实施方式
为了使本领域技术人员更好地理解本说明书实施例中的技术方案,下面将结合本说 明书实施例中的附图,对本说明书实施例中的技术方案进行详细地描述,显然,所描述的实施例仅仅是本说明书的一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于保护的范围。
物联网的设备不同于中心式服务器,往往处于分散和边缘的环境中其所采用的往往都是嵌入式系统。这类设备在操作系统的系统内核运行之前,往往需要运行执行系统启动引导程序Bootloader(通常是是内置于设备中),用于加载CPU和相关硬件的初始化之后,再将操作系统映像或固化的嵌入式应用程序装在到内存中然后跳转到操作系统所在的空间,启动操作系统运行。
换言之,系统启动引导程序Bootloader是设备在加电后执行的第一段代码,而由于各类设备的硬件条件不同,则系统启动引导程序Bootloader则往往都不相同。在这个过程中,如果被人非法修改或者注入了恶意代码,那么就会导致设备中依赖于Bootloader的系统内核或者固件在启动后的运行方式不同于常规,采集到的数据可能被恶意修改或者部分遗失。
基于此,本说明书实施例提供一种可以实现可信启动物联网设备的方案。具体包括三个方面:智能合约的部署,基于智能合约的审计,以及设备的可信启动。
对于第一方面,智能合约的部署,如图1所示,图1为本说明书实施例所提供的一种智能合约的部署方法的流程示意图,应用于区块链系统的节点中,所述方法包括:
S101,获取设备节点中的审计目标、设备节点标识和公钥。
在本说明书实施例中,基于应用场景的不同,区块链系统的节点可以包括如下:设备节点的制造方、设备节点的所有方、设备节点的使用方以及设备节点所采集到的数据的可能使用方等等。
例如,对于一个部署在无人超市中的摄像头而言,为了保证摄像头在启动后的数据是可信的,区块链系统的节点可以包括:摄像头设备本身、摄像头的制造商、摄像头的销售方、超市方以及监管部门等等。
换言之,在本说明书实施例中,部署智能合约的节点可以是与设备采集数据以及数据使用时所相关的任一方。
此时的审计目标包括启动代码、系统启动引导程序Bootloader和加载对象中的至少一个,加载对象包括设备节点的系统内核,以及应用在设备节点上的相关固件。在实际应用中,审计目标当然也可以是多个。审计目标都可以视为一段代码。
在本说明书实施例中,区块链系统中的任一节点都已经事先获得了所述审计目标的相关内容,包括代码的初始内容或者审计目标的哈希值等等。从而可以对包含了设备节点相关信息的智能合约进行共识。
S103,确定所述审计目标的哈希值。如果存在多个审计目标,则需要分别确定每个审计目标的哈希值。
S105,建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系。
如果存在多个审计目标,则需要建立关于每个审计目标的哈希值的对应关系。例如,如果审计目标包括启动代码和系统启动引导程序,而启动代码的哈希值为hash1,系统启动引导程序的哈希值为hash2,设备节点标识为ID1,设备节点的公钥为key1,则可以建立如下的对应关系(ID1,key1,hash1,hash2)。
在实际应用中,可以每一个设备给定一个设备节点标识和公钥,当然,在实际应用中,为了节省成本,也可以每一类设备节点给定一个设备节点标识和公钥。例如,基于,基于设备的出厂型号或者产品唯一序列号,给定一个设备节点标识和公钥,出厂型号/唯一序列号与设备节点标识和公钥一一对应。
S107,构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中。
针对一个/一类设备节点,即可以生成对应于该个/该类设备节点的智能合约,智能合约中即包含了前述对应关系,并且还包括了审计逻辑。如果存在多个/多类设备节点,那么则可以在智能合约中包含了多个前述的对应关系。
部署的方式即为将该智能合约发布至区块链中进行多方共识,在共识通过之后即部署在区块链的每个节点中。
该智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
具体而言,智能合约的部署节点接收到一个交易时,即可以根据交易中所包含的设备节点标识找到对应的公钥和审计目标的哈希值,并使用公钥解密交易中的数字签名从而得到一个哈希值(该数字签名即为设备节点使用公钥所对应的私钥对于审计目标的哈希值加密得到),并且使用该哈希值和智能合约中的哈希值进行一致性验证。
在实际应用中,审计目标还有可能发生更新,例如,审计目标中的固件有可能被远程更新,此时,则需要重新部署一个智能合约。即当审计目标更新时,则需要确定更新后的审计目标的哈希值;建立所述设备节点的公钥、设备节点标识和所述新后的审计目标的哈希值的对应关系;构建包含所述对应关系的另一智能合约,并部署所述另一智能合约至区块链系统的节点中。
在另一智能合约被部署之后,可以将前一智能合约进行无效。在实际应用中,还可以让各智能合约携带版本号,越靠后部署的智能合约版本号越新,从而,各节点设备在进行验证时可以基于最新版本的智能合约进行验证。
在智能合约已经被部署之后,即可以基于已经部署的智能合约进行设备启动信息的验证,即本说明书实施例所提供的第二方面,如图2所示,图2为本说明书实施例所提供的一种基于前述智能合约的启动信息的验证方法,应用于已经预先部署了所述智能合约的区块链系统中,所述方法包括:
S201,设备节点确定审计目标,确定所述设备节点的审计目标的哈希值。
在本说明书实施例中,设备节点可以在设备处理器内BootROM预置只读的启动代码。BootROM是嵌入处理器芯片内的一小块掩模ROM或写保护闪存,它包含处理器在上电或复位时执行的第一个代码。
换言之,由于启动代码总是被最先执行(还先于系统启动引导程序Bootloader),通过启动代码可以来控制性的加载外部存储器上的系统启动引导程序或者远程更新固件,以及,通过启动代码可以控制后续的设备行为,即,确定审计目标,并确定所述设备节点的审计目标的哈希值。
此处的确定审计目标可以是一个,也可以是多个。例如,在审计目标只有启动代码时,即计算启动代码的哈希值,并执行后续审计。
而在审计目标是多个时,则需要按照如下顺序启动代码---系统启动引导程序—加载对象,依序进行审计,即每次只计算一个审计目标的哈希值并进行审计,在前一个审计目标通过验证时,再计算下一个审计目标的哈希值并继续审计。
S203,所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易。设备节点的私钥即为智能合约中该设备节点的公钥所对应的私钥。
S205,所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块 链系统中。
S207,所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致性验证,得到验证结果。
区块链中能够接收到包含所述交易的节点可以基于区块链的形态而定。例如,每一个节点设备在通过了可信启动后都可以作为一个有效节点接收交易并进行广播和共识;又例如,在区块链为联盟链时,能够接收到交易的并进行共识的可以有若干个预先定义的节点,普通的设备节点不能参与共识。
如前所述,在区块链系统中每一个节点中都已经部署了包含对应关系和验证逻辑的智能合约,因此,任一接收到交易的节点都可以即可以根据交易中所包含的设备节点标识找到对应的公钥和审计目标的哈希值,并使用公钥解密交易中的数字签名从而得到一个哈希值(该数字签名即为设备节点使用公钥所对应的私钥对于审计目标的哈希值加密得到),并且使用该哈希值和智能合约中的哈希值进行一致性验证。
例如,一个节点如果接收到的交易中包含有设备节点标识ID1,从而可以从智能合约中基于ID1找到对应的哈希值hash1和hash2和公钥key1,而如果对于接收到的交易中的数字签名采用key1解密,得到的哈希值为hash1,从而可以确定验证成功。
在一种实施方式中,每个节点中可能部署了多个不同版本号的智能合约,那么在实际应用中,基于智能合约进行验证时,所述区块链系统中接收到包含所述交易的任一节点,从最新版本的智能合约中获取所述设备节点标识所对应的审计目标的哈希值进行验证,从而保审计目标被更新(通常是固件被更新)之后的可靠验证。
S209,在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点。
在各设备节点均执行了验证之后,既可以在区块链中对于验证结果发起共识,对于验证结果的共识机制也可以在智能合约中预先给定(例如,若有任一节点验证结果为不一致,则验证结果为不通过),从而得到最终的验证结果,区块链系统在确定了验证结果之后即发送验证结果至设备节点。验证结果和验证时间等信息可以存证到区块链供相关的授权者查询。
S211,所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
这里的执行所述审计目标包括以下几个方面,当审计目标为启动代码时,执行启动代码,并通过启动代码加载系统启动引导程序;而在审计目标为系统启动引导程序时,则执行系统启动引导程序加载固件或者系统内核,并把控制权转移给固件或者系统内核。在审计目标为固件或者系统内核时,则执行固件或者系统内核,并启动设备节点中的相应的硬件功能。
相应的,本说明书实施例的第三方面,如图3所示,图3为本说明书实施例所提供的一种基于前述的智能合约的设备节点启动方法的流程示意图,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:
S301,确定审计目标,确定所述设备节点的审计目标的哈希值;审计目标在前文已经进行了说明,此处不再赘述。
S303,采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易。
S305,广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果。
由于包含所述设备节点的公钥、设备节点标识和所述新后的审计目标的哈希值的对应关系的智能合约,已经被如第一方面所述的方式部署至区块链系统中,因此,此时可以区块链系统基于如第二方面所述的方式进行验证结果的确认和共识。
S307,接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
在一种实施方式中,审计目标可以同时包括启动代码、系统启动引导程序和加载对象。在这种实施方式下,则需要在启动时依序对每个审计目标进行审计。在前一审计目标的审计结果不通过(审计结果失败或者还没有收到审计结果)时,不审计后一审计目标,也不执行后一审计目标。审计的顺序即按照启动代码、系统启动引导程序和加载对象的顺序依序进行。
在这种方式下,当对于所述启动代码的共识结果表征一致性验证通过时,执行所述启动代码以启动所述系统启动引导程序,并将所述系统启动引导程序确定为下一个审计目标;和,当对于所述系统启动引导程序的共识结果表征一致性验证通过时,执行所述系统启动引导程序以启动所述加载对象,并将所述加载对象确定为下一个审计目标。
在这个过程中,如果不审计启动代码,虽然后续的启动可以保障,但是而有可能被 人修改启动代码(例如,在启动代码中写死后续的系统启动引导程序的哈希值,并将写死的哈希值提交进行审计),而导致后续的审计失去意义;如果不审计系统启动引导程序或者加载对象,则系统启动引导程序或者加载对象都有可能被人诸如恶意代码而导致设备的功能被扭曲或者挟持,致使数据失真。换言之,基于从启动代码、系统启动引导程序到加载对象的一条线式的验证,可以保障在启动过程中的任何一个过程都不会被人篡改,实现完全的可信启动。
通过本说明书实施例所提供的方案,基于预先部署用于验证的智能合约,在设备节点需要启动时,即对于启动时需要执行的审计目标生成哈希值并数字签名,并发送到区块链上通过多方共识的智能合约进行验证,并保存验证结果,在验证通过之后再执行审计目标的启动,通过分布式的区块链智能合约方式审计设备节点启动过程中的信息,实现设备节点的可信启动。
与第一方面对应的,本说明书实施例还提供一种智能合约的部署装置,应用于区块链系统的节点中,如图4所示,图4是本说明书实施例提供的一种智能合约的部署装置的结构示意图,包括:
获取模块401,获取设备节点中的审计目标、设备节点标识和公钥;
确定模块403,确定所述审计目标的哈希值;
建立模块405,建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系;
部署模块407,构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中。
其中,所述智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
进一步,在所述装置中,当所述审计目标更新时,所述确定模块403还用于,确定更新后的审计目标的哈希值;所述建立模块405还用于,建立所述设备节点的公钥、设备节点标识和所述新后的审计目标的哈希值的对应关系;所述部署模块407还用于,构建包含所述对应关系的另一智能合约,并部署所述另一智能合约至区块链系统的节点中。
与第二方面对应的,本说明书实施例还提供一种基于前述智能合约的验证系统,所述验证系统包含设备节点和其它节点,在所述系统中,设备节点确定审计目标,确定所 述设备节点的审计目标的哈希值;所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中;所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致性验证,得到验证结果;在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点;所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
进一步地,在所述系统中接收到包含所述交易的任一节点,从最新版本的智能合约中获取所述设备节点标识所对应的审计目标的哈希值。
与第三方面对应的,本说明书实施例还提供一种基于前述智能合约的设备节点启动装置,如图5所示,图5为本说明书实施例所提供的一种设备节点启动装置的结构示意图,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:
确定模块501,确定审计目标,确定所述设备节点的审计目标的哈希值;
签名模块503,采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;
广播模块505,广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果;
执行模块507,接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
进一步地,当所述审计目标包括启动代码、系统启动引导程序和加载对象时,所述确定模块501还用于,按照启动代码、系统启动引导程序和加载对象的顺序,依序确定审计目标。相应的,所述执行模块507,当对于所述启动代码的共识结果表征一致性验证通过时,执行所述启动代码以启动所述系统启动引导程序,并将所述系统启动引导程序确定为下一个审计目标;和,当对于所述系统启动引导程序的共识结果表征一致性验证通过时,执行所述系统启动引导程序以启动所述加载对象,并将所述加载对象确定为下一个审计目标。
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储 器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图1所示的智能合约的部署方法。
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图3所示的设备节点启动方法。
图6示出了本说明书实施例所提供的一种更为具体的计算设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。
处理器1010可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。
存储器1020可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。
输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。
通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。
总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出接口1030和通信接口1040)之间传输信息。
需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图1所示的智能合约的部署方法。
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图3所示的设备节点启动方法。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。
上述实施例阐明的系统、方法、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于方法实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的方法实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本说明书实施例方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其 中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上所述仅是本说明书实施例的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本说明书实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本说明书实施例的保护范围。

Claims (14)

  1. 一种智能合约的部署方法,应用于区块链系统的节点中,所述方法包括:
    获取设备节点中的审计目标、设备节点标识和公钥;
    确定所述审计目标的哈希值;
    建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系;
    构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中;
    其中,所述智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
  2. 如权利要求1所述的方法,当所述审计目标更新时,所述方法还包括:
    确定更新后的审计目标的哈希值;
    建立所述设备节点的公钥、设备节点标识和所述新后的审计目标的哈希值的对应关系;
    构建包含所述对应关系的另一智能合约,并部署所述另一智能合约至区块链系统的节点中。
  3. 一种基于权利要求1所述的智能合约的验证方法,应用于已经预先部署了所述智能合约的区块链系统中,所述方法包括:
    设备节点确定审计目标,确定所述设备节点的审计目标的哈希值;
    所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;
    所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中;
    所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致性验证,得到验证结果;
    在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点;
    所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
  4. 如权利要求3所述的方法,所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,包括:
    所述区块链系统中接收到包含所述交易的任一节点,从最新版本的智能合约中获取所述设备节点标识所对应的审计目标的哈希值。
  5. 一种基于权利要求1所述的智能合约的设备节点启动方法,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:
    确定审计目标,确定所述设备节点的审计目标的哈希值;
    采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;
    广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果;
    接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
  6. 如权利要求5所述的方法,当所述审计目标包括启动代码、系统启动引导程序和加载对象时,
    相应的,确定审计目标包括:按照启动代码、系统启动引导程序和加载对象的顺序,依序确定审计目标;
    相应的,当所述共识结果表征一致性验证通过时,执行所述审计目标,包括:
    当对于所述启动代码的共识结果表征一致性验证通过时,执行所述启动代码以启动所述系统启动引导程序,并将所述系统启动引导程序确定为下一个审计目标;和,
    当对于所述系统启动引导程序的共识结果表征一致性验证通过时,执行所述系统启动引导程序以启动所述加载对象,并将所述加载对象确定为下一个审计目标。
  7. 一种智能合约的部署装置,应用于区块链系统的节点中,所述装置包括:
    获取模块,获取设备节点中的审计目标、设备节点标识和公钥;
    确定模块,确定所述审计目标的哈希值;
    建立模块,建立所述设备节点的公钥、设备节点标识和所述审计目标的哈希值的对应关系;
    部署模块,构建包含所述对应关系的智能合约,并部署所述智能合约至区块链系统的节点中;
    其中,所述智能合约用于区块链系统的节点在接收到设备节点所发送的包含审计目标的哈希值的交易时,验证交易中所包含的审计目标和所述智能合约中所述设备节点的审计目标的哈希值的一致性。
  8. 如权利要求7所述的装置,当所述审计目标更新时,所述装置还包括:
    所述确定模块还用于,确定更新后的审计目标的哈希值;
    所述建立模块还用于,建立所述设备节点的公钥、设备节点标识和所述新后的审计目标的哈希值的对应关系;
    所述部署模块还用于,构建包含所述对应关系的另一智能合约,并部署所述另一智能合约至区块链系统的节点中。
  9. 一种基于权利要求1所述的智能合约的验证系统,在所述系统中,
    设备节点确定审计目标,确定所述设备节点的审计目标的哈希值;
    所述设备节点采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;
    所述设备节点广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中;
    所述区块链系统中接收到包含所述交易的任一节点,从所述智能合约中获取所述设备节点标识所对应的审计目标的哈希值,对所述交易中所包含的审计目标的哈希值进行一致性验证,得到验证结果;
    在所述区块链系统中的节点中基于各自的验证结果进行共识,生成共识结果并存储至区块链系统中,并发送所述共识结果至所述设备节点;
    所述设备节点,接收共识结果,当所述共识结果表征验证通过时,执行所述审计目标。
  10. 如权利要求9所述的系统,所述区块链系统中接收到包含所述交易的任一节点,从最新版本的智能合约中获取所述设备节点标识所对应的审计目标的哈希值。
  11. 一种基于权利要求1所述的智能合约的设备节点启动装置,应用于已经预先部署了所述智能合约的区块链系统的设备节点中,包括:
    确定模块,确定审计目标,确定所述设备节点的审计目标的哈希值;
    签名模块,采用所述设备节点的私钥对所述审计目标的哈希值加密,得到数字签名,生成包含所述数字签名和所述设备节点标识的交易;
    广播模块,广播包含所述数字签名和所述设备节点标识的交易至所述区块链系统中,以便所述区块链系统根据所述智能合约中所包含的审计目标的哈希值和交易中所包含的目标交易的哈希值进行一致性验证并共识,以返回共识结果;
    执行模块,接收共识结果,当所述共识结果表征一致性验证通过时,执行所述审计目标。
  12. 如权利要求11所述的装置,当所述审计目标包括启动代码、系统启动引导程 序和加载对象时,
    相应的,所述确定模块还用于,按照启动代码、系统启动引导程序和加载对象的顺序,依序确定审计目标;
    相应的,所述执行模块,当对于所述启动代码的共识结果表征一致性验证通过时,执行所述启动代码以启动所述系统启动引导程序,并将所述系统启动引导程序确定为下一个审计目标;和,当对于所述系统启动引导程序的共识结果表征一致性验证通过时,执行所述系统启动引导程序以启动所述加载对象,并将所述加载对象确定为下一个审计目标。
  13. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求1至2任一项所述的方法。
  14. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求5至6任一项所述的方法。
PCT/CN2021/087204 2020-04-17 2021-04-14 智能合约的部署 WO2021208956A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010302393.7A CN111461722A (zh) 2020-04-17 2020-04-17 一种智能合约的部署方法、装置及设备
CN202010302393.7 2020-04-17

Publications (1)

Publication Number Publication Date
WO2021208956A1 true WO2021208956A1 (zh) 2021-10-21

Family

ID=71679699

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/087204 WO2021208956A1 (zh) 2020-04-17 2021-04-14 智能合约的部署

Country Status (2)

Country Link
CN (1) CN111461722A (zh)
WO (1) WO2021208956A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114091061A (zh) * 2021-11-12 2022-02-25 天津理工大学 基于vrf和区块链的多云协同数据安全存储及审计方法
CN114363336A (zh) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 一种启动/关闭区块链节点服务的方法和装置
CN117668924A (zh) * 2024-01-31 2024-03-08 广东通莞科技股份有限公司 一种基于链上结算数据的pos机业务审计系统

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111461722A (zh) * 2020-04-17 2020-07-28 支付宝(杭州)信息技术有限公司 一种智能合约的部署方法、装置及设备
CN112162770B (zh) * 2020-10-20 2023-11-10 深圳技术大学 基于区块链实现完整性验证的固件版本升级方法及装置
CN112634040B (zh) * 2020-12-25 2023-08-18 中国农业银行股份有限公司 一种数据处理方法及装置
CN112436940B (zh) * 2021-01-27 2021-04-30 电子科技大学 一种基于零知识证明的物联网设备可信启动管理方法
CN113239635A (zh) * 2021-06-16 2021-08-10 中国银行股份有限公司 一种模型评价方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170155515A1 (en) * 2015-11-26 2017-06-01 International Business Machines Corporation System, method, and computer program product for privacy-preserving transaction validation mechanisms for smart contracts that are included in a ledger
CN108985936A (zh) * 2018-07-09 2018-12-11 北京中电普华信息技术有限公司 一种基于智能合约的审计方法及系统
CN109166040A (zh) * 2018-08-23 2019-01-08 北京京东金融科技控股有限公司 基于区块链的交易审计方法、装置、设备及存储介质
CN111461722A (zh) * 2020-04-17 2020-07-28 支付宝(杭州)信息技术有限公司 一种智能合约的部署方法、装置及设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325349A (zh) * 2018-08-15 2019-02-12 深圳市元征科技股份有限公司 一种安全管理方法、终端设备及计算机可读存储介质
CN109889477A (zh) * 2018-12-20 2019-06-14 北京华胜天成信息技术发展有限公司 基于可信密码引擎的服务器启动方法及装置
CN109858914A (zh) * 2019-01-18 2019-06-07 深圳壹账通智能科技有限公司 区块链数据验证方法、装置、计算机设备及可读存储介质
CN110138733B (zh) * 2019-04-03 2021-09-21 华南理工大学 基于区块链的对象存储系统可信存证与访问权限控制方法
CN110233823A (zh) * 2019-05-06 2019-09-13 深圳壹账通智能科技有限公司 区块链实现方法、系统及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170155515A1 (en) * 2015-11-26 2017-06-01 International Business Machines Corporation System, method, and computer program product for privacy-preserving transaction validation mechanisms for smart contracts that are included in a ledger
CN108985936A (zh) * 2018-07-09 2018-12-11 北京中电普华信息技术有限公司 一种基于智能合约的审计方法及系统
CN109166040A (zh) * 2018-08-23 2019-01-08 北京京东金融科技控股有限公司 基于区块链的交易审计方法、装置、设备及存储介质
CN111461722A (zh) * 2020-04-17 2020-07-28 支付宝(杭州)信息技术有限公司 一种智能合约的部署方法、装置及设备

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114091061A (zh) * 2021-11-12 2022-02-25 天津理工大学 基于vrf和区块链的多云协同数据安全存储及审计方法
CN114091061B (zh) * 2021-11-12 2024-05-03 天津理工大学 基于vrf和区块链的多云协同数据安全存储及审计方法
CN114363336A (zh) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 一种启动/关闭区块链节点服务的方法和装置
CN117668924A (zh) * 2024-01-31 2024-03-08 广东通莞科技股份有限公司 一种基于链上结算数据的pos机业务审计系统
CN117668924B (zh) * 2024-01-31 2024-05-03 广东通莞科技股份有限公司 一种基于链上结算数据的pos机业务审计系统

Also Published As

Publication number Publication date
CN111461722A (zh) 2020-07-28

Similar Documents

Publication Publication Date Title
WO2021208956A1 (zh) 智能合约的部署
KR101066727B1 (ko) 컴퓨팅 장치의 보안 부팅
US9680648B2 (en) Securely recovering a computing device
CN107077574B (zh) 用于客户端设备的信任服务
JP5576983B2 (ja) 非ローカル記憶装置からのサブシステムのセキュアなブート及び構成
US9768951B2 (en) Symmetric keying and chain of trust
US10826904B2 (en) Local verification of code authentication
US10810811B2 (en) Electronic device and method for managing electronic key thereof
CN107431924B (zh) 将设备标识符和用户标识符相关联的设备盗窃防护
US9325506B2 (en) Cryptographically enforcing strict separation of environments
US11706199B2 (en) Electronic device and method for generating attestation certificate based on fused key
CN109614798B (zh) 安全启动方法、装置及终端设备
US11770240B2 (en) Electronic device and method for receiving push message stored in blockchain
US11461475B2 (en) Electronic device including secure integrated circuit
US11347897B2 (en) Electronic device and method for transmitting and receiving data on the basis of security operating system in electronic device
US10019577B2 (en) Hardware hardened advanced threat protection
US11429366B2 (en) Electronic device for updating firmware by using security integrated circuit and operation method thereof
KR20200075451A (ko) 디바이스 고유암호키 생성기 및 방법
EP3221996B1 (en) Symmetric keying and chain of trust
CN116194939A (zh) 用于生成包括内部数据的交易的电子装置及其操作方法
KR20140082542A (ko) 보안부팅을 위한 인증수단의 변경을 지원하는 방법 및 장치
US11627468B2 (en) Connecting securely to a wireless display from BIOS
US20240015156A1 (en) Electronic device for controlling access to device resource and operation method thereof
US20240129134A1 (en) System and method for securing operation of data processing systems during and after onboarding
CN111868721A (zh) 电子装置及其操作方法

Legal Events

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

Ref document number: 21788080

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21788080

Country of ref document: EP

Kind code of ref document: A1