This is a 6 Step tutorial for getting a Raspberry Pi to run a fully functioning Lightning Node.

+ Docker

The trick is using Docker + Bitcoin with pruned data to allow everything to run in under 16 GB.

Step 0. Required Equipment

A secondary computer with ~300 GB of free space. A Raspberry Pi3 (Pi) with internet connectivity. (See other tutorials for this)

Step 1. Download full Bitcoin blockchain.

We need the Bitcoin blockchain in prunned mode. We will copy it to the Pi in Step 3.

Install Bitcoind (Linux) or Mac Start syncing Bitcoin blockchain. Wait for progress = 1.00.

sudo apt-get install bitcoind # (For Linux)

brew install bitcoind # (For Mac)

bitcoind -prune=555

... wait ... you can do steps 2 and 3.

*Note** The Blockchain data is stored in

/Library/Application Support/Bitcoin (Mac)

~/.bitcoin/ (Linux)

Step 2. Install Docker on your Pi.

We use Docker to containerize the LND and Bitcoind background services.

Install Docker.. Add the current user (pi) into the docker user group. Confirm the install.



sudo usermod -a -G docker $USER

docker --version curl -ssl https://get.docker.com | shsudo usermod -a -G docker $USERdocker --version

Step 3. Install Docker-Compose on your Pi

Docker-compose is used to build and connect our backends.

Install python-pip. Pip install docker-compose. Add the current user (pi) into the docker-compose user group Confirm the install.

sudo apt-get -y install python-pip

sudo pip install docker-compose

sudo usermod -a -G docker-compose $USER

docker-compose --version

Step 4. Download this repository and copy pruned bitcoin data

A fresh PI with 16 BG is not capable of holding the entire unpruned Bitcoin blockchain (~300 GB) so we will copy the pruned data from our secondary computer (Step 1)

Clone the docker files from DockerBitcoindLND Copy the blockchain data from the secondary computer onto the Pi.

git clone https://github.com/unconst/DockerBitcoindLND.git && cd DockerBitcoinLND scp -r <ip_of_secondary>:path/to/bitcoin_dir bitcoind/bitcoin_data # e.g scp -r 192.168.0.12:~/.bitcoin bitcoind/bitcoin_data

Step 5. Compose the Backend.

Compose and build the containers. Alias lncli. Alias bitcoind cli.

sudo docker-compose up --build

sudo alias lndcli='docker exec -i -t lnd_container lncli'

sudo alias bitcoin-cli='docker exec -i -t bitcoind_container bitcoin-cli'

Step 6. Wait for Nodes to sync.

After this step, you will need to wait for the containers to finish syncing. Check this progress through the logs.

docker logs bitcoind_container

docker logs lnd_container

You can interface with the docker containers as if they are locally running using the CLIs.

Good luck. Hope this was useful.

😉

:wq