This repository lets you build a bitcoin lightning box for Raspberry Pi 3 Model B & 3B+ based on Alpine Linux.
Work in progress. While stable enough for development, this software is subject to change, some of which may be breaking changes. Warning! Do not put money at stake that you are not willing to lose!
Tor
onion-routing for enhanced privacy and improved connectivity- Lightning Labs'
LND
bundled with our autoconnect and autounlock tools - Bitcoin Core
bitcoind
bundled with our implementation of Nicholas Dorier's fastsync to drastically reduce initial sync time Alpine Linux
, a security-oriented, lightweight Linux distribution based on musl libc andBusybox
- Containerization of most components including
nginx
,iotwifi
,invoicer
,bitcoind
,lnd
- Stateless OS - the microSD card image can be replaced with a newer version without loss of user data
- Simple
shell
,Python
scripts andGo
backends enable easy auditing and provide a small attack surface Docker
&docker-compose
make updates easier and orchestration painless- [Future] the microSD card can be mounted in read-only mode for zero-wear operation
- [Future] Redundant storage persistence using RAID
- invoicer: lightweight
bitcoind
andLND
backend in Go. - invoicer-ui: Point of Sale for Bitcoin and Lightning in React.
- iotwifi-ui: Wi-Fi connection wizard in React.
- noma: CLI node management utility and API in Python.
- docker-bitcoind: arm & amd64 support
- docker-berkeleydb: arm & amd64 support
- docker-lnd: arm & amd64 support
-
Raspberry Pi
- Recommended: model 3B+
- Optional: case, heatsink, LAN cable
We recommend using a heatsink on 3B+ models to unlock their full sustained performance. Useful, e.g. during syncing or filtering blocks.
-
microSD card
- Recommended: SanDisk 16GB or more
- microSD card to USB adapter or built-in hardware
Quality goes over quantity here!
-
USB storage devices
- Recommended: 4 USB flash drives of 16GB or more
- Alternatively for bitcoin full-archival nodes:
- 2 or 3 flash devices
- a hard drive or SSD for the blockchain
You may need to use a powered USB hub to prevent undervoltage when using some hard drives.
-
Power Supply (5V/2.5A) with micro-USB cable
- Recommended: official Raspberry Pi power supply
- Alternatively:
- high-quality USB charger (e.g. Samsung)
- short USB to micro-USB cable. (a longer cable can work with 5.1V chargers)
Warning! Your Raspberry Pi will not work properly without a correctly rated power supply and cable.
You risk losing bitcoin and data when running your Raspberry Pi in an underpowered state.
- Download Etcher
- Experienced users: it is possible to use
dd
instead
- Experienced users: it is possible to use
- Download latest lncm-box.img.zip
- Run Etcher and follow on-screen instructions to burn
lncm-box.img.zip
to microSD card - Place the SD card in your Raspberry Pi
- Connect your Raspberry Pi to a correctly rated power supply
- If you are using wired LAN:
- connect the cable to your Pi
- is your LAN cable active?
- congratulations, you are done!
- If you are using WiFi:
- find a device with a web browser and WiFi, e.g. your smartphone or laptop
- On your device, search for and connect to a WiFi network called LNCM-Box
- Password: lncm box
- Open the web browser on your device, e.g.
Chrome
orSafari
- Navigate to "http://box.local/wifi"
- Choose your WiFi network from the list
- Type in your password & connect
Your lightning box will automatically start installing itself to microSD card once it has an internet connection. This usually takes less than 15 minutes depending on the speed of your card and internet connection.
Once the box has synced up the invoicing service will be available at http://box.local/pos. Depending on the speed of your internet connection and your USB storage devices the process may take 30 minutes to an hour or more.
-
lncm
- username: lncm
- password: chiangmai
-
root
- username: root
- password: chiangmai
Note: sudo
is not installed, use su
instead
ssh lncm@box.local
Note: First boot will take some time as ssh host keys are generated.
The Raspberry Pi lightning box provides it's own WiFi hotspot to ease access and configuration.
-
WiFi name (SSID): "LNCM-Box"
-
WiFi password: "lncm box"
-
IP address: 192.168.27.1
-
hostname: box.local
To generate a fresh image from source run make_img.sh
as root on a Debian, Ubuntu or Alpine system.
For convenience, we also support vagrant
to automate setting up your development VM.
Install dependencies (homebrew, virtualbox, vagrant):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install virtualbox
brew cask install vagrant
git clone pi-factory
cd pi-factory
Create VM and generate image:
vagrant up
Rebuild image without wiping VM:
vagrant up --provision
Also useful:
vagrant ssh
vagrant halt
vagrant destroy -f
brew cask install vagrant-manager
(optional menu-bar utility)
If you are having problems, please let us know. We have a public chat room
Bug reports, pull-requests and suggestions are very welcome!
There are two public installations of this lightning box in Chiang Mai, Thailand acting as Bitcoin and Lightning points of sale in combination with a tablet.
Please do let us know about your own or those you spot!
The project is licensed under the permissive Apache 2.0 license.