A remote unlocking method and system based on blockchain, and electronic lock

By introducing blockchain technology into the remote lock-opening system, monitoring blockchain events and verifying transaction receipts, the problem of lock-opening instructions in the existing system is easily tampered with, and the security of electronic locks and the reliability of data storage is improved.

CN115909554BActive Publication Date: 2025-04-18HANGZHOU RIVTOWER TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211338912.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-28
Publication Date
2025-04-18
Estimated Expiration
2042-10-28

AI Technical Summary

Technical Problem

In the existing remote lock-opening system, unlocking instructions are easily tampered with during transmission, and the centralized structure of the smart home platform makes data storage insufficient security.

Method used

The remote lock-opening method based on blockchain is adopted. By obtaining the contract address of the unlocking smart contract, it monitors whether the unlocking event occurs in the blockchain, verify the matching between the transaction receipt and the unlocking event, and verify the correctness of the transaction receipt through Merkel to determine whether the electronic lock is opened.

Benefits of technology

It improves the security of electronic locks, prevents the risk of blockchain nodes committing evil or being attacked, and ensures the storage security of information such as lock-opening events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115909554B_ABST
    Figure CN115909554B_ABST
Patent Text Reader

Abstract

The present invention discloses a remote unlocking method and system based on blockchain, and an electronic lock, and relates to the field of blockchain technology. A specific implementation of the method includes: obtaining the contract address of the unlocking smart contract; monitoring whether an unlocking event occurs in the blockchain according to the contract address, and when the unlocking event is monitored, obtaining the transaction receipt of the unlocking transaction from the blockchain; verifying whether the transaction receipt matches the unlocking event, and if so, obtaining the Merkel proof of the transaction receipt from the blockchain; verifying whether the transaction receipt is correct according to the Merkel proof of the transaction receipt, and if correct, unlocking the electronic lock. This implementation can improve the security of the electronic lock.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a remote unlocking method and system based on blockchain, and an electronic lock. Background Art

[0002] An electronic lock with a remote unlocking function can be connected to the Internet through a router or other means. Users can send an unlocking request to the smart home platform through a mobile phone APP, and then the smart home platform sends an unlocking instruction to the electronic lock. The electronic lock unlocks after receiving the unlocking instruction. However, in this remote unlocking method, the unlocking instruction is sent from the smart home platform to the electronic lock via the Internet, which is easy to be tampered with during the transmission process. In addition, due to system failure or internal personnel, the unlocking instruction sent by the smart home platform may be tampered with. Summary of the invention

[0003] In view of this, the embodiments of the present invention provide a remote unlocking method and system, and an electronic lock based on blockchain, which can improve the security of the electronic lock.

[0004] In a first aspect, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to an electronic lock, comprising:

[0005] Get the contract address of the unlocking smart contract;

[0006] Monitoring whether an unlocking event occurs in the blockchain according to the contract address, and obtaining a transaction receipt of the unlocking transaction from the blockchain when the unlocking event occurs;

[0007] Verify whether the transaction receipt matches the unlocking event, and if so, obtain a Merkle proof of the transaction receipt from the blockchain;

[0008] According to the Merkel proof of the transaction receipt, verify whether the transaction receipt is correct, and if correct, open the electronic lock.

[0009] In a second aspect, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to a user end and includes:

[0010] Sending a deploy contract transaction to a blockchain to deploy an unlock smart contract in the blockchain;

[0011] Obtain the contract address of the unlocking smart contract;

[0012] Providing the contract address to the electronic lock;

[0013] Send an unlock transaction signed by the current user's private key to the blockchain.

[0014] In a third aspect, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to a node device of blockchain, including:

[0015] Receive the deployment contract transaction sent by the user;

[0016] Deploy an unlocking smart contract in the blockchain according to the deployment contract transaction;

[0017] Receiving an unlocking transaction sent by the user terminal; the unlocking transaction is signed by the private key of the current user;

[0018] The unlocking transaction is verified according to the unlocking smart contract. When the verification is passed, an unlocking event is generated; a transaction receipt and a Merkle proof of the transaction receipt are generated.

[0019] In a fourth aspect, an embodiment of the present invention provides an electronic lock, comprising:

[0020] An acquisition module, configured to obtain the contract address of the unlocking smart contract;

[0021] A monitoring module is configured to monitor whether an unlocking event occurs in the blockchain according to the contract address, and when the unlocking event occurs, obtain a transaction receipt of the unlocking transaction from the blockchain;

[0022] The verification module is configured to verify whether the transaction receipt matches the unlocking event, and if so, obtain the Merkle proof of the transaction receipt from the blockchain; and verify whether the transaction receipt is correct based on the Merkle proof of the transaction receipt, and if correct, unlock the electronic lock.

[0023] In a fifth aspect, an embodiment of the present invention provides a user terminal, including:

[0024] A deployment module, configured to send a deployment contract transaction to a blockchain to deploy an unlocking smart contract in the blockchain;

[0025] An acquisition module, configured to obtain the contract address of the unlocking smart contract;

[0026] The sending module is configured to provide the contract address to the electronic lock; and send an unlocking transaction signed by the private key of the current user to the blockchain.

[0027] In a sixth aspect, an embodiment of the present invention provides a remote unlocking device based on blockchain, which is applied to a node device of blockchain, including:

[0028] A deployment module, configured to receive a deployment contract transaction sent by a user terminal; and deploy an unlocking smart contract in the blockchain according to the deployment contract transaction;

[0029] The verification module is configured to receive the unlocking transaction sent by the user terminal; the unlocking transaction is signed by the private key of the current user; the unlocking transaction is verified according to the unlocking smart contract, and when the verification is passed, an unlocking event is generated; and a transaction receipt and a Merkle proof of the transaction receipt are generated.

[0030] In a seventh aspect, an embodiment of the present invention provides a remote unlocking system based on blockchain, comprising: an electronic lock as described in any of the above embodiments, a user terminal as described in any of the above embodiments, and a blockchain as described in any of the above embodiments.

[0031] One embodiment of the above invention has the following advantages or beneficial effects: Compared with the smart home platform, the data on the blockchain is difficult to be tampered with, thereby ensuring the storage security of information such as unlocking events. The embodiment of the present invention verifies whether the transaction receipt matches the unlocking event, confirms whether the transaction receipt or the unlocking event has been tampered with, and further confirms whether the transaction receipt has been tampered with by verifying the Merkle proof of the transaction receipt. The verification of the transaction receipt and the unlocking event can effectively identify the risk of blockchain nodes being malicious or attacked, thereby improving the security of electronic locks.

