Helium is a crowdsourced / blockchain IoT network running on hardware like raspberryPi. You can more details on this blog post describing Helium network. Sometime you can have to move you miner from one hardware to another and this task needs to be executed shortly because you stop the IoT communication during this step. Here how I did proceed for my miner.
Prepare your new hardware
The new hardware need to be prepared as a new miner by installing your Ubuntu distribution and your docker environment to execute the miner. you need to create you miner directory structure. Let’s assume you run it into /opt/helium
[~] mkdir -p /opt/helium/data/miner [~] mkdir /opt/helium/logs
In this directory I have 2 scripts for my tooling:
#!/bin/bash +x docker pull quay.io/team-helium/miner:latest-arm64 docker stop miner1 docker rm miner1 docker run -d --restart always \ --env REGION_OVERRIDE=EU868 \ --publish 1680:1680/udp \ --publish 44158:44158/tcp \ --name miner1 \ --mount type=bind,source=/opt/helium/data,target=/var/data \ --mount type=bind,source=/opt/helium/logs,target=/var/log/miner \ quay.io/team-helium/miner:latest-arm64
#!/bin/bash docker exec miner1 miner info summary docker exec miner1 miner info height docker exec miner1 miner peer book -s
Once done, you can get your swarm_key file from your initial hardware (from your /data/miner/swarm_key file). Copy this file into /opt/helium/data/miner/swarm_key in the target hardware.
Make a snapshot from the initial location
A snapshop will make you new miner to immediately resync from the top of the chain instead of spending hours on blockchain restore. For making a snapshot, you need to execute the following command on your initial miner:
[~] docker exec miner1 miner snapshot take /var/data/snap_1
This is going to create a snapshot in the file yourMiner/data/snap_1.
Now, let’s copy the file into your new miner hardware in the path /opt/helium/data/snap_1
Let’s stop the miner on the initial location:
[~] docker stop miner1 [~] # docker rm miner1 # let's do this at the end # when everything is working fine.
Load the snapshot and be back on business
Now, on the target hardware, we need to run the miner and load the snapshot to resync the chain and be back.
[/opt/helium/] ./run.sh # this is starting the miner [/opt/helium/] docker exec miner1 miner snapshot load /var/data/snap_1 RPC to 'email@example.com' failed: timeout
In my case, I’ve got the timeout error but the loading was correctly done. You can check this by running the ./status.sh command 1-2 minutes after. You should get something like
+---------+------+ | name |result| +---------+------+ |connected| yes | |dialable | yes | |nat_type | none | | height |646681| +---------+------+
The height should be in sync with the current blockchain height you can check from https://explorer.helium.com/