CN114462096A - Block chain-based Internet of things equipment control method and device, computer equipment and storage medium - Google Patents

Block chain-based Internet of things equipment control method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114462096A
CN114462096A CN202111643778.0A CN202111643778A CN114462096A CN 114462096 A CN114462096 A CN 114462096A CN 202111643778 A CN202111643778 A CN 202111643778A CN 114462096 A CN114462096 A CN 114462096A
Authority
CN
China
Prior art keywords
internet
intelligent contract
block chain
things
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111643778.0A
Other languages
Chinese (zh)
Inventor
李伟
张珂杰
汪晓可
邱炜伟
黄方蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202111643778.0A priority Critical patent/CN114462096A/en
Publication of CN114462096A publication Critical patent/CN114462096A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y30/00IoT infrastructure
    • G16Y30/10Security thereof
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y40/00IoT characterised by the purpose of the information processing
    • G16Y40/50Safety; Security of things, users, data or systems

Abstract

The invention relates to the technical field of block chains, and discloses a block chain-based Internet of things equipment control method and device, computer equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining an equipment control rule, generating an intelligent contract according to the equipment control rule and a preset intelligent contract template, deploying the intelligent contract to a block chain, receiving event information to be processed according to a preset service protocol if the event information to be processed uploaded by the Internet of things equipment is detected, obtaining a request block transaction according to the event information to be processed and the intelligent contract, obtaining a block chain event set according to the request block transaction and the intelligent contract, controlling the Internet of things equipment according to the block chain event set and a preset calling protocol, and improving the safety of the Internet of things equipment.

Description