[0032] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0034] Figure 1 This is a flowchart of a blockchain-based remote unlocking method for an electronic lock provided by an embodiment of the present invention;

[0035] Figure 2 This is a flowchart of a blockchain-based remote unlocking method applied to a user terminal provided by an embodiment of the present invention;

[0036] Figure 3 It is a flowchart of a remote unlocking based on blockchain and applied to a node device of blockchain provided by an embodiment of the present invention;

[0037] Figure 4 is a schematic diagram of an electronic lock provided by an embodiment of the present invention;

[0038] Figure 5 is a schematic diagram of a blockchain provided by an embodiment of the present invention;

[0039] Figure 6 is a schematic diagram of a remote unlocking device based on blockchain provided by an embodiment of the present invention;

[0040] Figure 7is a schematic diagram of a remote unlocking system based on blockchain provided by an embodiment of the present invention;

[0041] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0043] In the prior art, the smart home platform is a centralized structure. Compared with the blockchain, the data stored in it is easy to be tampered with. In addition, the risk of unlocking instructions being tampered with during transmission is high, posing a threat to the security of electronic locks.

[0044] In view of this, if Figure 1 As shown, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to an electronic lock, including:

[0045] Step 101: Get the contract address of the unlocking smart contract.

[0046] The electronic lock stores the contract address of the unlocking smart contract. The contract address can be input into the electronic lock by the user or sent to the electronic lock by the user terminal.

[0047] Step 102: Monitor whether an unlocking event occurs in the blockchain according to the contract address. When an unlocking event is detected, obtain a transaction receipt of the unlocking transaction from the blockchain.

[0048] If an unlocking event occurs, it means that the blockchain has received an unlocking transaction, and the unlocking transaction has been verified by the blockchain. In order to prevent the blockchain node from doing evil or being attacked, the embodiment of the present invention verifies the transaction receipt. The blockchain can be a consortium blockchain jointly built by multiple parties such as regulatory agencies and electronic lock manufacturers.

[0049] Step 103: Verify whether the transaction receipt matches the unlocking event. If they match, obtain the Merkle proof of the transaction receipt from the blockchain.

[0050] If the event information in the transaction receipt is consistent with the event information of the unlocking event, it means that the transaction receipt matches the unlocking event. Specifically, the transaction hash in the transaction receipt can be compared with the transaction hash in the unlocking event. If they are the same, it means that the transaction receipt matches the unlocking event. Of course, it can also be verified through other items in the transaction receipt, such as the timestamp of the unlocking transaction. If the transaction receipt does not match the unlocking event, the unlocking transaction is rejected. Specifically, a rejection notification of unlocking can be fed back to the user end.

[0051] Step 104: Verify whether the transaction receipt is correct based on the Merkle proof of the transaction receipt. If correct, open the electronic lock.

[0052] The Merkle proof of the transaction receipt can prove the correctness of the transaction receipt to the electronic lock without revealing the transaction receipt. If the Merkle proof of the transaction receipt can indicate that the transaction receipt is correct, it means that the transaction receipt has not been tampered with. The event information matches the transaction receipt, which means that the event information has not been tampered with. In actual application scenarios, you can also verify the Merkle proof of the transaction receipt first, and then verify whether the transaction receipt matches the unlocking event, or you can verify them at the same time. If the Merkle proof of the transaction receipt indicates that the transaction receipt is incorrect, the unlocking transaction is rejected and the electronic lock is kept in the closed state.

[0053] Compared with the smart home platform, the data on the blockchain is difficult to be tampered with, thereby ensuring the storage security of information such as unlocking events. The embodiment of the present invention verifies whether the transaction receipt matches the unlocking event, confirms whether the transaction receipt or the unlocking event has been tampered with, and further confirms whether the transaction receipt has been tampered with by verifying the Merkle proof of the transaction receipt. The verification of the transaction receipt and the unlocking event can effectively identify the risk of blockchain nodes being malicious or attacked, thereby improving the security of electronic locks.

[0054] In one embodiment of the present invention, the method further comprises:

[0055] Get the Merkle proof of the unlocking transaction from the blockchain;

[0056] According to the Merkle proof of the unlocking transaction, verify whether the unlocking transaction is correct. If it is correct, execute the Merkle proof based on the transaction receipt to verify whether the transaction receipt is correct.

[0057] In order to prevent the content of the unlocking transaction from being tampered with, the electronic lock can also verify the unlocking transaction through the Merkle proof of the unlocking transaction. If the Merkle proof of the unlocking transaction can indicate that the unlocking transaction is correct, it means that the unlocking transaction has not been tampered with. The present invention can further reduce the impact of blockchain nodes doing evil or being attacked on the electronic lock and improve the security of the electronic lock. In actual application scenarios, the Merkle proof of the transaction receipt can be verified first, and then the Merkle proof of the unlocking transaction can be verified, or both can be verified at the same time.

[0058] In one embodiment of the present invention, the method further comprises:

[0059] Get the public key of the consensus node;

[0060] Get the block header of the block where the unlocking transaction is located from the blockchain;

[0061] Verify whether the format of the block header meets the format rules. If so, verify whether the signature in the block header matches the public key of the consensus node. If they match, execute the Merkle proof based on the transaction receipt to verify whether the transaction receipt is correct.

[0062] Specifically, the signature verification can be used to determine whether the public key of the consensus node matches the signature in the block header. If the format of the block header does not meet the format rules, or the signature in the block header does not match the public key of the consensus node, the unlocking transaction is rejected. The embodiment of the present invention can determine whether the block header has been tampered with by verifying the format and content of the block header, thereby further improving the security of the electronic lock.

[0063] In one embodiment of the present invention, the unlocking event includes: a transaction hash;

[0064] The method also includes: verifying whether the transaction hash exists in a pre-established hash table, and if not, obtaining a transaction receipt for the unlocking transaction from the blockchain.

[0065] In order to prevent repeated unlocking transactions from being initiated by tampering with the timestamp, the embodiment of the present invention records the transaction hash in a hash table to identify whether the unlocking transaction is repeatedly initiated. If there is a transaction hash identical to the current unlocking transaction in the hash table, the current unlocking transaction is rejected.

