I have a rpi3 and it have to be a node of a blockchain. I have a script python on raspberry, which gather data from an accelerometer. Checked some conditions,I should store these data,plus other strings(Gps coordinates and date)in a blockchain. I am using testrpc and I've installed web3.js.
I start my tester from cmd inserting "testrpc" and it shows me the available accounts with theirs private keys. Then to interact with it I have to open another cmd window,right?
To interact with a generic node I have to use web3 library,so from the second cmd window I should run a node.js script,which takes data from python script( with a socket for example) and use web3 function to interface with node. Something like this:
var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); web3.isConnected();
Now,imaging I wanted to store on blockchain just some values written in node.js(and not the real data yet). I don't know. For example var
x=5 e var
y=10. What would be the complete code to do this?