Blockchain-based device control method and related devices
Through blockchain systems and smart contracts, the control of IoT devices is managed, the number of controls is limited and the operation history is recorded, and the problem of IoT devices being illegally attacked and high-frequency operation is solved, and the security and reliability of the devices are achieved.
Patent Information
- Application Number
- CN202111204189.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-10-15
AI Technical Summary
IoT devices face cyber attacks, and illegal users can crack control rights, resulting in unsafe equipment and high-frequency command operations that cause losses.
Through blockchain systems and smart contract management device control, limit the number of controls and record operation history, use blockchain to store transaction requests and certificate management to ensure the security and legality of device control.
Improve the security of IoT devices, prevent illegal control, reduce device losses, and ensure that operation records are not tampered with and traceable.
Smart Images

Figure CN115983850B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer and Internet technology, and in particular to a device control method and apparatus based on blockchain, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the advancement of network and computer technologies, the Internet of Things (IoT) has rapidly developed, enabling an increasing number of devices to be connected to the internet, enabling intelligent monitoring and control. IoT terminals or devices include self-service washing machines, self-service charging stations, self-service hair dryers, massage chairs, rocking cars, claw machines, robots, ordinary vehicles, trains, airplanes, unmanned vehicles, and drones. However, with the rapid development of the IoT industry, IoT terminals or devices are facing an increasing number of cyberattacks. For example, malicious users can launch multiple commands to gain control of IoT devices, thereby controlling and attacking them.
[0003] On the one hand, the above-mentioned control cracking operation will allow illegal users to obtain the controller of the IoT device, making the IoT device insecure; on the other hand, the IoT will cause certain damage to the IoT device due to the high frequency of receiving and executing instructions multiple times. Summary of the Invention
[0004] The purpose of the present disclosure is to provide a blockchain-based device control method, apparatus, electronic device, and computer-readable storage medium, which can control the target device through the blockchain to improve the security of the control of the target device.
[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0006] An embodiment of the present disclosure provides a device control method based on blockchain, comprising: receiving a first transaction request sent by a target device control object, the first transaction request carrying a first control instruction for controlling the target device; determining a first control smart contract corresponding to the first control instruction; responding to the first transaction request, executing the first control smart contract, determining that the number of control times performed by the target device control object on the target device is less than or equal to a first value, incrementing the number of control times performed by the target device control object on the target device by one, and storing the first transaction request on-chain in the blockchain system; after successful on-chain storage, sending the first transaction request to the target device so that the target device executes the first control instruction.
[0007] An embodiment of the present disclosure provides a device control method based on blockchain, which is executed by a target device. The method includes: receiving a first transaction request sent by a target blockchain system, the first transaction request carrying a first control instruction for controlling a target device, the first transaction request being sent by a target device control object to the target blockchain system for on-chain storage, the blockchain system determining, by executing a first control smart contract, that the number of control times by which the target device control object controls the target device is less than or equal to a first value, incrementing the number of control times by which the target device control object controls the target device by one, and then storing the first transaction request on-chain in the blockchain system; obtaining a target certificate, the target certificate being generated by a certificate issuing agency of the blockchain system based on an association relationship between a device control object and the target device, the device control object having control over the target device; determining, based on the target certificate, that the device control objects having control over the target device include the target device control object; and executing the first control instruction in the first transaction request.
[0008] An embodiment of the present disclosure provides a blockchain-based device control method, which is executed by a device control object. The method includes: sending a first transaction request to a blockchain system, where the first transaction request carries a first control instruction for controlling a target device, so that after the first transaction request is successfully stored on the blockchain, the first transaction is sent to the target device; wherein the blockchain system determines, by executing the first control smart contract, that the number of times the target device control object controls the target device is less than or equal to a first value, increments the number of times the target device control object controls the target device by one, and then stores the first transaction request on the blockchain in the blockchain system.
[0009] An embodiment of the present disclosure provides a device control method based on blockchain, which is executed by a node device on a blockchain system; wherein the method includes: receiving a first transaction request sent by a target vehicle control object, the first transaction request carrying a first control instruction for controlling the target vehicle; determining a first control smart contract corresponding to the first control instruction; responding to the first transaction request, executing the first control smart contract, determining that the number of controls performed by the target vehicle control object on the target vehicle is less than or equal to a first value, incrementing the number of controls performed by the target vehicle control object on the target vehicle by one, and storing the first transaction request on-chain in the blockchain system; after successful on-chain storage, sending the first transaction request to the target vehicle so that the target vehicle executes the first control instruction.
[0010] An embodiment of the present disclosure provides a blockchain-based device control method, which is executed by a target vehicle. The method includes: receiving a first transaction request sent by a target blockchain system, the first transaction request carrying a first control instruction for controlling the target vehicle, the first transaction request being sent by a target vehicle control object to the target blockchain system for on-chain storage, the blockchain system determining, by executing a first control smart contract, that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, incrementing the number of times the target vehicle control object controls the target vehicle by one, and then storing the first transaction request on-chain in the blockchain system; obtaining a target certificate, the target certificate being generated by a certificate issuing agency of the blockchain system based on an association relationship between a device control object and the target vehicle, the device control object having control over the target vehicle; determining, based on the target certificate, that the device control objects having control over the target vehicle include the target vehicle control object; and executing the first control instruction in the first transaction request.
[0011] An embodiment of the present disclosure provides a blockchain-based device control method, which is executed by a device control object. The method includes: sending a first transaction request to a blockchain system, where the first transaction request carries a first control instruction for controlling a target vehicle, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target vehicle; wherein the blockchain system determines, by executing the first control smart contract, that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, and after adding one to the number of times the target vehicle control object controls the target vehicle, the first transaction request is stored on the chain in the blockchain system.
[0012] The embodiment of the present disclosure proposes a blockchain-based device control device, which is deployed in a node device of a blockchain system and includes: a first transaction request acquisition module, a first control smart contract determination module, a first control smart contract execution module and a request sending module.
[0013] Among them, the first transaction request acquisition module is configured to receive a first transaction request sent by the target device control object, and the first transaction request carries a first control instruction for controlling the target device; the first control smart contract determination module is configured to determine the first control smart contract corresponding to the first control instruction; the first control smart contract execution module is configured to respond to the first transaction request, execute the first control smart contract, determine that the number of control times of the target device control object for controlling the target device is less than or equal to a first value, increase the number of control times of the target device control object for controlling the target device by one, and store the first transaction request on the blockchain in the blockchain system; the request sending module is configured to send the first transaction request to the target device after successful on-chain storage, so that the target device executes the first control instruction.
[0014] In some embodiments, the first control smart contract is used to control the number of first control tokens issued to the target device control object according to the first value; wherein the first control smart contract execution module includes: a first control token determination submodule and a first control token consumption submodule.
[0015] Among them, the first control token determination submodule is used to determine that the remaining number of the first control token of the target device control object is greater than or equal to the first number; the first control token consumption submodule is used to consume the first control token of the target device control object according to the first number.
[0016] In some embodiments, the blockchain-based device control device also includes: a second transaction request acquisition module, a smart contract matching module, a second transaction request response module and a second transaction request on-chain storage module.
[0017] Among them, the second transaction request acquisition module is configured to receive a second transaction request sent by the target device control object, the second transaction request carries a second control instruction for controlling the target device, and the first control instruction and the second control instruction are control instructions of different types; the smart contract matching module is configured to determine a first control smart contract corresponding to the second control instruction; the second transaction request response module is configured to respond to the second transaction request, execute the first control smart contract, determine that the number of control times of the target device control object for controlling the target device is less than or equal to the first value, increase the number of control times of the target device control object for controlling the target device by one, and store the second transaction request on-chain in the blockchain system; the second transaction request on-chain storage module is configured to send the second transaction request to the target device after successful on-chain storage, so that the target device executes the second control instruction.
[0018] In some embodiments, the first control smart contract is used to process a first control instruction of a first control type; wherein, the first control smart contract execution module includes: a first value matching submodule, the first value matching submodule is used to determine that the number of times the target device control object performs the first control type on the target device is less than or equal to the first value, and the number of times the target device control object performs the first control type on the target device is increased by one; wherein, the blockchain-based device control device also includes: a second transaction request receiving module, a second control smart contract determination module, a second control smart contract execution module, and a second transaction request storage module.
[0019] Among them, the second transaction request receiving module is used to receive a second transaction request sent by the target device control object, and the second transaction request carries a second control instruction for controlling the target device; the second control smart contract determination module is used to determine a second control smart contract corresponding to the second control instruction, and the second control smart contract is used to process the second control instruction of the second control type, and the first control type and the second control type are different control types; the second control smart contract execution module is used to respond to the second transaction request, execute the second control smart contract, determine that the number of times the target device control object controls the target device of the second control type is less than or equal to a second value, increase the number of times the target device control object controls the target device of the second control type by one, and store the second transaction request on the blockchain system; the second transaction request storage module is used to send the second transaction request to the target device after successful on-chain storage, so that the target device executes the second control instruction.
[0020] In some embodiments, the request sending module includes: a first response smart contract determination submodule, a third value comparison submodule and a first transaction sending submodule.
[0021] Among them, the first response smart contract determination submodule is used to determine the first response smart contract corresponding to the first control smart contract, and the first response smart contract is used to process the response corresponding to the first control instruction; the third value comparison submodule is used to determine, based on the first response smart contract, that the number of times the target device responds to the control instruction is less than or equal to a third value, and increase the number of times the target device responds to the control instruction by one; the first transaction sending submodule is used to send the first transaction request to the target device.
[0022] In some embodiments, the first control smart contract is used to process the first control instruction of the first control type; wherein, the third value comparison submodule includes: a control number comparison submodule and a number plus one submodule.
[0023] Among them, the control number comparison submodule is used to determine, based on the first response smart contract, that the number of times the target device responds to the control instruction of the first control type is less than or equal to the third value; the number addition submodule is used to increase the number of times the target device responds to the control instruction of the first control type by one.
[0024] In some embodiments, the first response smart contract is used to control the number of first response tokens issued to the target device according to the third value; wherein the third value comparison submodule includes: a first response token determination unit and a first response token consumption unit.
[0025] The first response token determining unit is used to determine whether the remaining number of the first response token of the target device is greater than or equal to a second number; and the first response token consuming unit is used to consume the second control token of the target device according to the second number.
[0026] In some embodiments, before receiving the first transaction request sent by the target device control object, the blockchain-based device control device also includes: a first control smart contract receiving module, a first block packaging module, a first consensus processing module and a first control smart contract deployment module.
[0027] The first control smart contract receiving module is used to receive the first control smart contract sent by the target device control object; the first block packaging module is used to package the first control smart contract into a first block; the first consensus processing module is used to perform consensus processing on the first control smart contract in the first block; and the first control smart contract deployment module is used to deploy the first control smart contract on the chain through the first block after consensus is passed.
[0028] In some embodiments, the blockchain-based device control device further includes: a first response smart contract receiving module, a second block packaging module, a second block consensus module, and a second block chain module.
[0029] Among them, the first response smart contract receiving module is used to receive the first response smart contract sent by the target device control object; the second block packaging module is used to package the first response smart contract into a second block; the second block consensus module is used to perform consensus processing on the first response smart contract in the second block; the second block chain module is used to deploy the first response smart contract on the chain through the second block after consensus is passed.
[0030] In some embodiments, the blockchain-based device control device also includes: a third transaction request receiving module, a first response smart contract determination module, a third transaction request response module, and a third transaction request chain module.
[0031] Among them, the third transaction request receiving module is used to receive the third transaction request returned by the target device in response to the first control instruction, and the third transaction request carries a first response for responding to the first control instruction; the first response smart contract determination module is used to determine the first response smart contract corresponding to the first response; the third transaction request response module is used to respond to the third transaction request, execute the first response smart contract, and store the third transaction request on the blockchain system; the third transaction request on-chain module is used to send the third transaction request to the target device control object after successful on-chain storage.
[0032] An embodiment of the present disclosure provides a blockchain-based device control device, which is deployed in a target device of a blockchain system and includes: a first transaction request receiving module, a first certificate acquisition module, a first relationship determination module, and an instruction execution module.
[0033] Among them, the first transaction request receiving module is configured to receive a first transaction request sent by the target blockchain system, the first transaction request carries a first control instruction for controlling the target device, and the first transaction request is sent by the target device control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to a first value by executing a first control smart contract, and after adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on-chain in the blockchain system; the first certificate acquisition module is configured to obtain a target certificate, and the target certificate is generated by a certificate issuing agency of the blockchain system according to the association relationship between the device control object and the target device, and the device control object has control over the target device; the first relationship determination module is configured to determine that the device control objects that have control over the target device include the target device control object according to the target certificate; the instruction execution module is configured to execute the first control instruction in the first transaction request.
[0034] An embodiment of the present disclosure provides a blockchain-based device control apparatus, which is deployed in a device control object. The apparatus includes: a first transaction request sending module.
[0035] The first transaction request sending module is configured to send a first transaction request to the blockchain system, where the first transaction request carries a first control instruction for controlling the target device, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target device; wherein the blockchain system determines, by executing the first control smart contract, that the number of times the target device control object controls the target device is less than or equal to a first value, and after adding one to the number of times the target device control object controls the target device, the first transaction request is stored on the chain in the blockchain system.
[0036] In some embodiments, the blockchain-based device control apparatus further includes: a third transaction request acquisition module, a target certificate acquisition module, and a control right determination module.
[0037] Among them, the third transaction request acquisition module is used to receive a third transaction request sent by the target device from the blockchain system, and the third transaction request carries a first response for responding to the first control instruction; the target certificate acquisition module is used to obtain a target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system according to the association relationship between the target device control object and the target device, and the device control object has control over the target device; the control right determination module is used to determine that the target device control object has control over the target device according to the target certificate, and then determine the response of the target device obtained by the first control instruction according to the first control instruction.
[0038] An embodiment of the present disclosure provides a blockchain-based device control apparatus, which is deployed on a node device on a blockchain system; wherein the apparatus includes: a vehicle control object information receiving module, a control smart contract matching module, a smart contract execution module, and a vehicle information sending module.
[0039] Among them, the vehicle control object information receiving module is used to receive a first transaction request sent by the target vehicle control object, and the first transaction request carries a first control instruction for controlling the target vehicle; the control smart contract matching module is used to determine the first control smart contract corresponding to the first control instruction; the execution smart contract module is used to respond to the first transaction request, execute the first control smart contract, determine that the number of controls performed by the target vehicle control object on the target vehicle is less than or equal to a first value, increase the number of controls performed by the target vehicle control object on the target vehicle by one, and store the first transaction request on the chain in the blockchain system; the module for sending information to the vehicle is used to send the first transaction request to the target vehicle after successful on-chain storage, so that the target vehicle executes the first control instruction.
[0040] In some embodiments, the blockchain-based device control device also includes: a vehicle information receiving module, a response smart contract determination module, a response smart contract execution module, and a module for sending information to a vehicle control object.
[0041] Among them, the vehicle information receiving module is used to receive the third transaction request returned by the target vehicle in response to the first control instruction, and the third transaction request carries a first response for responding to the first control instruction; the response smart contract determination module is used to determine the first response smart contract corresponding to the first response; the response smart contract execution module is used to respond to the third transaction request, execute the first response smart contract, and store the third transaction request on the chain in the blockchain system; the module for sending information to the vehicle control object is used to send the third transaction request to the target vehicle control object after successful on-chain storage.
[0042] An embodiment of the present disclosure provides a blockchain-based device control device, wherein the blockchain-based device control device is deployed on a target vehicle or a terminal corresponding to the target vehicle. The device includes: a first control instruction receiving module, a certificate acquisition module, a control right determination module, and a first instruction execution module.
[0043] Among them, the first control instruction receiving module is used to receive a first transaction request sent by the target blockchain system, the first transaction request carries a first control instruction for controlling the target vehicle, and the first transaction request is sent by the target vehicle control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target vehicle control object for controlling the target vehicle is less than or equal to a first value by executing a first control smart contract, and after adding one to the number of control times of the target vehicle control object for controlling the target vehicle, the first transaction request is stored on-chain in the blockchain system; the certificate acquisition module is used to obtain a target certificate, and the target certificate is generated by a certificate issuing agency of the blockchain system according to the association relationship between the device control object and the target vehicle, and the device control object has control over the target vehicle; the control right determination module is used to determine, based on the target certificate, that the device control objects that have control over the target vehicle include the target vehicle control object; the first instruction execution module is used to execute the first control instruction in the first transaction request.
[0044] In some embodiments, the blockchain-based device control device also includes: a third transaction generation module, which is used to send a third transaction request to the blockchain system after the execution of the first control instruction is completed, and the third transaction request carries a first response for responding to the first control instruction, so that after the third transaction request is successfully stored on the chain, the third transaction request is sent to the target vehicle control object.
[0045] An embodiment of the present disclosure provides a blockchain-based device control apparatus, which is deployed in a device control object or on a terminal corresponding to the device control object. The apparatus includes: a module for sending a first transaction request to a blockchain, for sending a first transaction request to a blockchain system, wherein the first transaction request carries a first control instruction for controlling a target vehicle, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target vehicle; wherein the blockchain system determines, by executing the first control smart contract, that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, and after adding one to the number of times the target vehicle control object controls the target vehicle, the first transaction request is stored on the chain in the blockchain system.
[0046] In some embodiments, the apparatus further comprises: a first response receiving module, a certificate determining module, and a vehicle response obtaining module.
[0047] Among them, the first response receiving module is used to receive a third transaction request sent by the target vehicle from the blockchain system, and the third transaction request carries a first response for responding to the first control instruction; the certificate determination module is used to obtain a target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system according to the association relationship between the target vehicle control object and the target vehicle, and the device control object has control over the target vehicle; the vehicle response acquisition module is used to determine that the target vehicle control object has control over the target vehicle according to the target certificate, and then determine the response of the target vehicle obtained by the first control instruction according to the first control instruction.
[0048] An embodiment of the present disclosure proposes an electronic device, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-described blockchain-based device control methods.
[0049] The embodiments of the present disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the blockchain-based device control method as described in any one of the above items.
[0050] The present disclosure provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned blockchain-based device control method.
[0051] The blockchain-based device control method, apparatus, electronic device, and computer-readable storage medium provided by the embodiments of the present disclosure can, on the one hand, operate IoT devices through the blockchain system, so that the ownership relationship between the target device and the target device control object cannot be forged, and the operation record of the target device control object on the target device cannot be tampered with and can be traced; on the other hand, the number of times the target device control object controls the target device is counted through the first control smart contract in the blockchain system, and then the number of times the target device control object controls the target device is managed and controlled, so as to avoid the target device control object from initiating too many control requests to the target device, thereby causing damage to the target device. For example, it can avoid illegal users from initiating too many control requests to the target device, thereby cracking the control of the target device, and improving the security of the target device.
[0052] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0054] Figure 1 This is a schematic diagram of the architecture of a blockchain-based data processing system provided by an embodiment of the present disclosure.
[0055] Figure 2 This is a schematic diagram of a blockchain network provided by an embodiment of the present disclosure.
[0056] Figure 3 It is a structural diagram of a block provided by an embodiment of the present disclosure.
[0057] Figure 4 This is a schematic diagram of a new block generation process provided by an embodiment of the present disclosure.
[0058] Figure 5 The present invention is a flowchart of a device control method based on blockchain according to an exemplary embodiment.
[0059] Figure 6 The figure is a schematic diagram showing a certificate generation according to an exemplary embodiment.
[0060] Figure 7 The present invention is a device control method based on a blockchain system according to an exemplary embodiment.
[0061] Figure 8 The present invention is a device control method based on a blockchain system according to an exemplary embodiment.
[0062] Figure 9 The present invention is based on an exemplary method for forwarding a first transaction request based on blockchain.
[0063] Figure 10 A device control method based on blockchain is shown according to an exemplary embodiment.
[0064] Figure 11 A third transaction request forwarding method based on blockchain is shown according to an exemplary embodiment.
[0065] Figure 12 A device control method based on blockchain is shown according to an exemplary embodiment.
[0066] Figure 13 This is a flowchart of a method for controlling a vehicle based on blockchain according to an exemplary embodiment.
[0067] Figure 14 The figure is a block diagram of a device control apparatus based on blockchain according to an exemplary embodiment.
[0068] Figure 15 The figure is a block diagram of a device control apparatus based on blockchain according to an exemplary embodiment.
[0069] Figure 16 A schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0070] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. Like reference numerals in the drawings represent like or similar parts, and thus repetitive description thereof will be omitted.
[0071] The features, structures or characteristics described in the present disclosure may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0072] The accompanying drawings are merely schematic illustrations of the present disclosure. Identical reference numerals in the drawings denote identical or similar components, and thus their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0073] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all content and steps, nor must they be executed in the order described. For example, some steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0074] In this specification, the terms "a", "an", "the", and "at least one" are used to indicate the presence of one or more elements / components / etc.; the terms "comprising", "including", and "having" are used to express open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first", "second", and "third", etc. are used only as labels and are not intended to limit the quantity of their objects.
[0075] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other unless there is a conflict.
[0076] The disclosed embodiments involve blockchain technology, which is a new application model of computer technologies such as distributed data storage, peer-to-peer (P2P) transmission, consensus mechanism, and encryption algorithm. It is essentially a decentralized database, a string of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer. The blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected and protected by cryptography. The distributed ledger connected by the blockchain allows multiple parties to effectively record transactions and can permanently verify such transactions (non-tamperable). Among them, the consensus mechanism refers to the mathematical algorithm that establishes trust and obtains rights and interests between different nodes in the blockchain system, that is, the consensus mechanism is a mathematical algorithm that is jointly recognized by all network nodes of the blockchain.
[0077] like Figure 1 As shown, the blockchain-based data processing system provided by the embodiment of the present disclosure may include a blockchain system 100 and multiple terminal devices. Figure 1 In the example, three terminal devices are included, namely the first terminal 201, the second terminal 202, and the third terminal 203. The first terminal 201, the second terminal 202, and the third terminal 203 can be used to obtain transaction data (including transaction requests or transaction data generated after executing transaction requests) from the blockchain system, or upload transaction data to the blockchain system.
[0078] like Figure 2 As shown, Figure 1 The blockchain system 100 in this embodiment may include multiple node devices 101. The multiple node devices 101 may refer to various clients in the blockchain system, and the blockchain system 100 refers to a system for data sharing between node devices 101. Each node device 101 may receive transaction data during normal operation and maintain shared data within the blockchain system 100 based on the received transaction data. To ensure information interoperability within the blockchain system 100, information connections may exist between each node device 101 in the blockchain system 100, allowing information to be transmitted between the node devices 101 via these connections. For example, when any node device 101 in the blockchain system 100 receives transaction data, the other node devices 101 in the blockchain system 100 obtain the transaction data according to a consensus algorithm and store the transaction data as shared data, ensuring that the data stored on all node devices 101 in the blockchain system 100 is consistent.
[0079] Among them, the node device 101, the first terminal 201, the second terminal 202 and the third terminal 203 in the blockchain system 100 can be any electronic device, including but not limited to mobile phones, tablet computers, laptops, PDAs, smart speakers, mobile Internet devices (mobile internet devices, MIDs), POS (Point Of Sales) machines, wearable devices (such as smart watches, smart bracelets, etc.); it can also be an independent server, or a server cluster composed of several servers, or a cloud computing center.
[0080] Each node device 101 in the blockchain system 100 has a corresponding node device identifier, and each node device 101 in the blockchain system 100 can store the node device identifiers of other node devices 101 in the blockchain system 100, so that the generated blocks can be broadcast to other node devices 101 in the blockchain system 100 based on the node device identifiers of other node devices 101. Each node device 101 can maintain a node device identifier list as shown in Table 1 below, and store the node device name and node device identifier in the node device identifier list accordingly. Among them, the node device identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the node device. Table 1 only uses the IP address as an example for illustration. Wherein N is a positive integer greater than or equal to 1.
[0081] Table 1
[0082]
[0083]
[0084] Each node device 101 in the blockchain system 100 stores an identical blockchain. The blockchain consists of multiple blocks, each of which contains a cryptographic hash of the previous block (which can be represented by a hash value calculated using a Merkle tree algorithm), a corresponding timestamp, and transaction data. This design makes the block content difficult to tamper with.
[0085] See also Figure 3The blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the transaction data feature value, version number, timestamp and difficulty value, and the block body stores the transaction data; the next block of the genesis block uses the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the transaction data feature value of the current block, the block header feature value, version number, timestamp and difficulty value of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the transaction data in the block.
[0086] When generating each block in the blockchain, see Figure 4 When the node device of the blockchain receives the transaction data, it verifies the transaction data. After the verification is completed, the transaction data is stored in the memory pool and the hash tree used to record the transaction data is updated. After that, the update timestamp is updated to the time when the transaction data is received, and different random numbers are tried to calculate the eigenvalue multiple times so that the calculated eigenvalue can satisfy the following formula:
[0087] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET(1)
[0088] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the transaction data; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.
[0089] In this way, when a random number that satisfies the above formula is calculated, the information can be stored accordingly, and the block header and block body can be generated to obtain the current block. Subsequently, the node device of the blockchain system 100 sends the newly generated block to the other node devices in the blockchain system 100 according to the node device identifiers of the other node devices in the blockchain system 100. The other node devices verify the newly generated block and, after completing the verification, add the newly generated block to the blockchain stored in their storage.
[0090] In order to illustrate the technical solutions provided by the embodiments of the present disclosure, the names involved in the embodiments will be explained below.
[0091] ChainMaker (Chang'an Chain): As an open-source underlying blockchain software platform, encompassing a core blockchain framework, a rich component library, and a toolkit, ChainMaker is dedicated to efficiently and accurately addressing differentiated blockchain implementation needs for users, building a high-performance, highly reliable, and secure new digital infrastructure. It is also China's first independently controlled blockchain hardware and software technology system. Chang'an Chain boasts advanced technological advantages such as high concurrency, low latency, and large-scale node networking, achieving a transaction throughput of 100,000 TPS (transactions per second), a global leader.
[0092] ChainMaker CA (ChainMaker Certificate Authority, Changan Chain certificate issuing agency): refers to the certificate and key system managed using the Changan Chain supporting certificate management tool.
[0093] ChainMaker SDK (ChainMaker Software Development Kit): a software development tool used to interact with the Changan Chain (sending transactions, subscribing, etc.).
[0094] TBFT (a Byzantine Fault Tolerant consensus algorithm): It can ensure the safe operation of the system even when the number of Byzantine nodes is less than one-third of the total number. TBFT is based on the Tendermint consensus algorithm. The key difference between TBFT and PBFT (Practical Byzantine Fault Tolerance) is that PBFT has a fixed leader (a type of node) that packages transactions. When the leader node fails, the view-change subprotocol (a type of consensus protocol) is used to replace the leader. In TBFT, the leader is rotated, and the leader is transferred to the next node every n blocks submitted (n is a configurable positive integer). Therefore, TBFT has better fairness than PBFT.
[0095] Token: There are currently two types of tokens. One is built into the blockchain system and is used for transfers between users and to reward miners. This type is understood as a digital cryptocurrency. The other is minted on a DApp (Decentralized application) or smart contract and is used for internal transactions. This type is closer to the meaning of "token", and the tokens in this disclosure refer to this type.
[0096] Figure 5 The present invention is a flowchart of a device control method based on blockchain according to an exemplary embodiment.
[0097] The core components of the technical solution provided by the embodiments of the present disclosure may include: a blockchain system, a smart contract for token issuance and token transfer transactions, a device control object, a target device, and an encryption chip (which can be built into the target device). Through the above-mentioned hardware devices and software systems, the relationship binding between the target device and the device control object can be achieved.
[0098] In execution Figure 5 Prior to the technical solution shown, a control smart contract can be deployed in a blockchain system according to the following method: receiving a first control smart contract sent by a target device control object; packaging the first control smart contract to form a first block; performing consensus processing on the first control smart contract in the first block; after the consensus is passed, deploying the first control smart contract on the chain through the first block.
[0099] The response smart contract can also be deployed in the blockchain system according to the following method: receiving the first response smart contract sent by the target device control object; packaging the first response smart contract to form a second block; performing consensus processing on the first response smart contract in the second block; after the consensus is passed, the first response smart contract is deployed on the chain through the second block.
[0100] It should be noted that the above-mentioned control smart contract or response smart contract can be deployed by the target device control object, or by the device corresponding to the blockchain operator, or by other devices, and this disclosure does not impose any restrictions on this.
[0101] In some embodiments, after the smart contract is deployed, you can refer to Figure 6 Generate public and private keys and certificates for the target device 601 (which may have a built-in encryption chip 603) and the device control object 602: the target device 601 or the device control object 602 sends a request to the encryption chip 603 to generate public and private keys; the encryption chip 603 can generate public and private keys for the target device 601 and the device control object 602; the target device 601 locally stores the public key of the device control object 602 to verify the identity of the device control object 602; the device control object 602 sends its own public key and the target device 601 public key to the blockchain system's certificate issuing agency (ChainMaker CA) 604; the blockchain system's certificate issuing agency generates certificates for the device control object 602 and the target device 601 respectively; the device control object 602 saves the certificate of the target device 601 to verify the identity of the target device 601; the target device 601 saves the certificate of the device control object 602 to verify the identity of the device control object 602.
[0102] Among them, the target device may refer to a device that can be controlled, such as an Internet of Things device (such as an ordinary driving vehicle, a train, an airplane, an unmanned vehicle, an unmanned aircraft, a robot, a sweeper, an air conditioner, a refrigerator, a workshop equipment, a washing machine, a charging pile, a hair dryer, a massage chair, a rocking car or a claw machine, etc.).
[0103] The device control object may refer to a device that can control the target device, for example, a device operated by a user who has control over the target device, such as the user's corresponding terminal device (mobile phone, computer, notebook, etc.).
[0104] It can be understood that the above embodiment provides a method for generating and storing public and private keys and certificates of a target device and a device control object, but the present disclosure is not limited thereto.
[0105] After completing the above deployment, the device control object can send a first transaction request to the blockchain system, where the first transaction request carries a first control instruction for controlling the target device, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target device so that the target device executes the first control instruction; wherein the blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on the chain in the blockchain system.
[0106] Among them, the first control instruction can refer to any instruction information that can control the target device, which can be any instruction such as a switch instruction, a turn instruction, a back instruction, etc., and the present disclosure does not impose any restrictions on this.
[0107] The first control instruction may be a single instruction or an instruction group (a combination of multiple instructions), and this disclosure does not impose any limitation on this.
[0108] After the device control object sends the first transaction request to the blockchain system, the node device on the blockchain system will execute the following Figure 5 Steps shown.
[0109] Step S502: receiving a first transaction request sent by a target device control object, where the first transaction request carries a first control instruction for controlling the target device.
[0110] Step S504: Determine a first control smart contract corresponding to the first control instruction.
[0111] In the blockchain system, one or more control smart contracts can be pre-deployed, and the one or more control smart contracts can be used to process control instructions issued by the device control object.
[0112] In the blockchain system, if only one control smart contract is deployed, the control smart contract is directly used as the first control smart contract that matches the first control instruction; if multiple control smart contracts are deployed in the blockchain system, the first control smart contract that matches the first control instruction can be determined from the multiple control smart contracts. For example, the first control smart contract that matches the first control instruction can be determined from the multiple control smart contracts based on the control type of the first control instruction. For another example, the first control smart contract can also be determined based on the instruction sender who sends the first control instruction (that is, different instruction senders correspond to different control smart contracts). This disclosure does not limit the method for determining the first control smart contract.
[0113] Step S506: In response to the first transaction request, the first control smart contract is executed, and it is determined that the number of times the target device control object controls the target device is less than or equal to the first value, the number of times the target device control object controls the target device is increased by one, and the first transaction request is stored on the blockchain system.
[0114] In some embodiments, a first control smart contract may be used to determine whether the number of times the target device control object controls the target device is less than or equal to a first value.
[0115] Here, determining whether the number of times the target device control object controls the target device is less than or equal to the first value may refer to determining whether the number of times the target device control object controls the target device within a period of time is less than or equal to the first value, or it may refer to determining whether the total number of times the target device control object controls the target device is less than or equal to the first value.
[0116] In addition, determining whether the number of times the target device control object controls the target device is less than or equal to the first value can refer to determining whether the number of times the target device control object controls the target device is less than or equal to the first value without distinguishing the control type; it can also refer to determining whether the number of times the target device control object controls the target device using a certain control type is less than or equal to the first value. Regardless of whether the control type is distinguished when determining whether the number of times the target device control object controls the target device is less than or equal to the first value, the determination can be made using the same control smart contract or using different control smart contracts (for example, one control type corresponds to one control smart contract).
[0117] The control type may refer to a control type determined according to a certain classification standard, and the present disclosure does not limit the above classification standard. The above control type may refer to a switch control type, a turning control type, a speed reduction control type, etc., and the present disclosure does not limit this.
[0118] In some embodiments, a counter can be set for the target device control object in the first control smart contract to determine whether the number of times the target device control object controls the target device is less than or equal to the first value; a certain number of tokens can also be pre-issued for the target device control object, and each time the target device control object controls the target device through a control instruction, a certain number of tokens will be consumed. After the tokens of the target device control object are consumed, the target device control object will no longer be allowed (or will no longer run for a period of time) to control the target device; of course, the number of times the target device control object controls the target device can also be counted in other ways, and the present disclosure does not limit this.
[0119] Among them, consuming the first control token of the target device control object may refer to transferring the first control token of the target device control object from the account of the target device control object to the account of the target device, and the present disclosure does not limit this.
[0120] In some embodiments, the first control smart contract can be used to control the number of first control tokens issued to the target device control object according to a first value. Then, determining that the number of control times the target device control object controls the target device is less than or equal to the first value can specifically include: the first control smart contract determines whether the remaining number of the first control tokens of the target device control object is greater than or equal to the first number, and if the remaining number of the first control tokens of the target device control object is greater than or equal to the first number, then the first control tokens of the target device control object can be consumed according to the first number (a method of "increasing the number of control times the target device control object controls the target device by one"); if the remaining number of the first control tokens of the target control object is less than the first number, it is determined that the number of control times the target device control object controls the target device is greater than the first value, and then the first transaction request is rejected (for example, the first transaction request is no longer forwarded to the target device, and a rejection request prompt is displayed to the target device control object).
[0121] In the technical solution provided in this embodiment, the number of times the target device control object controls the target device can be managed and controlled through the first control smart contract, which can prevent the target device control object from issuing too many control instructions to the target device (or control instructions issued within a period of time), thereby protecting the target device from illegal attacks.
[0122] Step S508: Send the first transaction request to the target device so that the target device executes the first control instruction.
[0123] The technical solution provided by this embodiment can, on the one hand, operate the Internet of Things device through the blockchain system, so that the ownership relationship between the target device and the target device control object cannot be forged, and the operation record of the target device control object on the target device cannot be tampered with and can be traced; on the other hand, the first control smart contract in the blockchain system is used to count the number of times the target device control object controls the target device, and then the number of times the target device control object controls the target device is managed and controlled, so as to avoid the target device control object from initiating too many control requests to the target device, thereby reducing the damage caused to the target device, for example, it can avoid illegal users from initiating too many control requests to the target device, and then cracking the control of the target device; in addition, the on-chain storage of the first transaction request will consume the digital cryptocurrency of the target control object in the blockchain system, increase the control cost of the target control object to the target device, and reduce the possibility of illegal attacks by illegal users.
[0124] Figure 7 The present invention is a device control method based on a blockchain system according to an exemplary embodiment.
[0125] In some embodiments, if different control smart contracts are used to process control instructions of different control types, Figure 7 The method shown processes the second transaction request sent by the target device control object.
[0126] refer to Figure 7 , the above-mentioned device control method may include the following steps.
[0127] Step S702: receiving a second transaction request sent by the target device control object, wherein the second transaction request carries a second control instruction for controlling the target device, and the first control instruction and the second control instruction are different types of control instructions.
[0128] Step S704: Determine the first control smart contract corresponding to the second control instruction.
[0129] Step S706: In response to the second transaction request, the first control smart contract is executed, and it is determined that the number of times the target device control object controls the target device is less than or equal to the first value. The number of times the target device control object controls the target device is increased by one, and the second transaction request is stored on the blockchain system.
[0130] In some embodiments, a counter can be set for the target device control object in the first control smart contract to determine whether the number of times the target device control object controls the target device is less than or equal to the first value; a certain number of tokens can also be pre-issued for the target device control object, and each time the target device control object controls the target device through a control instruction, a certain number of tokens will be consumed. After the tokens of the target device control object are consumed, the target device control object will no longer be allowed (or will no longer run for a period of time) to control the target device; of course, the number of times the target device control object controls the target device can also be counted in other ways, and the present disclosure does not limit this.
[0131] Step S708: After the on-chain storage is successful, the second transaction request is sent to the target device so that the target device executes the second control instruction.
[0132] The technical solution provided in this embodiment can uniformly manage and control the control instructions issued by the target control object through the same control smart contract, so that the number of times the target control object controls the target device is within a controllable range, reducing illegal attacks on the target device control object.
[0133] Figure 8 The present invention is a device control method based on a blockchain system according to an exemplary embodiment.
[0134] In some embodiments, if different control smart contracts are used to process control instructions of different control types, Figure 8 The method shown processes a first transaction request sent by a target device control object.
[0135] Among them, the first control smart contract is used to process the first control instruction of the first control type; and determining that the number of controls performed by the target device control object on the target device is less than or equal to the first value, and adding one to the number of controls performed by the target device control object on the target device may include: determining that the number of controls performed by the target device control object on the target device of the first control type is less than or equal to the first value, and adding one to the number of controls performed by the target device control object on the target device of the first control type.
[0136] refer to Figure 8 , the above-mentioned device control method may include the following steps.
[0137] Step S802: receiving a second transaction request sent by the target device control object, where the second transaction request carries a second control instruction for controlling the target device.
[0138] Step S804: Determine a second control smart contract corresponding to the second control instruction. The second control smart contract is used to process the second control instruction of the second control type. The first control type and the second control type are different control types.
[0139] Step S806: In response to the second transaction request, execute the second control smart contract, determine that the number of times the target device control object performs the second control type on the target device is less than or equal to the second value, increase the number of times the target device control object performs the second control type on the target device by one, and store the second transaction request on the blockchain system.
[0140] In some embodiments, a counter can be set for the target device control object in the second control smart contract to determine whether the number of times the target device control object performs the second control type on the target device is less than or equal to the first value; a certain number of tokens can also be pre-issued for the target device control object, and each time the target device control object controls the target device through a control instruction, a certain number of tokens will be consumed. After the tokens of the target device control object are consumed, the target device control object will no longer be allowed (or will no longer operate for a period of time) to perform the second type of control on the target device; of course, the number of times the target device control object performs the second type of control on the target device can also be counted by other means, and the present disclosure does not limit this.
[0141] Step S808: After the on-chain storage is successful, the second transaction request is sent to the target device so that the target device executes the second control instruction.
[0142] The technical solution provided in this embodiment can process different types of control instructions through different control smart contracts, and can also manage the control times of different types of control instructions through different control smart contracts, thereby achieving different processing for different control types.
[0143] Figure 9 The present invention is based on an exemplary method for forwarding a first transaction request based on blockchain.
[0144] In some embodiments, the first transaction request can be directly sent to the target device after the first transaction request is successfully stored on the chain; Figure 9 The illustrated method sends a first transaction request to a target device.
[0145] refer to Figure 9 , the above-mentioned first transaction request forwarding method may include the following steps.
[0146] Step S902: Determine a first response smart contract corresponding to the first control smart contract, where the first response smart contract is used to process the response corresponding to the first control instruction.
[0147] Among them, the first response smart contract is used to process the response to the first control instruction. The first response smart contract can also control the number of responses of the target device.
[0148] Among them, the response processed by the first response smart contract can be a response to the control instruction processed by the first control smart contract.
[0149] Step S904: According to the first response smart contract, it is determined that the number of times the target device responds to the control instruction is less than or equal to the third value, and the number of times the target device responds to the control instruction is increased by one.
[0150] Among them, determining that the number of times the target device responds to the control instruction is less than or equal to the third value can determine the total number of responses of the target device within a period of time (regardless of the control type), and can also count the number of responses of the target device to a control instruction of a certain control type within a period of time. The present disclosure does not impose any restrictions on this.
[0151] In some embodiments, the control type of the control instruction processed by the first control smart contract may be consistent with the control type corresponding to the response processed by the first response smart contract, and the first control smart contract is used to process a first control instruction of the first control type. Then, determining, according to the first response smart contract, that the number of times the target device responds to the control instruction is less than or equal to a third value, and incrementing the number of times the target device responds to the control instruction by one may include: determining, according to the first response smart contract, that the number of times the target device responds to the control instruction of the first control type is less than or equal to the third value; and incrementing the number of times the target device responds to the control instruction of the first control type by one.
[0152] In some embodiments, a counter can be set for the target device in the first response smart contract to determine whether the number of responses of the target device is less than or equal to the third value; a certain number of tokens can also be pre-issued for the target device, and each time the target device responds to a control instruction, a certain number of tokens will be consumed. After the tokens of the target device's control object are consumed, the target device will no longer respond to any instructions; of course, the number of responses of the target device can also be counted in other ways, and the present disclosure does not limit this.
[0153] For example, a first response smart contract can be used to control the number of first response tokens issued to a target device based on a third value. Then, according to the first response smart contract, determining that the number of times the target device responds to a control instruction is less than or equal to the third value, and incrementing the number of times the target device responds to the control instruction by one can include: determining that the remaining number of first response tokens of the target device is greater than or equal to a second number; and consuming the second control token of the target device based on the second number.
[0154] Step S906: Send the first transaction request to the target device.
[0155] The above method can control the number of responses of the target device (for example, the number of responses within a period of time) through the first response smart contract. When the number of responses of the target device reaches a certain threshold, the control instruction will no longer be forwarded to the target device to avoid the target device from responding frequently within a period of time, causing damage to the target device, or avoiding illegal attacks by illegal users.
[0156] Figure 10 A device control method based on blockchain is shown according to an exemplary embodiment.
[0157] The method provided in this embodiment can be executed by a target device.
[0158] refer to Figure 10 , the above-mentioned blockchain-based device control method may include the following steps.
[0159] Step S1002: Receive a first transaction request sent by the target blockchain system. The first transaction request carries a first control instruction for controlling the target device. The first transaction request is sent by the target device control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to the first value by executing the first control smart contract. After adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on-chain in the blockchain system.
[0160] Step S1004: Obtain the target certificate. The target certificate is generated by the certificate issuing agency of the blockchain system based on the association relationship between the device control object and the target device. The device control object has control over the target device.
[0161] The target certificate may refer to a certificate generated by the certificate issuing agency of the blockchain system for the target device or the target device control object based on the association relationship between the target device control object and the target device. The certificate may be stored locally on the target device or in the blockchain system. This disclosure does not impose any restrictions on this.
[0162] Step S1006: Determine, according to the target certificate, that the device control objects that have control rights over the target device include the target device control object.
[0163] In some embodiments, it may be determined whether there is a target device control object among the objects that have control rights over the target device according to the association relationship stored in the target certificate.
[0164] Step S1008: Execute the first control instruction in the first transaction request.
[0165] In some embodiments, if the target device control object has control over the target device, the target device may execute the first control instruction in the first transaction request; if the target device control object does not have control over the target device, the target device refuses to execute the first control instruction in the first transaction request.
[0166] The technical solution provided in this embodiment can store the association relationship between the target device and the target control object through the target certificate, so as to verify the control authority of the sender of the first control instruction when the target device obtains the first control instruction, thereby improving control security.
[0167] Figure 11 A third transaction request forwarding method based on blockchain is shown according to an exemplary embodiment.
[0168] After the target device completes executing the first control instruction, it can send a third transaction request to the blockchain system. The third transaction request carries the first response for responding to the first control instruction, so that after the third transaction request is successfully stored on the chain, the third transaction request is sent to the target device control object.
[0169] After receiving the third transaction request sent by the target device, the blockchain system will execute the following steps through the node device.
[0170] Step S1102: Receive a third transaction request returned by the target device in response to the first control instruction, where the third transaction request carries a first response for responding to the first control instruction.
[0171] Step S1104: Determine the first response smart contract corresponding to the first response.
[0172] Step S1106: respond to the third transaction request, execute the first response smart contract, and store the third transaction request on the blockchain system.
[0173] Step S1108: After the chain storage is successful, the third transaction request is sent to the target device control object.
[0174] After the blockchain system forwards the third transaction request to the target device control object, the target device control object will receive the third transaction request sent by the target device from the blockchain system, and the third transaction request carries the first response for responding to the first control instruction; obtain the target certificate, the target certificate is generated by the certificate issuing agency of the blockchain system based on the association relationship between the target device control object and the target device, and the device control object has control over the target device; determine that the target device control object has control over the target device based on the target certificate, and then determine the response of the target device obtained by the first control instruction based on the first control instruction, thereby determining that the target device has completed this control instruction.
[0175] The technical solution provided in this embodiment, on the one hand, after the target device executes the first control instruction, promptly returns a response to the target control object so that the target control object can know the execution status of the first control instruction; on the other hand, the blockchain system will upload the target device's response to the first control instruction to the chain, so that the target device's response record to the target device control object cannot be tampered with and can be traced.
[0176] Figure 12 A device control method based on blockchain is shown according to an exemplary embodiment.
[0177] This embodiment provides a system and method for operating IoT devices through a blockchain system. The core components of the system include: a blockchain system, smart contracts for token issuance and token transfer transactions, a user client, an IoT device client, and a built-in encryption chip in the IoT device. Through the above hardware devices and software system, the relationship between IoT devices and device owners is bound, and IoT operation records are recorded on the blockchain, which is traceable and cannot be tampered with.
[0178] The core components involved in this solution are as follows:
[0179] (1) Blockchain system: This solution is based on the ChainMaker blockchain system. Multiple IoT device manufacturers form an alliance to jointly maintain a ChainMaker alliance chain. The TBFT consensus algorithm is used to prevent illegal nodes from doing evil. This ChainMaker alliance chain serves IoT device buyers, and users and IoT devices interact through token transfer transactions.
[0180] (2) Smart Contract: This solution involves deploying token smart contracts on the ChainMaker blockchain. When users perform different types of operations on IoT devices, they need to deploy corresponding smart contracts in ChainMaker, issue different tokens accordingly, and run the contracts to execute corresponding token transfer transactions.
[0181] The user sends a transaction to deploy a smart contract. The transaction contains the bytecode of the smart contract. After the transaction is packaged into a block, the smart contract is permanently stored in the blockchain.
[0182] Different types of tokens correspond to a unique smart contract, which specifies the token name, the total number of tokens issued, or the total number of tokens issued over a period of time.
[0183] To operate IoT devices through the blockchain system, two types of smart contracts need to be deployed in the blockchain system:
[0184] 1. A first control token (op_token) used for user operations on IoT devices. Users need to purchase the token from the contract operator to operate IoT devices. The token has a cost and can prevent illegal attacks.
[0185] 2. A device used to notify users after a successful operation of an IoT device corresponds to a first response token (ok_token). The first response token (ok_token) is issued by the user and can effectively control the number of device responses (when the first response token (ok_token) held by the device is 0, it can no longer execute instructions sent by the device control object).
[0186] (3) User Client
[0187] Interact with the Changan Chain through the ChainMaker SDK to send transactions, such as deploying smart contract transactions, transferring transactions, subscribing to events, etc.
[0188] The user client converts different operations on the IoT device into calls to the ChainMaker SDK to initiate different types of token transfer transactions;
[0189] Save the public key of the IoT device locally and provide public key access and verification functions.
[0190] (4) IoT device client
[0191] Accept the request and call the encryption chip to generate the public and private keys of the IoT device and the device owner;
[0192] Interact with the Changan Chain through the ChainMaker SDK, such as sending transfer transactions, subscribing to events, etc.
[0193] Identify the token type received by the IoT device, establish a correspondence between different token types and different device operations, and perform related operations;
[0194] Save the user's public key locally and provide public key access and verification functions.
[0195] The core operational processes involved in this solution are as follows:
[0196] 1. Generate IoT device and user certificates through encryption chip and ChainMaker CA. The specific process is as follows: Figure 6 As shown in the figure: The IoT device (a target device) and the user send a request to the IoT device client to generate public and private keys through the target device control object; the IoT device client calls the encryption chip to generate public and private keys for the IoT device and the user. The IoT device locally stores the public key of the IoT device owner to verify the identity of the device owner; the user sends the public key of himself and the IoT device to ChainMaker CA; ChainMaker CA generates certificates for the user and the IoT device, and the user's client stores the IoT device certificate to verify the identity of the IoT device.
[0197] 2. Users operate IoT devices through the blockchain system. The specific process is as follows: Figure 12 As shown:
[0198] IoT device owner 1201 initiates a transaction to operate the IoT device, entering the corresponding parameters into user client SDK 1202. The user transfers one first control token (op_token) to the IoT device through the user client SDK and sends the transaction to blockchain node 1203. The blockchain node broadcasts the transaction to neighboring blockchain nodes, which then execute the smart contract to execute the transfer and store the transaction on the blockchain. The IoT device, through IoT client SDK 1204, monitors events indicating that the IoT device's address has received the first control token (op_token). The IoT device responds to the event of receiving the transaction: the IoT device receives a first control token (op_token), and the counterparty is the device owner (which can be verified by the locally stored public key of the device owner); the IoT device 1205 executes the corresponding operation instruction; after the operation of the IoT device 1205 is successful, the IoT device 1205 actively initiates a transaction to inform the user that the device operation is successful, and passes the corresponding parameters to the IoT device client SDK 1204; the IoT device transfers 1 first response token (ok_token) to the device owner through the IoT client SDK 1204 and sends the transaction to the blockchain node 1203; the blockchain node 1203 broadcasts the transaction to the adjacent blockchain nodes, and the blockchain nodes run the smart contract to execute the transfer transaction, and then store the transaction in the blockchain; the IoT device owner 1201 monitors the event of the IoT device owner 1201 receiving the first response token (token) through the user client SDK 1202. The IoT device owner 1201 receives an event response to the transaction: the IoT device owner 1201 receives a first response token (ok_token), and the counterparty is the IoT device 1205 (which can be verified by the public key of the IoT device stored locally); the user client SDK 1202 notifies the IoT device owner 1201 that the IoT device operation is successful.
[0199] The disclosed embodiment provides a method for operating an IoT device through a blockchain system. The disclosed embodiment is based on the ChainMaker blockchain system, adopts the TBFT Byzantine consensus algorithm, and has a built-in encryption chip in the IoT device to generate public and private keys for the IoT device and the device owner. Identity certificates for the IoT device and the device owner are generated by ChainMaker CA (certificate authority) for identity identification and verification. The identity certificate contains the ownership relationship between the user and the device to prevent the ownership relationship of the IoT device from being forged. The IoT device and the owner of the device are both regarded as blockchain users, and both have the authority to query and initiate transactions. Every operation of the device owner on the IoT device can be achieved by the device owner initiating a token transfer transaction to the IoT device. Different operations on the device correspond to different types of token transfers, and the IoT device performs corresponding operations based on the type of token received. After an IoT device successfully operates, it also initiates a First Response Token (ok_token) transfer transaction to the device owner. Different types of operations are successfully executed, corresponding to different types of First Response Token (ok_token) transfers. When the user receives the First Response Token (ok_token) sent by the IoT device indicating a certain type of operation success, they know that the IoT device has successfully operated the corresponding type of operation. This enables the operation of IoT devices through the blockchain system, and the operation records of IoT devices are recorded on the chain.
[0200] The innovations of this embodiment are as follows:
[0201] 1. The blockchain's certificate verification system ensures that device ownership is not forged. Users and IoT devices need to confirm each other's identities throughout the entire interaction process, which is safe and reliable.
[0202] 2. All user operation records of IoT devices are stored in the blockchain, making them tamper-proof and traceable.
[0203] 3. The number of IoT device operations is controlled. Bidirectional tokens not only increase the cost of malicious activity but also provide users with the ability to flexibly define the number of device responses. Users must purchase tokens from the contract operator to operate IoT devices. Tokens have a cost and can prevent illegal attacks. The first-response token (ok_token) is issued by the user and effectively controls the number of device responses (if the first-response token (ok_token) held by the device is 0, remote commands can no longer be executed).
[0204] 4. Based on the ChainMaker blockchain system, ChainMaker possesses advanced technological advantages such as high concurrency, low latency, and large-scale node networking. Its transaction throughput can reach 100,000 TPS, ensuring high performance of IoT device operations through the blockchain system.
[0205] 5. Using the ChainMaker blockchain system's tbft consensus algorithm, the tbft consensus algorithm is a Byzantine consensus algorithm that can effectively prevent illegal nodes from engaging in malicious activities. Through the ChainMaker blockchain system, remote operation of IoT devices can be achieved while ensuring security and reliability.
[0206] In some embodiments, the target device of the above embodiments may be a vehicle (e.g., a regular vehicle, train, airplane, unmanned vehicle, unmanned aircraft, etc.), and the target control object may be the terminal device corresponding to the vehicle control object of the vehicle (e.g., the owner of the regular vehicle, the owner of the unmanned vehicle, the owner of the unmanned aircraft, etc.). If the target device is a vehicle, the corresponding blockchain-based vehicle control method may include the following process.
[0207] 1. The device control object sends a first transaction request to the blockchain system, where the first transaction request carries a first control instruction for controlling a target vehicle, so that after the first transaction request is successfully stored on the blockchain, the first transaction is sent to the target vehicle; wherein the blockchain system determines, by executing a first control smart contract, that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, increments the number of times the target vehicle control object controls the target vehicle by one, and then stores the first transaction request on the blockchain in the blockchain system.
[0208] 2. A node device on the blockchain system receives a first transaction request sent by a target vehicle control object, the first transaction request carrying a first control instruction for controlling the target vehicle; determines a first control smart contract corresponding to the first control instruction; responds to the first transaction request, executes the first control smart contract, determines that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, increments the number of times the target vehicle control object controls the target vehicle by one, and stores the first transaction request on-chain in the blockchain system; after successful on-chain storage, sends the first transaction request to the target vehicle so that the target vehicle executes the first control instruction.
[0209] 3. The target vehicle receives a first transaction request sent by the target blockchain system. The first transaction request carries a first control instruction for controlling the target vehicle. The first transaction request is sent by the target vehicle control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target vehicle control object for controlling the target vehicle is less than or equal to the first value by executing the first control smart contract. After adding one to the number of control times of the target vehicle control object for controlling the target vehicle, the first transaction request is stored on-chain in the blockchain system; obtains a target certificate. The target certificate is generated by a certificate issuing agency of the blockchain system based on the association relationship between the device control object and the target vehicle. The device control object has control over the target vehicle; determines, based on the target certificate, that the device control objects that have control over the target vehicle include the target vehicle control object; and executes the first control instruction in the first transaction request.
[0210] 4. After the first control instruction is executed, the target vehicle sends a third transaction request to the blockchain system. The third transaction request carries the first response for responding to the first control instruction, so that after the third transaction request is successfully stored on the chain, the third transaction request is sent to the target vehicle control object.
[0211] The node device on the blockchain system receives a third transaction request returned by the target vehicle in response to the first control instruction, where the third transaction request carries a first response for responding to the first control instruction; determines a first response smart contract corresponding to the first response; responds to the third transaction request, executes the first response smart contract, and stores the third transaction request on-chain in the blockchain system; after successful on-chain storage, sends the third transaction request to the target vehicle control object.
[0212] 5. The device control object receives a third transaction request sent by the target vehicle from the blockchain system, where the third transaction request carries a first response for responding to the first control instruction; obtains a target certificate, where the target certificate is generated by a certificate issuing agency of the blockchain system based on the association between the target vehicle control object and the target vehicle, and the device control object has control over the target vehicle; determines, based on the target certificate, that the target vehicle control object has control over the target vehicle, and then determines, based on the first control instruction, the response of the target vehicle obtained by the first control instruction.
[0213] If the above-mentioned vehicle is an unmanned vehicle, the control process of the above-mentioned vehicle can be specifically referred to Figure 13 The embodiment shown.
[0214] Figure 13 The present invention is a flowchart of a blockchain-based unmanned vehicle control method according to an exemplary embodiment.
[0215] refer to Figure 13 , the above-mentioned unmanned vehicle control method may include the following steps.
[0216] Multiple autonomous vehicle manufacturers (e.g., autonomous vehicle manufacturer 1301 or autonomous vehicle manufacturer 1302) form an alliance to jointly maintain a ChainMaker alliance chain. This alliance chain serves autonomous vehicle owners (e.g., owner 1303). Owners can operate autonomous vehicles (e.g., autonomous vehicle 1304) by connecting to this alliance chain.
[0217] A user (e.g., car owner 1303) purchases a self-driving car (e.g., self-driving car 1304). The self-driving car's built-in "encryption machine (encryption chip)" is triggered offline to create a pair of public and private keys for the self-driving car and the owner, respectively. ChainMaker CA then issues identity certificates to both the self-driving car and the owner. The certificates contain the ownership relationship between the owner and the self-driving car. The owner's public key and interaction configuration information are also imported into the self-driving car.
[0218] The car owner sends a transaction to the ChainMaker consortium chain through the user client, deploying two token smart contracts. The smart contracts required for the car owner to start the autonomous vehicle are deployed on the ChainMaker blockchain. One smart contract issues a first control token (op_token) for the car owner to start the autonomous vehicle. The first control token (op_token) must be purchased from the contract operator. The first control token (op_token) has a cost and can prevent illegal attacks. The other smart contract issues a first response token (ok_token) for the autonomous vehicle to notify the car owner that the car has been successfully started. The first response token (ok_token) is issued by the user and can be used to customize the number of response times of the control device.
[0219] Both the driverless car and the owner are considered blockchain users, with the authority to query and initiate transactions. The owner can activate the driverless car with a single transfer. The owner purchases a certain amount of first control tokens (op_token) from the contract operator, and also issues a certain amount of first response tokens (ok_token) to the driverless car.
[0220] The process for the owner to start the unmanned vehicle is as follows:
[0221] The car owner 1303 transfers one first control token (op_token) to the unmanned car 1304. The transfer transaction carries the control instruction.
[0222] The unmanned vehicle 1304 monitors the event of receiving a first control token (op_token) through the vehicle client, and the sender of the first control token (op_token) is its owner (which can be verified by the user's public key stored locally);
[0223] The unmanned vehicle 1304 executes the start command and sends a first response token (ok_token) to the vehicle owner 1303 through the vehicle client after successful start.
[0224] When the car owner 1303 monitors the event of receiving a first response token (ok_token) through the user client, and the sender of the first control token (op_token) is the unmanned car 1304 (which can be verified by the locally stored unmanned car certificate), the startup is considered successful; a safe remote control command for the unmanned car startup is completed.
[0225] Figure 14 This is a block diagram of a device control device based on blockchain according to an exemplary embodiment. The device can be deployed in a node device of a blockchain system. Figure 14 The blockchain-based device control device 1400 provided by the embodiment of the present disclosure may include: a first transaction request acquisition module 1401, a first control smart contract determination module 1402, a first control smart contract execution module 1403 and a request sending module 1404.
[0226] Among them, the first transaction request acquisition module 1401 can be configured to receive a first transaction request sent by the target device control object, and the first transaction request carries a first control instruction for controlling the target device; the first control smart contract determination module 1402 can be configured to determine the first control smart contract corresponding to the first control instruction; the first control smart contract execution module 1403 can be configured to respond to the first transaction request, execute the first control smart contract, determine that the number of control times of the target device control object for controlling the target device is less than or equal to the first value, increase the number of control times of the target device control object for controlling the target device by one, and store the first transaction request on the blockchain system; the request sending module 1404 can be configured to send the first transaction request to the target device after the on-chain storage is successful, so that the target device executes the first control instruction.
[0227] In some embodiments, the first control smart contract is used to control the number of first control tokens issued to the target device control object according to the first value; wherein, the first control smart contract execution module 1403 may include: a first control token determination submodule and a first control token consumption submodule.
[0228] Among them, the first control token determination submodule can be used to determine whether the remaining number of the first control token of the target device control object is greater than or equal to the first number; the first control token consumption submodule can be used to consume the first control token of the target device control object according to the first number.
[0229] In some embodiments, the blockchain-based device control apparatus 1400 may further include: a second transaction request acquisition module, a smart contract matching module, a second transaction request response module, and a second transaction request on-chain storage module.
[0230] Among them, the second transaction request acquisition module can be configured to receive a second transaction request sent by the target device control object, the second transaction request carries a second control instruction for controlling the target device, and the first control instruction and the second control instruction are different types of control instructions; the smart contract matching module can be configured to determine the first control smart contract corresponding to the second control instruction; the second transaction request response module can be configured to respond to the second transaction request, execute the first control smart contract, determine that the number of control times of the target device control object for controlling the target device is less than or equal to the first value, increase the number of control times of the target device control object for controlling the target device by one, and store the second transaction request on the chain in the blockchain system; the second transaction request on-chain storage module can be configured to send the second transaction request to the target device after the on-chain storage is successful, so that the target device executes the second control instruction.
[0231] In some embodiments, the first control smart contract is used to process the first control instruction of the first control type; wherein, the first control smart contract execution module 1403 may include: a first value matching submodule, the first value matching submodule may be used to determine that the number of times the target device control object performs the first control type on the target device is less than or equal to the first value, and the number of times the target device control object performs the first control type on the target device is increased by one; wherein, the blockchain-based device control device may also include: a second transaction request receiving module, a second control smart contract determination module, a second control smart contract execution module, and a second transaction request storage module.
[0232] Among them, the second transaction request receiving module can be used to receive a second transaction request sent by the target device control object, and the second transaction request carries a second control instruction for controlling the target device; the second control smart contract determination module can be used to determine the second control smart contract corresponding to the second control instruction, and the second control smart contract is used to process the second control instruction of the second control type, and the first control type and the second control type are different control types; the second control smart contract execution module can be used to respond to the second transaction request, execute the second control smart contract, determine that the number of times the target device control object controls the target device of the second control type is less than or equal to the second value, increase the number of times the target device control object controls the target device of the second control type by one, and store the second transaction request on the blockchain system; the second transaction request storage module can be used to send the second transaction request to the target device after successful on-chain storage, so that the target device executes the second control instruction.
[0233] In some embodiments, the request sending module 1404 may include: a first response smart contract determination submodule, a third value comparison submodule, and a first transaction sending submodule.
[0234] Among them, the first response smart contract determination submodule can be used to determine the first response smart contract corresponding to the first control smart contract, and the first response smart contract is used to process the response corresponding to the first control instruction; the third value comparison submodule can be used to determine, based on the first response smart contract, that the number of times the target device responds to the control instruction is less than or equal to the third value, and increase the number of times the target device responds to the control instruction by one; the first transaction sending submodule can be used to send the first transaction request to the target device.
[0235] In some embodiments, the first control smart contract is used to process the first control instruction of the first control type; wherein the third value comparison submodule may include: a control number comparison submodule and a number plus one submodule.
[0236] Among them, the control number comparison submodule can be used to determine, based on the first response smart contract, that the number of times the target device responds to the control instruction of the first control type is less than or equal to the third value; the number addition submodule can be used to add one to the number of times the target device responds to the control instruction of the first control type.
[0237] In some embodiments, the first response smart contract is used to control the number of first response tokens issued to the target device based on the third value; wherein the third value comparison submodule may include: a first response token determination unit and a first response token consumption unit.
[0238] Among them, the first response token determination unit can be used to determine whether the remaining number of the first response token of the target device is greater than or equal to the second number; the first response token consumption unit can be used to consume the second control token of the target device according to the second number.
[0239] In some embodiments, before receiving the first transaction request sent by the target device control object, the blockchain-based device control device also includes: a first control smart contract receiving module, a first block packaging module, a first consensus processing module and a first control smart contract deployment module.
[0240] The first control smart contract receiving module may be used to receive the first control smart contract sent by the target device control object; the first block packaging module may be used to package the first control smart contract into a first block; the first consensus processing module may be used to perform consensus processing on the first control smart contract in the first block; and the first control smart contract deployment module may be used to deploy the first control smart contract on the blockchain through the first block after consensus is passed.
[0241] In some embodiments, the blockchain-based device control device further includes: a first response smart contract receiving module, a second block packaging module, a second block consensus module, and a second block chain module.
[0242] Among them, the first response smart contract receiving module can be used to receive the first response smart contract sent by the target device control object; the second block packaging module can be used to package the first response smart contract to form a second block; the second block consensus module can be used to perform consensus processing on the first response smart contract in the second block; the second block chain module can be used to deploy the first response smart contract on the chain through the second block after the consensus is passed.
[0243] In some embodiments, the blockchain-based device control apparatus further includes: a third transaction request receiving module, a first response smart contract determination module, a third transaction request response module, and a third transaction request on-chain module.
[0244] Among them, the third transaction request receiving module can be used to receive the third transaction request returned by the target device in response to the first control instruction, and the third transaction request carries the first response for responding to the first control instruction; the first response smart contract determination module can be used to determine the first response smart contract corresponding to the first response; the third transaction request response module can be used to respond to the third transaction request, execute the first response smart contract, and store the third transaction request on the blockchain system; the third transaction request on-chain module can be used to send the third transaction request to the target device control object after successful on-chain storage.
[0245] Figure 15This is a block diagram of a device control apparatus based on blockchain according to an exemplary embodiment, which can be deployed in a target device of a blockchain system. Figure 15 The blockchain-based device control device 1500 provided by the embodiment of the present disclosure may include: a first transaction request receiving module, a first certificate acquisition module, a first relationship determination module, and an instruction execution module.
[0246] Among them, the first transaction request receiving module can be configured to receive a first transaction request sent by the target blockchain system, the first transaction request carries a first control instruction for controlling the target device, and the first transaction request is sent by the target device control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on-chain in the blockchain system; the first certificate acquisition module can be configured to obtain the target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system according to the association relationship between the device control object and the target device, and the device control object has control over the target device; the first relationship determination module can be configured to determine that the device control objects that have control over the target device include the target device control object based on the target certificate; the instruction execution module can be configured to execute the first control instruction in the first transaction request.
[0247] An embodiment of the present disclosure provides a blockchain-based device control device, which is deployed in a device control object. The device includes: a first transaction request sending module.
[0248] Among them, the first transaction request sending module can be configured to send a first transaction request to the blockchain system, and the first transaction request carries a first control instruction for controlling the target device, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target device; wherein the blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on the chain in the blockchain system.
[0249] In some embodiments, the blockchain-based device control apparatus may further include: a third transaction request acquisition module, a target certificate acquisition module, and a control right determination module.
[0250] Among them, the third transaction request acquisition module can be used to receive a third transaction request sent by the target device from the blockchain system, and the third transaction request carries a first response for responding to the first control instruction; the target certificate acquisition module can be used to obtain a target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system based on the association relationship between the target device control object and the target device, and the device control object has control over the target device; the control right determination module can be used to determine that the target device control object has control over the target device based on the target certificate, and then determine the response of the target device obtained by the first control instruction based on the first control instruction.
[0251] The embodiments of the present disclosure provide a device control apparatus based on blockchain, which can be deployed on a node device on a blockchain system; wherein the apparatus includes: a vehicle control object information receiving module, a control smart contract matching module, a smart contract execution module, and a vehicle information sending module.
[0252] Among them, the vehicle control object information receiving module can be used to receive a first transaction request sent by the target vehicle control object, and the first transaction request carries a first control instruction for controlling the target vehicle; the control smart contract matching module can be used to determine the first control smart contract corresponding to the first control instruction; the execution smart contract module can be used to respond to the first transaction request, execute the first control smart contract, determine that the number of controls performed by the target vehicle control object on the target vehicle is less than or equal to the first value, increase the number of controls performed by the target vehicle control object on the target vehicle by one, and store the first transaction request on the blockchain system; the information sending module to the vehicle can be used to send the first transaction request to the target vehicle after successful on-chain storage, so that the target vehicle executes the first control instruction.
[0253] In some embodiments, the blockchain-based device control apparatus may further include: a vehicle information receiving module, a response smart contract determination module, a response smart contract execution module, and a module for sending information to a vehicle control object.
[0254] Among them, the vehicle information receiving module can be used to receive the third transaction request returned by the target vehicle in response to the first control instruction, and the third transaction request carries the first response for responding to the first control instruction; the response smart contract determination module can be used to determine the first response smart contract corresponding to the first response; the response smart contract execution module can be used to respond to the third transaction request, execute the first response smart contract, and store the third transaction request on the blockchain system; the information sending module to the vehicle control object can be used to send the third transaction request to the target vehicle control object after successful on-chain storage.
[0255] An embodiment of the present disclosure provides a blockchain-based device control device. The blockchain-based device control device can be deployed on a target vehicle or on a terminal corresponding to the target vehicle. The device includes: a first control instruction receiving module, a certificate acquisition module, a control right determination module, and a first instruction execution module.
[0256] Among them, the first control instruction receiving module is used to receive a first transaction request sent by the target blockchain system, the first transaction request carries a first control instruction for controlling the target vehicle, and the first transaction request is sent by the target vehicle control object to the target blockchain system for on-chain storage. The blockchain system determines that the number of control times of the target vehicle control object for controlling the target vehicle is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of control times of the target vehicle control object for controlling the target vehicle, the first transaction request is stored on-chain in the blockchain system; the certificate acquisition module can be used to obtain the target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system according to the association relationship between the device control object and the target vehicle, and the device control object has control over the target vehicle; the control right determination module can be used to determine that the device control objects that have control over the target vehicle include the target vehicle control object based on the target certificate; the first instruction execution module can be used to execute the first control instruction in the first transaction request.
[0257] In some embodiments, the blockchain-based device control device may also include: a third transaction generation module, which is used to send a third transaction request to the blockchain system after the first control instruction is executed. The third transaction request carries a first response for responding to the first control instruction, so that after the third transaction request is successfully stored on the chain, the third transaction request is sent to the target vehicle control object.
[0258] An embodiment of the present disclosure provides a blockchain-based device control apparatus. The blockchain-based device control apparatus can be deployed in a device control object or on a terminal corresponding to the device control object. The apparatus includes: a module for sending a first transaction request to a blockchain, for sending a first transaction request to a blockchain system, the first transaction request carrying a first control instruction for controlling a target vehicle, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target vehicle; wherein the blockchain system determines, by executing a first control smart contract, that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, and after adding one to the number of times the target vehicle control object controls the target vehicle, stores the first transaction request on the chain in the blockchain system.
[0259] In some embodiments, the apparatus may further include: a first response receiving module, a certificate determining module, and a vehicle response obtaining module.
[0260] Among them, the first response receiving module can be used to receive a third transaction request sent by the target vehicle from the blockchain system, and the third transaction request carries a first response for responding to the first control instruction; the certificate determination module can be used to obtain a target certificate, and the target certificate is generated by the certificate issuing agency of the blockchain system according to the association relationship between the target vehicle control object and the target vehicle, and the device control object has control over the target vehicle; the vehicle response acquisition module can be used to determine that the target vehicle control object has control over the target vehicle based on the target certificate, and then determine the response of the target vehicle obtained by the first control instruction based on the first control instruction.
[0261] Since the functions of the above-mentioned devices have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0262] The modules and / or submodules described in the embodiments of the present application may be implemented in software or hardware. The modules and / or submodules described may also be provided in a processor. The names of these modules and / or submodules do not, in certain circumstances, limit the modules and / or submodules themselves.
[0263] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0264] Furthermore, the figures above are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the figures above do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0265] Figure 16 Schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure is shown. Figure 16 The electronic device 1600 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0266] like Figure 16 As shown, electronic device 1600 includes a central processing unit (CPU) 1601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1602 or a program loaded from a storage portion 1608 into a random access memory (RAM) 1603. Various programs and data required for the operation of electronic device 1600 are also stored in RAM 1603. CPU 1601, ROM 1602, and RAM 1603 are connected to each other via a bus 1604. An input / output (I / O) interface 1605 is also connected to bus 1604.
[0267] The following components are connected to the I / O interface 1605: an input section 1606 including a keyboard, a mouse, and the like; an output section 1607 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 1608 including a hard disk; and a communication section 1609 including a network interface card such as a LAN card or a modem. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to the I / O interface 1605 as needed. Removable media 1611, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1610 as needed, so that computer programs read therefrom can be installed into the storage section 1608 as needed.
[0268] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1609, and / or installed from the removable medium 1611. When the computer program is executed by the central processing unit (CPU) 1601, the above-mentioned functions defined in the system of the present application are executed.
[0269] It should be noted that the computer-readable storage medium shown in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical cable, RF, or any suitable combination thereof.
[0270] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed by a device, the device can implement functions including: receiving a first transaction request sent by a target device control object, the first transaction request carrying a first control instruction for controlling the target device; determining a first control smart contract corresponding to the first control instruction; responding to the first transaction request, executing the first control smart contract, determining that the number of control times the target device control object controls the target device is less than or equal to a first value, increasing the number of control times the target device control object controls the target device by one, and storing the first transaction request on the blockchain system; after successful storage on the blockchain, sending the first transaction request to the target device so that the target device executes the first control instruction.
[0271] When the above one or more programs are executed by a device, the device can also implement functions including: receiving a first transaction request sent by the target blockchain system, the first transaction request carries a first control instruction for controlling the target device, the first transaction request is sent by the target device control object to the target blockchain system for on-chain storage, the blockchain system determines that the number of control times of the target device control object for controlling the target device is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of control times of the target device control object for controlling the target device, the first transaction request is stored on-chain in the blockchain system; obtaining a target certificate, the target certificate is generated by a certificate issuing agency of the blockchain system according to the association relationship between the device control object and the target device, and the device control object has control over the target device; determining, based on the target certificate, that the device control object that has control over the target device includes the target device control object; and executing the first control instruction in the first transaction request.
[0272] When the one or more programs are executed by the device, the device can implement functions that may also include: sending a first transaction request to the blockchain system, the first transaction request carrying a first control instruction for controlling the target device, so that after the first transaction request is successfully stored on the chain, the first transaction is sent to the target device; wherein the blockchain system determines that the number of times the target device control object controls the target device is less than or equal to the first value by executing the first control smart contract, and after adding one to the number of times the target device control object controls the target device, the first transaction request is stored on the chain in the blockchain system.
[0273] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations of the above-described embodiments.
[0274] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computing device (which can be a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiment of the present disclosure, for example Figure 5 、 Figure 7 、 Figure 8、 Figure 9 、 Figure 10 、 Figure 11 、 Figure 12 or Figure 13 One or more of the steps shown.
[0275] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0276] It should be understood that the present disclosure is not limited to the detailed structures, drawings or implementations shown herein, but rather is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A device control method based on blockchain, characterized in that: The method is executed by a node device on a blockchain system, wherein the method includes: receiving a first transaction request sent by a target device control object, wherein the first transaction request carries a first control instruction for controlling the target device; Determining a first control smart contract corresponding to the first control instruction; In response to the first transaction request, executing the first control smart contract, determining that the number of times the target device control object controls the target device is less than or equal to a first value, incrementing the number of times the target device control object controls the target device by one, and storing the first transaction request on-chain in the blockchain system; The first transaction request is sent to the target device so that the target device executes the first control instruction.
2. The method according to claim 1, characterized in that The first control smart contract is used to control the number of first control tokens issued to the target device control object according to the first value; wherein, determining that the number of control times performed by the target device control object on the target device is less than or equal to the first value includes: Determining that the remaining number of the first control token of the control object of the target device is greater than or equal to the first number; The step of increasing the number of times the target device control object controls the target device by one includes: A first number of first control tokens of the target device control object is consumed.
3. The method according to claim 1, characterized in that The method further comprises: receiving a second transaction request sent by the target device control object, where the second transaction request carries a second control instruction for controlling the target device, and the first control instruction and the second control instruction are different types of control instructions; Determining a first control smart contract corresponding to the second control instruction; In response to the second transaction request, executing the first control smart contract, determining that the number of times the target device control object controls the target device is less than or equal to the first value, incrementing the number of times the target device control object controls the target device by one, and storing the second transaction request on-chain in the blockchain system; After the on-chain storage is successful, the second transaction request is sent to the target device so that the target device executes the second control instruction.
4. The method according to claim 1, characterized in that The first control smart contract is used to process a first control instruction of a first control type; wherein determining that the number of times the target device control object controls the target device is less than or equal to a first value, and increasing the number of times the target device control object controls the target device by one includes: determining that the number of times the target device control object performs the first control type on the target device is less than or equal to the first value, and incrementing the number of times the target device control object performs the first control type on the target device by one; The method further comprises: receiving a second transaction request sent by the target device control object, where the second transaction request carries a second control instruction for controlling the target device; Determining a second control smart contract corresponding to the second control instruction, where the second control smart contract is used to process a second control instruction of a second control type, where the first control type and the second control type are different control types; In response to the second transaction request, executing the second control smart contract, determining that the number of times the target device control object performs the second control type on the target device is less than or equal to a second value, incrementing the number of times the target device control object performs the second control type on the target device by one, and storing the second transaction request on-chain in the blockchain system; After the on-chain storage is successful, the second transaction request is sent to the target device so that the target device executes the second control instruction.
5. The method according to claim 1, characterized in that: Sending the first transaction request to the target device includes: Determining a first response smart contract corresponding to the first control smart contract, where the first response smart contract is used to process a response corresponding to the first control instruction; Determining, according to the first response smart contract, that the number of times the target device responds to the control instruction is less than or equal to a third value, and incrementing the number of times the target device responds to the control instruction by one; The first transaction request is sent to the target device.
6. The method according to claim 5, characterized in that The first control smart contract is used to process a first control instruction of a first control type; wherein, according to the first response smart contract, determining that the number of times the target device responds to the control instruction is less than or equal to a third value, and increasing the number of times the target device responds to the control instruction by one, includes: Determining, according to the first response smart contract, that the number of times the target device responds to the control instruction of the first control type is less than or equal to the third value; The number of times the target device responds to the control instruction of the first control type is increased by one.
7. The method according to claim 5, characterized in that The first response smart contract is used to control the number of first response tokens issued to the target device according to the third value; wherein, according to the first response smart contract, it is determined that the number of times the target device responds to the control instruction is less than or equal to the third value, and the number of times the target device responds to the control instruction is increased by one, including: Determining that a remaining number of first response tokens of the target device is greater than or equal to a second number; A second control token of the target device is consumed in a second quantity.
8. The method according to claim 1, characterized in that: The method further comprises: receiving a third transaction request returned by the target device in response to the first control instruction, wherein the third transaction request carries a first response for responding to the first control instruction; Determining a first response smart contract corresponding to the first response; Responding to the third transaction request, executing the first response smart contract, and storing the third transaction request on-chain in the blockchain system; After the on-chain storage is successful, the third transaction request is sent to the target device control object.
9. A device control method based on blockchain, characterized in that: The blockchain-based device control method is executed by a target device, and the method includes: Receiving a first transaction request sent by a target blockchain system, the first transaction request carrying a first control instruction for controlling a target device, the first transaction request being sent by a target device control object to the target blockchain system for on-chain storage, the blockchain system determining, by executing a first control smart contract, that a number of control times performed by the target device control object on the target device is less than or equal to a first value, incrementing the number of control times performed by the target device control object on the target device by one, and then storing the first transaction request on-chain in the blockchain system; Obtaining a target certificate, where the target certificate is generated by a certificate issuing agency of the blockchain system based on an association between a device control object and the target device, and the device control object has control over the target device; Determining, according to the target certificate, that a device control object having control rights over the target device includes the target device control object; executing the first control instruction in the first transaction request; After the execution of the first control instruction is completed, a third transaction request is sent to the blockchain system, where the third transaction request carries a first response for responding to the first control instruction, so that after the third transaction request is successfully stored on the chain, the third transaction request is sent to the target device control object.
10. A device control method based on blockchain, characterized in that: The blockchain-based device control method is executed by a device control object, and the method includes: Sending a first transaction request to the blockchain system, where the first transaction request carries a first control instruction for controlling a target device, so that after the first transaction request is successfully stored on the blockchain, the first transaction is sent to the target device; The blockchain system determines that the number of times the target device control object controls the target device is less than or equal to a first value by executing the first control smart contract, increases the number of times the target device control object controls the target device by one, and then stores the first transaction request on-chain in the blockchain system.
11. The method according to claim 10, characterized in that: The method further comprises: receiving, from the blockchain system, a third transaction request sent by the target device, where the third transaction request carries a first response for responding to the first control instruction; Obtaining a target certificate, where the target certificate is generated by a certificate issuing authority of the blockchain system based on an association between a target device control object and the target device, and the device control object has control over the target device; It is determined according to the target certificate that the target device control object has control rights over the target device, and then a response of the target device obtained by the first control instruction is determined according to the first control instruction.
12. A device control method based on blockchain, characterized in that: The method is performed by a node device on a blockchain system; wherein the method includes: receiving a first transaction request sent by a target vehicle control object, wherein the first transaction request carries a first control instruction for controlling the target vehicle; Determining a first control smart contract corresponding to the first control instruction; In response to the first transaction request, executing the first control smart contract, determining that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, incrementing the number of times the target vehicle control object controls the target vehicle by one, and storing the first transaction request on-chain in the blockchain system; After the on-chain storage is successful, the first transaction request is sent to the target vehicle so that the target vehicle executes the first control instruction.
13. A device control method based on blockchain, characterized in that: The blockchain-based device control method is executed by a target vehicle, and the method includes: Receiving a first transaction request sent by a target blockchain system, the first transaction request carrying a first control instruction for controlling a target vehicle, the first transaction request being sent by a target vehicle control object to the target blockchain system for on-chain storage, the blockchain system determining, by executing a first control smart contract, that a number of times the target vehicle control object controls the target vehicle is less than or equal to a first value, incrementing the number of times the target vehicle control object controls the target vehicle by one, and then storing the first transaction request on-chain in the blockchain system; Obtaining a target certificate, where the target certificate is generated by a certificate issuing authority of the blockchain system based on an association between a device control object and the target vehicle, and the device control object has control over the target vehicle; Determining, based on the target certificate, that a device control object having control rights over the target vehicle includes the target vehicle control object; Execute the first control instruction in the first transaction request.
14. A device control method based on blockchain, characterized in that: The blockchain-based device control method is executed by a device control object, and the method includes: Sending a first transaction request to the blockchain system, where the first transaction request carries a first control instruction for controlling a target vehicle, so that after the first transaction request is successfully stored on the blockchain, the first transaction is sent to the target vehicle; The blockchain system determines that the number of times the target vehicle control object controls the target vehicle is less than or equal to a first value by executing the first control smart contract, adds one to the number of times the target vehicle control object controls the target vehicle, and then stores the first transaction request on the blockchain system.
15. A device control device based on blockchain, characterized in that: The device is deployed in a node device of a blockchain system; wherein the device includes: a first transaction request acquiring module configured to receive a first transaction request sent by a target device control object, wherein the first transaction request carries a first control instruction for controlling the target device; a first control smart contract determination module, configured to determine a first control smart contract corresponding to the first control instruction; a first control smart contract execution module, configured to respond to the first transaction request, execute the first control smart contract, determine that a number of times the target device control object controls the target device is less than or equal to a first value, increment the number of times the target device control object controls the target device by one, and store the first transaction request on-chain in the blockchain system; The request sending module is configured to send the first transaction request to the target device after successful on-chain storage, so that the target device executes the first control instruction.
16. A device control device based on blockchain, characterized in that: The blockchain-based device control device is deployed in the target device, and the device includes: A first transaction request receiving module is configured to receive a first transaction request sent by a target blockchain system, the first transaction request carrying a first control instruction for controlling a target device, the first transaction request being sent by a target device control object to the target blockchain system for on-chain storage, the blockchain system determining, by executing a first control smart contract, that a number of control times by the target device control object for controlling the target device is less than or equal to a first value, incrementing the number of control times by the target device control object for controlling the target device by one, and then storing the first transaction request on-chain in the blockchain system; a first certificate acquisition module configured to acquire a target certificate, the target certificate being generated by a certificate issuing authority of the blockchain system based on an association between a device control object and the target device, the device control object having control over the target device; a first relationship determination module configured to determine, based on the target certificate, that a device control object having control rights over the target device includes the target device control object; An instruction execution module is configured to execute the first control instruction in the first transaction request.
17. A device control device based on blockchain, characterized in that: The blockchain-based device control device is deployed in the device control object, and the device includes: a first transaction request sending module configured to send a first transaction request to the blockchain system, wherein the first transaction request carries a first control instruction for controlling a target device, so as to send the first transaction to the target device after the first transaction request is successfully stored on the blockchain; The blockchain system determines that the number of times the target device control object controls the target device is less than or equal to a first value by executing the first control smart contract, increases the number of times the target device control object controls the target device by one, and then stores the first transaction request on-chain in the blockchain system.
18. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the blockchain-based device control method according to any one of claims 1-8, 9, 10-11, 12, 13, or 14 based on instructions stored in the memory.
19. A computer-readable storage medium, characterized in that A program is stored thereon, which, when executed by a processor, implements the blockchain-based device control method as described in any one of claims 1-8, 9, 10-11, 12, 13 or 14.
20. A computer program product comprising computer instructions stored in a computer-readable storage medium, wherein: When the computer instructions are executed by a processor, the method of any one of claims 1-8, 9, 10-11, 12, 13 or 14 is implemented.
Citation Information
Patent Citations
Method and device for determining intelligent contract language performance of block chain
CN112486464A
Computation and prediction of linked access
US20210318870A1