Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 3.24 KB

BUILD.md

File metadata and controls

61 lines (42 loc) · 3.24 KB

Development instructions

Prerequisites

The current setup has been tried only on ubuntu 17.10 but should work on other platforms too, to start developing btc-hotspot you need the following tools:

⚠️ This minimal setup will let you run btc-hotspot locally but remember to wire it to a lightning protocol server (eclair) to test the payment process, if in doubt feel free to contact the repo owner for help or to use the project's test instance. ⚠️

⚠️ To build the project you will need bitcoin-lib_2.12, since the official version from ACINQ [https://github.com/ACINQ/bitcoin-lib] does not yet support scala 2.12 you will need to clone and build my fork at [https://github.com/araspitzu/bitcoin-lib], to install the library in your local system run mvn install in the bitcoin-lib directory. ⚠️

Overview

This is captive portal system accepting bitcoin payments over the lightning network protocol and it's designed to run on a home server like the raspberry-pi. The app is written in Scala and uses eclair as payment gateway, clients connected to the hotspot are captured via an iptable based setup (check it out here), the build script also serves as one-liner installer for the users of btc-hotspot. In the local instance the database is wiped everytime you restart the server, 3 test offers are inserted by default (TestData.scala) for ease of testing, also when running locally your mac address is mocked with 'unknown'. To check out the hotspot main page visit http://127.0.0.1:8081/anything, you will be caught and redirected to the index.html, in this process a new session for your MAC address is being created. You can now choose an offer and click buy, the backend will create an invoice for you and redirect your browser to the invoice page, there you can pay with a ⚡ wallet. As the owner of the hotspot you get an admin panel where you can configure the offers and check the current active clients connected, to open the admin panel visit http://127.0.0.1:8082

Setup

Clone and enter the project folder with:

git clone https://github.com/araspitzu/btc-hotspot && cd btc-hotspot

To compile and run type:

sbt run

protip: to avoid killing sbt and restarting it you can launch sbt and then reStart from the interactive shell.

To run the test type:

sbt test

When running locally the configuration will be read from src/main/resources/application.conf, this is where you need to set host and api-token of the eclair node. The finished application aims at having an internal (inside the raspberry-pi) eclair node to connect to.

Packaging and deploying

There is a Makefile that provides useful alias for common operations, namely:

  • To package the application into a debian package

make package version=0.0.1-dev

  • To deploy a new version into the raspberry

make deploy version=0.0.1-dev host=1.0.0.1

The above command will pack the app, push it in the PI and install it.