[0066] In one embodiment of the present invention, the unlocking event includes: unlocking time;

[0067] If the transaction receipt is correct, the method further includes: verifying whether the difference between the unlocking time and the current time is not greater than a preset time threshold, and if so, executing the unlocking of the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminating the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, then when the difference between the current time and the unlocking time is not greater than the time threshold, executing the unlocking of the electronic lock.

[0068] The unlocking time refers to the unlocking time expected by the user. If the difference is greater than the time threshold and the unlocking time is earlier than the current time, it means that there may be a delay in the network. At this time, in order to ensure the safety of the electronic lock, the unlocking transaction is rejected. The embodiment of the present invention can determine whether to unlock and the unlocking time according to the difference between the unlocking time and the current time of the electronic lock, which can meet the needs of the user while ensuring the safety of the electronic lock.

[0069] In actual application scenarios, there are at least three different remote unlocking methods:

[0070] Method 1: Single administrator unlocks the door;

[0071] Method 2: Multiple administrators unlock the door;

[0072] Method 3: Unlocking by temporary user.

[0073] In one embodiment of the present invention, for mode 1, the unlocking event includes: a public key of the first user;

[0074] The method further includes:

[0075] Get the unlock transaction from the blockchain; the unlock transaction is signed by the current user's private key;

[0076] The signature of the unlocking transaction is verified based on the public key of the first user. If the verification is successful, a verification transaction receipt is performed to determine whether it matches the unlocking event.

[0077] In order to verify whether the current user has the unlocking authority, the electronic lock can verify the signature of the first user's public key to determine whether the current user is the first user, that is, the administrator or owner of the electronic lock. In this way, only the first user has the unlocking authority.

[0078] In one embodiment of the present invention, for mode 2, the unlocking event includes: public keys of multiple second users;

[0079] The method further comprises:

[0080] Get multiple unlocking transactions from the blockchain; the unlocking transactions are signed by the corresponding private key of the current user;

[0081] The signatures of the corresponding unlocking transactions are verified respectively according to the public key of the second user. If the signatures of multiple unlocking transactions are verified, then the verification transaction receipt is executed to see whether it matches the unlocking event.

[0082] The multiple second users are multiple administrators. In mode 2, multiple administrators are required to send unlocking transactions to open the electronic lock. If multiple users want to remotely unlock the lock through mode 2, each user needs to sign the unlocking transaction sent by him based on his own private key. In the embodiment of the present invention, if the multiple unlocking transactions obtained are for the same electronic lock and there are multiple electronic locks, each electronic lock needs to be distinguished by the identification of the electronic lock.

[0083] In actual application scenarios, the electronic lock can obtain multiple unlocking transactions from the blockchain whose sending time is within the specified time and the unlocking time is the same. At this time, these unlocking transactions are regarded as one multi-administrator unlocking. The embodiment of the present invention verifies the identity of the initiator of each unlocking transaction through the public key of the second user to determine whether each user has the unlocking authority.

[0084] In one embodiment of the present invention, for mode 3, the unlocking event includes: the public key of the temporary user;

[0085] The method further comprises:

[0086] Get the unlock transaction from the blockchain; the unlock transaction is signed by the current user's private key;

[0087] The signature of the unlocking transaction is verified based on the public key of the temporary user. If the verification is successful, the transaction receipt is verified to see if it matches the unlocking event.

[0088] In mode 3, the administrator can authorize a temporary user to unlock the door. At this time, the processing for the temporary user is similar to that in mode 1, and will not be further elaborated in this embodiment of the present invention.

[0089] like Figure 2 As shown, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to a user end and includes:

[0090] Step 201: Send a deployment contract transaction to the blockchain to deploy the unlocking smart contract in the blockchain.

[0091] Specifically, the user end signs the deployment contract transaction with the current user's private key, and the blockchain can verify the deployment contract transaction through the administrator's public key. If the verification is successful, the unlocking smart contract is deployed in the blockchain. For method 1, the administrator's public key is the public key of the first user. For method 2, the administrator's public key is the public key of any second user, that is, any second user can initiate a deployment contract transaction.

[0092] Step 202: Get the contract address of the unlocking smart contract.

[0093] Step 203: Provide the contract address to the electronic lock.

[0094] The user end can send the contract address directly to the electronic lock, and can also display the contract address to the current user, who will then enter the contract address into the electronic lock.

[0095] Step 204: Send an unlocking transaction signed by the current user's private key to the blockchain.

[0096] It should be noted that if the unlocking smart contract remains unchanged, steps 201 to 203 do not need to be repeated, that is, after the user terminal provides the contract address to the electronic lock, multiple unlocking transactions can be sent to the blockchain.

[0097] In an embodiment of the present invention, the user end can deploy an unlocking smart contract in the blockchain, so that the blockchain can verify whether the current user has the unlocking authority based on the unlocking smart contract, and the user end can also provide the contract address to the electronic lock, so that the electronic lock can monitor the unlocking event and verify the unlocking transaction based on the unlocking event. The embodiment of the present invention can effectively identify the risk of blockchain nodes being malicious or attacked, and improve the security of electronic locks.

[0098] In one embodiment of the present invention, the method further comprises:

[0099] Obtain the public key of the consensus node and provide the public key of the consensus node to the electronic lock.

[0100] The user end can provide the electronic lock with the public key of the consensus node so that the electronic lock can verify the block header of the unlocking transaction based on the public key of the consensus node, further improving the security of the electronic lock.

[0101] In one embodiment of the present invention, the method further includes: sending a contract modification transaction to the blockchain to add the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract.

[0102] In the embodiment of the present invention, the administrator of the electronic lock can grant temporary unlocking authority to other users. Specifically, after deploying the unlocking smart contract, the first user can initiate a contract modification transaction to add the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract. In actual application scenarios, the first user can also initiate a temporary smart contract, which includes the temporary user's public key and its corresponding third unlocking method.

[0103] Through the embodiments of the present invention, the administrator of the electronic lock can temporarily grant unlocking authority to other users to meet the needs of different scenarios.

[0104] like Figure 3 As shown, an embodiment of the present invention provides a remote unlocking method based on blockchain, which is applied to a node device of blockchain, including:

[0105] Step 301: Receive the deployment contract transaction sent by the user.

[0106] Step 302: Deploy the unlocking smart contract in the blockchain according to the deployment contract transaction.

