A method, device and equipment for deploying smart contracts

By deploying smart contracts in the blockchain system, verifying the hash consistency of the audit target of IoT devices, the problem of illegal firmware and kernel systems during device startup is solved, and the trusted startup of device nodes and data collection is realized. Trustworthiness.

CN111461722BActive Publication Date: 2024-11-22ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010302393.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-17
Publication Date
2024-11-22
Estimated Expiration
2040-04-17

AI Technical Summary

Technical Problem

Illegal firmware and illegal kernel systems may be loaded at startup or during remote updates, resulting in untrustworthy or harmful data collected, and a trusted startup solution is required.

Method used

By deploying smart contracts in the blockchain system, obtaining the hash value of the audit target of the device node, establishing the correspondence between the public key and the device node identification, building a smart contract and deploying it to the blockchain node, verifying the audit target in the transaction Consistent value, generate digital signatures and pass multi-party consensus verification to ensure the trusted startup of the device node.

Benefits of technology

It realizes the trusted startup of the device node, ensures the trustworthiness and security of data collection, and prevents malicious code injection and data tampering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111461722B_ABST
    Figure CN111461722B_ABST
Patent Text Reader

Abstract

Disclosed is a method, device and equipment for deploying smart contracts. Based on a pre-deployed smart contract for verification, when a device node needs to be started, a hash value is generated and digitally signed for the audit target that needs to be executed at startup, and sent to the blockchain for verification by a smart contract that passes multi-party consensus, and the verification result is saved. After the verification is passed, the audit target is started.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of information technology, and in particular to a method, device and equipment for deploying a smart contract. Background Art

[0002] With the widespread application of the Internet of Things, a large number of devices also need to collect data through these IoT terminal devices, such as videos collected by lieu cameras, environmental information collected by temperature and humidity sensors, radar data from car ADAS systems, etc. If these terminal devices are loaded with illegal firmware and illegal kernel systems when they are started or remotely updated, the collected data will often become unreliable or harmful.

[0003] Based on this, a solution is needed to achieve trusted startup of IoT devices. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a solution that can realize trusted startup of IoT devices.

