Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Installation of an Ethereum client on emonPi/emonBase?

Hello,

I would like to install an ethereum client on two sensors (one emonPi connected to the inverter of a PV panel and an emonBase communicating with an emonTx) and make them communicate through a basic smart contract on the blockchain.

The structure I would like to replicate is the one from the project GitHub - tomconte/SolarChainHack: Updated SolarChain app for the Microsoft 2016 //oneweek Hackathon.

The emonPi will be at the producer side and the emonBase at the consumer. I want to install a node using either geth or parity (I would prefer the second), here is a reference project GitHub - diglos/pi-gen: Tool used to create the raspberrypi.org Raspbian images.

My question is: can I work on the raspberry Pi of the 2 emons, install an Ethereum client and then make the 2 nodes communicate with each other without hampering the normal operations of the devices or interfereing with emonCMS? Is there any precaution I should take? Is it better if I use a separate device?

I’m an energy engineer and I’m new to blockchain, Linux and coding, so I apologize if my questions and the future follw-ups are too basic.

Thanks in advance,

Simo

You should be able to. The emonPi runs an emonSD pre built SD card based on raspbian Jessie. However, the root filesytem is in read-only mode by default. You will need to make the filesytem RW with $rpi-rw before installing any packages then back to RO with $rpi-ro when you’re done.

You may need to mount a folder as RW in tmpfs if your applications needs to write tmp files etc. See fstab

Thanks a lot for your answer, I have one more doubt before buying all the emons. I see in the store that the emonSD pre built SD card can only be 8gb, but I will need much more if I want to store a blockchain and run a node. Thus my question is: do you think it’s better if I buy a separate bigger SD card and I flash it myself (and have 2 partitions, root filesystem read-only with RW data partition) or to buy the pre-loaded SD card and add an USB external storage where to store the blockchain?

Again thanks a lot for your help, I migt post more doubts after I receive the devices.

Great work and great project! Thanks a lot :slight_smile:

Sure, not a problem. You can download the SD card image and flash to SD card of your choice emonSD pre built SD card Download & Change Log · openenergymonitor/emonpi Wiki · GitHub

You will need to expand the partitions.

I am interested in doing very much the same thing. We have a number of experimental, intranet-only Ethereum-based chains and I just happen to have a spare emon Pi which I need to re-flash having tweaked it for metering 3-phase. I would likely use the light client, which reduces the amount of data, and the Pi would not mine - just fire off transactions, say every 5 minutes, to record its parameters on the blockchain.

Our project pages are:
http://blockchain.open.ac.uk
http://projects.kmi.open.ac.uk/greendata/

Chris
KMi, The Open University, UK

1 Like

In case someone is interested in this topic, here you find the repositories with all the steps I followed:

And here is the integration of emonPi with NODE-RED and smart-contracts:

I hope it helps and that I referenced the great work you guys did in the proper way. I’ll be posting more.

Best,

Simone

Thanks for that. I did download a card image of Raspbian plus the ethereum light client but haven’t managed to get it on a card yet. But the above is better as it appears to allow me to add ethereum to an existing Pi card - precisely what I need to do in order to save generation data directly onto our blockchain.

1 Like

Yes, indeed, that is exactly what we did in order to add the node on the emonSD.

It’s the first time I write a repository on github, so I hope it’s clear enough.

Simone

We now have geth running on a Pi 3 but so far I’ve not got geth running on an emon Pi. It looks like using a pre-build module is a non-starter as no builds are available for Raspbian. I don’t think its worth trying to use a card image with geth already on as no one seems to be updating them to the current releases of geth (the one I have is 1.4). The only remaining option therefore is to build geth from the binary.

Another option would be to grab the data directly from PHPFina on the emon Pi and send it (CURL) to an existing mining node on our ethereum chain.