Block chain-based Internet of things equipment control method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of block chains, in particular to a block chain-based Internet of things equipment control method and device, computer equipment and a storage medium.
Background
With the development of network and computer technologies, the technology of internet of things has been developed rapidly, and more devices can be connected to the network to realize intelligent monitoring and control of the devices. The terminal of the internet of things or the equipment of the internet of things comprises an intelligent washing machine, an intelligent charging pile, an intelligent blower, a massage chair, a rocking car, a doll grabbing machine, an intelligent television, an intelligent lamp, an intelligent air conditioner and the like.
Although the internet of things provides convenience and comfort for life of people, the internet of things equipment is mainly remotely monitored through the internet of things cloud platform, and the internet of things cloud platform opens an interface to the internet of things equipment or the internet of things terminal for a long time, so that the internet of things equipment or the internet of things terminal is easy to be attacked maliciously, for example, network threats such as hacking and the like, when the internet of things cloud platform is attacked by hacking and the like, an intruder can perform unauthorized control on the internet of things equipment and hurt a user in various ways, for example, a camera is intruded by a hacker, privacy of the user is damaged, or related internet of things equipment is forbidden to execute lasso software attack and redemption is required as a reward, so that the security of the internet of things terminal or the internet of things equipment is low, and potential safety hazards are large.
Disclosure of Invention
The embodiment of the invention provides a block chain-based Internet of things equipment control method and device, computer equipment and a storage medium, so as to improve the safety of controlling the Internet of things equipment.
In order to solve the technical problem, an embodiment of the present application provides a method for controlling an internet of things device based on a block chain, including:
acquiring a device control rule;
generating an intelligent contract according to the equipment control rule and a preset intelligent contract template, and deploying the intelligent contract to a block chain;
if the to-be-processed event information uploaded by the Internet of things equipment is detected, receiving the to-be-processed event information according to a preset service protocol;
obtaining request block transaction according to the event information to be processed and the intelligent contract;
acquiring a block chain event set according to the request block transaction and the intelligent contract;
and controlling the Internet of things equipment according to the block chain event set and a preset calling protocol.
In order to solve the above technical problem, an embodiment of the present application further provides an internet of things device control apparatus based on a block chain, including:
the rule acquisition module is used for acquiring the equipment control rule;
the contract generation module is used for generating an intelligent contract according to the equipment control rule and a preset intelligent contract template and deploying the intelligent contract to the block chain;
the information receiving module is used for receiving the event information to be processed according to a preset service protocol if the event information to be processed uploaded by the Internet of things equipment is detected;
the request block transaction acquisition module is used for acquiring a request block transaction according to the to-be-processed event information and the intelligent contract;
the event acquisition module is used for acquiring a block chain event set according to the request block transaction and the intelligent contract;
and the first control module is used for controlling the Internet of things equipment according to the block chain event set and a preset calling protocol.
In order to solve the technical problem, an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for controlling an internet of things device based on a block chain when executing the computer program.
In order to solve the technical problem, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of the above method for controlling an internet of things device based on a block chain.
The method, the device, the computer equipment and the storage medium for controlling the Internet of things equipment based on the block chain provided by the embodiment of the invention have the advantages that by acquiring the equipment control rule, generating an intelligent contract according to the equipment control rule and a preset intelligent contract template, deploying the intelligent contract to a block chain, receiving the information of the event to be processed according to a preset service protocol if the information of the event to be processed uploaded by the equipment of the Internet of things is detected, obtaining request block transaction according to the information of the event to be processed and the intelligent contract, obtaining a block chain event set according to the request block transaction and the intelligent contract, controlling the Internet of things equipment according to the block chain event set and a preset calling protocol, generating an intelligent contract according to an equipment control rule and a preset intelligent contract template, and the intelligent contract is deployed to the block chain, and the safety of the equipment for controlling the Internet of things is improved through the intelligent contract.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive labor.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
fig. 2 is a flowchart of an embodiment of a device control method for an internet of things based on a block chain according to the present application;
fig. 3 is a schematic structural diagram of an embodiment of a device control apparatus for internet of things based on a block chain according to the application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Referring to fig. 1, as shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that the method for controlling an internet of things device based on a block chain provided in the embodiment of the present application is executed by a server, and accordingly, the apparatus for controlling an internet of things device based on a block chain is disposed in the server.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. Any number of terminal devices, networks and servers may be provided according to implementation needs, and the terminal devices 101, 102 and 103 in this embodiment may specifically correspond to an application system in actual production.
Referring to fig. 2, fig. 2 shows a method for controlling an internet of things device based on a block chain according to an embodiment of the present invention, which is described by taking the application of the method to the server in fig. 1 as an example, and is detailed as follows:
s201: and acquiring a device control rule.
Specifically, the user may write the device control rule in the form of filling in a form or writing a script, where the device control rule includes a trigger condition and an action, where the trigger condition may be a judgment statement, that is, whether a certain attribute of an event satisfies a certain condition, the action may be a series of operations, and the change may include, but is not limited to, calculation, server-side RPC call, and in addition, the device control rule includes, but is not limited to, a block chain account address, an attribute name, a comparison mode, and a numerical value of an internet-of-things involved pen. In the present invention, the appliance control rule may be an IFTTT rule, which is a service That can create a flow following a simple logic instruction of "(IF) IF a set condition (This) is satisfied, Then (Then) triggers a specified operation (thin)".
Further, in step S201, the step of obtaining the device control rule further includes:
and carrying out syntax check and service call check on the equipment control rule.
Specifically, the device control rule further includes user information, and service invocation check is performed on the device control rule according to the user information and preset user registration information, where the user information may be a user account, the service invocation check is to check whether the user information has an operation right on the internet of things device declared in an action to be executed in the device control rule and whether the internet of things device provides the service, the syntax check includes checking whether a device name and a device method in the device control rule include illegal characters, and whether a method parameter conforms to a preset format, where the preset format may be a json format, such as filling in a trigger condition (temperature sensor, temperature, greater than, 30), and executing the action (air conditioner, open, { "state": 1 }). The method comprises the steps that whether a temperature sensor and an air conditioner exist in a system or not is checked by an Internet of things platform, whether a user has the right to operate the two devices or not is checked, whether the temperature sensor has the attribute of temperature or not, and whether the air conditioner has an open or not is checked.
S202: and generating an intelligent contract according to the equipment control rule and a preset intelligent contract template, and deploying the intelligent contract to the block chain.
Specifically, the preset intelligent contract template comprises a plurality of placeholders, a VerifyEvents method, a getattrib method, an invoke method and a reply method, wherein the placeholders are used for replacing the block chain account addresses, the attribute names, the comparison modes, the numerical values, the actions and the like of the internet of things equipment in the equipment control rule, for example, #1, #2, #3, #4, #5 are placeholders in the preset intelligent contract template, and the placeholders are replaced according to the equipment control rule, specifically, #1 is replaced by the block chain account addresses of the equipment, #2 is replaced by the attribute names, #3 is replaced by the comparison modes, #4 is replaced by the numerical values, and #5 is replaced by the actions;
the VerifyEvents method is used for verifying to-be-processed event information uploaded by the internet of things equipment, and specifically comprises the following steps: verifying whether the signature in the event information to be processed is a digital signature obtained by calculating the device name, the attribute value and the timestamp by adopting an encryption algorithm (such as a Hash algorithm) and verifying whether the device address of the equipment of the Internet of things is authorized;
the GetAttribute method is used for extracting attribute values from the to-be-processed event information uploaded by the Internet of things equipment;
the invoke method comprises two parameters (UUID, events), wherein the events is a character string message in a json format sent to an internet of things platform by an internet of things device, the UUID is an abbreviation of a universal Unique Identifier (universal Unique Identifier), the UUID is a standard for software construction, the UUID is also a part of an open software fund organized in the field of distributed computing environments, and in the application, the feature code which needs to be transmitted when the internet of things platform calls the contract method is used for returning the reply method after the correlation;
the reply method includes two parameters (uuid, reply), wherein the reply includes (success or failure, error information), the calling of the reply method will generate a block chain event, the subject of the block chain event is "reply", and the content is (requestId, reply) encapsulated character string.
S203: and if the to-be-processed event information uploaded by the Internet of things equipment is detected, receiving the to-be-processed event information according to a preset service protocol.
Specifically, the event information to be processed includes, but is not limited to, a signature, a device name, an attribute value, and a timestamp, wherein the digital signature may be obtained by calculating the device name, the attribute value, and the timestamp by using an encryption algorithm (such as a hash algorithm, an asymmetric encryption algorithm, and a symmetric encryption algorithm), the preset service protocol is a protocol agreed by the internet of things device and the internet of things platform, and the common protocols include an mqtt protocol and an http protocol.
Illustratively, the to-be-processed event information is specifically: { "deviceID": temperature sensor, "temp": 35, "timeframe": 1637218269117, "signature": "0094004 b40e3f061c7e1c08c96d3c763df45150a0708ff3bf8f18ba42d116d3cdf2c0836ed87498ae5f115df80063c9ea9dd2b6e88708e83df580017d6d5c 7388000" }, where the temperature sensor is the device name, temp is the attribute name, 35 is the attribute value, 1637218269117 is the timestamp, 0094004b40e3f061c7e1c08c96d3c763df45150a0708ff3bf8f18ba42d116d3cdf2c0836ed87498ae5f115df80063c9ea9dd2b6e88708 d 83 580017d6 c 7300 is the digital signature calculated using the device name, internet of things, the attributes, and the time of the internet of things.
S204: and obtaining the request block transaction according to the event information to be processed and the intelligent contract.
Specifically, the request block transaction comprises a data field, a from field, a to field and a signature field, after the internet of things platform receives information of an event to be processed uploaded by the internet of things equipment, a uuid is generated firstly, then an invoke method of an intelligent contract is called to a block chain, the uuid and the information of the event to be processed are used as parameters of the invoke method, the uuid and the information of the event to be processed are called to agree according to an EVM intelligent contract, the uuid and the information of the event to be processed are coded into 16-system character strings to be used as the data field of the request block transaction, an account address of the internet of things platform is used as the from field of the request block transaction, an address of the intelligent contract is used as the to field of the request block transaction, and a private key of the internet of things platform is used for signing the (from, to, data) field to be used as the signature field of the request block transaction.
S205: and acquiring a block chain event set according to the request block transaction and the intelligent contract.
Specifically, the block chain event set comprises at least one block chain event, the block transaction is requested to be used as a request body of an http protocol, sendtransmission transaction (namely block transaction request) is continuously sent to the block chain through an http post request until the block transaction is successfully sent or the number of sending times exceeds a preset number, wherein the preset number of sending times is defined according to an actual application scene, when the sending is successful, the block chain checks the legality of the block transaction request, namely, whether a signature field of the block transaction request can pass a signature verification process of the block chain is judged, after the verification is passed, an invoke method in an intelligent contract is called and executed, and a corresponding block chain event is output. It should be particularly noted that one device control rule may trigger multiple actions, and therefore pending event information uploaded by one internet of things device may generate multiple blockchain events. For example, when the temperature is higher than 30 degrees, a plurality of events including turning on an air conditioner, turning on a shower head to water trees and the like are set in the event information to be processed.
S206: and controlling the Internet of things equipment according to the block chain event set and a preset calling protocol.
Specifically, the preset calling protocol is a protocol agreed by the internet of things platform and the internet of things equipment, the common protocols include an mqtt protocol and an http protocol, and the RPC service method provided by the internet of things equipment is called through the preset calling protocol to control the internet of things equipment.
In the embodiment, an equipment control rule is obtained, an intelligent contract is generated according to the equipment control rule and a preset intelligent contract template, the intelligent contract is deployed to a block chain, if the to-be-processed event information uploaded by the internet of things equipment is detected, the to-be-processed event information is received according to a preset service protocol, a request block transaction is obtained according to the to-be-processed event information and the intelligent contract, a block chain event set is obtained according to the request block transaction and the intelligent contract, the internet of things equipment is controlled according to the block chain event set and a preset calling protocol, the intelligent contract is generated according to the equipment control rule and the preset intelligent contract template, the intelligent contract is deployed to the block chain, and safety of the control equipment is improved through the intelligent contract.
In some optional implementation manners of this embodiment, in step S202, the device control rule includes at least one rule information, the preset intelligent contract template includes a placeholder corresponding to the rule information, and generating the intelligent contract according to the device control rule and the preset intelligent contract template includes:
and carrying out validity verification on the equipment control rule by adopting a preset intelligent contract template to obtain a verification result.
Specifically, the preset intelligent contract template comprises a VerifyEvents method, the equipment control rule carries a digital signature, and the digital signature of the equipment control rule is verified through the VerifyEvents method.
And if the verification result is legal, extracting the rule information, and replacing the corresponding placeholder with the rule information to generate the intelligent contract.
Specifically, the rule information includes, but is not limited to, a device name, an attribute value, a timestamp, a digital signature, and a placeholder, which are symbols preset in a preset intelligent contract template, for replacing parameters or attributes in the rule information.
In this embodiment, the device control rule is verified by a VerifyEvents method in a preset intelligent contract template, so that the security of controlling the internet of things device is improved.
In some optional implementations of this embodiment, in step S204, obtaining the requested block transaction according to the to-be-processed event information and the smart contract includes:
when the event information to be processed is received, an event request code is generated.
Specifically, the event request code is uuid, which is an abbreviation of universal Unique Identifier (universal Unique Identifier), is a standard for software construction, and is also a part of the field of distributed computing environments organized by the open software foundation.
And calling an intelligent contract, and encapsulating the event information to be processed and the event request code to obtain the request block transaction.
Specifically, an invoke method of the intelligent contract is called to the block chain, and the event information to be processed and the event request code are packaged and processed to obtain the request block transaction.
In the embodiment, the event information to be processed and the event request code are encapsulated through the intelligent contract, so that the safety of controlling the equipment of the Internet of things is improved.
In some optional implementations of this embodiment, in step S205, acquiring the blockchain event set according to the request blockchain transaction and the smart contract includes:
and uploading the request block transaction to a block chain for validity verification to obtain a request verification result.
Specifically, the request block transaction comprises a corresponding digital signature, the request block transaction is an http request body, the http request body is uploaded to a block chain through an http protocol, the block chain calls a VerifyEvents method in an intelligent contract to verify the validity of the digital signature of the request block transaction, and the request verification result comprises a legal result and an illegal result.
And if the request verification result is legal, calling and executing the intelligent contract to obtain a first execution output result.
Specifically, the first execution output result is a blockchain event set, the blockchain event set includes at least one blockchain event, the blockchain event includes a subject and a content, where the subject may be "RESPONSE" and the content may be a character string encapsulated by (requestId, RESPONSE), and the blockchain outputs the first execution output result by calling and executing a reply method in the smart contract.
And taking the first execution output result as a block chain event set.
In the embodiment, the validity of the request block transaction is verified through the intelligent contract, so that the safety of controlling the internet of things equipment is improved.
In some optional implementation manners of this embodiment, in step S206, controlling the internet of things device according to the blockchain event set and the preset invoking protocol includes the following steps S2060 to S2061:
step S2060: and calling a remote service method of the Internet of things equipment according to the block chain event set and a preset calling protocol.
Specifically, the preset calling protocol may be an http protocol, and the remote service method of the corresponding internet of things device is called through the http protocol, where the remote service method is an RPC service method built in the internet of things device.
Step S2061: and controlling the corresponding Internet of things equipment according to the remote service method.
Specifically, the corresponding Internet of things equipment is controlled through the block chain event set and the preset calling protocol, and the safety of controlling the Internet of things equipment is improved.
In some optional implementation manners of this embodiment, in step S2061, according to the blockchain event set and the preset invoking protocol, after invoking the remote service method of the internet of things device, the method further includes:
and acquiring a calling result of the remote service method.
And calling and executing the intelligent contract according to the calling result to obtain a second execution output result.
Specifically, the second execution output result is a block chain event, and when the internet of things platform receives the call result, the internet of things platform calls a reply method of the intelligent contract and executes the reply method to obtain a second execution output result.
And taking the second execution output result as a block chain event.
When the calling result is traced, the block chain event is sent to the Internet of things equipment.
In the embodiment, the block chain event is obtained by calling and executing the intelligent contract, the safety of controlling the Internet of things equipment is improved, the block chain event is sent to the Internet of things equipment for the user to look up, the transparency of the Internet of things platform for controlling the Internet of things equipment is improved, the trust of the user on the Internet of things platform is further improved, and the reliability of the Internet of things platform is improved.
Further, the second execution output result is added to the first execution output result, and a final execution result is obtained.
When the equipment control rules are traced, the final execution result is sent to the Internet of things equipment.
In the embodiment, the final execution result is sent to the Internet of things equipment for the user to look up, so that the transparency of the Internet of things platform for controlling the Internet of things equipment is improved, the trust of the user on the Internet of things platform is further improved, and the reliability of the Internet of things platform is improved.
Further, when the device control rule is traced, the first execution output result and/or the second execution output result is pushed to the message queue service.
And according to the message queue service, obtaining a first execution output result and/or a second execution output result and outputting the first execution output result and/or the second execution output result to the corresponding Internet of things equipment.
Specifically, a corresponding block chain event is obtained by subscribing to the block chain event served by the message queue, and is output to the corresponding internet of things device.
In this embodiment, the transparency of the internet of things platform for controlling the internet of things equipment is improved by outputting the first execution output result and/or the second execution output result to the corresponding internet of things equipment for the user to look up, so that the trust of the user on the internet of things platform is further improved, and the reliability of the internet of things platform is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by functions and internal logic of the process, and should not limit the implementation process of the embodiments of the present invention in any way.
Fig. 3 is a schematic block diagram of the device for controlling an internet of things based on a block chain, which corresponds to the method for controlling an internet of things based on a block chain according to the foregoing embodiment. As shown in fig. 3, the device for controlling an internet of things based on a blockchain includes a rule obtaining module 30, a contract generating module 31, an information receiving module 32, a request blocktransaction obtaining module 33, an event obtaining module 34, and a first control module 35. The functional modules are explained in detail as follows:
and a rule obtaining module 30, configured to obtain the device control rule.
And the contract generating module 31 is configured to generate an intelligent contract according to the device control rule and a preset intelligent contract template, and deploy the intelligent contract to the block chain.
The information receiving module 32 is configured to receive the to-be-processed event information according to a preset service protocol if the to-be-processed event information uploaded by the internet of things device is detected.
And the request block transaction obtaining module 33 is configured to obtain a request block transaction according to the to-be-processed event information and the intelligent contract.
And the event acquisition module 34 is configured to acquire a blockchain event set according to the requested blockchain transaction and the smart contract.
The first control module 35 is configured to control the internet of things device according to the blockchain event set and a preset calling protocol.
Optionally, the device control rule includes at least one rule information, and the contract generating module 31 includes:
and the validity verification module is used for verifying the validity of the equipment control rule by adopting a preset intelligent contract template to obtain a verification result.
And the judging module is used for extracting the rule information if the verification result is legal, and replacing the corresponding placeholder with the rule information to generate the intelligent contract.
Optionally, the request block transaction obtaining module 33 includes:
and the code generating module is used for generating the event request code when receiving the event information to be processed.
And the code packaging module is used for calling the intelligent contract, packaging the event information to be processed and the event request code and obtaining the request block transaction.
Optionally, the event acquiring module 34 includes:
and the transaction uploading module is used for uploading the request block transaction to the block chain for validity verification to obtain a request verification result.
And the contract execution module is used for calling and executing the intelligent contract to acquire a first execution output result if the request verification result is legal.
And the event determining module is used for taking the first execution output result as the block chain event set.
Optionally, the first control module 35 includes:
and the service method calling module is used for calling a remote service method of the equipment of the Internet of things according to the block chain event set and a preset calling protocol.
And the second control module is used for controlling the Internet of things equipment according to the remote service method.
For specific limitations of the device for controlling an internet of things device based on a block chain, reference may be made to the above limitations of the method for controlling an internet of things device based on a block chain, which are not described herein again. All or part of each module in the device control apparatus for internet of things based on the block chain can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only the computer device 4 having the components connection memory 41, processor 42, network interface 43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or D interface display memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as program codes for controlling electronic files. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute the program code stored in the memory 41 or process data, such as program code for executing control of an electronic file.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
The present application provides another embodiment, which is to provide a computer-readable storage medium storing an interface display program, where the interface display program is executable by at least one processor to cause the at least one processor to execute the steps of the method for controlling a device of an internet of things based on a block chain as described above.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A block chain-based Internet of things equipment control method is characterized by comprising the following steps:
acquiring a device control rule;
generating an intelligent contract according to the equipment control rule and a preset intelligent contract template, and deploying the intelligent contract to a block chain;
if the to-be-processed event information uploaded by the Internet of things equipment is detected, receiving the to-be-processed event information according to a preset service protocol;
obtaining a request block transaction according to the event information to be processed and the intelligent contract;
acquiring a block chain event set according to the request block transaction and the intelligent contract;
and controlling the Internet of things equipment according to the block chain event set and a preset calling protocol.
2. The method for controlling device of internet of things based on block chain according to claim 1, wherein the device control rule includes at least one rule information, the preset intelligent contract template includes a placeholder corresponding to the rule information, and the generating an intelligent contract according to the device control rule and the preset intelligent contract template includes:
carrying out validity verification on the equipment control rule by adopting the preset intelligent contract template to obtain a verification result;
and if the verification result is legal, extracting the rule information, and replacing the corresponding placeholder with the rule information to generate the intelligent contract.
3. The method for controlling devices of the internet of things based on the blockchain according to claim 1, wherein the obtaining of the requested blockchain transaction according to the to-be-processed event information and the smart contract comprises:
when the event information to be processed is received, generating an event request code;
and calling the intelligent contract, and packaging the to-be-processed event information and the event request code to obtain a request block transaction.
4. The method for controlling a device of the internet of things based on a blockchain according to claim 1, wherein the obtaining a set of blockchain events according to the requested blockchain transaction and the smart contract comprises:
uploading the request block transaction to a block chain for validity verification to obtain a request verification result;
if the request verification result is legal, calling and executing the intelligent contract to obtain a first execution output result;
and taking the first execution output result as the block chain event set.
5. The method as claimed in claim 1, wherein the controlling the internet of things device according to the blockchain event set and a preset invoking protocol includes:
calling a remote service method of the Internet of things equipment according to the block chain event set and the preset calling protocol;
and controlling the Internet of things equipment according to the remote service method.
6. The blockchain-based internet of things device control method according to claim 5, further comprising, after the invoking the remote service method of the internet of things device according to the blockchain event set and the preset invoking protocol:
obtaining a calling result of the remote service method;
calling and executing the intelligent contract according to the calling result to obtain a second execution output result;
taking the second execution output result as a blockchain event;
and when the calling result is traced, sending the block chain event to the Internet of things equipment.
7. The utility model provides a thing networking equipment control device based on block chain which characterized in that, thing networking equipment control device based on block chain includes:
the rule acquisition module is used for acquiring the equipment control rule;
the contract generation module is used for generating an intelligent contract according to the equipment control rule and a preset intelligent contract template and deploying the intelligent contract to the block chain;
the information receiving module is used for receiving the event information to be processed according to a preset service protocol if the event information to be processed uploaded by the Internet of things equipment is detected;
the request block transaction acquisition module is used for acquiring a request block transaction according to the to-be-processed event information and the intelligent contract;
the event acquisition module is used for acquiring a block chain event set according to the request block transaction and the intelligent contract;
and the first control module is used for controlling the Internet of things equipment according to the block chain event set and a preset calling protocol.
8. The blockchain-based internet of things device control apparatus of claim 7, wherein the device control rule includes at least one rule information, and the contract generation module includes:
the validity verification module is used for verifying the validity of the equipment control rule by adopting the preset intelligent contract template to obtain a verification result;
and the judging module is used for extracting the rule information if the verification result is legal, replacing the corresponding placeholder with the rule information and generating the intelligent contract.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor when executing the computer program implements the method for controlling a device of the internet of things based on a blockchain according to any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for controlling a device of the internet of things based on a block chain according to any one of claims 1 to 6.
CN202111643778.0A 2021-12-29 2021-12-29 Block chain-based Internet of things equipment control method and device, computer equipment and storage medium Pending CN114462096A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111643778.0A CN114462096A (en) 2021-12-29 2021-12-29 Block chain-based Internet of things equipment control method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111643778.0A CN114462096A (en) 2021-12-29 2021-12-29 Block chain-based Internet of things equipment control method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114462096A true CN114462096A (en) 2022-05-10

