Backup and restore the gateway key from your Helium Hotspot
Published: 2022-02-26 01:06:53


If you have a Helium Hotspot it's very important to backup the gateway_key of your hotspot. If you loose this key and something happen to your SD card or secure element, you will not be able to use this hotspot anymore. In conclusion, backup your key, store it in a safe place and you will be able to restore it in the future in case it's needed.

This tutorial it's compatible with `DIY Helium Hotspots` and `Data-Only Hotspots` managed with [balena](https://balena.io).

## DIY Helium Hotspots

### Backup your swarm key

1. Open an SSH session to the "host-os"
2. Type this command and keep note of the (YOUR INSTANCE)_miner-data information: 
      `ls /var/lib/docker/volumes`
3. Type this command to get a link to download the swarm key (note to replace the YOUR INSTANCE part with the container number that you got from the previous command) 
      `curl -F "file=@/var/lib/docker/volumes/(YOUR INSTANCE)_miner-data/_data/miner/swarm_key" https://file.io`
4. Use the outputted file.io link to securely download your swarm key. The file is deleted once downloaded.

### Restore your swarm key on your new hotspot

1. Open an SSH session to the "host-os"
2. Type this command and keep note of the (YOUR INSTANCE)_miner-data information: 
      `ls /var/lib/docker/volumes`
3. Navigate to where the swarm_key is stored
      `cd /var/lib/docker/volumes/(YOUR INSTANCE)_miner-data/_data/miner/`
4. Remove the original swarm_key file
      `rm swarm_key`
5. Upload your swarm_key that you wish to restore onto file.io and do
      `curl -LJO [FILE.IO UPLOAD LINK]`
6. Reboot miner and you will see it restored successfully.


## Helium Data-Only Hotspot

To build the Helium Data-Only Hotspot using a Raspberry Pi and balena follow [these intructions](https://docs.helium.com/mine-hnt/data-only-guides/balena-data-only-hotspot/)


### Backup your gateway_key.bin file


1. Open an SSH session to the "host-os" on balenaCloud Terminal.
2. Type this command and keep note of the (YOUR INSTANCE)_miner-storage: `ls /var/lib/docker/volumes`
3. Type this command to get a link to download the gateway key (note to replace the YOUR INSTANCE part with the container number that you got from the previous command) `curl -F "file=@/var/lib/docker/volumes/(YOUR INSTANCE)_miner-storage/_data#/gateway_key.bin" https://file.io`
4. Use the outputted file.io link to securely download your `swarm key`. The link only works one time.


### Restore your gateway_key.bin file on your new hotspot


1. Open an SSH session to the "host-os" on balenaCloud Terminal.
2. Type this command and keep note of the (YOUR INSTANCE)_miner-storage information: `ls /var/lib/docker/volumes`
3. Navigate to where the swarm_key is stored `cd /var/lib/docker/volumes/(YOUR INSTANCE)_miner-storage/_data#/`
4. Remove the original gateway_key.bin file `rm gateway_key.bin`
5. Upload your gateway_key.bin that you wish to restore onto file.io and do `curl -LJO [FILE.IO UPLOAD LINK]`
6. Reboot miner and you will see it restored and working :)


## Acknowledgements

Thank you for the inspiration made by [bottxrnife](https://github.com/bottxrnife/helium-2287-w) and Mithun. Also give the credits to [olieman.eth](https://unsplash.com/@moneyphotos) for the picture of the blogpost.


If you have other methods to backup and restore gateway keys, feel free to share them on the comments.