[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows:

[0006] In a first aspect, an embodiment of this specification provides a method for deploying a smart contract, which is applied to a node of a blockchain system, and the method includes:

[0007] Get the audit target, device node identifier and public key in the device node;

[0008] Determining a hash value of the audit objective;

[0009] Establishing a correspondence between the public key of the device node, the device node identifier and the hash value of the audit target;

[0010] Constructing a smart contract containing the corresponding relationship, and deploying the smart contract to the node of the blockchain system;

[0011] In which, when a node of the blockchain system receives a transaction containing a hash value of an audit target sent by a device node, the smart contract verifies the consistency between the audit target contained in the transaction and the hash value of the audit target of the device node in the smart contract.

[0012] In a second aspect, the embodiments of this specification provide a verification method based on the aforementioned smart contract, which is applied to a blockchain system in which the smart contract has been pre-deployed, and the method includes:

[0013] The device node determines an audit target, and determines a hash value of the audit target of the device node;

[0014] The device node encrypts the hash value of the audit target 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;

[0015] The device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system;

[0016] The blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result;

[0017] The nodes in the blockchain system reach a consensus 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;

[0018] The device node receives the consensus result, and executes the audit target when the consensus result indicates that the verification is passed.

[0019] In a third aspect, the embodiments of this specification provide a method for starting a device node based on the aforementioned smart contract, which is applied to a device node of a blockchain system in which the smart contract has been pre-deployed, including:

[0020] Determine an audit target, and determine a hash value of the audit target of the device node;

[0021] Encrypting the hash value of the audit target using the private key of the device node to obtain a digital signature, and generating a transaction including the digital signature and the device node identifier;

[0022] Broadcasting the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus according to the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result;

[0023] A consensus result is received, and when the consensus result indicates that the consistency verification has passed, the audit objective is executed.

[0024] Corresponding to the first aspect, an embodiment of this specification provides a smart contract deployment device, which is applied to a node of a blockchain system, and the device includes:

[0025] An acquisition module is used to acquire the audit target, device node identifier and public key in the device node;

[0026] A determination module determines a hash value of the audit target;

[0027] Establishing a module to establish a corresponding relationship between the public key of the device node, the device node identifier and the hash value of the audit target;

[0028] A deployment module, constructing a smart contract containing the corresponding relationship, and deploying the smart contract to the nodes of the blockchain system;

[0029] In which, when a node of the blockchain system receives a transaction containing a hash value of an audit target sent by a device node, the smart contract verifies the consistency between the audit target contained in the transaction and the hash value of the audit target of the device node in the smart contract.

[0030] Corresponding to the second aspect, the embodiment of this specification also provides a verification system based on the aforementioned smart contract, in which:

[0031] The device node determines an audit target, and determines a hash value of the audit target of the device node;

[0032] The device node encrypts the hash value of the audit target 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;

[0033] The device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system;

[0034] The blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result;

[0035] The nodes in the blockchain system reach a consensus 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;

[0036] The device node receives the consensus result, and executes the audit target when the consensus result indicates that the verification is passed.

[0037] Corresponding to the third aspect, the embodiment of this specification also provides a device node startup device based on the aforementioned smart contract, which is applied to the device node of the blockchain system in which the smart contract has been pre-deployed, including:

[0038] A determination module determines an audit target and determines a hash value of the audit target of the device node;

[0039] A signature module, which 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;

[0040] A broadcast module, which broadcasts the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus according to the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result;

[0041] The execution module receives the consensus result, and executes the audit objective when the consensus result indicates that the consistency verification has passed.

[0042] Through the solution provided in the embodiments of this specification, based on the pre-deployed smart contract for verification, when the device node needs to be started, that is, for the audit target that needs to be executed at startup, a hash value is generated and digitally signed, and sent to the blockchain for verification through a multi-party consensus smart contract, and the verification result is saved. After the verification is passed, the startup of the audit target is executed, and the information during the startup process of the device node is audited through a distributed blockchain smart contract method to achieve trusted startup of the device node.

[0043] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the embodiments of the present specification.

[0044] In addition, any embodiment in the embodiments of this specification does not need to achieve all the above-mentioned effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this specification. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0046] Figure 1 A flowchart of a smart contract deployment method provided in an embodiment of this specification;

[0047] Figure 2 A flowchart of a verification method provided in an embodiment of this specification;

[0048] Figure 3 A schematic diagram of a process flow of a device node startup method provided in an embodiment of this specification;

[0049] Figure 4 It is a structural diagram of a smart contract deployment device provided in an embodiment of this specification;

[0050] Figure 5A schematic diagram of the structure of a device node startup apparatus provided in an embodiment of this specification;

[0051] Figure 6 It is a structural diagram of a device used to configure the method of the embodiment of this specification. DETAILED DESCRIPTION

[0052] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification, the technical solutions in the embodiments of this specification will be described in detail below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection.

[0053] Unlike centralized servers, IoT devices are often located in decentralized and edge environments and often use embedded systems. Before the operating system kernel runs, these devices often need to run the bootloader (usually built into the device) to load the CPU and related hardware initialization, then install the operating system image or solidified embedded application into the memory and jump to the space where the operating system is located to start the operating system.

[0054] In other words, the system bootloader is the first code executed by the device after power-on. Due to the different hardware conditions of various devices, the system bootloader is often different. In this process, if it is illegally modified or injected with malicious code, the system kernel or firmware that depends on the bootloader in the device will run differently after startup, and the collected data may be maliciously modified or partially lost.

[0055] Based on this, the embodiments of this specification provide a solution that can realize trusted startup of IoT devices, which specifically includes three aspects: deployment of smart contracts, auditing based on smart contracts, and trusted startup of devices.