Family

ID=81408117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111643778.0A Pending CN114462096A (en) 2021-12-29 2021-12-29 Block chain-based Internet of things equipment control method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114462096A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115334038A (en) * 2022-08-20 2022-11-11 信通院(江西)科技创新研究院有限公司 APPID application management method and system based on block chain
CN116663026A (en) * 2023-06-01 2023-08-29 北京网藤科技有限公司 Block chain-based data processing method and device, electronic equipment and medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115334038A (en) * 2022-08-20 2022-11-11 信通院(江西)科技创新研究院有限公司 APPID application management method and system based on block chain
CN115334038B (en) * 2022-08-20 2024-03-26 信通院(江西)科技创新研究院有限公司 APPID application management method and system based on blockchain
CN116663026A (en) * 2023-06-01 2023-08-29 北京网藤科技有限公司 Block chain-based data processing method and device, electronic equipment and medium
CN116663026B (en) * 2023-06-01 2024-01-26 北京网藤科技有限公司 Block chain-based data processing method and device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN105282088A (en) Method and system for controlling verification server and method and system for controlling verification
CN114462096A (en) Block chain-based Internet of things equipment control method and device, computer equipment and storage medium
CN103744686A (en) Control method and system for installing application in intelligent terminal
CN114070583B (en) Information access control method, device, computer equipment and medium
CN112200949B (en) Entrance guard starting method and device and identity verification system
CN113259342A (en) Login verification method, device, computer equipment and medium
CN112632605A (en) Method and device for preventing unauthorized access, computer equipment and storage medium
CN113239397A (en) Information access method, device, computer equipment and medium
CN104660417A (en) Verification method, verification device and electronic device
CN109769010B (en) Method, device, equipment and storage medium for accessing CloudStack server based on SDK
CN117319450B (en) Ultrasonic metering instrument data interaction method, device and equipment based on Internet of things
CN112260983B (en) Identity authentication method, device, equipment and computer readable storage medium
CN108092947B (en) Method and device for identity authentication of third-party application
CN113259429A (en) Session keeping control method, device, computer equipment and medium
CN108574658B (en) Application login method and device
CN111953633A (en) Access control method and access control device based on terminal environment
CN113434824B (en) Software service authorization management method, device, equipment and storage medium
CN115733685A (en) Web session authentication management method and device, computer equipment and storage medium
CN115525930A (en) Information transfer method, device and related equipment
CN115242608A (en) Method, device and equipment for generating alarm information and storage medium
CN211557285U (en) Control terminal, signature server and task server
CN107153791B (en) Data presentation method and electronic equipment
CN105323287B (en) Third-party application program login method and system
CN114697956B (en) Secure communication method and device based on double links
CN113839917B (en) Voice information processing method, data processing platform and equipment cloud server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination