Hardware as a Service Using Blockchain And IoT
Hardware as a Service Using Blockchain And IoT
16 December 2021
Introduction:
Hardware as a Service (HaaS) is a service providing model for hardware that is defined Separately in managed services and grid computing contexts. In managed services, HaaS is very close to licensing. In Grid computing, HaaS is a pay-and-go model. Here we are using HaaS to deal on hardware sensor values.
Required programs we have to implement are:
- solidity smart contract.
- event listening program.
Required packages to run:
- web3
- rpi.gpio
First of all we have to write the solidity smart contract program in the point of get and set functions which is compiled in the remix etherscan and deploy it by linking it with the metamask account and there itself we get the abi string and contract address.
After that we have to write the event listener program in python which listens the ethereum transaction happen to that contract address and it displays the triggered event set value .In that program we are using AWS IOT MQTT CLIENT which is used to publish a message to an aws topic. Here I am publishing the gpio pin value as a message to aws iot topic. And also I am using the set value as the raspberry pi value.
And also I wrote this program in such a way that the publish will happen when the transaction in remix is done and the publish will stop when the other transaction happens.