2020-02-05 06:02:12 +01:00
# **ThunderHub - Lightning Node Manager**
2020-05-11 06:21:16 +02:00
![Home Screenshot ](/docs/Home.png )
2020-04-12 18:27:01 +02:00
[![license ](https://img.shields.io/github/license/DAVFoundation/captain-n3m0.svg?style=flat-square )](https://github.com/DAVFoundation/captain-n3m0/blob/master/LICENSE)
2020-02-27 09:06:53 +01:00
## Table Of Contents
- [Introduction ](#introduction )
2020-05-11 06:21:16 +02:00
- [Integrations ](#integrations )
2020-02-27 09:06:53 +01:00
- [Features ](#features )
- [Installation ](#installation )
2020-05-23 19:30:04 +02:00
- [Updating ](#updating )
2020-02-27 09:06:53 +01:00
- [Development ](#development )
2020-05-11 06:21:16 +02:00
- [Docker deployment ](#docker )
2020-02-27 09:06:53 +01:00
2020-06-05 18:50:10 +02:00
---
2020-02-27 09:06:53 +01:00
## Introduction
ThunderHub is an **open-source** LND node manager where you can manage and monitor your node on any device or browser. It allows you to take control of the lightning network with a simple and intuitive UX and the most up-to-date tech stack.
2020-06-05 18:50:10 +02:00
---
2020-05-11 06:21:16 +02:00
### Integrations
**BTCPay Server**
ThunderHub is currently integrated into BTCPay for easier deployment. If you already have a BTCPay server and want to add ThunderHub or even want to start a BTCPay server from zero, be sure to check out this [tutorial ](https://apotdevin.com/blog/thunderhub-btcpay )
**Raspiblitz**
For Raspiblitz users you can also get ThunderHub running by following this [gist ](https://gist.github.com/openoms/8ba963915c786ce01892f2c9fa2707bc )
2020-06-05 18:50:10 +02:00
---
2020-02-27 09:06:53 +01:00
### Tech Stack
2020-05-11 06:21:16 +02:00
This repository consists of a **NextJS** server that handles both the backend **Graphql Server** and the frontend **React App** . ThunderHub connects to your Lightning Network node by using the gRPC ports.
2020-02-27 09:06:53 +01:00
2020-04-12 18:27:01 +02:00
- NextJS
2020-02-27 09:06:53 +01:00
- ReactJS
- Typescript
- Styled-Components
- Apollo
- Apollo-Server
- GraphQL
- Ln-Service
2020-06-05 18:50:10 +02:00
---
2020-02-27 09:06:53 +01:00
## Features
### Monitoring
- Overview of current and pending balance for the Lightning and Bitcoin wallets.
- URI strings for the node (Onion public uri also if available)
- Invoice and Payment graph.
- Liquidity report with total remote and local lightning balance.
- Forwarded payments graph and the routes used for these payments.
- Complete network info.
- View open/pending/closed channels and how balanced they are.
- View channel base and rate fees.
- View all transactions.
- View all forwarded payments.
- View all chain transactions.
2020-04-08 20:06:59 +02:00
- View all unspent UTXOS.
2020-02-27 09:06:53 +01:00
### Management
2020-09-23 15:53:38 +02:00
- LNURL integration: ln-pay and ln-withdraw are available. Ln-auth soon.
2020-02-27 09:06:53 +01:00
- Send and Receive Lightning payments.
- Send and Receive Bitcoin payments.
- Decode lightning payment requests.
- Open and close channels.
2020-05-11 06:21:16 +02:00
- Balance your channels through circular payments. ([Check out the Tutorial](https://apotdevin.com/blog/thunderhub-balancing))
2020-02-27 09:06:53 +01:00
- Update your all your channels fees or individual ones.
- Backup, verify and recover all your channels.
2020-04-08 20:06:59 +02:00
- Sign and verify messages.
2020-02-27 09:06:53 +01:00
### Visual
- Responsive UI for any device. Mobile, Tablet or Desktop.
2020-09-17 07:48:56 +02:00
- Light, Dark and Night mode.
2020-02-27 09:06:53 +01:00
- Check values in Bitcoin, Satoshis or Fiat.
### Accounts
2020-09-17 07:48:56 +02:00
- Connect to your node with **HEX/Base64 strings** or by passing the **file locations** of the macaroons and certificate.
- Manage however many nodes you want.
- Use a master password or individual passwords for each account.
- Passwords are hashed to avoid having them in cleartext form.
2020-02-27 09:06:53 +01:00
2020-04-08 20:06:59 +02:00
### Deployment
2020-05-11 06:21:16 +02:00
- Docker images for easier deployment
2020-04-08 20:06:59 +02:00
2020-06-05 18:50:10 +02:00
---
2020-05-11 06:21:16 +02:00
## **Requirements**
2020-11-10 07:28:18 +01:00
- NPM installed
- Node installed (Version 14.15 or higher)
2020-05-11 06:21:16 +02:00
2020-06-05 18:50:10 +02:00
---
2020-05-11 06:21:16 +02:00
## Config
2020-06-23 10:54:52 +02:00
You can define some environment variables that ThunderHub can start with. To do this create a `.env.local` (or use the template `.env` ) file in the root directory with the following parameters:
**Important - If you want to use the `.env` template file and don't want it to be replaced after an update please duplicate and rename to `.env.local` **
2020-05-11 06:21:16 +02:00
2020-06-09 21:43:04 +02:00
```bash
# -----------
# Server Configs
# -----------
2020-07-16 22:50:21 +02:00
LOG_LEVEL = 'error' | 'warn' | 'info' | 'http' | 'verbose' | 'debug' | 'silly' # Default: 'info'
BASE_PATH = '[Base path where you want to have thunderhub running i.e. '/btcpay']' # Default: ''
2020-06-09 21:43:04 +02:00
# -----------
# Interface Configs
# -----------
2020-08-19 23:52:29 +02:00
THEME = 'dark' | 'light' | 'night' # Default: 'dark'
2020-07-16 22:50:21 +02:00
CURRENCY = 'sat' | 'btc' | 'fiat' # Default: 'sat'
2020-06-09 21:43:04 +02:00
# -----------
# Privacy Configs
# -----------
2020-07-16 22:50:21 +02:00
FETCH_PRICES = true | false # Default: true
FETCH_FEES = true | false # Default: true
DISABLE_LINKS = true | false # Default: false
2020-10-10 19:56:48 +02:00
DISABLE_LNMARKETS = true | false # Default: false
2020-07-16 22:50:21 +02:00
NO_VERSION_CHECK = true | false # Default: false
2020-05-19 07:50:16 +02:00
```
### SSO Account
You can define an account to work with SSO cookie authentication by adding the following parameters in the `.env` file:
2020-06-09 21:43:04 +02:00
```bash
# -----------
# SSO Account Configs
# -----------
2020-07-16 22:50:21 +02:00
COOKIE_PATH = '/path/to/cookie/file/.cookie'; # i.e. '/data/.cookie'
SSO_SERVER_URL = 'url and port to node'; # i.e. '127.0.0.1:10009'
SSO_CERT_PATH = '/path/to/tls/certificate'; # i.e. '\lnd\alice\tls.cert'
SSO_MACAROON_PATH = '/path/to/macaroon/folder'; # i.e. '\lnd\alice\data\chain\bitcoin\regtest\'
2020-05-19 07:50:16 +02:00
```
To login to this account you must add the cookie file content to the end of your ThunderHub url. For example:
```
http://localhost:3000?token=[COOKIE]
```
Replace `[COOKIE]` with the contents of the `.cookie` file.
### Server Accounts
You can add accounts on the server by adding this parameter to the `.env` file:
2020-06-09 21:43:04 +02:00
```bash
# -----------
# Account Configs
# -----------
2020-07-16 22:50:21 +02:00
ACCOUNT_CONFIG_PATH = '/path/to/config/file.yaml'; # i.e. '/data/thubConfig.yaml'
2020-05-19 07:50:16 +02:00
```
You must also add a YAML file at that location with the following format:
```yaml
masterPassword: 'password' # Default password unless defined in account
accounts:
- name: 'Account 1'
serverUrl: 'url:port'
macaroonPath: '/path/to/admin.macaroon'
certificatePath: '/path/to/tls.cert'
password: 'password for account 1'
- name: 'Account 2'
serverUrl: 'url:port'
macaroonPath: '/path/to/admin.macaroon'
certificatePath: '/path/to/tls.cert'
# password: Leave without password and it will use the master password
2020-06-10 07:07:50 +02:00
- name: 'Account 3'
serverUrl: 'url:port'
macaroon: '0201056...' # HEX or Base64 encoded macaroon
certificate: '0202045c...' # HEX or Base64 encoded certificate
password: 'password for account 3'
2020-05-11 06:21:16 +02:00
```
2020-06-10 07:07:50 +02:00
Notice you can specify either `macaroonPath` and `certificatePath` or `macaroon` and `certificate` .
2020-07-16 22:50:21 +02:00
#### Account with LND directory
You can also specify the main LND directory and ThunderHub will look for the certificate and the macaroon in the default folders (based on the network).
Default folders (assuming LND is at path `/lnd` ):
- Certificate: `/lnd/tls.cert`
- Macaroon: `/lnd/data/chain/bitcoin/[mainnet | testnet | regtest]/admin.macaroon`
The YAML file for this example would be:
```yaml
masterPassword: 'password' # Default password unless defined in account
defaultNetwork: 'testnet' # Default network unless defined in account
accounts:
- name: 'Account1'
serverUrl: 'url:port'
# network: Leave without network and it will use the default network
lndDir: '/path/to/lnd'
- name: 'Account2'
serverUrl: 'url:port'
network: 'mainnet'
lndDir: '/path/to/lnd'
```
If you don't specify `defaultNetwork` then `mainnet` is used as the default.
2020-07-15 22:40:00 +02:00
#### Security
On the first start of the server, the `masterPassword` and all account `password` fields will be **hashed** and the file will be overwritten with these new values to avoid having cleartext passwords on the server.
2020-06-09 21:43:04 +02:00
### Privacy Configs
2020-05-11 06:21:16 +02:00
2020-06-09 21:43:04 +02:00
**Prices and Fees**
2020-05-11 06:21:16 +02:00
ThunderHub fetches fiat prices from [Blockchain.com ](https://blockchain.info/ticker )'s api and bitcoin on chain fees from [Earn.com ](https://bitcoinfees.earn.com/api/v1/fees/recommended )'s api.
If you want to deactivate these requests you can set `FETCH_PRICES=false` and `FETCH_FEES=false` in your `.env` file or manually change them inside the settings view of ThunderHub.
2020-10-10 19:56:48 +02:00
**LnMarkets**
ThunderHub can connect to the LnMarkets API. You can disable this option by setting `DISABLE_LNMARKETS=true` in your `.env` file.
2020-06-09 21:43:04 +02:00
**Links**
ThunderHub shows you links for quick viewing of nodes by public key on [1ml.com ](https://1ml.com/ ) and for viewing onchain transactions on [Blockchain.com ](https://www.blockchain.com/ ).
If you don't want to show these links, you can set `DISABLE_LINKS=true` in your `.env` file.
**Version Check**
ThunderHub gets the latest available version from [Github ](https://api.github.com/repos/apotdevin/thunderhub/releases/latest ) and shows you a message if you are on an older version.
If you want to disable this option you can set `NO_VERSION_CHECK=true` in your `.env` file.
2020-05-11 06:21:16 +02:00
### Running on different base path
Adding a BASE_PATH will run the ThunderHub server on a different base path.
For example:
2020-06-26 20:22:43 +02:00
- by default ThunderHub runs on `http://localhost:3000`
2020-05-11 06:21:16 +02:00
- base path of `/thub` runs ThunderHub on `http://localhost:3000/thub`
2020-06-26 20:22:43 +02:00
**Notice - If you don't need to run ThunderHub on a different base path don't add this variable in your file**
2020-05-11 06:21:16 +02:00
To run on a base path, ThunderHub needs to be behind a proxy with the following configuration (NGINX example):
```nginx
location /thub/ {
rewrite ^/thub(.*)$ $1 break;
proxy_pass http://localhost:3000/;
}
```
2020-06-05 18:50:10 +02:00
---
2020-02-27 09:06:53 +01:00
## Installation
2020-02-26 18:55:07 +01:00
To run ThunderHub you first need to clone this repository.
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
```js
2020-02-26 18:55:07 +01:00
git clone https://github.com/apotdevin/thunderhub.git
```
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
After cloning the repository run `yarn` or `npm install` to get all the necessary modules installed.
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
After all the dependencies have finished installing, you can proceed to build and run the app with the following commands.
2020-02-05 06:02:12 +01:00
```javascript
2020-05-23 19:30:04 +02:00
// Yarn
2020-04-12 18:27:01 +02:00
yarn build
yarn start
2020-05-11 06:21:16 +02:00
2020-05-23 19:30:04 +02:00
// NPM
2020-05-11 06:21:16 +02:00
npm run build
npm start
2020-02-05 06:02:12 +01:00
```
2020-05-11 06:21:16 +02:00
This will start the server on port 3000, so just go to `localhost:3000` to see the app running.
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
If you want to specify a different port (for example port `4000` ) run with:
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
```js
// Yarn
yarn start -p 4000
// NPM
2020-05-14 07:30:19 +02:00
npm start -- -p 4000
2020-05-11 06:21:16 +02:00
```
2020-02-05 06:02:12 +01:00
2020-08-09 16:39:55 +02:00
For **PRODUCTION** , if you want to reduce the space taken up by ThunderHub you can run `npm prune --production` after the build is completed.
2020-06-05 18:50:10 +02:00
---
2020-05-23 19:30:04 +02:00
## Updating
2020-06-05 18:50:10 +02:00
There are multiple ways to update ThunderHub to it's latest version.
2020-05-23 19:30:04 +02:00
_Commands have to be called inside the thunderhub repository folder._
2020-06-05 18:50:10 +02:00
**1. Script Shortcut**
```sh
// Yarn
yarn update
// NPM
npm run update
```
**2. Script**
```sh
sh ./scripts/updateToLatest.sh
```
**3. Step by Step**
```sh
2020-05-23 19:30:04 +02:00
// Yarn
git pull
yarn
yarn build
// NPM
git pull
npm install
npm run build
2020-06-05 18:50:10 +02:00
```
**Then you can start your server:**
```sh
// Yarn
yarn start
// NPM
2020-05-23 19:30:04 +02:00
npm run start
```
2020-06-05 18:50:10 +02:00
---
2020-02-27 09:06:53 +01:00
## Development
2020-02-05 06:02:12 +01:00
2020-04-08 20:06:59 +02:00
If you want to develop on ThunderHub and want hot reloading when you do changes, use the following commands:
2020-02-05 06:02:12 +01:00
2020-05-11 06:21:16 +02:00
```js
//Yarn
2020-04-12 18:27:01 +02:00
yarn dev
2020-05-11 06:21:16 +02:00
//NPM
npm run dev
2020-02-05 06:02:12 +01:00
```
2020-06-05 18:50:10 +02:00
---
2020-05-11 06:21:16 +02:00
## Docker
ThunderHub also provides docker images for easier deployment. [Docker Hub ](https://hub.docker.com/repository/docker/apotdevin/thunderhub )
To get ThunderHub running with docker follow these steps:
1. `docker pull apotdevin/thunderhub:v0.5.5` (Or the latest version you find)
2. `docker run --rm -it -p 3000:3000/tcp apotdevin/thunderhub:v0.5.5`
You can now go to `localhost:3000` to see your running instance of ThunderHub