Blockchain-implemented method and system
The computer-implemented invention provides a method and corresponding system for controlling access to and/or use of an internet-enabled resource. The invention uses a distributed electronic ledger such as, for example, the Bitcoin blockchain. The resource may be an IoT device or system. Access to the resource is permitted or enabled upon provision of a cryptographic key e.g. a private key which corresponds to a public key which has been stored in memory. In one embodiment, the public key is stored in a DHT. Access to the resource is prevented or disabled by removing the public key from memory, and using a redeem script of a blockchain Transaction to spend a tokenised output of a further blockchain Transaction. The process of communicating the requisite cryptographic keys and transferring funds is performed via the blockchain. The keys are communicated as tokens in the metadata of transactions scripts. In use, when access is requested by the user, an encrypted message is sent to the resource. The message has been encrypted using the user's private key. If the resource can use the previously communicated public key to decrypt the message, access can be granted. The invention is particularly suited for use in situations where temporary access or use of the resource is to be granted eg rental scenarios.
1 . A method of controlling access to and/or use of an Internet of Things (IoT) device having a Blockchain IoT Device (BID) agent that executes predetermined instructions stored off the IoT device and accessed via cryptographic keys, the method comprising:
receiving, at the IoT device, a first blockchain transaction (TxB) from a blockchain network, the first blockchain transaction comprising:
i) a token representing a smart contract relating to the access to and/or use of the IoT device, wherein the token is a multisig address that includes more than one signature from a user, a controller of the IoT device and an escrow agent;
ii) an output having a redeem script which includes a token containing metadata stored in a distributed hash table (DHT) representing a public key associated with the user, wherein the BID agent is configured to access the public key from the DHT using the metadata in the token; and
iii) at least one output for transferring cryptocurrency from the user of the IoT device to the escrow agent;
accessing, by the BID agent, the public key associated with the user from the metadata contained in the token of the redeem script after the first transaction has been confirmed on the blockchain, wherein the BID agent retrieves operating instructions from the DHT that specify how to store and use the public key for verification;
storing the public key, or a reference to its location, in memory within the IoT device, wherein the BID agent executes the retrieved operating instructions to store the public key;
receiving, at the IoT device from a portable computing device associated with the user, a message or other data which has been encrypted using a private key associated with the user;
allowing or preventing access to and/or use of the IoT device by the BID agent performing cryptographic calculations to verify the encrypted message using the stored public key and toggling switches of a set of switches on the IoT device via an application programming interface (API) dependent upon successful cryptographic verification, wherein the BID agent operates and controls the IoT device via the API by executing predetermined instructions stored off the IoT device and accessed via cryptographic keys;
detecting, at the IoT device, a second blockchain transaction on the blockchain network, the second blockchain transaction responsive to completion of a rental period specified in the smart contract,
the second blockchain transaction comprising:
a first input signed by the escrow agent and a second input signed by the user of the IoT device and the controller of the IoT device; and
an output which sends a second token that represents the public key associated with the user to the IoT device, or a hash of said public key, wherein responsive to a broadcast of the second blockchain transaction on the blockchain, the public key associated with the user is removed from the memory of the IoT device by the BID agent executing instructions retrieved from the DHT that specify how to identify and remove the specific public key matching the hash in the second token, wherein removing the public key prevents the IoT device from decrypting further messages from the portable computing device.
2 . A method according to claim 1 wherein:
the smart contract comprises details or conditions relating to an agreement for use of or access to the IoT device; and/or
the transfer of value is a payment of funds such as an amount of currency.
3 . A method according to claim 1 and comprising the step of accessing or obtaining the public key from the token and storing it in memory.
4 . A method according to claim 1 wherein the first transaction (TxB) is generated by the controller of the IoT device and sent to the user for modification.
5 . A method according to claim 4 wherein the user modifies the first blockchain transaction by adding at least one output to the first transaction.
6 . A method according to claim 1 wherein the data that has been encrypted is sent to the IoT device by the user, using a handheld or portable computing device.
7 . A method according to claim 1 and comprising the step of:
detokenizing the token of the second blockchain transaction (TxC) by creating a third blockchain transaction (TxD) which comprises an input that spends the output of the second transaction (TxC).
8 . A method according to claim 7 wherein submission of the first blockchain (TxB), second blockchain (TxC) and/or third blockchain (TxD) transactions to the blockchain network is automated, wherein the time of submission is dependent upon an instruction or setting provided within the respective transaction.
9 . A method according to claim 1 wherein the first blockchain transaction (TxB) comprises:
an output for transferring a deposit payment to the controller of the IoT device; and/or
an output for transferring a payment to the escrow agent.
10 . A computer-implemented system for controlling access to and/or use of an Internet of Things (IoT) device having a Blockchain IoT Device (BID) agent that executes predetermined instructions stored off the IoT device and accessed via cryptographic keys comprising:
one or more processors; and
memory including computer-executable instructions that, as a result of execution by the one or more processors, cause the system to:
receive, at the IoT device a first blockchain transaction (TxB) from a blockchain network, the first blockchain transaction comprising:
i) a token representing a smart contract relating to the access to and/or use of the IoT device, wherein the token is a multisig address that includes more than one signature from a user, a controller of the IoT device and an escrow agent;
ii) an output having a redeem script which includes a token containing metadata stored in a distributed hash table (DHT) representing a public key associated with the user, wherein the BID agent is configured to access the public key from the DHT using the metadata in the token; and
iii) at least one output for transferring cryptocurrency from the user of the IoT device to the escrow agent;
access, by the BID agent, the public key associated with the user from the metadata contained in the token of the redeem script after the first transaction has been confirmed on the blockchain, wherein the BID agent retrieves operating instructions from the DHT that specify how to store and use the public key for verification;
store the public key, or a reference to its location, in memory within the IoT device, wherein the BID agent executes the retrieved operating instructions to store the public key:
receive, at the IoT device from a portable computing device associated with the user, a message or other data which has been encrypted using a private key associated with the user;
allow or prevent access to and/or use of the IoT device by the BID agent performing cryptographic calculations to verify the encrypted message using the stored public key and toggling switches of a set of switches on the IoT device via an application programming interface (API) dependent upon successful cryptographic verification, wherein the BID agent operates and controls the IoT device via the API by executing predetermined instructions stored off the IoT device and accessed via cryptographic keys;
detect, at the IoT device, a second blockchain transaction on the blockchain network, the second blockchain transaction responsive to completion of a rental period specified in the smart contract,
the second blockchain transaction comprising:
a first input signed by the escrow agent and a second input signed by the user of the IoT device and the controller of the IoT device, and
an output which sends a second token that represents the public key associated with the user to the IoT device, or a hash of said public key, wherein responsive to a broadcast of the second blockchain transaction on the blockchain, the public key associated with the user is removed from the memory of the IoT device by the BID agent executing instructions retrieved from the DHT that specify how to identify and remove the specific public key matching the hash in the second token, wherein removing the public key prevents the IoT device from decrypting further messages from the portable computing device.
11 . A system according to claim 10 wherein the system comprises:
the IoT device;
a blockchain; and
an internet-enabled client device associated with a user and arranged to store a cryptographic key associated with the user, wherein the client device is a portable or handheld computing device.
12 . A system according to claim 10 wherein the IoT device is arranged to generate a blockchain Transaction and provide the Transaction to a blockchain network.