[0107] Step 303: Receive the unlocking transaction sent by the user; the unlocking transaction is signed by the private key of the current user.

[0108] Step 304: Verify the unlocking transaction according to the unlocking smart contract, and generate an unlocking event when the verification passes.

[0109] Step 305: Generate a transaction receipt and a Merkle proof of the transaction receipt.

[0110] Similar to the user side, if the unlocking smart contract remains unchanged, steps 301 and 302 do not need to be repeated for different unlocking transactions. The method can verify whether the current user has the unlocking authority based on the unlocking smart contract, and can also verify the content of the unlocking transaction. For example, the signature of the unlocking transaction is verified based on the unlocking smart contract to determine whether the current user has the unlocking authority. The embodiment of the present invention can record the relevant information of the unlocking transaction through the blockchain, and provide the electronic lock with a transaction receipt, etc., so that the electronic lock can determine whether the unlocking transaction has been tampered with.

[0111] Corresponding to the above three unlocking methods, the unlocking smart contract can contain different contents.

[0112] For method 1, in one embodiment of the present invention, the unlocking smart contract includes: a public key of a first user and a first unlocking method;

[0113] Verify the unlock transaction according to the unlock smart contract, including:

[0114] The signature of the unlocking transaction is verified according to the public key of the first user. If the verification is successful, the first unlocking method is called to verify the unlocking transaction.

[0115] In this scenario, the unlocking smart contract only contains the public key of the electronic lock administrator and its corresponding first unlocking method. If the administrator owns multiple electronic locks, the corresponding first unlocking methods can be set for different electronic locks respectively. By verifying the signature of the unlocking transaction, it is also possible to verify whether the current user is the first user, that is, whether the current user has the unlocking permission. The first unlocking method can be set according to the application scenario, for example, to verify whether the unlocking time in the unlocking transaction is within the set time period, or to verify whether the electronic lock identifier in the unlocking transaction is a valid identifier.

[0116] For method 2, in one embodiment of the present invention, the unlocking smart contract includes: public keys of multiple second users and a second unlocking method;

[0117] The unlocking transaction includes: unlocking time;

[0118] There are multiple unlocking transactions, which are sent by multiple current users through their respective user terminals;

[0119] Verify the unlock transaction according to the unlock smart contract, including:

[0120] The signatures of the corresponding unlocking transactions are verified according to the public key of the second user respectively. If the signatures of multiple unlocking transactions are verified, the second unlocking method is called to verify whether the number of current users with the same unlocking time exceeds the unlocking threshold.

[0121] If multiple unlocking transactions for the same electronic lock are received within a specified time period, and the unlocking time of these unlocking transactions is the same, then the unlocking method corresponding to these unlocking transactions is method 2, and the unlocking transaction is verified by the unlocking smart contract corresponding to method 2. For example, the number of second users is 5, and the unlocking threshold is 2. If 5 current users send unlocking transactions, the number of unlocking transactions with the same unlocking time is 3, which is greater than the unlocking threshold. The second unlocking method can be adjusted according to the actual application scenario. For example, the second unlocking method is used to verify whether the ratio of the number of current users with the same unlocking time to the number of current users exceeds the set ratio, or the second unlocking method is used to verify whether the number of current users exceeds the set number.

[0122] For mode 3, in one embodiment of the present invention, the unlocking transaction includes: unlocking time;

[0123] The method further includes: receiving an update contract transaction sent by the user end; adding the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract according to the update contract transaction;

[0124] Verify the unlock transaction according to the unlock smart contract, including:

[0125] The signature of the unlocking transaction is verified according to the public key of the temporary user. If the verification is successful, the third unlocking method is called to verify whether the unlocking time is within the valid time period.

[0126] The first user can grant the temporary user unlocking authority by changing the content of the unlocking smart contract. The embodiment of the present invention can control the unlocking time of the temporary user through the third unlocking method, and can also control the number of unlocking times of the temporary user through the third unlocking method. For example, the third unlocking method is called to verify whether the number of unlocking times of the temporary user within the preset time exceeds the number threshold.

[0127] The following embodiments will take a remote unlocking system based on blockchain as an example to illustrate the above three unlocking methods respectively, wherein the system includes an electronic lock, a user terminal and a blockchain.

[0128] Method 1:

[0129] The embodiment of the present invention provides a remote unlocking method based on blockchain, comprising:

[0130] A1: The user sends a deployment contract transaction signed by the first user's private key to the blockchain.

[0131] A2: The blockchain verifies the signature of the deployment contract transaction based on the public key of the first user. If the verification is successful, the unlocking smart contract is deployed according to the deployment contract transaction. Otherwise, the deployment contract transaction is rejected. The unlocking smart contract includes: the public key of the first user and the first unlocking method.

[0132] A3: The user obtains the contract address of the unlocking smart contract and the public key of the consensus node, and provides the contract address and the public key of the consensus node to the electronic lock.

[0133] A4: The electronic lock monitors whether an unlocking event occurs in the blockchain based on the contract address.

[0134] A5: The user sends an unlocking transaction signed by the current user's private key to the blockchain. The unlocking transaction includes: unlocking time.

[0135] A6: The blockchain verifies the signature of the unlocking transaction based on the public key of the first user. If the verification is successful, the first unlocking method is called to verify whether the unlocking time in the unlocking transaction is within the set time period. If so, an unlocking event is generated; wherein the unlocking event includes: transaction hash, the public key of the first user and the unlocking time.

[0136] A7: The blockchain generates a transaction receipt, a Merkle proof of the transaction receipt, and a Merkle proof of the unlocking transaction.

[0137] It should be noted that the blockchain can generate a transaction receipt, a Merkle proof of the transaction receipt, and a Merkle proof of the unlocking transaction immediately after generating an unlocking event. It can also be generated when receiving an electronic lock query request or acquisition request. Methods 2 and 3 are similar.

[0138] A8: When an unlocking event is detected, the electronic lock obtains the unlocking transaction signed by the current user's private key, the transaction receipt, the Merkle proof of the unlocking transaction, the Merkle proof of the transaction receipt, and the block header of the block where the unlocking transaction is located from the blockchain.

