kornpow / LND-iot-app-launcher

2 stars 0 forks source link

LND-iot-app-launcher

An easy way to spin up a BTC Lightning node on an Odroid or Raspberry Pi 3B+, and easily portable to other embedded linux platforms.

This project makes heavy use of the Balena platform for managing fleets of embedded linux devices. Balena Logo

The goal of this project is to be able to create a Bitcoin or Litecoin Lightning node on Odroid devices, in around 24 hours. However, unlike other node projects, this will be a basic installation LND with some small steps to connect Python to the LND gRPC. This install is meant to be basic, so LND developers will have a platform for running a Lightning node and potentially running an app on top.

Bill Of Materials

Download the Blockchain

  1. Download Bitcoin: \~x minutes
  2. Download Litecoin: \~x minutes

Initial Installation

  1. Have access to Linux computer, or it is possible to use Ubuntu Subsystem for Windows.
  2. Create Balena.io account, the free tier should be fine.
  3. Once inside dashboard.balena-cloud.com, click "Create Application".
    1. Choose Raspberry Pi 3 or Odroid XU4, lookup Balena Balena Supported Devices, all of these boards can likely run this software with just a change of Base Image.
    2. Create Application
    3. Create Application2
  4. Now you are ready to create a new device and download the image, click "Add Device".
    1. Add Device
    2. Click "Download BalenaOS" and download and decompress image.
  5. Download Balena Etcher in order to burn images to MicroSD cards.
  6. Follow the steps to burn the MicroSD card using Etcher, you'll probably need a MicroSD to SD or MicroSD to USB adapter.

Preload Latest Build to Fleet

  1. sudo balena preload balena-cloud-LNDBerry-raspberrypi3-2.43.0+rev1-dev-v10.2.2.img --app={app id}

Device Configuration

  1. Navigate to your device visible on the Balena Dashboard. Dashboard
  2. Make a fork of this repo, and clone it to your machine.
    1. Note: You need to fork it since Balena uses a build pattern of adding a new remote and then you push up your image with git push balena master
  3. After you push up your image, it should show up as service 'main' on the device summary page (see screenshot above).
  4. Select the "Device Service Variables" tab, these are environment variables for a given device.
  5. Create environment variables like in the picture, be sure to use proper names that match the release images. Environment
  6. Place your ~>500gb SSD into its enclosure and connect it to your linux machines usb port.
    1. Use ls /dev/sd* before and after plugging in the drive, in order to determine which device is the one you plugged in.
  7. Obtain the UUID of the drive, this will be used to mount the blockchain and LND data directories stored on this device.
    1. Use the target drive letter here: sudo blkid /dev/sda
    2. Save this UUID and the filesystem type, they will need to be entered in the device service variables section.

Environment Variables

In the Balena dashboard, click "S(x) Device Service Variables". These are global settings for the container running your node. We'll use it for configuring the software versions and other device specific things. One thing this software could potentially be used for is easily detecting differences in different versions of the blockchain software.

Balena Commands

Balena has a CLI that we will use mostly for accessing our IoT lightning nodes from anywhere with Internet. Balena's vpn capability is very useful, as it eliminates the need for port forwarding for accessing devices over SSH.

Install Balena-CLI

Obtain API Obtain access token

Aliases

Useful alias' for using the node:

User Machine

This uses the balena cli to ssh to your node, it uses a vpn which makes getting to your node from anywhere easy.

Node

This is a handy alias for using litecoin

This project is still very early, and without much knowledge could be too much for beginners. However when it is completed my hope is this can compete with many of the other node launcher tools, and be one of the easiest ways to start a node. Looking for feedback!

Example Python Projects to Extend Node Functionality

  1. M-D-Br/FlaskBitcoinDashboard
  2. bitromortac/lndmanage

TODO:

Useful links for me and maybe for you