[0056] For the first aspect, the deployment of smart contracts, such as Figure 1 As shown, Figure 1 A flow chart of a method for deploying a smart contract provided in an embodiment of this specification is applied to a node of a blockchain system, and the method includes:

[0057] S101, obtaining an audit target, a device node identifier and a public key in a device node.

[0058] In the embodiments of this specification, based on different application scenarios, 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 possible user of the data collected by the device node, etc.

[0059] For example, for a camera deployed in an unmanned supermarket, in order to ensure that the data after the camera is started is reliable, the nodes of the blockchain system may include: the camera device itself, the camera manufacturer, the camera seller, the supermarket, and the regulatory authorities, etc.

[0060] In other words, in the embodiments of this specification, the node that deploys the smart contract can be any party related to the device collecting data and using the data.

[0061] The audit target at this time includes at least one of the boot code, the system boot program Bootloader and the load object, and the load object includes the system kernel of the device node and the related firmware applied on the device node. In actual applications, there can be multiple audit targets. All audit targets can be regarded as a piece of code.

[0062] In the embodiments of this specification, any node in the blockchain system has already 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, etc., so that a consensus can be reached on the smart contract containing the relevant information of the device node.

[0063] S103, determining the hash value of the audit target. If there are multiple audit targets, it is necessary to determine the hash value of each audit target respectively.

[0064] S105, establishing a correspondence between the public key of the device node, the device node identifier, and the hash value of the audit target.

[0065] If there are multiple audit targets, you need to establish a corresponding relationship between the hash values ​​of each audit target. For example, if the audit targets include the boot code and the system boot program, and the hash value of the boot code is hash1, the hash value of the system boot program is hash2, the device node is ID1, and the public key of the device node is key1, then you can establish the following corresponding relationship (ID1, key1, hash1, hash2).

[0066] In practical applications, each device can be given a device node identifier and a public key. Of course, in practical applications, in order to save costs, each type of device node can also be given a device node identifier and a public key. For example, based on the factory model or product unique serial number of the device, a device node identifier and a public key are given, and the factory model / unique serial number corresponds to the device node identifier and the public key one by one.

[0067] S107, constructing a smart contract including the corresponding relationship, and deploying the smart contract to the node of the blockchain system.

[0068] For one / one type of device node, a smart contract corresponding to the device node can be generated, and the smart contract includes the aforementioned correspondence and audit logic. If there are multiple / multiple types of device nodes, multiple aforementioned correspondences can be included in the smart contract.

[0069] The deployment method is to publish the smart contract to the blockchain for multi-party consensus, and after the consensus is passed, it is deployed in each node of the blockchain.

[0070] The smart contract is used for a node of a blockchain system to verify the consistency between the hash value of the audit target contained in the transaction and the audit target of the device node in the smart contract when receiving a transaction containing the hash value of the audit target sent by the device node.