[0139] A9: The electronic lock verifies whether the transaction hash in the unlocking event exists in the hash table. If not, the signature of the unlocking transaction is verified based on the public key of the first user. If the verification is successful, the transaction receipt is verified to match the unlocking event. If they match, the format of the block header is verified to meet the format rules. If they do, the signature in the block header is verified to match the public key of the consensus node. If they match, the Merkel proof of the unlocking transaction is verified to be correct. If correct, the Merkel proof of the transaction receipt is verified to be correct. If correct, the difference between the unlocking time and the current time is verified to be not greater than the preset time threshold. If so, the electronic lock is unlocked. If the difference is greater than the time threshold and the unlocking time is earlier than the current time, the current process is terminated. If the difference is greater than the time threshold and the unlocking time is later than the current time, the electronic lock is unlocked when the difference between the current time and the unlocking time is not greater than the time threshold.

[0140] Method 2:

[0141] The embodiment of the present invention provides a remote unlocking method based on blockchain, comprising:

[0142] B1: The user sends a deployment contract transaction signed by the private key of any second user to the blockchain.

[0143] B2: The blockchain verifies the signature of the deployment contract transaction based on the public key of the second user. If the verification is successful, the unlocking smart contract is deployed according to the deployment contract transaction. Otherwise, the deployment contract transaction is rejected. The unlocking smart contract includes: multiple public keys of the second users and the second unlocking method.

[0144] B3: The user obtains the contract address of the unlocking smart contract and the public key of the consensus node, and provides the contract address and the public key of the consensus node to the electronic lock.

[0145] B4: The electronic lock monitors whether an unlocking event occurs in the blockchain based on the contract address.

[0146] B5: Multiple current users send unlocking transactions signed by the current user's private key to the blockchain through their respective user terminals. The unlocking transaction includes: unlocking time.

[0147] B6: The blockchain verifies the signatures of the corresponding unlocking transactions according to the public keys of the second users. If the signatures of these unlocking transactions are verified, the second unlocking method is called to verify whether the number of current users with the same unlocking time exceeds the unlocking threshold. If so, an unlocking event is generated; wherein the unlocking event includes: the transaction hash of each unlocking transaction, the public key of each second user and the unlocking time.

[0148] B7: The blockchain generates a transaction receipt corresponding to each unlocking transaction, a Merkle proof of the transaction receipt, and a Merkle proof of the unlocking transaction.

[0149] B8: When an unlocking event is detected, the electronic lock obtains the unlocking transaction signed by the private key of each current user, the transaction receipt, the Merkle proof of the unlocking transaction, the Merkle proof of the transaction receipt, and the block header of the block where the unlocking transaction is located from the blockchain.

[0150] B9: For any unlocking transaction, the electronic lock performs the following verification steps to determine the validity of each unlocking transaction:

[0151] The electronic lock verifies whether the transaction hash in the unlocking event exists in the hash table. If not, the signature of the unlocking transaction is verified based on the public key of the second user. If the verification succeeds, it verifies whether the transaction receipt matches the unlocking event. If they match, it verifies whether the format of the block header meets the format rules. If they do, it verifies whether the signature in the block header matches the public key of the consensus node. If they match, it verifies whether the Merkel proof of the unlocking transaction is correct. If correct, it verifies whether the Merkel proof of the transaction receipt is correct.

[0152] B10: If B9 is passed and all unlocking transactions are verified to be valid, then perform the following steps:

[0153] The electronic lock verifies whether the difference between the unlocking time and the current time is not greater than the preset time threshold. If so, the electronic lock is unlocked. If the difference is greater than the time threshold and the unlocking time is earlier than the current time, the current process is terminated. If the difference is greater than the time threshold and the unlocking time is later than the current time, the electronic lock is unlocked when the difference between the current time and the unlocking time is not greater than the time threshold.

[0154] Method 3:

[0155] The embodiment of the present invention provides a remote unlocking method based on blockchain, comprising:

[0156] C1: The user sends a deployment contract transaction signed by the first user’s private key to the blockchain.

[0157] C2: The blockchain verifies the signature of the deployment contract transaction based on the public key of the first user. If the verification is successful, the unlocking smart contract is deployed according to the deployment contract transaction. Otherwise, the deployment contract transaction is rejected. The unlocking smart contract includes: the public key of the first user and the first unlocking method.

[0158] C3: The user obtains the contract address of the unlocking smart contract and the public key of the consensus node, and provides the contract address and the public key of the consensus node to the electronic lock.

[0159] C4: The electronic lock monitors whether an unlocking event occurs in the blockchain based on the contract address.

[0160] C5: The user sends a contract change transaction signed by the first user's private key to the blockchain.

[0161] C6: The blockchain verifies the signature of the contract transaction based on the public key of the first user. If the verification passes, the public key of the temporary user and its corresponding third unlocking method are added to the unlocking smart contract.

[0162] C7: The user sends an unlocking transaction signed by the current user's private key to the blockchain. The unlocking transaction includes: unlocking time.

[0163] It should be noted that, in order to distinguish it from the unlocking transaction of method 1, an identifier of the unlocking method may be added to the unlocking transaction.

[0164] C8: The blockchain verifies the signature of the unlocking transaction based on the temporary user's public key. If the verification is successful, the third unlocking method is called to verify whether the unlocking time is within the valid time period. If so, an unlocking event is generated; wherein the unlocking event includes: transaction hash, temporary user's public key and unlocking time.

[0165] C9: The blockchain generates a transaction receipt, a Merkle proof of the transaction receipt, and a Merkle proof of the unlocking transaction.

[0166] C10: When an unlocking event is detected, the electronic lock obtains the unlocking transaction signed by the current user's private key, the transaction receipt, the Merkle proof of the unlocking transaction, the Merkle proof of the transaction receipt, and the block header of the block where the unlocking transaction is located from the blockchain.

[0167] C11: The electronic lock verifies whether the transaction hash in the unlocking event exists in the hash table. If not, the signature of the unlocking transaction is verified based on the public key of the first user. If the verification is successful, the transaction receipt is verified to match the unlocking event. If they match, the format of the block header is verified to meet the format rules. If they do, the signature in the block header is verified to match the public key of the consensus node. If they match, the Merkel proof of the unlocking transaction is verified to be correct. If correct, the Merkel proof of the transaction receipt is verified to be correct. If correct, the difference between the unlocking time and the current time is verified to be not greater than the preset time threshold. If so, the electronic lock is unlocked. If the difference is greater than the time threshold and the unlocking time is earlier than the current time, the current process is terminated. If the difference is greater than the time threshold and the unlocking time is later than the current time, the electronic lock is unlocked when the difference between the current time and the unlocking time is not greater than the time threshold.

