As you heard many times before, blockchain technology is going to change the whole IoT industry. What you have not heard is how this is going to happen. Here is the answer to three questions and how blockchain is a platform for IoT solutions.
- What is a blockchain?
- Which blockchain is a better choice for IoT solutions?
- How to design IoT based solutions?
Note that there are several fundamental problems with almost all the blockchains that you know, including BTC and Ethereum.
What is a blockchain
A blockchain is a distributed database that is accessible from anywhere, and there is no single point of failure. So, is that it? You might argue that all these things are achievable by current platforms and infrastructures.
But the cost is higher, and the availability of the system is lower. To understand it better, let me take you through the characteristics of blockchain technology.
A Public ledger
A public ledger means everyone can join the system. That is the major difference between a blockchain and other systems. Let’s clarify that any blockchain that is not public, is not a blockchain. So just drop any private blockchain without being impressed by the big names (e,g., Hyper ledger by IBM).
An immutable database or ledger records everything. So, it is a trail of evidence! It logs every action on the system. It doesnâ€™t mean you can not update a record, you can! But you need to create a new record and refer it to the old one.
If you work with current databases like Oracle, you know how costly it is to distribute data. By using blockchain as a database, the data is already distributed with no single point of failure which leads to 100% service availability with global access.
Paying from a device to another device in the form of micropayments opens many opportunities for IoT solutions.
Imagine in the coming years and with the existence of driverless cars, you get to your workplace, your car goes away and works for you during working hours, and gets paid constantly per kilometer/meter/hour/minute.
In this instance, your car could also sell the current traffic data to other applications whenever they use the data.
All of these are possible only with micropayments on the blockchain, (not all of them) because micropayments are too expensive on any other system.
The nature of asymmetric cryptography allows you to authenticate and authorize devices. The feature is a perfect tool to trigger other devices without a direct connection. More on the later.
Choosing the right one.
Now we know why we should use blockchain in IoT. The next step would be how to evaluate a blockchain for IoT solutions. The followings are the basic requirements for a usable blockchain-based platform
- Global Accessibility
- Low and non-Volatile Cost
A successful IoT solution generates a massive set of actions(transactions). As a result that will put the platform in real test. A blockchain that doesnâ€™t scale has no chance to be used for an IoT solution.
IoT devices vary in many ways, their OS, the application, usage, etc.. So it is necessary to use a platform that works perfectly with any device despite the differences.
How silly it sounds when someone tells you they have their own internet? The same rule applies if someone tells you they have their own IoT network. The nature of an IoT solution is to be accessible globally, the name â€œInternetâ€� is in the IoT after all!
Low and non-Volatile Cost
In any solution, estimating the cost is part of the process. To do that, you need to make sure the platform you are using has a fair and steady cost. If the cost of using the platform decreases in the future, Great! But an increase in cost will kill the project easily.
Last but not least is the stability. For instance, you have installed a device to work for years, but the protocol of the platform changes constantly. Think about it, you are not changing anything, but any change on the platform affects you directly.
Imagine having an FTP server where the FTP protocol changes every six months, how painful that would be.
A blockchain is secure if it meets the following requirements:
- Having an immutable database where nobody can alter or delete the data. The major difference between a blockchain database and other databases is the immutability. This feature makes blockchain a perfect database to store activities of IoT devices.
- It is expected to continue running in the future. One of the existing problems of many blockchains is the uncertain future of these projects. This comes from things like regulations, business models, number of users, lack of incentive in miners and investors.
- Having incentivized and honest players. In bitcoin whitepaper, the word â€œhonestâ€� was written fifteen times which pretty much emphasizes the importance of honesty in blockchains. So, if a miner or a major player isnâ€™t honest to the platform, nothing can make that network secure.
Not all the blockchains pass the requirements of being a proper platform for IoT solutions. Now we are going to learn how to distinguish a suitable blockchain from the rest.
How to Use Blockchain with IoT
A blockchain is a single distributed database (ledger) where data won’t be altered or lost. Now the main question is how to update this database? How do the transactions on Bitcoin work?
Transactions are a way of telling the network that you want to update the ledger. Generally, this update can be a request for actions like moving coins or inserting data.
Each transaction requires at least one input as the sender unless it is a Coinbase transaction and one output as the recipient.
When someone requests an update on the ledger, he needs to provide the proof for its request which is the signature of Unspent Transaction Outputs – UTXOs (the process is simplified). Only the person who has the private keys can provide those signatures.
As long as the private key(s) are safe and not compromised, nobody can update the ledger on behalf of the sender (the owner of UTXOs).
With the original version of Bitcoin, the transactions also can carry data, this data can be anything with any instructions. (Today you find some limitations on the BTC network regarding injecting data into the ledger.)
We have devices A and B with no direct connection, or through a specific server. Item A is a motion detection device. Whenever it detects any activity, it logs and encrypts the event in a transaction and sends it to the network.
If device A doesn’t detect anything in five minutes, it creates an “OK ” transaction and sends it to the network.
On the other part of the city, device B is monitoring the network(with no direct connection to the device B). Device B is ready to take some actions according to the following situations:
- Device B captures a transaction with the address of Device A as the sender, including the status of â€œOK.â€� As a result, it resets the timer to zero and does nothing.
- Device B detects a transaction with the status of the warning. It will make an automatic call to the Police station with a proper message.
- The timer on Device B passes five minutes with no transaction from Device A. Accordingly, Device B will make an automatic call to the Police station with a proper message.
In this scenario, there is no way to counterfeit Device A by an adversary unless he gets his hands on the keys. Also, there is no way to detect any server involved in the process or any relation between A and B.
Another simple example would be having two dogs in the yard and feeding them one by one. For example, you want to feed them only in times that one of them is in the yard, and the other one is resting.
You think about it and find out how we can manage two dogs with GPS devices and food gates that take actions according to the GPS data inside the transactions to the network. The above instances were only examples to grasp the concept of IoT on the blockchain better.
If you look at the keywords, you can think of thousands of other possibilities for creating complex algorithms.
Note that In Bitcoin you can have 2^256 (the real number is a bit lower) addresses. Each address can represent a device without requiring a public IP. The transactions cost less than $0.002. By using payment channels this amount will decrease even more considering the transactions transferred between parties.
Most of what you hear about blockchain technology is just hype but using blockchain technology improves security, transparency, and availability. Also, it lowers the cost of running projects.
At the moment of writing this article, theÂ original Bitcoin is the best candidate for IoT solutions. It has all the elements an IoT solution requires.
In this article, I gave you the pieces of the puzzle. The rest is up to you to come up with countless secure IoT solutions.
Image Credit: Worldspectrum; Pexels