[0071] Specifically, when the deployment node of the smart contract receives a transaction, it can find the corresponding public key and the hash value of the audit target based on the device node identifier contained in the transaction, and use the public key to decrypt the digital signature in the transaction to obtain a hash value (the digital signature is the hash value of the audit target encrypted 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.

[0072] In actual applications, the audit target may also be updated. For example, the firmware in the audit target may be updated remotely. In this case, a smart contract needs to be redeployed. That is, when the audit target is updated, it is necessary to determine the hash value of the updated audit target; establish the corresponding relationship between the public key of the device node, the device node identifier and the hash value of the new audit target; construct another smart contract containing the corresponding relationship, and deploy the other smart contract to the node of the blockchain system.

[0073] After another smart contract is deployed, the previous smart contract can be invalidated. In practical applications, each smart contract can also carry a version number. The later the smart contract is deployed, the newer the version number is. Therefore, each node device can verify based on the latest version of the smart contract when verifying.

[0074] After the smart contract has been deployed, 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, such as Figure 2 As shown, Figure 2A verification method based on the startup information of the aforementioned smart contract provided in an embodiment of this specification is applied to a blockchain system in which the smart contract has been pre-deployed, and the method includes:

[0075] S201, a device node determines an audit target, and determines a hash value of the audit target of the device node.

[0076] In the embodiments of this specification, the device node can preset read-only startup code in the BootROM in the device processor. The BootROM is a small mask ROM or write-protected flash memory embedded in the processor chip, which contains the first code executed by the processor when it is powered on or reset.

[0077] In other words, since the startup code is always executed first (also before the system boot program Bootloader), the startup code can be used to control the loading of the system boot program on the external memory or remotely update the firmware. In addition, the startup code can be used to control subsequent device behaviors, that is, to determine the audit target and determine the hash value of the audit target of the device node.

[0078] The audit target determined here can be one or more. For example, when the audit target is only the startup code, the hash value of the startup code is calculated and subsequent audits are performed.

[0079] When there are multiple audit targets, the code needs to be started in the following order: system startup boot program—load object, and audit in sequence, that is, only the hash value of one audit target is calculated and audited each time. When the previous audit target passes the verification, the hash value of the next audit target is calculated and the audit continues.

[0080] S203, the device node encrypts the hash value of the audit target 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.

[0081] S205, the device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system.

[0082] S207, the blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result.

[0083] The nodes in the blockchain that can receive the transaction can be determined based on the form of the blockchain. For example, each node device can receive transactions as a valid node and broadcast and reach consensus after passing the trusted startup; for example, when the blockchain is a consortium chain, there can be several pre-defined nodes that can receive transactions and reach consensus, and ordinary device nodes cannot participate in the consensus.

[0084] As mentioned earlier, a smart contract containing the corresponding relationship and verification logic has been deployed in each node in the blockchain system. Therefore, any node that receives a transaction can find the corresponding public key and the hash value of the audit target based on the device node identifier contained in the transaction, and use the public key to decrypt the digital signature in the transaction to obtain a hash value (the digital signature is the hash value of the audit target encrypted 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.

[0085] For example, if a node receives a transaction containing the device node identifier ID1, it can find the corresponding hash values ​​hash1 and hash2 and public key key1 based on ID1 from the smart contract. If key1 is used to decrypt the digital signature in the received transaction, the obtained hash value is hash1, so it can be determined that the verification is successful.

[0086] In one embodiment, 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 any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the latest version of the smart contract for verification, thereby ensuring reliable verification after the audit target is updated (usually the firmware is updated).

[0087] S209, reaching a consensus among the nodes in the blockchain system based on their respective verification results, generating a consensus result and storing it in the blockchain system, and sending the consensus result to the device node.

[0088] After each device node has performed verification, a consensus can be initiated on the verification result in the blockchain, and the consensus mechanism for the verification result can also be pre-given in the smart contract (for example, if the verification result of any node is inconsistent, the verification result will be failed), so as to obtain the final verification result. After the blockchain system determines the verification result, it will send the verification result to the device node. Information such as the verification result and verification time can be stored in the blockchain for query by relevant authorized persons.

[0089] S211, the device node receives a consensus result, and when the consensus result indicates that verification has passed, executes the audit target.

[0090] The execution of the audit target here includes the following aspects: when the audit target is the startup code, the startup code is executed, and the system boot program is loaded through the startup code; when the audit target is the system boot program, the system boot program is executed to load the firmware or system kernel, and the control is transferred to the firmware or system kernel. When the audit target is the firmware or system kernel, the firmware or system kernel is executed and the corresponding hardware function in the device node is started.

[0091] Accordingly, the third aspect of the embodiments of this specification is as follows: Figure 3 As shown, Figure 3 A flow chart of a method for starting a device node based on the aforementioned smart contract provided in an embodiment of this specification is applied to a device node of a blockchain system in which the smart contract has been pre-deployed, including:

[0092] 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 previous text and will not be repeated here.

[0093] 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.

[0094] S305, broadcasting the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus based on the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result.

[0095] Since the smart contract containing the correspondence between the public key of the device node, the device node identifier and the hash value of the new audit target has been deployed to the blockchain system in the manner described in the first aspect, the blockchain system can now confirm and reach consensus on the verification results based on the manner described in the second aspect.

[0096] S307, receiving a consensus result, and when the consensus result indicates that the consistency verification has passed, executing the audit objective.

[0097] In one implementation, the audit target may include the startup code, the system startup boot program, and the load object. In this implementation, each audit target needs to be audited in sequence at startup. When the audit result of the previous audit target does not pass (the audit result fails or the audit result has not been received), the next audit target is not audited, nor is it executed. The order of the audit is the order of the startup code, the system startup boot program, and the load object.

[0098] In this way, when the consistency verification of the consensus result representation of the startup code is passed, 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; and, when the consistency verification of the consensus result representation of the system startup boot program is passed, the system startup boot program is executed to start the loading object, and the loading object is determined as the next audit target.

[0099] In this process, if the boot code is not audited, although the subsequent boot can be guaranteed, it is possible that the boot code can be modified by someone (for example, the hash value of the subsequent system boot program is hard-coded in the boot code, and the hard-coded hash value is submitted for audit), which makes the subsequent audit meaningless; if the system boot program or the loading object is not audited, the system boot program or the loading object may be distorted or hijacked by someone, such as malicious code, causing the function of the device to be distorted or hijacked, resulting in data distortion. In other words, based on a one-line verification from the boot code, the system boot program to the loading object, it can be guaranteed that any process in the boot process will not be tampered with by someone, and a completely trusted boot can be achieved.

[0100] Through the solution provided in the embodiments of this specification, based on the pre-deployed smart contract for verification, when the device node needs to be started, that is, for the audit target that needs to be executed at startup, a hash value is generated and digitally signed, and sent to the blockchain for verification through a multi-party consensus smart contract, and the verification result is saved. After the verification is passed, the startup of the audit target is executed, and the information during the startup process of the device node is audited through a distributed blockchain smart contract method to achieve trusted startup of the device node.

[0101] Corresponding to the first aspect, the embodiment of this specification also provides a smart contract deployment device, which is applied to a node of a blockchain system, such as Figure 4 As shown, Figure 4 It is a schematic diagram of the structure of a smart contract deployment device provided in an embodiment of this specification, including:

[0102] The acquisition module 401 acquires the audit target, the device node identifier and the public key in the device node;

[0103] Determination module 403, determining the hash value of the audit target;

[0104] Establishing module 405, establishing a corresponding relationship between the public key of the device node, the device node identifier and the hash value of the audit target;

[0105] A deployment module 407 constructs a smart contract including the corresponding relationship and deploys the smart contract to a node of the blockchain system;

[0106] In which, when a node of the blockchain system receives a transaction containing a hash value of an audit target sent by a device node, the smart contract verifies the consistency between the audit target contained in the transaction and the hash value of the audit target of the device node in the smart contract.

[0107] Furthermore, in the device, when the audit target is updated, the determination module 403 is also used to determine the hash value of the updated audit target; the establishment module 405 is also used to establish a correspondence between the public key of the device node, 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 correspondence, and deploy the other smart contract to the node of the blockchain system.

[0108] Corresponding to the second aspect, the embodiment of this specification further provides a verification system based on the aforementioned smart contract, wherein the verification system includes a device node and other nodes. In the system,

[0109] The device node determines an audit target, and determines a hash value of the audit target of the device node;

[0110] The device node encrypts the hash value of the audit target 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;

[0111] The device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system;

[0112] The blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result;

[0113] The nodes in the blockchain system reach a consensus 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;

[0114] The device node receives the consensus result, and executes the audit target when the consensus result indicates that the verification is passed.

[0115] Furthermore, when any node containing the transaction is received in the system, a hash value of the audit target corresponding to the device node identifier is obtained from the latest version of the smart contract.

[0116] Corresponding to the third aspect, the embodiment of this specification also provides a device node startup device based on the aforementioned smart contract, such as Figure 5 As shown, Figure 5 A schematic diagram of the structure of a device node startup device provided in an embodiment of this specification is applied to a device node of a blockchain system in which the smart contract has been pre-deployed, including:

[0117] Determine module 501, determine the audit target, determine the hash value of the audit target of the device node;

[0118] 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;

[0119] A broadcast module 505 is configured to broadcast the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus based on the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result;

[0120] The execution module 507 receives the consensus result, and when the consensus result indicates that the consistency verification has passed, executes the audit objective.

[0121] Furthermore, when the audit target includes a startup code, a system startup boot program, and a load object, the determination module 501 is further used to determine the audit target in sequence according to the order of the startup code, the system startup boot program, and the load object;

[0122] Correspondingly, the execution module 507, when the consistency verification of the consensus result representation of the startup code is passed, executes the startup code to start the system startup boot program, and determines the system startup boot program as the next audit target; and, when the consistency verification of the consensus result representation of the system startup boot program is passed, executes the system startup boot program to start the loading object, and determines the loading object as the next audit target.

[0123] The embodiment of the present specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, Figure 1 The deployment method of the smart contract shown.

[0124] The embodiment of the present specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, Figure 3 The device node startup method shown.

[0125] Figure 6A more specific hardware structure diagram of a computing device provided in an embodiment of this specification is shown, and 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 are connected to each other through the bus 1050 in the device.

[0126] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0127] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (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, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.

[0128] The input / output interface 1030 is used to connect the 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 it can be externally 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 the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0129] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0130] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).