[0168] It can be seen from the above three embodiments that the method is applicable to different unlocking scenarios, and can further improve the security of electronic locks by verifying unlocking events, unlocking transactions, transaction receipts and other aspects.

[0169] like Figure 4 As shown, an embodiment of the present invention provides an electronic lock, comprising:

[0170] An acquisition module 401 is configured to acquire a contract address of an unlocking smart contract;

[0171] The monitoring module 402 is configured to monitor whether an unlocking event occurs in the blockchain according to the contract address, and when an unlocking event is detected, obtain a transaction receipt of the unlocking transaction from the blockchain;

[0172] The verification module 403 is configured to verify whether the transaction receipt matches the unlocking event. If they match, the Merkle proof of the transaction receipt is obtained from the blockchain; based on the Merkle proof of the transaction receipt, it is verified whether the transaction receipt is correct. If it is correct, the electronic lock is unlocked.

[0173] In one embodiment of the present invention, the acquisition module 401 is configured to obtain a Merkle proof of an unlocking transaction from a blockchain;

[0174] The verification module 403 is configured to verify whether the unlocking transaction is correct according to the Merkle proof of the unlocking transaction, and if correct, to verify whether the transaction receipt is correct according to the Merkle proof of the transaction receipt.

[0175] In one embodiment of the present invention, the acquisition module 401 is configured to acquire the public key of the consensus node; acquire the block header of the block where the unlocking transaction is located from the blockchain;

[0176] The verification module 403 is configured to verify whether the format of the block header satisfies the format rules. If so, it verifies whether the signature in the block header matches the public key of the consensus node. If they match, it executes the Merkle proof based on the transaction receipt to verify whether the transaction receipt is correct.

[0177] In one embodiment of the present invention, the unlocking event includes: a transaction hash;

[0178] The verification module 403 is configured to verify whether the transaction hash exists in the pre-established hash table, and if not, obtain the transaction receipt of the unlocking transaction from the blockchain.

[0179] In one embodiment of the present invention, the unlocking event includes: unlocking time;

[0180] The verification module 403 is configured to verify whether the difference between the unlocking time and the current time is not greater than a preset time threshold if the transaction receipt is correct. If so, the electronic lock is unlocked; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, the current process is terminated; if the difference is greater than the time threshold and the unlocking time is later than the current time, the electronic lock is unlocked when the difference between the current time and the unlocking time is not greater than the time threshold.

[0181] In one embodiment of the present invention, the unlocking event includes: a public key of the first user;

[0182] The acquisition module 401 is configured to acquire an unlocking transaction from the blockchain; the unlocking transaction is signed by the private key of the current user;

[0183] The verification module 403 is configured to verify the signature of the unlocking transaction based on the public key of the first user. If the verification is successful, it verifies whether the transaction receipt matches the unlocking event.

[0184] In one embodiment of the present invention, the unlocking event includes: public keys of multiple second users;

[0185] The acquisition module 401 is configured to acquire multiple unlocking transactions from the blockchain; the unlocking transactions are signed by the corresponding private key of the current user;

[0186] The verification module 403 is configured to verify the signatures of the corresponding unlocking transactions according to the public key of the second user respectively. If the signatures of multiple unlocking transactions are verified, it is executed to verify whether the transaction receipt matches the unlocking event.

[0187] In one embodiment of the present invention, the unlocking event includes: a public key of a temporary user;

[0188] The acquisition module 401 is configured to acquire an unlocking transaction from the blockchain; the unlocking transaction is signed by the private key of the current user;

[0189] The verification module 403 is configured to verify the signature of the unlocking transaction based on the public key of the temporary user. If the verification is successful, it verifies whether the transaction receipt matches the unlocking event.

[0190] like Figure 5 As shown, an embodiment of the present invention provides a user terminal, including:

[0191] A deployment module 501 is configured to send a deployment contract transaction to the blockchain to deploy the unlocking smart contract in the blockchain;

[0192] An acquisition module 502 is configured to acquire a contract address of an unlocking smart contract;

[0193] The sending module 503 is configured to provide the contract address to the electronic lock; send the unlocking transaction signed by the current user's private key to the blockchain

[0194] In one embodiment of the present invention, the acquisition module 502 is configured to acquire the public key of the consensus node and provide the public key of the consensus node to the electronic lock.

[0195] In one embodiment of the present invention, the sending module 503 is configured to send a contract modification transaction to the blockchain to add the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract.

[0196] like Figure 6 As shown, an embodiment of the present invention provides a remote unlocking device based on blockchain, which is applied to a node device of blockchain, including:

[0197] The deployment module 601 is configured to receive a deployment contract transaction sent by a user terminal; and deploy an unlocking smart contract in the blockchain according to the deployment contract transaction;

[0198] The verification module 602 is configured to receive the unlocking transaction sent by the user end; the unlocking transaction is signed by the private key of the current user; the unlocking transaction is verified according to the unlocking smart contract, and when the verification passes, an unlocking event is generated; and a transaction receipt and a Merkle proof of the transaction receipt are generated.

[0199] In one embodiment of the present invention, the unlocking smart contract includes: a first user's public key and a first unlocking method;

[0200] The verification module 602 is configured to verify the signature of the unlocking transaction according to the public key of the first user, and if the verification is successful, call the first unlocking method to verify the unlocking transaction.

[0201] In one embodiment of the present invention, the unlocking smart contract includes: public keys of multiple second users and a second unlocking method;

[0202] The unlocking transaction includes: unlocking time;

[0203] There are multiple unlocking transactions, which are sent by multiple current users through their respective user terminals;

[0204] The verification module 602 is configured to verify the signature of the corresponding unlocking transaction according to the public key of the second user respectively. If the signatures of multiple unlocking transactions are verified, the second unlocking method is called to verify whether the number of current users with the same unlocking time exceeds the unlocking threshold.

[0205] In one embodiment of the present invention, the unlocking transaction includes: unlocking time;

[0206] The deployment module 601 is configured to receive the update contract transaction sent by the user terminal; according to the update contract transaction, add the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract;

[0207] The verification module 602 is configured to verify the signature of the unlocking transaction according to the public key of the temporary user, and if the verification is successful, call the third unlocking method to verify whether the unlocking time is within the valid time period.

[0208] like Figure 7 As shown, an embodiment of the present invention provides a remote unlocking system based on blockchain, including: the electronic lock 701 described in any of the above embodiments, the user terminal 702 described in any of the above embodiments, and the blockchain 703 described in any of the above embodiments.

[0209] An embodiment of the present invention provides an electronic device, including:

[0210] one or more processors;

[0211] a storage device for storing one or more programs,

[0212] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.

[0213] An embodiment of the present invention provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method of any of the above embodiments is implemented.

[0214] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0215] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0216] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0217] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a 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 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0218] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may 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 may 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 the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0219] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0220] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."

[0221] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A remote unlocking method based on blockchain, characterized in that: Electronic locks used in smart homes include: Get the contract address of the unlocking smart contract; Monitor whether an unlocking event occurs in the blockchain according to the contract address, and when the unlocking event occurs, obtain a transaction receipt of the unlocking transaction from the blockchain; the unlocking event includes: unlocking time; Verify whether the transaction receipt matches the unlocking event, and if so, obtain a Merkle proof of the transaction receipt from the blockchain; Obtain the public key of the consensus node; obtain the block header of the block where the unlocking transaction is located from the blockchain; verify whether the format of the block header meets the format rules, and if so, verify whether the signature in the block header matches the public key of the consensus node, and if so, execute the Merkle proof based on the transaction receipt to verify whether the transaction receipt is correct; According to the Merkel proof of the transaction receipt, verify whether the transaction receipt is correct. If correct, verify whether the difference between the unlocking time and the current time is not greater than a preset time threshold. If so, execute the unlocking of the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminate the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, then when the difference between the current time and the unlocking time is not greater than the time threshold, execute the unlocking of the electronic lock.

2. The method according to claim 1, characterized in that Further including: Obtaining a Merkle proof of the unlocking transaction from the blockchain; According to the Merkel proof of the unlocking transaction, verify whether the unlocking transaction is correct. If correct, execute the Merkel proof according to the transaction receipt to verify whether the transaction receipt is correct.

3. The method according to claim 1, characterized in that The unlocking event includes: transaction hash; The method further includes: verifying whether the transaction hash exists in a pre-established hash table, and if not, executing the step of obtaining a transaction receipt for the unlocking transaction from the blockchain.

4. The method according to any one of claims 1 to 3, characterized in that: The unlocking event includes: a public key of the first user; The method further comprises: Obtain the unlocking transaction from the blockchain; the unlocking transaction is signed by the private key of the current user; The signature of the unlocking transaction is verified based on the public key of the first user. If the verification is successful, the verification of whether the transaction receipt matches the unlocking event is performed.

5. The method according to any one of claims 1 to 3, characterized in that: The unlocking event includes: public keys of multiple second users; The method further comprises: Acquire a plurality of unlocking transactions from the blockchain; the unlocking transactions are signed by the corresponding private key of the current user; The signatures of the corresponding unlocking transactions are verified respectively according to the public key of the second user. If the signatures of multiple unlocking transactions are all verified, the verification of whether the transaction receipt matches the unlocking event is performed.

6. The method according to any one of claims 1 to 3, characterized in that: The unlocking event includes: the public key of the temporary user; The method further comprises: Obtain the unlocking transaction from the blockchain; the unlocking transaction is signed by the private key of the current user; The signature of the unlocking transaction is verified based on the public key of the temporary user. If the verification is successful, the verification of whether the transaction receipt matches the unlocking event is performed.

7. A remote unlocking method based on blockchain, characterized in that: The user end used in smart home includes: Sending a deploy contract transaction to a blockchain to deploy an unlock smart contract in the blockchain; Obtain the contract address of the unlocking smart contract; Providing the contract address to the electronic lock; Send an unlocking transaction signed by the current user's private key to the blockchain, so that the electronic lock can monitor whether an unlocking event occurs in the blockchain according to the contract address of the unlocking smart contract obtained. When the unlocking event is monitored, the transaction receipt of the unlocking transaction is obtained from the blockchain; the unlocking event includes: unlocking time; verifying whether the transaction receipt matches the unlocking event, if so, obtaining the Merkle proof of the transaction receipt from the blockchain; obtaining the public key of the consensus node; obtaining the block header of the block where the unlocking transaction is located from the blockchain; verifying whether the format of the block header meets the format rules, if so, verifying that the signature in the block header matches the consensus node. whether the public key of the transaction receipt matches, if so, executing the Merkel proof according to the transaction receipt to verify whether the transaction receipt is correct; verifying whether the transaction receipt is correct according to the Merkel proof of the transaction receipt, if correct, verifying whether the difference between the unlocking time and the current time is not greater than a preset time threshold, if so, executing to unlock the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminating the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, then when the difference between the current time and the unlocking time is not greater than the time threshold, executing to unlock the electronic lock.

8. The method according to claim 7, characterized in that Further including: Obtain a public key of a consensus node, and provide the public key of the consensus node to the electronic lock.

9. The method according to claim 7 or 8, characterized in that Further including: Send a change contract transaction to the blockchain to add the temporary user's public key and its corresponding third unlocking method to the unlocking smart contract.

10. A remote unlocking method based on blockchain, characterized in that: Node devices used in blockchain include: Receive the deployment contract transaction sent by the smart home user; Deploy an unlocking smart contract in the blockchain according to the deployment contract transaction; Receiving an unlocking transaction sent by the user terminal; the unlocking transaction is signed by the private key of the current user; Verify the unlocking transaction according to the unlocking smart contract, and generate an unlocking event when the verification passes; Generate a transaction receipt and a Merkle proof of the transaction receipt, so that the electronic lock of the smart home can monitor whether an unlocking event occurs in the blockchain according to the contract address of the unlocking smart contract obtained. When the unlocking event is monitored, obtain the transaction receipt of the unlocking transaction from the blockchain, and the unlocking event includes: unlocking time; verify whether the transaction receipt matches the unlocking event, if so, obtain the Merkle proof of the transaction receipt from the blockchain; obtain the public key of the consensus node; obtain the block header of the block where the unlocking transaction is located from the blockchain; verify whether the format of the block header meets the format rules, if so, verify that the signature in the block header matches the consensus node. whether the public key of the transaction receipt matches, if so, executing the Merkel proof according to the transaction receipt to verify whether the transaction receipt is correct; verifying whether the transaction receipt is correct according to the Merkel proof of the transaction receipt, if correct, verifying whether the difference between the unlocking time and the current time is not greater than a preset time threshold, if so, executing to unlock the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminating the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, then when the difference between the current time and the unlocking time is not greater than the time threshold, executing to unlock the electronic lock.

