I havea project in which I need to send the readings from the sensor connected to RPi to blockchain. Due to the fact that smart contract cannot manipulate data outside blockchain I need an oracle that will modify the sensor data (to be an integer) and address it to the Ethereum blockchain. I have no idea how to write oracles and how to run the script on RPi. Please, help
closed as too broad by smarx, Achala Dissanayake, Richard Horrocks, carver, Ismael Feb 27 '18 at 4:49
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
There's nothing particularily fancy about an oracle. They are just an external source that sends regular transactions to the blockchain. The transactions are in a well-defined format which can be read within the blockchain from other contracts.
So basically you have:
- An external program that gets external data and connects to the blockchain
- A way to serialize the external data in an understandable format to be stored in the blockchain (in a smart contract)
- A smart contract that can read the serialized data and provide it for whichever contract requires it
What you do need to be worried about is deciding on how you update the data in the blockchain. Is it regularily (once a day? once a minute?) or per-request? Each update costs you some gas and each read costs gas.