[0131] It should be noted that, although 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 other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0132] The present specification also provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement Figure 1 The deployment method of the smart contract shown.

[0133] The present specification also provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement Figure 3 The device node startup method shown.

[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0135] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the embodiments of this specification can be implemented by means of software plus the necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of this specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments of this specification.

[0136] The systems, methods, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0137] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the method embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The method embodiment described above is merely illustrative, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment scheme of this specification. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0138] The above is only a specific implementation of the embodiments of this specification. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiments of this specification. These improvements and modifications should also be regarded as the protection scope of the embodiments of this specification.

Claims

1. A method for deploying a smart contract, applied to a node of a blockchain system, the method include: Get the audit target, device node identifier and public key in the device node; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; Determining a hash value of the audit objective; Establishing a correspondence between the public key of the device node, the device node identifier and the hash value of the audit target; Constructing a smart contract containing the corresponding relationship, and deploying the smart contract to a node of the blockchain system; Among them, when the node of the blockchain system receives a transaction containing the hash value of the audit target sent when the device node needs to be started, the smart contract verifies the consistency between the hash value of the audit target contained in the transaction and the hash value of the audit target of the device node in the smart contract.

2. The method according to claim 1, wherein when the audit target is updated, the method further include: Determine the hash value of the updated audit target; Establishing a correspondence between the public key of the device node, the device node identifier, and the hash value of the updated audit target; Construct another smart contract including the corresponding relationship, and deploy the other smart contract to the node of the blockchain system.

3. A verification method based on the smart contract of claim 1, applied to a blockchain system in which the smart contract has been pre-deployed, wherein the method include: The device node determines an audit target, and determines a hash value of the audit target of the device node; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; The device node encrypts the hash value of the audit target 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 device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system; The blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result; The nodes in the blockchain system reach a consensus 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 device node receives the consensus result, and executes the audit target when the consensus result indicates that the verification is passed.

4. The method as claimed in claim 3, wherein the blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, include: The blockchain system receives any node containing the transaction and obtains the hash value of the audit target corresponding to the device node identifier from the latest version of the smart contract.

5. A device node startup method based on the smart contract of claim 1, applied to a device node of a blockchain system in which the smart contract has been pre-deployed, include: Determine an audit target, and determine a hash value of the audit target of the device node; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; Encrypting the hash value of the audit target using the private key of the device node to obtain a digital signature, and generating a transaction including the digital signature and the device node identifier; Broadcasting the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus according to the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result; A consensus result is received, and when the consensus result indicates that the consistency verification has passed, the audit objective is executed.

6. The method of claim 5, when the audit target includes a boot code, a system boot program, and a load object, Accordingly, determine the audit objectives include: Determine the audit targets in order of the startup code, system boot program, and loading object; Accordingly, when the consensus result represents that the consistency verification is passed, the audit objectives are executed, including: When the consistency verification of the consensus result representation of the startup code is passed, 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; and, When the consensus result representation consistency verification of the system boot program is passed, the system boot program is executed to start the loaded object, and the loaded object is determined as the next audit target.

7. A smart contract deployment device, applied to a node of a blockchain system, the device include: An acquisition module is used to acquire the audit target, device node identifier and public key in the device node; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; A determination module determines a hash value of the audit target; Establishing a module to establish a corresponding relationship between the public key of the device node, the device node identifier and the hash value of the audit target; A deployment module, constructing a smart contract containing the corresponding relationship, and deploying the smart contract to the nodes of the blockchain system; Among them, when the node of the blockchain system receives a transaction containing the hash value of the audit target sent when the device node needs to be started, the smart contract verifies the consistency between the hash value of the audit target contained in the transaction and the hash value of the audit target of the device node in the smart contract.

8. The device according to claim 7, when the audit target is updated, the device further include: The determination module is also used to determine the hash value of the updated audit target; The establishment module is also used to establish a corresponding relationship between the public key of the device node, the device node identifier and the hash value of the updated audit target; The deployment module is also used to construct another smart contract containing the corresponding relationship and deploy the other smart contract to the node of the blockchain system.

9. A verification system based on the smart contract according to claim 1, wherein: The device node determines the audit target and determines the hash value of the audit target of the device node ; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; The device node encrypts the hash value of the audit target 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 device node broadcasts the transaction including the digital signature and the device node identifier to the blockchain system; The blockchain system receives any node containing the transaction, obtains the hash value of the audit target corresponding to the device node identifier from the smart contract, performs consistency verification on the hash value of the audit target contained in the transaction, and obtains a verification result; The nodes in the blockchain system reach a consensus 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 device node receives the consensus result, and executes the audit target when the consensus result indicates that the verification is passed.

10. The system as claimed in claim 9, wherein any node in the blockchain system that receives the transaction obtains the hash value of the audit target corresponding to the device node identifier from the latest version of the smart contract.

11. A device node startup device based on the smart contract of claim 1, applied to a device node of a blockchain system in which the smart contract has been pre-deployed, include: A determination module determines an audit target and determines a hash value of the audit target of the device node; The device node has an embedded system, and the audit target includes a boot program corresponding to the embedded system; A signature module, which 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; A broadcast module, which broadcasts the transaction including the digital signature and the device node identifier to the blockchain system, so that the blockchain system performs consistency verification and consensus according to the hash value of the audit target included in the smart contract and the hash value of the target transaction included in the transaction, and returns a consensus result; The execution module receives the consensus result, and executes the audit objective when the consensus result indicates that the consistency verification has passed.

12. The apparatus of claim 11, wherein when the audit target includes a boot code, a system boot program, and a load object, Correspondingly, the determination module is also used to determine the audit target in sequence according to the order of the startup code, the system startup boot program and the loading object; Correspondingly, the execution module, when the consistency verification of the consensus result representation of the startup code is passed, executes the startup code to start the system startup boot program, and determines the system startup boot program as the next audit target; and, when the consistency verification of the consensus result representation of the system startup boot program is passed, executes the system startup boot program to start the loading object, and determines the loading object as the next audit target.

13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, in, When the processor executes the program, the method according to any one of claims 1 to 2 is implemented.

14. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, in, When the processor executes the program, the method according to any one of claims 5 to 6 is implemented.