11. The method according to claim 10, characterized in that The unlocking smart contract includes: a first user's public key and a first unlocking method; Verifying the unlocking transaction according to the unlocking smart contract includes: The signature of the unlocking transaction is verified according to the public key of the first user. If the verification is successful, the first unlocking method is called to verify the unlocking transaction.

12. The method according to claim 10, characterized in that The unlocking smart contract includes: public keys of multiple second users and a second unlocking method; The unlocking transaction includes: unlocking time; There are multiple unlocking transactions, which are sent by multiple current users through their respective user terminals; Verifying the unlocking transaction according to the unlocking smart contract includes: The signatures of the corresponding unlocking transactions are verified respectively according to the public keys of the second users. If the signatures of multiple unlocking transactions are verified, the second unlocking method is called to verify whether the number of current users with the same unlocking time exceeds the unlocking threshold.

13. The method according to claim 10, characterized in that The unlocking transaction includes: unlocking time; Further comprising: receiving an update contract transaction sent by the user terminal; adding a temporary user's public key and its corresponding third unlocking method to the unlocking smart contract according to the update contract transaction; Verifying the unlocking transaction according to the unlocking smart contract includes: The signature of the unlocking transaction is verified according to the public key of the temporary user. If the verification is successful, the third unlocking method is called to verify whether the unlocking time is within a valid time period.

14. An electronic lock, characterized in that: The electronic lock is a smart home electronic lock, comprising: An acquisition module, configured to obtain the contract address of the unlocking smart contract; The monitoring module is configured to monitor whether an unlocking event occurs in the blockchain according to the contract address, and when the unlocking event occurs, obtain a transaction receipt of the unlocking transaction from the blockchain; the unlocking event includes: unlocking time; A verification module is configured to verify whether the transaction receipt matches the unlocking event, and if so, obtain the Merkle proof of the transaction receipt from the blockchain; verify whether the transaction receipt is correct according to the Merkle proof of the transaction receipt, and if correct, verify whether the difference between the unlocking time and the current time is not greater than a preset time threshold, and if so, execute unlocking of the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminate the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, execute unlocking of the electronic lock when the difference between the current time and the unlocking time is not greater than the time threshold; The acquisition module is configured to obtain the public key of the consensus node; obtain the block header of the block where the unlocking transaction is located from the blockchain; The verification module is configured to verify whether the format of the block header meets the format rules. If so, it verifies whether the signature in the block header matches the public key of the consensus node. If they match, it executes the Merkle proof based on the transaction receipt to verify whether the transaction receipt is correct.

15. A user terminal, characterized in that: The user terminal is a user terminal of a smart home, including: A deployment module, configured to send a deployment contract transaction to a blockchain to deploy an unlocking smart contract in the blockchain; An acquisition module, configured to obtain the contract address of the unlocking smart contract; A sending module is configured to provide the contract address to the electronic lock; send an unlocking transaction signed by the private key of the current user to the blockchain, so that the electronic lock monitors whether an unlocking event occurs in the blockchain according to the acquired contract address of the unlocking smart contract, and when the unlocking event is monitored, obtain a transaction receipt of the unlocking transaction from the blockchain; the unlocking event includes: unlocking time; verify whether the transaction receipt matches the unlocking event, if so, obtain the Merkle proof of the transaction receipt from the blockchain; obtain the public key of the consensus node; obtain the block header of the block where the unlocking transaction is located from the blockchain; verify whether the format of the block header meets the format rules, if so, verify the block header The signature in the transaction receipt matches the public key of the consensus node. If so, the Merkel proof based on the transaction receipt is executed to verify whether the transaction receipt is correct; the transaction receipt is verified to be correct based on the Merkel proof of the transaction receipt. If correct, the difference between the unlocking time and the current time is not greater than the preset time threshold. If so, the electronic lock is unlocked; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, the current process is terminated; if the difference is greater than the time threshold and the unlocking time is later than the current time, when the difference between the current time and the unlocking time is not greater than the time threshold, the electronic lock is unlocked.

16. A remote unlocking device based on blockchain, characterized in that: Node devices used in blockchain include: A deployment module, configured to receive a deployment contract transaction sent by a user end of a smart home; and deploy an unlocking smart contract in the blockchain according to the deployment contract transaction; A verification module is configured to receive an unlocking transaction sent by the user end; the unlocking transaction is signed by the private key of the current user; the unlocking transaction is verified according to the unlocking smart contract, and when the verification is passed, an unlocking event is generated; a transaction receipt and a Merkle proof of the transaction receipt are generated, so that the electronic lock of the smart home can monitor whether an unlocking event occurs in the blockchain according to the acquired contract address of the unlocking smart contract, and when the unlocking event is monitored, the transaction receipt of the unlocking transaction is obtained from the blockchain, and the unlocking event includes: unlocking time; verify whether the transaction receipt matches the unlocking event, and if so, obtain the Merkle proof of the transaction receipt from the blockchain; obtain the public key of the consensus node; obtain the block header of the block where the unlocking transaction is located from the blockchain; verify the block header The format of the transaction receipt satisfies the format rules. If so, verify whether the signature in the block header matches the public key of the consensus node. If they match, execute the Merkel proof based on the transaction receipt to verify whether the transaction receipt is correct; verify whether the transaction receipt is correct based on the Merkel proof of the transaction receipt. If correct, verify whether the difference between the unlocking time and the current time is not greater than the preset time threshold. If so, execute the unlocking of the electronic lock; if the difference is greater than the time threshold and the unlocking time is earlier than the current time, terminate the current process; if the difference is greater than the time threshold and the unlocking time is later than the current time, when the difference between the current time and the unlocking time is not greater than the time threshold, execute the unlocking of the electronic lock.

17. A remote unlocking system based on blockchain, characterized in that: include: The electronic lock of claim 14, the user terminal of claim 15, and the blockchain-based remote unlocking device of claim 16.

Citation Information

Patent Citations

  • Block chain network, electronic lock control method thereof, terminal equipment and storage medium

    CN111163034A

  • Trusted data cross-chain system based on blockchain all-in-one machine

    CN113590718A

  • Lock control method and system based on block chain and electronic lock

    CN115035637A