diff --git a/.gitbook/assets/PostgreSQL-Logo-white.png b/.gitbook/assets/PostgreSQL-Logo-white.png new file mode 100644 index 00000000..bf9a512d Binary files /dev/null and b/.gitbook/assets/PostgreSQL-Logo-white.png differ diff --git a/.gitbook/assets/bonus-logo.png b/.gitbook/assets/bonus-logo.png new file mode 100644 index 00000000..fcebf68f Binary files /dev/null and b/.gitbook/assets/bonus-logo.png differ diff --git a/.gitbook/assets/core_logo.png b/.gitbook/assets/core_logo.png new file mode 100644 index 00000000..5dfe1152 Binary files /dev/null and b/.gitbook/assets/core_logo.png differ diff --git a/.gitbook/assets/golang.png b/.gitbook/assets/golang.png new file mode 100644 index 00000000..0b7e8a1d Binary files /dev/null and b/.gitbook/assets/golang.png differ diff --git a/README.md b/README.md index b3999ee0..c8e49ec7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Build your own "do-everything-yourself" Bitcoin full node on a personal computer No need to trust anyone else. Don't trust, verify! -### What is the MiniBolt? +## What is the MiniBolt? With this guide, you can set up a Bitcoin and Lightning node on a personal computer from scratch, doing everything yourself. You will learn about Linux, Bitcoin, and Lightning. As a result, you'll have your very own Bitcoin node, built by you and no one else. @@ -28,11 +28,11 @@ There are many reasons why you should run your own Bitcoin node: ⚡️ **Be part of Lightning.** Run your Lightning node for everyday payments and help build a robust, decentralized Bitcoin Lightning network. -### MiniBolt overview +## MiniBolt overview This guide explains how to set up your own Bitcoin node on a Personal Computer. But it works on most hardware platforms because it only uses standard Debian Linux commands. -#### Features +### Features Your Bitcoin node will offer the following functionality: @@ -48,52 +48,37 @@ Your Bitcoin node will offer the following functionality: 🌐 **Reachable from anywhere**: connect to all your services through the Tor network and Wireguard VPN -#### Target audience +### Target audience -We strive to give foolproof instructions. But the goal is also to do everything ourselves. +* [x] We strive to give foolproof instructions. But the goal is also to do everything ourselves. +* [x] Shortcuts that involve trusting someone else are not allowed. This makes this guide quite technical, but we try to make it as straightforward as possible. +* [x] You'll gain a basic understanding of the how and why. +* [x] If you like to learn about Linux, Bitcoin, and Lightning, then this guide is for you. -Shortcuts that involve trusting someone else are not allowed. This makes this guide quite technical, but we try to make it as straightforward as possible. - -You'll gain a basic understanding of the how and why. - -If you like to learn about Linux, Bitcoin, and Lightning, then this guide is for you. - -#### Structure +### Structure We aim to keep the core of this guide well-maintained and up-to-date: -1. [System](system/): prepare the hardware and set up the operating system -2. [Bitcoin](bitcoin/): sync your own Bitcoin full node, Electrum server, Blockchain Explorer, and connect a desktop wallet to the Electrum server -3. [Lightning](lightning/): run your Lightning client with web-based node management, connect a mobile app, and save safely your SCB backup - -➕ Bonus guides: the bonus section contains more specific guides that build on top of the main section. More fun, lots of knowledge, but with lesser maintenance guarantees. Everything is optional. +
| Prepare the hardware and set up the operating system | preparations.md | operating-system.md | remote-access.md | system | operating-system.gif | |
Sync your own Bitcoin full node, Electrum server, Blockchain Explorer, and connect a desktop wallet to the Electrum server | bitcoin-client.md | electrum-server.md | blockchain-explorer.md | bitcoin | core_logo.png | ||
Run your Lightning client with web-based node management, connect a mobile app, and save safely your SCB backup | lightning-client.md | channel-backup.md | web-app.md | lightning | lightning-network-daemon-logo.png | ||
➕ Bonus guides | The bonus section contains more specific guides that build on top of the main section. More fun, lots of knowledge, but with lesser maintenance guarantees. Everything is optional. | system | bitcoin | Broken link | bonus-logo.png |
🛠️ GitHub 🛠️ | ||
👥 RRSS 👥 |
|
> tcp LISTEN 0 200 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=2532748,fd=7))
-> tcp LISTEN 0 200 [::1]:5432 [::]:* users:(("postgres",pid=2532748,fd=6))
-
-
-### Create PostgreSQL databases
-
-* With user `admin`, change to the automatically created user for the PostgreSQL installation called `postgres`
-
-```bash
-sudo su - postgres
-```
-
-* Create a new database user
-
-```bash
-createuser --pwprompt --interactive
+> psql (PostgreSQL) 16.3 (Ubuntu 16.3-1.pgdg22.04+1)
```
-Type in the following:
-
-> > Enter name of role to add: **admin**
->
-> > Enter password for new role: **admin**
->
-> > Enter it again: **admin**
->
-> > Shall the new role be a superuser? (y/n) **n**
->
-> > Shall the new role be allowed to create databases? (y/n) **y**
->
-> > Shall the new role be allowed to create more new roles? (y/n) **n**
-
-* Create 2 new databases
-
-```bash
-createdb -O admin btcpayserver
-```
+{% hint style="info" %}
+If PostgreSQL is not installed (output: Command 'psql' not found), follow this [PostgreSQL](../system/postgresql.md) guide to install it
+{% endhint %}
-```bash
-createdb -O admin nbxplorer
-```
+#### Create PostgreSQL databases
-* Go back to the `admin` user
+* With user `admin`, create 2 new databases with the `postgres` user
+{% code overflow="wrap" %}
```bash
-exit
+sudo -u postgres createdb -O admin btcpayserver && sudo -u postgres createdb -O admin nbxplorer
```
+{% endcode %}
## Installation, Configuration & Run
@@ -306,14 +229,10 @@ exit
sudo su - btcpay
```
-* Create a "src" directory and enter the folder
+* Create a `src` directory and enter the folder
```bash
-mkdir src
-```
-
-```bash
-cd src
+mkdir src && cd src
```
* Set the environment variable version
@@ -506,8 +425,8 @@ sudo nano /etc/systemd/system/nbxplorer.service
[Unit]
Description=NBXplorer
-Wants=bitcoind.service
-After=bitcoind.service
+Requires=bitcoind.service postgresql.service
+After=bitcoind.service postgresql.service
[Service]
WorkingDirectory=/home/btcpay/src/NBXplorer
@@ -539,7 +458,7 @@ WantedBy=multi-user.target
sudo systemctl enable nbxplorer
```
-* Prepare “`nbxplorer`” monitoring by the systemd journal and checking the logging output. You can exit monitoring at any time with Ctrl-C
+* Prepare `nbxplorer` monitoring by the systemd journal and checking the logging output. You can exit monitoring at any time with Ctrl-C
```bash
journalctl -fu nbxplorer
@@ -821,8 +740,8 @@ sudo nano /etc/systemd/system/btcpay.service
[Unit]
Description=BTCPay Server
-Wants=nbxplorer.service
-After=nbxplorer.service
+Requires=nbxplorer.service postgresql.service
+After=nbxplorer.service postgresql.service
[Service]
WorkingDirectory=/home/btcpay/src/btcpayserver
@@ -907,13 +826,13 @@ sudo ss -tulpn | grep LISTEN | grep 23000
Expected output:
```
-> tcp LISTEN 0 512 127.0.0.1:23000 0.0.0.0:* users:(("dotnet",pid=2811744,fd=320))
+> tcp LISTEN 0 512 0.0.0.0:23000 0.0.0.0:* users:(("dotnet",pid=2811744,fd=320))
```
-Now point your browser, `"http://minibolt.local:23000"` (or your node IP address) like `"http://192.168.0.20:23000"`.
+Now point your browser, `"http://minibolt.local:23000"` (or your node IP address) like `"http://192.168.0.20:23000"`
{% hint style="info" %}
-You can now create the first account to access the dashboard using a real (recommended) or a dummy email, and password
+You can now create the first account to access the dashboard using a real (recommended) or a dummy email + password
{% endhint %}
{% hint style="success" %}
@@ -983,7 +902,7 @@ restlisten=0.0.0.0:8080
sudo systemctl restart lnd
```
-* Ensure the REST port is now binding to the `0.0.0.0` host instead of `127.0.0.1`
+* Ensure the REST port is now binding to the `0.0.0.0` host instead of `127.0.0.1`
```bash
sudo ss -tulpn | grep LISTEN | grep lnd | grep 8080
@@ -1000,6 +919,8 @@ Expected output:
sudo systemctl stop btcpay
```
+#### Modify BTCPay Server configuration
+
* Change to the `btcpay` user
```bash
@@ -1025,6 +946,21 @@ BTC.lightning=type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/dat
exit
```
+#### Modify the BTCPay Server systemd service
+
+* Modify the next lines of the systemd service file by following [this section](btcpay-server.md#create-btcpay-server-systemd-service)
+
+```
+Requires=nbxplorer.service lnd.service
+After=nbxplorer.service lnd.service
+```
+
+* Reload the systemd daemon
+
+```bash
+sudo systemctl daemon-reload
+```
+
* Start the BTCPay Server again
```bash
@@ -1439,6 +1375,6 @@ sudo systemctl reload tor
| Port | Protocol | Use |
| :---: | :------: | :------------------------: |
-| 5432 | TCP | PostgreSQL default port |
+| 5432 | TCP | PostgreSQL default port |
| 24444 | TCP | NBXplorer default port |
| 23000 | TCP | BTCPay Server default port |
diff --git a/bonus-guides/bitcoin/nostr-relay.md b/bonus-guides/bitcoin/nostr-relay.md
index bd58c36b..3888ea6b 100644
--- a/bonus-guides/bitcoin/nostr-relay.md
+++ b/bonus-guides/bitcoin/nostr-relay.md
@@ -45,20 +45,27 @@ You can obtain more info about nostr on these additional resources:
* [Cloudflare tunnel](../system/cloudflare-tunnel.md)
* Others
+ * [PostgreSQL](../system/postgresql.md)
* [Rustup + Cargo](../system/rustup-+-cargo.md)
## Preparations
### Install dependencies
-* With user `admin`, make sure that all necessary software packages are installed (pending to concrete)
+* With user `admin`, make sure that all necessary software packages are installed
{% code overflow="wrap" %}
```bash
-sudo apt install build-essential cmake protobuf-compiler pkg-config libssl-dev build-essential sqlite3 libsqlite3-dev
+sudo apt install build-essential cmake protobuf-compiler pkg-config libssl-dev
```
{% endcode %}
+{% hint style="info" %}
+If you want to use the default SQLite database backend, go to the [Use the default SQLite database backend extra section](nostr-relay.md#use-the-default-sqlite-database-backend) to install the additional SQLite dependency packages
+{% endhint %}
+
+### Install Rustup + Cargo
+
* Check if you already have Rustup installed
```bash
@@ -84,9 +91,39 @@ cargo -V
```
{% hint style="info" %}
-If you obtain "**command not found**" outputs, you need to follow the [Rustup + Cargo bonus section](../system/rustup-+-cargo.md) to install it and then come back to continue with the guide
+If you obtain "**command not found**" output, you need to follow the [Rustup + Cargo bonus guide](../system/rustup-+-cargo.md) to install it and then come back to continue with the guide
+{% endhint %}
+
+### Install PostgreSQL
+
+{% hint style="info" %}
+Skip this step if you want to use the SQLite database, go directly to the [next section](nostr-relay.md#installation)
{% endhint %}
+* Check if you already have PostgreSQL installed
+
+```bash
+psql -V
+```
+
+**Example** of expected output:
+
+```
+> psql (PostgreSQL) 15.3 (Ubuntu 15.3-1.pgdg22.04+1)
+```
+
+{% hint style="info" %}
+If you obtain "**command not found**" outputs, you need to follow the [PostgreSQL bonus guide](../system/postgresql.md) to install it and then come back to continue with the guide
+{% endhint %}
+
+#### Create PostgreSQL database
+
+* With user `admin`, create a new database with the `postgres` user
+
+```bash
+sudo -u postgres createdb -O admin nostrelay
+```
+
## Installation
* With user `admin`, go to the temporary folder
@@ -180,7 +217,7 @@ nostr-rs-relay -V
```
{% hint style="info" %}
-If you come to update this is the final step, continue with the indications of the [Update section](nostr-relay.md#for-the-future-nostr-relay-upgrade)
+If you come to update this is the final step, continue with the indications of the [Upgrade section](nostr-relay.md#upgrade)
{% endhint %}
### Create the nostr user
@@ -201,12 +238,6 @@ Creating home directory `/home/nostr' ...
Copying files from `/etc/skel' ...
```
-* Create the `rs-relay` and `db` folder
-
-```bash
-mkdir -p /data/nostr/rs-relay/db
-```
-
* Change to the home `nostr` user folder
```bash
@@ -221,30 +252,30 @@ wget https://raw.githubusercontent.com/minibolt-guide/minibolt/main/resources/fa
```
{% endcode %}
-* Exit to the `admin` user
+* Create the `rs-relay` folder
```bash
-exit
+mkdir rs-relay
```
-## Configuration
-
-* With user `admin`, copy-paste the configuration file
+* Exit to the `admin` user
```bash
-sudo cp /tmp/nostr-rs-relay/config.toml /data/nostr/rs-relay/
+exit
```
-* Assign as the owner to the `nostr` user
+## Configuration
+
+* Copy-paste the configuration file template to the before-created folder
```bash
-sudo chown -R nostr:nostr /data/nostr
+sudo cp /tmp/nostr-rs-relay/config.toml /home/nostr/rs-relay/
```
-* Return to the home folder
+* Assign the owner of the file to the `nostr` user
```bash
-cd
+sudo chown nostr:nostr /home/nostr/rs-relay/config.toml
```
* Delete the `nostr-rs-relay` folder to be ready for the next update
@@ -256,24 +287,38 @@ sudo rm -r /tmp/nostr-rs-relay
* Edit the config file, uncomment, and replace the needed information on the next parameters. Save and exit
```bash
-sudo nano /data/nostr/rs-relay/config.toml
+sudo nano /home/nostr/rs-relay/config.toml
```
+{% hint style="info" %}
+Pay attention to not include the next lines:
+
+> engine = "postgres"[^1]
+
+> connection = "postgresql://admin:admin@localhost:5432/nostrelay"[^2]
+
+Include the uncomment, and replace the next line:
+
+> data\_directory = "/data/nostr/rs-relay/db"
+
+If you want to use the default SQLite database backend. More details and additional steps on the exclusive [extra section](nostr-relay.md#use-the-default-sqlite-database-backend)
+{% endhint %}
+
> > **Customize this with your own info (\*):**
> >
-> > **(\*)** click on parameter to get an example/explanation)
-> >
-> > > relay\_url = "[`> go1.21.10.linux-amd64.tar.gz: OK
+
+
+* Extract and install Go in the `/usr/local` directory
+
+```bash
+sudo tar -C /usr/local -xvzf go$VERSION.linux-amd64.tar.gz
+```
+
+* Edit `/etc/profile` file
+
+```bash
+sudo nano /etc/profile
+```
+
+* Add the next line at the end of the file. Save and exit
+
+```bash
+export PATH=$PATH:/usr/local/go/bin
+```
+
+* Apply the changes immediately to the current session
+
+```bash
+source /etc/profile
+```
+
+* Verify that you've installed Go by typing the following command
+
+```bash
+go version
+```
+
+**Example** of expected output:
+
+```
+> go version go1.21.10 linux/amd64
+```
+
+* **(Optional)** Delete the file of the temporary folder to be immediately ready for the next update
+
+```bash
+rm go$VERSION.linux-amd64.tar.gz
+```
+
+## Upgrade
+
+* With user `admin`, remove any previous Go installation
+
+```bash
+sudo rm -rf /usr/local/go
+```
+
+* Go to the temporary folder
+
+```bash
+cd /tmp
+```
+
+* Set a temporary version environment variable with the new value, to the installation
+
+```bash
+VERSION=1.22.3
+```
+
+* Set the new temporary SHA256 environment variable to the installation
+
+```bash
+SHA256=8920ea521bad8f6b7bc377b4824982e011c19af27df88a815e3586ea895f1b36
+```
+
+* Get the latest binary of the [official repository](https://go.dev/dl/)
+
+```bash
+wget https://go.dev/dl/go$VERSION.linux-amd64.tar.gz
+```
+
+* Check the checksum of the file
+
+```bash
+echo "$SHA256 go$VERSION.linux-amd64.tar.gz" | sha256sum --check
+```
+
+**Example** of expected output:
+
+```
+> go1.22.3.linux-amd64.tar.gz: OK
+```
+
+* Extract and install Go in the `/usr/local` directory
+
+```bash
+sudo tar -C /usr/local -xvzf go$VERSION.linux-amd64.tar.gz
+```
+
+* Verify that you've updated Go by typing the following command
+
+```
+go version
+```
+
+**Example** of expected output:
+
+```
+go version go1.22.3 linux/amd64
+```
+
+* **(Optional)** Delete the file of the temporary folder to be immediately ready for the next update
+
+```bash
+rm go$VERSION.linux-amd64.tar.gz
+```
+
+## Uninstall
+
+* Delete go folder
+
+```bash
+sudo rm -rf /usr/local/go
+```
+
+* Edit `/etc/profile` file and delete the complete `export PATH=$PATH:/usr/local/go/bin` line at the end of the file. Save and exit
+
+```bash
+sudo nano /etc/profile
+```
+
+* Apply the changes immediately to the current session
+
+```bash
+source /etc/profile
+```
+
+* Ensure you are uninstalled Go definitely
+
+```bash
+go version
+```
+
+Expected output:
+
+```
+> -bash: /usr/local/go/bin/go: No such file or directory
+```
+
+Next new session you will obtain this command when you try `go version` command:
+
+```
+Command 'go' not found..
+```
diff --git a/bonus-guides/system/nym-mixnet.md b/bonus-guides/system/nym-mixnet.md
index c005f4e1..e4ce0430 100644
--- a/bonus-guides/system/nym-mixnet.md
+++ b/bonus-guides/system/nym-mixnet.md
@@ -248,7 +248,7 @@ The system needs to run the network requester daemon automatically in the backgr
[Unit]
Description=Nym Network Requester
-Wants=network-online.target
+Requires=network-online.target
After=network-online.target
StartLimitInterval=350
@@ -439,7 +439,7 @@ sudo nano /etc/systemd/system/nym-socks5-client.service
[Unit]
Description=Nym Socks5 client
-Wants=network-online.target
+Requires=network-online.target
After=network-online.target
StartLimitInterval=350
@@ -715,7 +715,7 @@ If you have installed the NYM socks5 client installed in a machine inside of you
#### Sparrow desktop
-Follow the [Desktop wallet: Sparrow Wallet](../../bitcoin/desktop-wallet.md) until the [(Optional) Set up a Tor proxy for external services](../../bitcoin/desktop-wallet.md#optional-set-up-a-tor-proxy-for-external-services), which could be used for these 2 cases of uses:
+Follow the [Desktop wallet: Sparrow Wallet](../../itcoin/bitcoin/desktop-wallet.md) until the [(Optional) Set up a Tor proxy for external services](../../itcoin/bitcoin/desktop-wallet.md#optional-set-up-a-tor-proxy-for-external-services), which could be used for these 2 cases of uses:
1. If you don't have your node and you want to **proxy** all connections (**The Electrum Servers** of the wallet & **third-party server connections**) using the NYM mixnet
diff --git a/bonus-guides/system/postgresql.md b/bonus-guides/system/postgresql.md
new file mode 100644
index 00000000..74412d52
--- /dev/null
+++ b/bonus-guides/system/postgresql.md
@@ -0,0 +1,559 @@
+---
+layout:
+ title:
+ visible: true
+ description:
+ visible: false
+ tableOfContents:
+ visible: true
+ outline:
+ visible: true
+ pagination:
+ visible: true
+---
+
+# PostgreSQL
+
+PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.
+
+{% hint style="warning" %}
+Difficulty: Medium
+{% endhint %}
+
+
+
+## Installation
+
+### Install PostgreSQL using the apt package manager
+
+* With user `admin`, create the file repository configuration
+
+{% code overflow="wrap" %}
+```bash
+sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+```
+{% endcode %}
+
+* Import the repository signing key
+
+{% code overflow="wrap" %}
+```bash
+wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+```
+{% endcode %}
+
+Expected output:
+
+```
+> Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
+OK
+```
+
+{% hint style="info" %}
+You can ignore the `W: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))` message
+{% endhint %}
+
+* Update the package lists and install the latest version of PostgreSQL. Press "**y**" and `enter` or directly `enter` when the prompt asks you
+
+```bash
+sudo apt update && sudo apt install postgresql postgresql-contrib
+```
+
+* Check the correct installation of the PostgreSQL
+
+```bash
+psql -V
+```
+
+**Example** of expected output:
+
+```
+> psql (PostgreSQL) 15.3 (Ubuntu 15.3-1.pgdg22.04+1)
+```
+
+* Ensure PostgreSQL is running and listening on the default port `5432`
+
+```bash
+sudo ss -tulpn | grep LISTEN | grep postgres
+```
+
+Expected output:
+
+> tcp LISTEN 0 200 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=2532748,fd=7))
+> tcp LISTEN 0 200 [::1]:5432 [::]:* users:(("postgres",pid=2532748,fd=6))
+
+
+* You can monitor general logs by the systemd journal. You can exit monitoring at any time with `Ctrl-C`
+
+```bash
+journalctl -fu postgresql
+```
+
+**Example** of expected output:
+
+```
+May 31 13:51:11 minibolt systemd[1]: Finished PostgreSQL RDBMS.
+```
+
+* And the sub-instance and specific cluster logs. You can exit monitoring at any time with `Ctrl-C`
+
+```bash
+journalctl -fu postgresql@16-main
+```
+
+**Example** of expected output:
+
+```
+May 31 13:51:18 minibolt systemd[1]: Starting PostgreSQL Cluster 16-main...
+May 31 13:51:21 minibolt systemd[1]: Started PostgreSQL Cluster 16-main.
+```
+
+### Create data folder
+
+* Create the dedicated PostgreSQL data folder
+
+```bash
+sudo mkdir /data/postgresdb
+```
+
+* Assign as the owner to the `postgres` user
+
+sudo chown postgres:postgres /data/postgresdb
+
+
+* Assign permissions of the data folder only to the `postgres` user
+
+sudo chmod -R 700 /data/postgresdb
+
+
+* With user `postgres`, create a new cluster on the dedicated folder
+
+```bash
+sudo -u postgres /usr/lib/postgresql/16/bin/initdb -D /data/postgresdb
+```
+
+data_directory = '/data/postgresdb'
+
+
+* Restart PostgreSQL to apply changes and monitor the correct status of the main instance and sub-instance monitoring sessions before
+
+sudo systemctl restart postgresql
+
+
+* You can monitor the PostgreSQL main instance by the systemd journal and check the log output. You can exit the monitoring at any time with `Ctrl-C`
+
+```bash
+journalctl -fu postgresql
+```
+
+Expected output:
+
+```
+Nov 08 11:51:10 minibolt systemd[1]: Stopped PostgreSQL RDBMS.
+Nov 08 11:51:10 minibolt systemd[1]: Stopping PostgreSQL RDBMS...
+Nov 08 11:51:13 minibolt systemd[1]: Starting PostgreSQL RDBMS...
+Nov 08 11:51:13 minibolt systemd[1]: Finished PostgreSQL RDBMS.
+```
+
+* You can monitor the PostgreSQL sub-instance by the systemd journal and check log output. You can exit monitoring at any time with `Ctrl-C`
+
+```bash
+journalctl -fu postgresql@16-main
+```
+
+**Example** of the expected output:
+
+```
+Nov 08 11:51:10 minibolt systemd[1]: Stopping PostgreSQL Cluster 16-main...
+Nov 08 11:51:11 minibolt systemd[1]: postgresql@16-main.service: Succeeded.
+Nov 08 11:51:11 minibolt systemd[1]: Stopped PostgreSQL Cluster 16-main.
+Nov 08 11:51:11 minibolt systemd[1]: postgresql@16-main.service: Consumed 1h 10min 8.677s CPU time.
+Nov 08 11:51:11 minibolt systemd[1]: Starting PostgreSQL Cluster 16-main...
+Nov 08 11:51:13 minibolt systemd[1]: Started PostgreSQL Cluster 16-main.
+```
+
+{% hint style="info" %}
+**(Optional)** -> If you want, you can **disable the autoboot** option for PostgreSQL **(not recommended)** using:
+
+```bash
+sudo systemctl disable postgresql
+```
+
+Expected output:
+
+```
+Synchronizing state of postgresql.service with SysV service script with /lib/systemd/systemd-sysv-install.
+Executing: /lib/systemd/systemd-sysv-install disable postgresql
+Removed /etc/systemd/system/multi-user.target.wants/postgresql.service.
+```
+{% endhint %}
+
+### Create a PostgreSQL user account
+
+* With user `admin`, change to the automatically created user for the PostgreSQL installation called `postgres`
+
+```bash
+sudo su - postgres
+```
+
+* Create a new database user
+
+```bash
+createuser -d admin
+```
+
+* Assign the password "`admin`" to the new user
+
+```bash
+psql -c "ALTER ROLE admin WITH PASSWORD 'admin';"
+```
+
+* Come back to the `admin` user
+
+```bash
+exit
+```
+
+## Extras (optional)
+
+### Some useful PostgreSQL commands
+
+* With user `admin`, enter the PostgreSQL CLI with the user `postgres`. The prompt should change to `postgres=#`
+
+```bash
+sudo -u postgres psql
+```
+
+**Example** of expected output:
+
+```
+psql (16.3 (Ubuntu 16.3-1.pgdg22.04+1))
+Type "help" for help.
+
+postgres=#
+```
+
+{% hint style="info" %}
+Type `\q` command and enter to exit PostgreSQL CLI and exit to come back to the `admin` user
+{% endhint %}
+
+#### List the global existing users and roles associated
+
+* Type the next command and enter
+
+```bash
+\du
+```
+
+**Example** of expected output:
+
+```
+ List of roles
+ Role name | Attributes
+-----------+------------------------------------------------------------
+ admin | Create DB
+ postgres | Superuser, Create role, Create DB, Replication, Bypass RLS
+```
+
+#### List the global existing databases
+
+* Type the next command and enter
+
+```bash
+\l
+```
+
+**Example** of expected output:
+
+```
+ Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
+--------------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
+ btcpayserver | admin | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
+ lndb | admin | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
+ nbxplorer | admin | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
+ nostrelay | admin | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
+ postgres | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
+ template0 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
+ | | | | | | | | postgres=CTc/postgres
+ template1 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
+ | | | | | | | | postgres=CTc/postgres
+(8 rows)
+```
+
+#### List tables inside of a specific database
+
+* Connect to a specific database, type the next command, and enter. The prompt should change to the name of the database. Example: `lndb=#`
+
+```bash
+\c # Use external fee estimator
+[fee]
+fee.url=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
+
* Start LND again
@@ -452,8 +452,8 @@ Remember to restart the Bitcoin Core to apply the new version with `$ sudo syste
## Uninstall
-To uninstall Bitcoin Core with the Ordisrespector patch applied, follow the entire Bitcoin Core [uninstall section](../../index-2/bitcoin-client.md#uninstall)
+To uninstall Bitcoin Core with the Ordisrespector patch applied, follow the entire Bitcoin Core [uninstall section](../../itcoin/bitcoin/bitcoin-client.md#uninstall)
## Port reference
-Same as the [Bitcoin Core section](../../index-2/bitcoin-client.md#port-reference)
+Same as the [Bitcoin Core section](../../itcoin/bitcoin/bitcoin-client.md#port-reference)
diff --git a/bonus/bitcoin/sparrow-server.md b/bonus/bitcoin/sparrow-server.md
index 5b987e0f..ae6bdc6b 100644
--- a/bonus/bitcoin/sparrow-server.md
+++ b/bonus/bitcoin/sparrow-server.md
@@ -30,8 +30,8 @@ Difficulty: Medium
## Requirements
-* [Bitcoin Core](../../index-2/bitcoin-client.md)
-* Electrum server: [Fulcrum](../../bitcoin/electrum-server.md) or [Electrs](electrs.md)
+* [Bitcoin Core](../../itcoin/bitcoin/bitcoin-client.md)
+* Electrum server: [Fulcrum](../../itcoin/bitcoin/electrum-server.md) or [Electrs](electrs.md)
## Installation
diff --git a/bonus/system/README.md b/bonus/system/README.md
index 78ae72d6..cc8ffff5 100644
--- a/bonus/system/README.md
+++ b/bonus/system/README.md
@@ -17,7 +17,7 @@ layout:
visible: true
---
-# System
+# 🖥️ System
## Bonus Section: System guides
@@ -30,10 +30,15 @@ layout:
* [**Aliases**](aliases.md) - set up CLI command shortcuts to simplify your node management experienc**e**
* [**Static IP & custom DNS servers**](../../bonus-guides/system/static-ip-and-custom-dns-servers.md) - set a static IP local address and customize the DNS servers
-### Install / Update / Uninstall common languages
+### Common programming languages
-* [**Node + NPM**](nodejs-npm.md) - Install/Update/Uninstall Node + NPM
-* [**Rustup + Cargo**](../../bonus-guides/system/rustup-+-cargo.md) - Install/ Update/Uninstall Rustup + Cargo
+* [**Node + NPM**](nodejs-npm.md) - Install / Update / Uninstall Node + NPM
+* [**Rustup + Cargo**](../../bonus-guides/system/rustup-+-cargo.md) - Install / Update / Uninstall Rustup + Cargo
+* [**Go!**](https://github.com/golang/go) - Install / Update / Uninstall Go
+
+### Databases
+
+* [**PostgreSQL**](../../bonus-guides/system/postgresql.md) - Install / Update / Uninstall PostgreSQL database
### Security
diff --git a/index-1/privacy.md b/index-1/privacy.md
index 037bcc1e..0bbb74c7 100644
--- a/index-1/privacy.md
+++ b/index-1/privacy.md
@@ -204,23 +204,6 @@ Not all network traffic is routed over the Tor network, by default some services
```
{% endhint %}
-### Uninstall Tor
-
-* With user `admin`, enter the next command and "`y`" when the prompt asks you if you want to continue
-
-```bash
-sudo apt autoremove tor deb.torproject.org-keyring && sudo apt purge tor
-```
-
-Expected output:
-
-```
-[...]
-The following packages will be REMOVED:
- deb.torproject.org-keyring tor tor-geoipdb torsocks
-[...]
-```
-
## I2P Project
> Nov 16 16:56:56 minibolt systemd[1]: Starting A high performance web server and a reverse proxy server...
-> Nov 16 16:56:56 minibolt systemd[1]: Started A high performance web server and a reverse proxy server.
+> Jun 04 18:21:09 minibolt systemd[1]: Starting A high performance web server and a reverse proxy server...
+> Jun 04 18:21:09 minibolt systemd[1]: Started A high performance web server and a reverse proxy server.
+> Jun 04 18:25:18 minibolt systemd[1]: Reloading A high performance web server and a reverse proxy server...
+> Jun 04 18:25:18 minibol systemd[1]: Reloaded A high performance web server and a reverse proxy server.
{% hint style="info" %}
-You can monitor Nginx error logs by entering this command. Exit with Ctrl + C
+You can monitor Nginx error logs by entering this command. Exit with `Ctrl + C`
{% endhint %}
```bash
diff --git a/index-4/index/tor-bridge.md b/index-4/index/tor-bridge.md
index 90e826e0..d8cf434b 100644
--- a/index-4/index/tor-bridge.md
+++ b/index-4/index/tor-bridge.md
@@ -148,8 +148,6 @@ By default, Tor will advertise your bridge to users through various [mechanisms]
Currently valid, recognized options are: `none` | `any` | `https` | `email` | `moat`
-
-
If you don't specify this line, by default the method will be `any` , this means that you give the choice of whatever method it sees fit
{% endhint %}
@@ -168,9 +166,9 @@ sudo ufw allow /tcp comment 'allow obsf4 port Tor bridge from anywhere'
{% hint style="warning" %}
Note that both Tor's OR port and its obfs4 port must be reachable from outside.
-If your bridge is behind a NAT, make sure to open both ports. See [portforward.com](https://portforward.com/) for directions on how to port forward with your NAT/router device.
+If your bridge is behind a NAT, make sure to open both ports. See [portforward.com](https://portforward.com/) for directions on how to port forward with your NAT/router device.
-You can use our reachability [test](https://bridges.torproject.org/scan/) to see if your obfs4 port **``** is reachable from the Internet.
+You can use our reachability [test](https://bridges.torproject.org/scan/) to see if your obfs4 port **``** is reachable from the Internet.
Enter the website your public **"IP ADDRESS"** obtained with **`curl icanhazip.com`** or navigate directly with your regular browser to [icanhazip.com](https://icanhazip.com/) on your personal computer inside of the same local network, and put your **``** port.
{% endhint %}
@@ -196,7 +194,7 @@ NoNewPrivileges=no
sudo nano /lib/systemd/system/tor@.service
```
-* Change `"NoNewPrivileges=yes"` to `"NoNewPrivileges=no"`. Save and exit
+* Change `"NoNewPrivileges=yes"` to `"NoNewPrivileges=no"`. Save and exit
```
# Hardening
@@ -243,9 +241,24 @@ You can check the status of your bridge relay at https://bridges.torproject.org/
```
{% hint style="info" %}
-About **3 hours** after you start your relay, it should appear on [Relay Search](https://metrics.torproject.org/rs.html) on the Metrics portal. You can search for your relay using your nickname or IP address and can monitor your obfs4 bridge's usage on Relay Search. Just enter your bridge's **"HASHED FINGERPRINT"** in the form and click on "Search"
+About **3 hours** after you start your relay, it should appear on [Relay Search](https://metrics.torproject.org/rs.html) on the Metrics portal. You can search for your relay using your nickname or IP address and monitor your obfs4 bridge's usage on Relay Search. Just enter your bridge's **"HASHED FINGERPRINT"** in the form and click on "Search"
{% endhint %}
+* Ensure that the Tor port related to the bridge and the Obfs4proxy service are working and listening at the the ports selected
+
+```bash
+sudo ss -tulpn | grep 'LISTEN.*\(tor\|obfs4proxy\)'
+```
+
+**Example** of expected output:
+
+```
+tcp LISTEN 0 4096 0.0.0.0:2016 0.0.0.0:* users:(("tor",pid=1302348,fd=7))
+tcp LISTEN 0 4096 127.0.0.1:9051 0.0.0.0:* users:(("tor",pid=14899,fd=7))
+tcp LISTEN 0 4096 0.0.0.0:9050 0.0.0.0:* users:(("tor",pid=14899,fd=6))
+tcp LISTEN 0 4096 *:2008 *:* users:(("obfs4proxy",pid=1302349,fd=7))
+```
+
* If you want to connect to your bridge manually, you will need to know the bridge's obfs4 certificate. Open the file **"obfs4\_bridgeline.txt"** to obtain your bridge info
```sh
@@ -274,7 +287,7 @@ More info to connect the Tor browser to your own Tor bridge on this [website](ht
### **Enable automatic software updates**
-One of the most important things to keep your relay secure is to install security updates timely and ideally automatically so you can not forget about them. Follow the instructions to enable automatic software updates for your operating system.
+One of the most important things to keep your relay secure is to install security updates timely and ideally do it automatically, so you can not forget about them. Follow the instructions to enable automatic software updates for your operating system.
* Install dependencies
@@ -309,7 +322,7 @@ Unattended-Upgrade::Automatic-Reboot "true";
unattended-upgrade --debug
```
-* If you just want to see the debug output but don't change anything use
+* If you want to see the debug output but don't change anything use
```sh
unattended-upgrade --debug --dry-run
@@ -346,7 +359,7 @@ nyx
* Press the right -> navigation key to navigate to page 2/5 to show the traffic of your Tor instance
-![Example of an obsf4 bridge running ](../../images/nyx-tor-bridge.png)
+![Example of an obsf4 bridge running](../../images/nyx-tor-bridge.png)
* Press `"q"` key **2 times** to exit
diff --git a/itcoin/bitcoin/README.md b/itcoin/bitcoin/README.md
new file mode 100644
index 00000000..cc6ab085
--- /dev/null
+++ b/itcoin/bitcoin/README.md
@@ -0,0 +1,26 @@
+---
+title: Bitcoin
+nav_order: 30
+has_children: true
+layout:
+ title:
+ visible: true
+ description:
+ visible: false
+ tableOfContents:
+ visible: true
+ outline:
+ visible: true
+ pagination:
+ visible: true
+---
+
+# 2. ₿itcoin
+
+
+
+The base of a sovereign Bitcoin node is a fully validating [Bitcoin client](bitcoin-client.md). It will download the whole blockchain and validate every single transaction that ever happened. After this verification, the client can check the validity of all future transactions.
+
+Your [Bitcoin client](bitcoin-client.md) also acts as a data source for other applications, like the [Electrum server](electrum-server.md) (to use with your software and hardware wallets), blockchain explorer, or Lightning client.
+
+We first install [Bitcoin Core](bitcoin-client.md) and [Fulcrum](electrum-server.md) on the node. We then set up the powerful Sparrow desktop wallet on your computer and connect it to your Fulcrum server for secure and private base layer operations, such as sending and receiving payments from and to your hardware wallet. Finally, we install [BTC RPC Explorer](blockchain-explorer.md) on the node, a lite blockchain explorer with a clean web UI for privately checking your transactions and the mempool.
diff --git a/index-2/bitcoin-client.md b/itcoin/bitcoin/bitcoin-client.md
similarity index 89%
rename from index-2/bitcoin-client.md
rename to itcoin/bitcoin/bitcoin-client.md
index 84870a02..f2d41248 100644
--- a/index-2/bitcoin-client.md
+++ b/itcoin/bitcoin/bitcoin-client.md
@@ -16,7 +16,7 @@ layout:
We install [Bitcoin Core](https://bitcoin.org/en/bitcoin-core/), the reference client implementation of the Bitcoin network.
-![](../images/bitcoin-core-logo-trans.png)
+![](../../images/bitcoin-core-logo-trans.png)
## This may take some time
@@ -26,9 +26,9 @@ Bitcoin Core will download the full Bitcoin blockchain, and validate all transac
We download the latest Bitcoin Core binary (the application) and compare this file with the signed and timestamped checksum. This is a precaution to make sure that this is an official release and not a malicious version trying to steal our money.
-💡 If you want to install the Ordisrespector patch to reject the Ordinals of your mempool, follow the [Ordisrespector bonus guide](../bonus/bitcoin/ordisrespector.md#preparations) and come back to continue with the ["Create the bitcoin user"](bitcoin-client.md#create-the-bitcoin-user) section.
+💡 If you want to install the Ordisrespector patch to reject the Ordinals of your mempool, follow the [Ordisrespector bonus guide](../../bonus/bitcoin/ordisrespector.md#preparations) and come back to continue with the ["Create the bitcoin user"](bitcoin-client.md#create-the-bitcoin-user) section.
-💡 If you want to install Bitcoin Core from the source code but without the Ordisrespector patch, follow the [Ordisrespector bonus guide](../bonus/bitcoin/ordisrespector.md#preparations) skipping [Apply the patch “Ordisrespector”](../bonus/bitcoin/ordisrespector.md#apply-the-patch-ordisrespector) and come back to continue with the ["Create the bitcoin user"](bitcoin-client.md#create-the-bitcoin-user) section.
+💡 If you want to install Bitcoin Core from the source code but without the Ordisrespector patch, follow the [Ordisrespector bonus guide](../../bonus/bitcoin/ordisrespector.md#preparations) skipping [Apply the patch “Ordisrespector”](../../bonus/bitcoin/ordisrespector.md#apply-the-patch-ordisrespector) and come back to continue with the ["Create the bitcoin user"](bitcoin-client.md#create-the-bitcoin-user) section.
### Download binaries
@@ -122,7 +122,7 @@ gpg --verify SHA256SUMS.asc
The following screenshot is just an **example** of one of the versions:
-![](../images/bitcoin-ots-check.PNG)
+![](../../images/bitcoin-ots-check.PNG)
* If you're satisfied with the checksum, signature, and timestamp checks, extract the Bitcoin Core binaries
@@ -130,6 +130,10 @@ The following screenshot is just an **example** of one of the versions:
tar -xvf bitcoin-$VERSION-x86_64-linux-gnu.tar.gz
```
+{% hint style="info" %}
+If you want to [generate a full bitcoin.conf file](bitcoin-client.md#generate-a-full-bitcoin.conf-example-file), follow the proper [extra section](bitcoin-client.md#generate-a-full-bitcoin.conf-example-file), and then come back to continue with the [next section](bitcoin-client.md#binaries-installation)
+{% endhint %}
+
### Binaries installation
* Install it
@@ -166,6 +170,8 @@ sudo rm -r bitcoin-$VERSION && sudo rm bitcoin-$VERSION-x86_64-linux-gnu.tar.gz
```
{% endcode %}
+
+
### Create the bitcoin user & group
The Bitcoin Core application will run in the background as a daemon and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.
@@ -347,7 +353,7 @@ blocksonly=1
```
{% hint style="info" %}
-If you checked on the "[Check IPv6 availability](../index-1/security.md#check-ipv6-availability)" section and don't have IPv6 available, you can discard the IPv6 network of the Bitcoin Core by adding the next lines at the end of the configuration file:
+If you checked on the [Check IPv6 availability](../../index-1/security.md#check-ipv6-availability) section and don't have IPv6 available, you can discard the IPv6 network of the Bitcoin Core by adding the next lines at the end of the configuration file:
```
# Disable IPv6 network
@@ -356,7 +362,7 @@ onlynet=i2p
onlynet=ipv4
```
-This is a standard configuration. Check this Bitcoin Core [sample-bitcoind.conf](https://gist.github.com/1ma/65751ba7f148612dfb39ff3527486a92) with all possible options
+This is a standard configuration. Check this [Bitcoin Core sample bitcoind.conf](https://gist.github.com/twofaktor/af6e2226e2861fa86874340f5315aa01) file with all possible options or generate one yourself following the proper [extra section](bitcoin-client.md#generate-a-full-bitcoin.conf-example-file)
{% endhint %}
* Set permissions: only the user `bitcoin` and members of the `bitcoin` group can read it (needed for LND to read the "`rpcauth`" line)
@@ -375,7 +381,7 @@ exit
### Create systemd service
-The system needs to run the bitcoin daemon automatically in the background, even when nobody is logged in. We use `"systemd"`, a daemon that controls the startup process using configuration files.
+The system needs to run the bitcoin daemon automatically in the background. We use `systemd`, a daemon that controls the startup process using configuration files
* Create the systemd configuration
@@ -391,7 +397,7 @@ sudo nano /etc/systemd/system/bitcoind.service
[Unit]
Description=Bitcoin Core Daemon
-Wants=network-online.target
+Requires=network-online.target
After=network-online.target
[Service]
@@ -447,7 +453,7 @@ Keep **this terminal open,** you'll need to come back here on the next step to m
## Run
-To keep an eye on the software movements, [start your SSH program](../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "`admin`"
+To keep an eye on the software movements, [start your SSH program](../../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "`admin`"
* Start the service
@@ -504,7 +510,7 @@ ln -s /data/bitcoin /home/admin/.bitcoin
exit
```
-* Log in again as a user `admin` [opening a new SSH session](../index-1/remote-access.md#access-with-secure-shell)
+* Log in again as a user `admin` [opening a new SSH session](../../index-1/remote-access.md#access-with-secure-shell)
* Check symbolic link have been created correctly
```bash
@@ -616,7 +622,7 @@ If everything is running smoothly, this is the perfect time to familiarize yours
* You definitely need to have a [real copy](https://bitcoinbook.info/) of this book!
* Read it online on [GitHub](https://github.com/bitcoinbook/bitcoinbook)
-
+
* [Learning Bitcoin from the Command Line](https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line/blob/master/README.md) by Christopher Allen gives a thorough deep dive into understanding the technical aspects of Bitcoin
* Also, check out the [bitcoin-cli reference](https://en.bitcoin.it/wiki/Original\_Bitcoin\_client/API\_calls\_list)
@@ -761,7 +767,7 @@ rpcworkqueue=256
```
{% hint style="info" %}
-Realize that with `maxuploadtarget` parameter enabled you will need whitelist the connection to [Electrs](../bonus/bitcoin/electrs.md) and [Bisq](../bonus/bitcoin/bisq.md) by adding these parameter to `bitcoin.conf`:
+Realize that with `maxuploadtarget` parameter enabled you will need whitelist the connection to [Electrs](../../bonus/bitcoin/electrs.md) and [Bisq](../../bonus/bitcoin/bisq.md) by adding these parameter to `bitcoin.conf`:
For Electrs:
@@ -776,12 +782,48 @@ whitelist=bloomfilter@192.168.0.0/16
```
{% endhint %}
-### Manual page for bitcoin-cli
+### Renovate your Bitcoin Core Tor and I2P addresses
+
+* With user `admin`, stop bitcoind and dependencies
+
+```bash
+sudo systemctl stop bitcoind
+```
+
+* Delete
+
+```bash
+sudo rm /data/bitcoin/onion_v3_private_key &&
+```
+
+* Start bitcoind again
+
+```bash
+sudo systemctl start bitcoind
+```
+
+* If you want to monitor the bitcoind logs and the starting progress, type `journalctl -fu bitcoind` in a separate SSH session
+* Wait a minute to identify your newly generated addresses with
+
+{% code overflow="wrap" %}
+```bash
+bitcoin-cli getnetworkinfo | grep address.*onion && bitcoin-cli getnetworkinfo | grep address.*i2p
+```
+{% endcode %}
+
+**Example** of expected output:
+
+```
+> "address": "vctk9tie5srguvz262xpyukkd7g4z2xxxy5xx5ccyg4f12fzop8hoiad.onion",
+> "address": "sesehks6xyh31nyjldpyeckk3ttpanivqhrzhsoracwqjxtk3apgq.b32.i2p",
+```
+
+### The manual page for bitcoin-cli
* For convenience, it might be useful to have the manual page for `bitcoin-cli` in the same machine so that they can be consulted offline, they can be installed from the directory
{% hint style="warning" %}
-This extra section is not valid if you compiled it from source code using the [Ordisrespector bonus guide](../bonus/bitcoin/ordisrespector.md)
+This extra section is not valid if you compiled it from source code using the [Ordisrespector bonus guide](../../bonus/bitcoin/ordisrespector.md)
{% endhint %}
```sh
@@ -802,7 +844,52 @@ sudo cp * /usr/share/man/man1/
man bitcoin-cli
```
-⬆️ Now come back to the next section [Create the bitcoin user](bitcoin-client.md#create-the-bitcoin-user) to continue with the Bitcoin Core installation process.
+⬆️ Now come back to the next section [Create the bitcoin user](bitcoin-client.md#create-the-bitcoin-user) to continue with the Bitcoin Core installation process
+
+### Generate a full bitcoin.conf example file
+
+* Follow the [Installation progress before](bitcoin-client.md#installation)
+* With user `admin`, clone the source code from GitHub
+
+```bash
+git clone https://github.com/bitcoin/bitcoin.git
+```
+
+* Copy-paste the bitcoind binary file to the source code folder
+
+```bash
+cp /tmp/bitcoin-$VERSION/bin/bitcoind /tmp/bitcoin/src/
+```
+
+* Go to the `devtools` folder
+
+```bash
+cd bitcoin/contrib/devtools
+```
+
+* Exec the `gen-bitcoin-conf` script to generate the file
+
+```bash
+sudo ./gen-bitcoin-conf.sh
+```
+
+Expected output:
+
+```
+Generating example bitcoin.conf file in share/examples/
+```
+
+* Use `cat` to print it on the terminal to enable a copy-paste
+
+```bash
+cat /tmp/bitcoin/share/examples/bitcoin.conf
+```
+
+* Or `nano` to examine the content inside of
+
+```bash
+nano /tmp/bitcoin/share/examples/bitcoin.conf
+```
## Upgrade
@@ -991,7 +1078,7 @@ sudo rm /usr/local/bin/bitcoin-cli && sudo rm /usr/local/bin/bitcoind
### Uninstall FW configuration
-If you followed the [Bisq bonus guide](../bonus/bitcoin/bisq.md), probably you needed to add an allow rule on UFW to allow the incoming connection to the `8333` port (P2P)
+If you followed the [Bisq bonus guide](../../bonus/bitcoin/bisq.md), probably you needed to add an allow rule on UFW to allow the incoming connection to the `8333` port (P2P)
* Ensure you are logged in with the user `admin`, display the UFW firewall rules, and note the numbers of the rules for Bitcoin Core (e.g. "Y" below)
diff --git a/bitcoin/blockchain-explorer.md b/itcoin/bitcoin/blockchain-explorer.md
similarity index 95%
rename from bitcoin/blockchain-explorer.md
rename to itcoin/bitcoin/blockchain-explorer.md
index ca8b8513..49263969 100644
--- a/bitcoin/blockchain-explorer.md
+++ b/itcoin/bitcoin/blockchain-explorer.md
@@ -19,19 +19,19 @@ layout:
Run your own private blockchain explorer with [BTC RPC Explorer](https://github.com/janoside/btc-rpc-explorer). Trust your node, not some external services.
-![](../images/btcrpcexplorer-homepage.png)
+![](../../images/btcrpcexplorer-homepage.png)
## Requirements
-* [Bitcoin Core](../index-2/bitcoin-client.md)
+* [Bitcoin Core](bitcoin-client.md)
* Others
- * [Node + NPM](../bonus/system/nodejs-npm.md)
+ * [Node + NPM](../../bonus/system/nodejs-npm.md)
## Introduction
After the MiniBolt runs your own fully validated node, and even acts as a backend for your hardware wallet with [Fulcrum](electrum-server.md), the last important puzzle piece to improve privacy and financial sovereignty is your own Blockchain Explorer. It lets you query transactions, addresses, and blocks of your choice. You no longer need to leak information by querying a third-party blockchain explorer that can be used to get your location and cluster addresses.
-[BTC RPC Explorer](https://github.com/janoside/btc-rpc-explorer) provides a lightweight and easy to use web interface to accomplish just that. It's a database-free, self-hosted Bitcoin blockchain explorer, querying [Bitcoin Core](../index-2/bitcoin-client.md) and [Fulcrum](electrum-server.md) via RPC.
+[BTC RPC Explorer](https://github.com/janoside/btc-rpc-explorer) provides a lightweight and easy to use web interface to accomplish just that. It's a database-free, self-hosted Bitcoin blockchain explorer, querying [Bitcoin Core](bitcoin-client.md) and [Fulcrum](electrum-server.md) via RPC.
## Preparations
@@ -62,7 +62,7 @@ npm -v
```
{% hint style="info" %}
-If the version is **`>=18`**, you can move to the next section. If Nodejs is not installed, follow this [Node + NPM bonus guide](../bonus/system/nodejs-npm.md) to install it
+If the version is **`>=18`**, you can move to the next section. If Nodejs is not installed, follow this [Node + NPM bonus guide](../../bonus/system/nodejs-npm.md) to install it
{% endhint %}
* Install the next dependency package. Press "**y**" and `enter` or directly `enter` when the prompt asks you
@@ -73,7 +73,7 @@ sudo apt install build-essential
### Reverse proxy & Firewall
-In the security [section](../index-1/security.md#prepare-nginx-reverse-proxy), we set up Nginx as a reverse proxy. Now we can add the BTC RPC Explorer configuration.
+In the security [section](../../index-1/security.md#prepare-nginx-reverse-proxy), we set up Nginx as a reverse proxy. Now we can add the BTC RPC Explorer configuration.
Enable the Nginx reverse proxy to route external encrypted HTTPS traffic internally to the BTC RPC Explorer. The `error_page 497` directive instructs browsers that send HTTP requests to resend them over HTTPS.
@@ -161,7 +161,7 @@ sudo su - btcrpcexplorer
curl https://github.com/janoside.gpg | gpg --import
```
-* Download the source code directly from GitHub and go to the `btc-rpc-explorer` folder
+* Download the source code directly from GitHub and go to the `btc-rpc-explorer` folder
{% code overflow="wrap" %}
```sh
@@ -228,23 +228,27 @@ Installation can take some time, be patient. There might be a lot of confusing o
cp .env-sample .env
```
-* Edit the `.env` file. Activate any setting by removing the `#` at the beginning of the line or editing directly
+* Edit the `.env` file.
```sh
nano .env
```
+{% hint style="info" %}
+Activate any setting by removing the `#` at the beginning of the line or editing directly
+{% endhint %}
+
* Instruct the BTC RPC Explorer to connect to the local Bitcoin Core
```
-# replace this line
+# Uncomment & replace the value of these lines
BTCEXP_BITCOIND_COOKIE=/data/bitcoin/.cookie
```
* To get address balances, either an Electrum server or an external service is necessary. Your local Electrum server can provide address transaction lists, balances, and more
```
-# replace these lines
+# Uncomment & replace the value of these lines
BTCEXP_ADDRESS_API=electrum
BTCEXP_ELECTRUM_SERVERS=tcp://127.0.0.1:50001
```
@@ -260,7 +264,7 @@ You can set additional features of [Privacy](blockchain-explorer.md#privacy) / [
{% endhint %}
* Save and exit
-* Exit the `btcrpcexplorer` user session to return to the "admin" user session
+* Exit the `btcrpcexplorer` user session to return to the `admin` user session
```sh
exit
@@ -284,6 +288,7 @@ sudo nano /etc/systemd/system/btcrpcexplorer.service
[Unit]
Description=BTC RPC Explorer
+Requires=bitcoind.service fulcrum.service
After=bitcoind.service fulcrum.service
[Service]
@@ -318,7 +323,7 @@ journalctl -fu btcrpcexplorer
## Run
-To keep an eye on the software movements, [start your SSH program](../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "admin"
+To keep an eye on the software movements, [start your SSH program](../../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "admin"
* Start the service
@@ -516,12 +521,12 @@ RPC Terminal / Browser require authentication. Set an authentication password vi
{% endhint %}
{% hint style="info" %}
-With DEMO mode enabled, the user will see the next message:
+With DEMO mode enabled, the user will see the next message:
`"Sorry, that RPC command is blacklisted. If this is your server, you may allow this command by removing it from the 'rpcBlacklist' setting in config.js."`
{% endhint %}
-
+
### Remote access over Tor
diff --git a/bitcoin/desktop-wallet.md b/itcoin/bitcoin/desktop-wallet.md
similarity index 93%
rename from bitcoin/desktop-wallet.md
rename to itcoin/bitcoin/desktop-wallet.md
index 35b6bbb6..bbd0d50a 100644
--- a/bitcoin/desktop-wallet.md
+++ b/itcoin/bitcoin/desktop-wallet.md
@@ -19,12 +19,12 @@ layout:
We install [Sparrow wallet](https://github.com/sparrowwallet/sparrow) on a computer and connect it to your Electrum server on your node for private Bitcoin on-chain transactions.
-![](../images/sparrow.png)
+![](../../images/sparrow.png)
## Requirements
-* [Bitcoin Core](../index-2/bitcoin-client.md)
-* Electrum server: [Fulcrum](electrum-server.md) or [Electrs](../bonus/bitcoin/electrs.md)
+* [Bitcoin Core](bitcoin-client.md)
+* Electrum server: [Fulcrum](electrum-server.md) or [Electrs](../../bonus/bitcoin/electrs.md)
## Introduction
@@ -33,13 +33,13 @@ Sparrow wallet is an excellent software wallet to use with your MiniBolt: it's r
You can also use the following alternatives instead of Sparrow Wallet, according to your preferences and needs:
* BitBoxApp: wallet for users of BitBox hardware wallets
-* [Electrum Wallet Desktop](../bonus/bitcoin/electrum-wallet-desktop.md): a well-established poweruser wallet
+* [Electrum Wallet Desktop](../../bonus/bitcoin/electrum-wallet-desktop.md): a well-established poweruser wallet
* [Ledger Live](https://support.ledger.com/hc/en-us/articles/360017551659-Setting-up-your-Bitcoin-full-node?docs=true): wallet for users of Ledger hardware wallets (this wallet connects directly to Bitcoin Core)
* [Trezor Suite](https://blog.trezor.io/connecting-your-wallet-to-a-full-node-edf56693b545?gi=d1e285f3d3c5): wallet for users of Trezor hardware wallets
We will connect Sparrow wallet to our own Electrum server as it is the most private option. For more information about the privacy and security trade-offs of the various server connection options, read the following [article](https://www.sparrowwallet.com/docs/best-practices.html) by Craig Raw, the author of the wallet.
-![](../images/sparrow-stages.png)
+![](../../images/sparrow-stages.png)
We will set up Sparrow to connect to Fulcrum within your local network. There is also an optional section at the end that explains how to connect Sparrow to Fulcrum using Tor for when you're on the move.
@@ -77,7 +77,7 @@ We now configure Sparrow to connect to your node within your local network.
> [...]
```
-![](../images/sparrow-electrum-no-proxy.png)
+![](../../images/sparrow-electrum-no-proxy.png)
If there is a connection error message, try the following troubleshooting:
@@ -90,7 +90,7 @@ If there is a connection error message, try the following troubleshooting:
Let's go back to the wallet and check that it is connected to our own Electrum server.
* Close the server configuration window
-* Check the icon in the bottom right corner of the wallet window ![status icon](../images/sparrow-server-icon.png)
+* Check the icon in the bottom right corner of the wallet window ![status icon](../../images/sparrow-server-icon.png)
* The icon should be a blue slider button and a mouse over should display "Connected to \[...] at height \[...]"
You're set! Sparrow is now configured to connect to your Electrum server from within your local network.
@@ -147,7 +147,7 @@ Expected output:
> [...]
```
-![](../images/sparrow-electrum-tor-no-proxy.png)
+![](../../images/sparrow-electrum-tor-no-proxy.png)
You're set! Sparrow is now configured to connect to your node over Tor and you can use it wherever you are.
@@ -197,16 +197,16 @@ Expected output:
> [...]
```
-![](../images/sparrow-tor-proxy.png)
+![](../../images/sparrow-tor-proxy.png)
{% hint style="info" %}
-If you followed the [**Use the Tor proxy from another device**](../index-1/privacy.md#use-the-tor-proxy-from-another-device) section, you can use the Tor instance of your node instead of the instance of your regular computer, simply put on the "Proxy URL" box, your node IP local address (i.e 192.168.1.60) instead of localhost (127.0.0.1)
+If you followed the [**Use the Tor proxy from another device**](../../index-1/privacy.md#use-the-tor-proxy-from-another-device) section, you can use the Tor instance of your node instead of the instance of your regular computer, simply put on the "Proxy URL" box, your node IP local address (i.e 192.168.1.60) instead of localhost (127.0.0.1)
{% endhint %}
Now, let's go back to the wallet and check that the proxy is working properly.
* Close the server configuration window
-* Check the two icons in the bottom right corner of the wallet window ![status icons](../images/sparrow-server-proxy-icons.png)
+* Check the two icons in the bottom right corner of the wallet window ![status icons](../../images/sparrow-server-proxy-icons.png)
* The first icon should be grey, not red; and a mouse hover should display "External Tor proxy enabled"
You're set! Sparrow Wallet is now configured to use the Tor proxy when fetching the Bitcoin price and when communicating with the Whirlpool server during CoinJoins.
diff --git a/bitcoin/electrum-server.md b/itcoin/bitcoin/electrum-server.md
similarity index 96%
rename from bitcoin/electrum-server.md
rename to itcoin/bitcoin/electrum-server.md
index dd3fb838..ddbb82dc 100644
--- a/bitcoin/electrum-server.md
+++ b/itcoin/bitcoin/electrum-server.md
@@ -21,16 +21,16 @@ layout:
-
+
## Requirements
-* [Bitcoin Core](../index-2/bitcoin-client.md)
+* [Bitcoin Core](bitcoin-client.md)
* \~ 130GB of free storage for the database
-Fulcrum is a replacement for [Electrs](../bonus/bitcoin/electrs.md), these two services cannot be run at the same time (due to the same standard ports used), remember to stop Electrs doing `sudo systemctl stop electrs`.
+Fulcrum is a replacement for [Electrs](../../bonus/bitcoin/electrs.md), these two services cannot be run at the same time (due to the same standard ports used), remember to stop Electrs doing `sudo systemctl stop electrs`.
## Introduction
@@ -44,7 +44,7 @@ One possibility to use Bitcoin Core with your Bitcoin wallets is to use an Elect
## Preparations
-Make sure that you have [reduced the database cache of Bitcoin Core](../index-2/bitcoin-client.md#activate-mempool-and-reduce-dbcache-after-a-full-sync)
+Make sure that you have [reduced the database cache of Bitcoin Core](bitcoin-client.md#activate-mempool-and-reduce-dbcache-after-a-full-sync)
### Install dependencies
@@ -399,7 +399,7 @@ sudo nano /etc/systemd/system/fulcrum.service
[Unit]
Description=Fulcrum
-Wants=bitcoind.service
+Requires=bitcoind.service
After=bitcoind.service
StartLimitBurst=2
@@ -436,7 +436,7 @@ journalctl -fu fulcrum
## Run
-To keep an eye on the software movements, [start your SSH program](../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "admin"
+To keep an eye on the software movements, [start your SSH program](../../index-1/remote-access.md#access-with-secure-shell) (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "admin"
* Start the service
@@ -448,7 +448,7 @@ sudo systemctl start fulcrum
-
+
@@ -464,7 +464,7 @@ DO NOT REBOOT OR STOP THE SERVICE DURING THE DB CREATION PROCESS. YOU MAY CORRUP
* When you see logs like this ` XXXX mempool txs involving XXXX addresses`, which means that Fulcrum is fully indexed
-
+
* Ensure the service is working and listening at the default `50002` & `50001` ports and the `8000` admin port
diff --git a/lightning/channel-backup.md b/lightning/channel-backup.md
index 4759edb2..84f79449 100644
--- a/lightning/channel-backup.md
+++ b/lightning/channel-backup.md
@@ -57,7 +57,7 @@ We recommend using both methods, but you can choose either one of them, dependin
## Requirements
-* [Bitcoin Core](../index-2/bitcoin-client.md)
+* [Bitcoin Core](../itcoin/bitcoin/bitcoin-client.md)
* [LND](lightning-client.md)
## Preparations
@@ -237,7 +237,7 @@ UUID=123456 /mnt/static-channel-backup-external vfat auto,noexec,nouser,rw,sync,
sudo mount -a
```
-* Ensure that `/mnt/static-channel-backup-external` is listed
+* Ensure that `/mnt/static-channel-backup-external` is listed
```bash
df -h /mnt/static-channel-backup-external
@@ -330,7 +330,7 @@ git config user.email "minibolt@dummyemail.com"
cd ~/.lnd
```
-* Replace `` with your own GitHub username. When prompted `"Are you sure you want to continue connecting (yes/no/[fingerprint])?"` type "yes" and enter
+* Replace `` with your own GitHub username. When prompted `"Are you sure you want to continue connecting (yes/no/[fingerprint])?"` type "yes" and enter
```bash
git clone git@github.com:/remote-lnd-backup.git
@@ -423,7 +423,7 @@ To keep an eye on the software movements, [start your SSH program](../index-1/re
sudo systemctl start scb-backup
```
-**Example** of expected output on the first SSH session with `journalctl -fu scb-backup` ⬇️
+**Example** of expected output on the first SSH session with `journalctl -fu scb-backup` ⬇️
```
Jul 25 17:31:54 minibolt systemd[1]: Started SCB Backup.
@@ -440,7 +440,7 @@ sudo touch /data/lnd/data/chain/bitcoin/mainnet/channel.backup
-Example of the expected output with journalctl -fu scb-backup
⬇️
+Example of the expected output with journalctl -fu scb-backup
⬇️
```
Jul 25 17:32:32 minibolt scb-backup[401705]: /data/lnd/data/chain/bitcoin/mainnet/channel.backup OPEN
@@ -473,7 +473,7 @@ Nov 05 23:18:43 minibolt scb-backup[1711268]: error: src refspec main does not m
Nov 05 23:18:43 minibolt scb-backup[1711268]: error: failed to push some refs to 'github.com:/remote-lnd-backup.git
```
-\-> Replace the line 41 `git push "--set-upstream origin`` `**`main"`** to "`git push --set-upstream origin`` `**`master"`** [in the script](channel-backup.md#create-script) , and try again
+\-> Replace the line 41 ` git push "--set-upstream origin`` `` `**`main"`** to "` git push --set-upstream origin`` `` `**`master"`** [in the script](channel-backup.md#create-script) , and try again
{% endhint %}
* **If you enabled the local backup**, check the content of your local storage device. It should now contain a backup file with the date/time corresponding to the test made just above
@@ -514,7 +514,7 @@ sudo rm /etc/systemd/system/scb-backup.service
### Uninstall script
-* Delete the script installed
+* Delete the script installed
```bash
sudo rm /usr/local/bin/scb-backup
diff --git a/lightning/lightning-client.md b/lightning/lightning-client.md
index 3cb39e8f..ca4a69e2 100644
--- a/lightning/lightning-client.md
+++ b/lightning/lightning-client.md
@@ -27,7 +27,10 @@ We set up [LND](https://github.com/lightningnetwork/lnd), the Lightning Network
## Requirements
-* [Bitcoin Core](../index-2/bitcoin-client.md)
+* [Bitcoin Core](../itcoin/bitcoin/bitcoin-client.md)
+* Others
+ * [PostgreSQL](../bonus-guides/system/postgresql.md)
+ * [Go!](../bonus-guides/system/go.md) **(optional)**
## Preparations
@@ -69,13 +72,41 @@ Expected output:
> tcp LISTEN 0 100 127.0.0.1:28333 0.0.0.0:* users:(("bitcoind",pid=773834,fd=22))
+### Install PostgreSQL
+
+{% hint style="warning" %}
+You may want to use the bbolt database backend instead of PostgreSQL, if yes, jump to the [next step](lightning-client.md#installation) and follow the [Use bbolt database backend](lightning-client.md#use-the-bbolt-database-backend) section and remember to create the `lnd.conf` properly with this configuration when you arrive at the [configuration section](lightning-client.md#configuration)
+{% endhint %}
+
+* With user `admin`, check if you already have PostgreSQL installed
+
+```bash
+psql -V
+```
+
+**Example** of expected output:
+
+```
+> psql (PostgreSQL) 15.3 (Ubuntu 15.3-1.pgdg22.04+1)
+```
+
+{% hint style="info" %}
+If you obtain "**command not found**" outputs, you need to follow the [PostgreSQL bonus guide installation progress](../bonus-guides/system/postgresql.md#installation) to install it and then come back to continue with the guide
+{% endhint %}
+
+#### Create PostgreSQL database
+
+* With user `admin`, create a new database with the `postgres` user
+
+```bash
+sudo -u postgres createdb -O admin lndb
+```
+
## Installation
### Download binaries
-We'll download, verify, and install LND.
-
-* Navigate to the temporary directory
+* We'll download, verify, and install LND. Navigate to the temporary directory
```sh
cd /tmp
@@ -84,7 +115,7 @@ cd /tmp
* Set a temporary version environment variable to the installation
```sh
-VERSION=0.17.5
+VERSION=0.18.0
```
* Download the application, checksums, and signature
@@ -257,7 +288,7 @@ sudo rm -r lnd-linux-amd64-v$VERSION-beta && sudo rm lnd-linux-amd64-v$VERSION-b
{% endcode %}
{% hint style="info" %}
-If you come to update this is the final step
+If you come to [update](lightning-client.md#upgrade) this is the final step
{% endhint %}
### Create the lnd user & group
@@ -288,7 +319,7 @@ sudo adduser admin lnd
sudo mkdir /data/lnd
```
-* Assign as owner the `lnd` user
+* Assign as owner the `lnd` user
```sh
sudo chown -R lnd:lnd /data/lnd
@@ -379,13 +410,13 @@ tlsautorefresh=true
tlsdisableautofill=true
# Channel settings
-# Fee settings - default LND base fee = 1000 (mSat),
-# default LND fee rate = 1 (ppm)
+# Fee settings - default LND base fee = 1000 (mSat), fee rate = 1 (ppm)
# You can choose whatever you want e.g ZeroFeeRouting (0,0) or ZeroBaseFee (0,1)
#bitcoin.basefee=0
#bitcoin.feerate=0
-# Minimum channel size (default: 20000 sats). You can choose whatever you want
+# (Optional) Minimum channel size. Uncomment and set whatever you want
+# (default: 20000 sats)
#minchansize=20000
maxpendingchannels=5
@@ -401,7 +432,7 @@ protocol.simple-taproot-chans=true
# Watchtower client
wtclient.active=true
-# Specify the fee rate with which justice transactions will be signed
+# (Optional) Specify the fee rate with which justice transactions will be signed
# (default: 10 sat/byte)
#wtclient.sweep-fee-rate=10
@@ -415,19 +446,19 @@ ignore-historical-gossip-filters=true
stagger-initial-reconnect=true
# Database
-[bolt]
-# Set the next value to false to disable auto-compact DB
-# and fast boot and comment the next line
-db.bolt.auto-compact=true
-# Uncomment to do DB compact at every LND reboot (default: 168h)
-#db.bolt.auto-compact-min-age=0h
+[db]
+db.backend=postgres
-# Optional (uncomment the next 2 lines (default: CONSERVATIVE))
+[postgres]
+db.postgres.dsn=postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable
+db.postgres.timeout=0
+
+# (Optional) Uncomment the next 2 lines
+# (default: CONSERVATIVE)
#[Bitcoind]
-#bitcoind.estimatemode=ECONOMICAL
+#bitcoind.estimatemode=ECONOMICAL
[Bitcoin]
-bitcoin.active=true
bitcoin.mainnet=true
bitcoin.node=bitcoind
@@ -438,10 +469,10 @@ tor.streamisolation=true
{% hint style="info" %}
-This is a standard configuration. Check the official LND [sample-lnd.conf](https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf) with all possible options
+This is a standard configuration. Check the official LND [sample-lnd.conf](https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf) with all possible options if you want to add something special
{% endhint %}
-* Exit of the `lnd` user session to return to the **admin** user session
+* Exit of the `lnd` user session to return to the `admin` user session
```sh
exit
@@ -465,8 +496,8 @@ sudo nano /etc/systemd/system/lnd.service
[Unit]
Description=Lightning Network Daemon
-Wants=bitcoind.service
-After=bitcoind.service
+Requires=bitcoind.service postgresql.service
+After=bitcoind.service postgresql.service
[Service]
ExecStart=/usr/local/bin/lnd
@@ -588,12 +619,12 @@ or 'n' to create a new seed (Enter y/x/n):
{% tabs %}
{% tab title="Scenery 1" %}
-#### **If you are creating a new node and you wish to create a new seed**
+**If you are creating a new node and you wish to create a new seed**
* Press `n` and enter
{% hint style="info" %}
-If you choose this option, the next step will be choosing the passphrase **(optional -** press enter to proceed without a cipher seed passphrase**)**
+If you choose this option, the next step will be choosing the passphrase **(optional -** press enter to proceed without a cipher seed passphrase\*\*)\*\*
{% endhint %}
Expected output:
@@ -632,39 +663,36 @@ You can use a simple piece of paper, write them on the custom themed [Shiftcrypt
{% hint style="danger" %}
This piece of paper is all an attacker needs to empty your on-chain wallet!
-
-
🚫 **Do not store it on a computer**
🚫 **Do not take a picture with your mobile phone**
🚫 **This information should never be stored anywhere in digital form**
-
-
This information must be kept secret at all times
{% endhint %}
**Return to the first terminal with `journalctl -fu lnd`. Example of expected output ⬇️**
```
-Nov 26 19:17:38 raspiboltest lnd[1004]: 2023-11-26 19:17:38.037 [INF] LNWL: Opened wallet
-Nov 26 19:17:38 raspiboltest lnd[1004]: 2023-11-26 19:17:38.204 [INF] CHRE: Primary chain is set to: bitcoin
-Nov 26 19:17:38 raspiboltest lnd[1004]: 2023-11-26 19:17:38.244 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on 127.0.0.1:28332
-Nov 26 19:17:38 raspiboltest lnd[1004]: 2023-11-26 19:17:38.245 [INF] CHRE: Initializing bitcoind backed fee estimator in CONSERVATIVE mode
-Nov 26 19:17:38 raspiboltest lnd[1004]: 2023-11-26 19:17:38.244 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on 127.0.0.1:28333
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.576 [INF] LNWL: The wallet has been unlocked without a time limit
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.712 [INF] CHRE: LightningWallet opened
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.722 [INF] SRVR: Proxying all network traffic via Tor (stream_isolation=true)! NOTE: Ensure the backend node is proxying over Tor as well
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.723 [INF] TORC: Starting tor controller
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.744 [INF] HSWC: Cleaning circuits from disk for closed channels
-Nov 26 19:17:40 raspiboltest lnd[1004]: 2023-11-26 19:17:40.744 [INF] HSWC: Finished cleaning: no closed channels found, no actions taken.
+[...]
+Nov 26 19:17:38 minibolt lnd[1004]: 2023-11-26 19:17:38.037 [INF] LNWL: Opened wallet
+Nov 26 19:17:38 minibolt lnd[1004]: 2023-11-26 19:17:38.204 [INF] CHRE: Primary chain is set to: bitcoin
+Nov 26 19:17:38 minibolt lnd[1004]: 2023-11-26 19:17:38.244 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on 127.0.0.1:28332
+Nov 26 19:17:38 minibolt lnd[1004]: 2023-11-26 19:17:38.245 [INF] CHRE: Initializing bitcoind backed fee estimator in CONSERVATIVE mode
+Nov 26 19:17:38 minibolt lnd[1004]: 2023-11-26 19:17:38.244 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on 127.0.0.1:28333
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.576 [INF] LNWL: The wallet has been unlocked without a time limit
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.712 [INF] CHRE: LightningWallet opened
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.722 [INF] SRVR: Proxying all network traffic via Tor (stream_isolation=true)! NOTE: Ensure the backend node is proxying over Tor as well
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.723 [INF] TORC: Starting tor controller
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.744 [INF] HSWC: Cleaning circuits from disk for closed channels
+Nov 26 19:17:40 minibolt lnd[1004]: 2023-11-26 19:17:40.744 [INF] HSWC: Finished cleaning: no closed channels found, no actions taken.
[...]
```
{% endtab %}
{% tab title="Scenery 2" %}
-#### **If you had an old node and an existing cipher seed**
+**If you had an old node and an existing cipher seed**
* Press `y` and enter to recover it
@@ -721,8 +749,9 @@ lnd successfully initialized!
Return to the first terminal with `journalctl -f -u lnd`. Search to the next lines to ensure LND already entered the RECOVERY MODE and go out of this ⬇️
-Apr 17 21:17:19 roamingrpi lnd[63591]: 2024-04-17 21:17:19.288 [INF] LNWL: Opened wallet
-Apr 17 21:17:19 roamingrpi lnd[63591]: 2024-04-17 21:17:19.288 [INF] LTND: Wallet recovery mode enabled with address lookahead of 2500 addresses
+[...]
+Apr 17 21:17:19 minibolt lnd[63591]: 2024-04-17 21:17:19.288 [INF] LNWL: Opened wallet
+Apr 17 21:17:19 minibolt lnd[63591]: 2024-04-17 21:17:19.288 [INF] LTND: Wallet recovery mode enabled with address lookahead of 2500 addresses
[...]
Nov 26 19:47:08 minibolt lnd[1321]: 2023-11-26 19:47:08.642 [INF] LNWL: RECOVERY MODE ENABLED -- rescanning for used addresses with recovery_window=2500
Nov 26 19:47:08 minibolt lnd[1321]: 2023-11-26 19:47:08.685 [INF] LNWL: Seed birthday surpassed, starting recovery of wallet from height=2540246 hash=00000000000000178484e446a4fb5c966b5fd5db76121421bfa470c7c879ff05 with recovery-window=2500
@@ -743,7 +772,7 @@ The current state of your channels, however, cannot be recreated from this seed.
There is a dedicated [guide](channel-backup.md) to making an automatic backup
{% endhint %}
-* Type "exit" to return to the `admin` user
+* Return to the `admin` user
```sh
exit
@@ -757,16 +786,16 @@ sudo ss -tulpn | grep LISTEN | grep lnd
Expected output:
-> tcp LISTEN 0 4096 127.0.0.1:9735 0.0.0.0:* users:(("lnd",pid=774047,fd=51))
-> tcp LISTEN 0 4096 127.0.0.1:10009 0.0.0.0:* users:(("lnd",pid=774047,fd=8))
-> tcp LISTEN 0 4096 *:9911 *:* users:(("lnd",pid=774047,fd=50))
+> tcp LISTEN 0 4096 127.0.0.1:9735 0.0.0.0:* users:(("lnd",pid=774047,fd=51))
+> tcp LISTEN 0 4096 127.0.0.1:10009 0.0.0.0:* users:(("lnd",pid=774047,fd=8))
+> tcp LISTEN 0 4096 *:9911 *:* users:(("lnd",pid=774047,fd=50))
### Allow user "admin" to work with LND
-We interact with LND using the application `lncli`. At the moment, only the user "lnd" has the necessary access privileges. To make the user "admin" the main administrative user, we make sure it can interact with LND as well.
+We interact with LND using the application `lncli`. At the moment, only the user `lnd` has the necessary access privileges. To make the user "admin" the main administrative user, we make sure it can interact with LND as well.
-* As user `admin`, link the LND data directory in the user "`admin`" home. As a member of the group "`lnd`", the "`admin`" user has read-only access to certain files
+* As user `admin`, link the LND data directory in the user `admin` home. As a member of the group `lnd`, the `admin` user has read-only access to certain files
```sh
ln -s /data/lnd /home/admin/.lnd
@@ -795,7 +824,7 @@ drwxrwxr-x 5 admin admin 4096 Jul 12 07:57 .cargo
drwxrwxr-x 3 admin admin 4096 Jul 11 20:32 .config
drwx------ 3 admin admin 4096 Jul 15 20:54 .gnupg
-rw------- 1 admin admin 20 Jul 11 22:09 .lesshst
-lrwxrwxrwx 1 admin admin 9 Jul 18 07:10 .lnd -> /data/lnd
+lrwxrwxrwx 1 admin admin 9 Jul 18 07:10 .lnd -> /data/lnd
drwxrwxr-x 3 admin admin 4096 Jul 12 09:15 .local
drwxrwxr-x 3 admin admin 4096 Jul 16 09:23 .npm
-rw-r--r-- 1 admin admin 828 Jul 12 07:56 .profile
@@ -808,7 +837,7 @@ drwx------ 2 admin admin 4096 Jul 11 20:47 .ssh
-* Make all directories browsable for the group
+* Make all directories browsable for the group
```sh
sudo chmod -R g+X /data/lnd/data/
@@ -891,7 +920,7 @@ Monitor logs with `journalctl -fu lnd` to check the watchtower client is working
### Watchtower server
-Same as you can connect as a watchtower client to other watchtower servers, you could give the same service running an altruist watchtower server. **This was previously activated** in the `lnd.conf`, and you can see the information about it by typing the following command and sharing it with your peers.
+Same you can connect as a watchtower client to other watchtower servers, you could give the same service running an altruist watchtower server. **This was previously activated** in the `lnd.conf`, and you can see the information about it by typing the following command and sharing it with your peers.
```sh
lncli tower info
@@ -911,131 +940,414 @@ Expected output:
}
```
-{% hint style="info" %}
+{% hint style="warning" %}
This watchtower server service is not recommended to activate if you have a slow device without high-performance features, if yes consider disabling it commenting, or deleting the line `watchtower.active=true` of the `lnd.conf` file
{% endhint %}
-{% hint style="warning" %}
-Almost all of the following steps could be run with the [mobile](mobile-app.md) | [web](web-app.md) app guides. We strongly recommend using these applications with intuitive and visual UI to manage the Lightning Node, instead of using the command line
+{% hint style="info" %}
+Almost all of the following steps could be run with the [mobile](mobile-app.md) | [web](web-app.md) app guides. We strongly recommend using these applications with intuitive and visual UI to manage the Lightning Node, instead of using the command line. Anyway, if you want to explore the lncli, you have some useful commands in the[ extra section](lightning-client.md#some-useful-lncli-commands)
{% endhint %}
## Extras (optional)
-### Funding your Lightning node
+### Use the default bbolt database backend
-* Generate a new Bitcoin address (p2tr = taproot/bech32m) to receive funds on-chain and send a small amount of Bitcoin to it from any wallet of your choice
+Once you have skipped the before section of the [PostgreSQL installation](lightning-client.md#install-postgresql), and when you arrive at the [Configuration section](lightning-client.md#configuration), modify `lnd.conf` file
-```sh
-lncli newaddress p2tr
+* With user `lnd`, edit `lnd.conf`
+
+```bash
+nano /data/lnd/lnd.conf
```
-Expected output:
+* Replace `# Database` section about the PostgreSQL database backend
```
-> "address": "bc1p..."
+# Database
+[db]
+db.backend=postgres
+
+[postgres]
+db.postgres.dsn=postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable
+db.postgres.timeout=0
```
-* Check your LND wallet balance
+* To this
-```sh
-lncli walletbalance
+```
+# Database
+[bolt]
+# Set the next value to false to disable auto-compact DB
+# and fast boot and comment the next line
+db.bolt.auto-compact=true
+# Uncomment to do DB compact at every LND reboot (default: 168h)
+#db.bolt.auto-compact-min-age=0h
+```
+
+* Return to the `admin` user
+
+```bash
+exit
+```
+
+{% hint style="info" %}
+Continue with the guide on the [Create systemd service](lightning-client.md#create-systemd-service) section
+{% endhint %}
+
+### Migrate an existing bbolt database to PostgreSQL
+
+{% hint style="danger" %}
+Attention: this process is very risky, supposedly this [software is in an experimental state](https://github.com/lightninglabs/lndinit/pull/21) which could damage your existing LND database. Act at your own risk. It is recommended to start from scratch by closing all existing channels, rather than a migration
+{% endhint %}
+
+#### Install Go!
+
+* With user `admin`, verify that you've installed Go by typing the following command
+
+```bash
+go version
```
**Example** of expected output:
```
-{
- "total_balance": "712345",
- "confirmed_balance": "0",
- "unconfirmed_balance": "712345"
-}
+> go version go1.21.10 linux/amd64
```
-As soon as your funding transaction is mined (1 confirmation), LND will show its amount as "confirmed\_balance".
+{% hint style="info" %}
+If you obtain "**command not found**" outputs, you need to follow the [Go! bonus guide installation progress](../bonus-guides/system/go.md#installation) to install it and then come back to continue with the guide
+{% endhint %}
+
+#### Install lndinit
+
+* With user `admin`, go to the temporary folder
+
+```bash
+cd /tmp
+```
+
+* Clone the `migrate-db` branch of the lndinit, from the official repository of the Minibolt and enter to the lndinit folder
+
+{% code overflow="wrap" %}
+```bash
+git clone --branch migrate-db https://github.com/minibolt-guide/lndinit.git && cd lndinit
+```
+{% endcode %}
+
+* Compile it
+
+```bash
+make install
+```
{% hint style="info" %}
-If you want to open a few channels, you might want to send a few transactions. If you have only one UTXO, you need to wait for the change to return to your wallet after every new channel opening
+This process can take quite a long time, 5-10 minutes or more, depending on the performance of your device. Please be patient until the prompt shows again
{% endhint %}
-### Opening channels
+* Install it
+
+```bash
+sudo install -m 0755 -o root -g root -t /usr/local/bin /home/admin/go/bin/lndinit
+```
+
+* Check the correct installation
-Although LND features an optional "autopilot", we manually open some channels.
+```bash
+lndinit -v
+```
+
+**Example** of expected output:
-We recommend going on [amboss.space](https://amboss.space) or [1ML.com](https://1ml.com) and looking for a mix of big and small nodes with decent Node Ranks. Another great way to find peers to collaboratively set up channels is [LightningNetwork+](https://lightningnetwork.plus/).
+```
+2024-05-30 23:00:15.666 LNDINIT: Version 0.1.4-beta commit=, debuglevel=debug
+2024-05-30 23:00:15.668 LNDINIT: Config error: Please specify one command of: gen-password, gen-seed, init-wallet, load-secret, migrate-db, store-secret or wait-ready
+```
-To connect to a remote node, you need its URI that looks like `@host`:
+**(Optional)** Delete the installation files
-* the `` is just a long hexadecimal number, like `02b03a1d133c0338c0185e57f0c35c63cce53d5e3ae18414fc40e5b63ca08a2128`
-* the `host` can be a domain name, a clearnet IP address, or a Tor onion address, followed by the port number (usually `:9735`)
+```bash
+sudo rm -r /tmp/lndinit
+```
-Just grab the whole URI above the big QR code and use it as follows (we will use the `⚡2FakTor⚡` LN node **as an example**):
+#### Migrate bbolt database to PostgreSQL
-* **Connect** to the remote node, with the full URI
+* With user `admin`, stop lnd
-{% code overflow="wrap" %}
```bash
-lncli connect 02b03a1d133c0338c0185e57f0c35c63cce53d5e3ae18414fc40e5b63ca08a2128@aopvxn7cf7kv42u5oxfo3mplhl5oerukndi3wos7vpsfvqvc7vvmgyqd.onion:9735
+sudo systemctl stop lnd
+```
+
+* Confirm and ensure that LND is stopped successfully by monitoring logs
+
+```bash
+journalctl -fu lnd
```
-{% endcode %}
-* **Open a channel** using the `` only (_i.e._, the part of the URI before the `@`) and the channel capacity in satoshis.
+Expected output:
-The command has a built-in fee estimator, but to avoid overpaying fees, you can manually control the fees for the funding transaction by using the `sat_per_vbyte` argument as follows (to select the appropriate fee, in sats/vB, check [mempool.space](https://mempool.space/))
+May 30 20:44:36 minibolt lnd[314082]: 2024-05-30 20:44:36.840 [INF] INVC: Cancelling invoice subscription for client=1
+May 30 20:44:36 minibolt lnd[314082]: 2024-05-30 20:44:36.855 [ERR] RPCS: [/routerrpc.Router/SubscribeHtlcEvents]: context canceled
+May 30 20:44:36 minibolt lnd[314082]: 2024-05-30 20:44:36.861 [ERR] RPCS: [/routerrpc.Router/SubscribeHtlcEvents]: context canceled
+May 30 20:44:48 minibolt lnd[314082]: 2024-05-30 20:44:48.927 [INF] CRTR: Processed channels=0 updates=21 nodes=0 in last 1m0.000123683s
+May 30 20:45:02 minibolt systemd[1]: Stopping Lightning Network Daemon...
+May 30 20:45:02 minibolt lnd[314082]: 2024-05-30 20:45:02.606 [INF] LTND: Received shutdown request.
+May 30 20:45:02 minibolt lnd[314082]: 2024-05-30 20:45:02.609 [INF] LTND: Shutting down...
+May 30 20:45:02 minibolt lnd[314082]: 2024-05-30 20:45:02.612 [INF] LTND: Systemd was notified about stopping
+May 30 20:45:02 minibolt lnd[314082]: 2024-05-30 20:45:02.612 [INF] LTND: Gracefully shutting down.
+May 30 20:45:02 minibolt lnd[314082]: 2024-05-30 20:45:02.615 [INF] WTWR: Stopping watchtower
+May 30 20:45:02 minibolt systemd[1]: lnd.service: Succeeded.
+May 30 20:45:02 minibolt systemd[1]: Stopped Lightning Network Daemon.
+May 30 20:45:02 minibolt systemd[1]: lnd.service: Consumed 12h 11min 606ms CPU time.
+
+
+* Previously followed:
+ 1. [Install PostgreSQL section](lightning-client.md#install-postgresql)
+ 2. [Create PostgreSQL database section](lightning-client.md#create-postgresql-database)
+* Exec the migration and wait to finish it
-{% code overflow="wrap" %}
```bash
-lncli openchannel --sat_per_vbyte 8 02b03a1d133c0338c0185e57f0c35c63cce53d5e3ae18414fc40e5b63ca08a2128 500000 0
+sudo lndinit -v migrate-db \
+ --source.bolt.data-dir /home/admin/.lnd/data \
+ --source.bolt.tower-dir /home/admin/.lnd/data/watchtower \
+ --source.bolt.network=mainnet \
+ --dest.backend postgres \
+ --dest.postgres.dsn=postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable \
+ --dest.postgres.timeout=0
```
-{% endcode %}
-* **Check your funds**, both in the on-chain wallet and the channel balances
+
-```sh
-lncli walletbalance
+Example of expected output ⬇️
+
+```
+2024-04-17 14:07:41.277 LNDINIT: Version 0.1.4-beta commit=, debuglevel=debug
+2024-04-17 14:07:41.279 LNDINIT: Migrating DB with prefix channeldb
+2024-04-17 14:07:41.279 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/graph/mainnet/channel.db for prefix 'channeldb'
+2024-04-17 14:07:41.370 LNDINIT: Opened source DB
+2024-04-17 14:07:41.370 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'channeldb'
+2024-04-17 14:07:41.394 LNDINIT: Opened destination DB
+2024-04-17 14:07:41.394 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:07:41.394 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:07:41.401 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:07:41.402 LNDINIT: Copying top-level bucket 'alias-bucket'
+2024-04-17 14:07:41.409 LNDINIT: Committing bucket 'alias-bucket'
+2024-04-17 14:07:41.411 LNDINIT: Copying top-level bucket 'base-bucket'
+2024-04-17 14:07:41.413 LNDINIT: Committing bucket 'base-bucket'
+2024-04-17 14:07:41.415 LNDINIT: Copying top-level bucket 'chan-id-bucket'
+2024-04-17 14:07:41.417 LNDINIT: Committing bucket 'chan-id-bucket'
+2024-04-17 14:07:41.481 LNDINIT: Copying top-level bucket 'circuit-adds'
+2024-04-17 14:07:41.483 LNDINIT: Committing bucket 'circuit-adds'
+2024-04-17 14:07:41.484 LNDINIT: Copying top-level bucket 'circuit-fwd-log'
+2024-04-17 14:07:41.486 LNDINIT: Committing bucket 'circuit-fwd-log'
+2024-04-17 14:07:41.487 LNDINIT: Copying top-level bucket 'circuit-keystones'
+2024-04-17 14:07:41.489 LNDINIT: Committing bucket 'circuit-keystones'
+2024-04-17 14:07:41.490 LNDINIT: Copying top-level bucket 'close-summaries'
+2024-04-17 14:07:41.492 LNDINIT: Committing bucket 'close-summaries'
+2024-04-17 14:07:41.493 LNDINIT: Copying top-level bucket 'closed-chan-bucket'
+2024-04-17 14:07:41.495 LNDINIT: Committing bucket 'closed-chan-bucket'
+2024-04-17 14:07:41.496 LNDINIT: Copying top-level bucket 'confirm-hints'
+2024-04-17 14:07:41.497 LNDINIT: Committing bucket 'confirm-hints'
+2024-04-17 14:07:41.499 LNDINIT: Copying top-level bucket 'edge-index'
+2024-04-17 14:07:41.500 LNDINIT: Committing bucket 'edge-index'
+2024-04-17 14:07:41.501 LNDINIT: Copying top-level bucket 'fwd-packages'
+2024-04-17 14:07:41.503 LNDINIT: Committing bucket 'fwd-packages'
+2024-04-17 14:07:41.504 LNDINIT: Copying top-level bucket 'graph-edge'
+2024-04-17 14:07:58.418 LNDINIT: Committing bucket 'graph-edge'
+2024-04-17 14:08:08.332 LNDINIT: Copying top-level bucket 'graph-meta'
+2024-04-17 14:08:08.337 LNDINIT: Committing bucket 'graph-meta'
+2024-04-17 14:08:08.834 LNDINIT: Copying top-level bucket 'graph-node'
+2024-04-17 14:08:11.346 LNDINIT: Committing bucket 'graph-node'
+2024-04-17 14:08:13.710 LNDINIT: Copying top-level bucket 'historical-chan-bucket'
+2024-04-17 14:08:13.713 LNDINIT: Committing bucket 'historical-chan-bucket'
+2024-04-17 14:08:13.727 LNDINIT: Copying top-level bucket 'invoice-alias-bucket'
+2024-04-17 14:08:13.728 LNDINIT: Committing bucket 'invoice-alias-bucket'
+2024-04-17 14:08:13.733 LNDINIT: Copying top-level bucket 'invoices'
+2024-04-17 14:08:13.737 LNDINIT: Committing bucket 'invoices'
+2024-04-17 14:08:13.742 LNDINIT: Copying top-level bucket 'message-store'
+2024-04-17 14:08:13.743 LNDINIT: Committing bucket 'message-store'
+2024-04-17 14:08:13.748 LNDINIT: Copying top-level bucket 'metadata'
+2024-04-17 14:08:13.750 LNDINIT: Committing bucket 'metadata'
+2024-04-17 14:08:13.754 LNDINIT: Copying top-level bucket 'missioncontrol-results'
+2024-04-17 14:08:13.756 LNDINIT: Committing bucket 'missioncontrol-results'
+2024-04-17 14:08:13.760 LNDINIT: Copying top-level bucket 'network-result-store-bucket'
+2024-04-17 14:08:13.762 LNDINIT: Committing bucket 'network-result-store-bucket'
+2024-04-17 14:08:13.767 LNDINIT: Copying top-level bucket 'next-payment-id-key'
+2024-04-17 14:08:13.768 LNDINIT: Committing bucket 'next-payment-id-key'
+2024-04-17 14:08:13.773 LNDINIT: Copying top-level bucket 'nib'
+2024-04-17 14:08:13.774 LNDINIT: Committing bucket 'nib'
+2024-04-17 14:08:13.779 LNDINIT: Copying top-level bucket 'open-chan-bucket'
+2024-04-17 14:08:13.780 LNDINIT: Committing bucket 'open-chan-bucket'
+2024-04-17 14:08:13.782 LNDINIT: Copying top-level bucket 'outpoint-bucket'
+2024-04-17 14:08:13.783 LNDINIT: Committing bucket 'outpoint-bucket'
+2024-04-17 14:08:13.784 LNDINIT: Copying top-level bucket 'pay-addr-index'
+2024-04-17 14:08:13.786 LNDINIT: Committing bucket 'pay-addr-index'
+2024-04-17 14:08:13.787 LNDINIT: Copying top-level bucket 'payments-index-bucket'
+2024-04-17 14:08:13.788 LNDINIT: Committing bucket 'payments-index-bucket'
+2024-04-17 14:08:13.790 LNDINIT: Copying top-level bucket 'peers-bucket'
+2024-04-17 14:08:13.791 LNDINIT: Committing bucket 'peers-bucket'
+2024-04-17 14:08:13.792 LNDINIT: Copying top-level bucket 'set-id-index'
+2024-04-17 14:08:13.793 LNDINIT: Committing bucket 'set-id-index'
+2024-04-17 14:08:13.794 LNDINIT: Copying top-level bucket 'spend-hints'
+2024-04-17 14:08:13.796 LNDINIT: Committing bucket 'spend-hints'
+2024-04-17 14:08:13.797 LNDINIT: Copying top-level bucket 'sweeper-tx-hashes'
+2024-04-17 14:08:13.798 LNDINIT: Committing bucket 'sweeper-tx-hashes'
+2024-04-17 14:08:13.803 LNDINIT: Migrating DB with prefix macaroondb
+2024-04-17 14:08:13.803 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/chain/bitcoin/mainnet/macaroons.db for prefix 'macaroondb'
+2024-04-17 14:08:13.804 LNDINIT: Opened source DB
+2024-04-17 14:08:13.804 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'macaroondb'
+2024-04-17 14:08:13.878 LNDINIT: Opened destination DB
+2024-04-17 14:08:13.878 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:08:13.878 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:08:13.881 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:08:13.881 LNDINIT: Copying top-level bucket 'macrootkeys'
+2024-04-17 14:08:13.887 LNDINIT: Committing bucket 'macrootkeys'
+2024-04-17 14:08:13.900 LNDINIT: Migrating DB with prefix decayedlogdb
+2024-04-17 14:08:13.900 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/graph/mainnet/sphinxreplay.db for prefix 'decayedlogdb'
+2024-04-17 14:08:13.900 LNDINIT: Opened source DB
+2024-04-17 14:08:13.900 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'decayedlogdb'
+2024-04-17 14:08:14.762 LNDINIT: Opened destination DB
+2024-04-17 14:08:14.762 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:08:14.762 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:08:14.768 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:08:14.768 LNDINIT: Copying top-level bucket 'batch-replay'
+2024-04-17 14:08:14.776 LNDINIT: Committing bucket 'batch-replay'
+2024-04-17 14:08:14.782 LNDINIT: Copying top-level bucket 'shared-hash'
+2024-04-17 14:08:14.786 LNDINIT: Committing bucket 'shared-hash'
+2024-04-17 14:08:14.811 LNDINIT: Migrating DB with prefix towerclientdb
+2024-04-17 14:08:14.811 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/graph/mainnet/wtclient.db for prefix 'towerclientdb'
+2024-04-17 14:08:14.812 LNDINIT: Opened source DB
+2024-04-17 14:08:14.812 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'towerclientdb'
+2024-04-17 14:08:14.956 LNDINIT: Opened destination DB
+2024-04-17 14:08:14.956 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:08:14.956 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:08:14.963 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:08:14.963 LNDINIT: Copying top-level bucket 'client-channel-detail-bucket'
+2024-04-17 14:08:14.970 LNDINIT: Committing bucket 'client-channel-detail-bucket'
+2024-04-17 14:08:14.975 LNDINIT: Copying top-level bucket 'client-channel-id-index'
+2024-04-17 14:08:14.978 LNDINIT: Committing bucket 'client-channel-id-index'
+2024-04-17 14:08:14.983 LNDINIT: Copying top-level bucket 'client-closable-sessions-bucket'
+2024-04-17 14:08:14.986 LNDINIT: Committing bucket 'client-closable-sessions-bucket'
+2024-04-17 14:08:14.991 LNDINIT: Copying top-level bucket 'client-session-bucket'
+2024-04-17 14:08:14.994 LNDINIT: Committing bucket 'client-session-bucket'
+2024-04-17 14:08:14.999 LNDINIT: Copying top-level bucket 'client-session-id-index'
+2024-04-17 14:08:15.002 LNDINIT: Committing bucket 'client-session-id-index'
+2024-04-17 14:08:15.007 LNDINIT: Copying top-level bucket 'client-session-key-index-bucket'
+2024-04-17 14:08:15.010 LNDINIT: Committing bucket 'client-session-key-index-bucket'
+2024-04-17 14:08:15.015 LNDINIT: Copying top-level bucket 'client-tower-bucket'
+2024-04-17 14:08:15.017 LNDINIT: Committing bucket 'client-tower-bucket'
+2024-04-17 14:08:15.022 LNDINIT: Copying top-level bucket 'client-tower-index-bucket'
+2024-04-17 14:08:15.025 LNDINIT: Committing bucket 'client-tower-index-bucket'
+2024-04-17 14:08:15.030 LNDINIT: Copying top-level bucket 'client-tower-to-session-index-bucket'
+2024-04-17 14:08:15.032 LNDINIT: Committing bucket 'client-tower-to-session-index-bucket'
+2024-04-17 14:08:15.037 LNDINIT: Copying top-level bucket 'metadata-bucket'
+2024-04-17 14:08:15.043 LNDINIT: Committing bucket 'metadata-bucket'
+2024-04-17 14:08:15.061 LNDINIT: Migrating DB with prefix towerserverdb
+2024-04-17 14:08:15.061 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/watchtower/bitcoin/mainnet/watchtower.db for prefix 'towerserverdb'
+2024-04-17 14:08:15.061 LNDINIT: Opened source DB
+2024-04-17 14:08:15.061 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'towerserverdb'
+2024-04-17 14:08:15.144 LNDINIT: Opened destination DB
+2024-04-17 14:08:15.144 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:08:15.144 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:08:15.149 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:08:15.149 LNDINIT: Copying top-level bucket 'lookout-tip-bucket'
+2024-04-17 14:08:15.155 LNDINIT: Committing bucket 'lookout-tip-bucket'
+2024-04-17 14:08:15.161 LNDINIT: Copying top-level bucket 'metadata-bucket'
+2024-04-17 14:08:15.166 LNDINIT: Committing bucket 'metadata-bucket'
+2024-04-17 14:08:15.168 LNDINIT: Copying top-level bucket 'sessions-bucket'
+2024-04-17 14:08:15.171 LNDINIT: Committing bucket 'sessions-bucket'
+2024-04-17 14:08:15.173 LNDINIT: Copying top-level bucket 'update-index-bucket'
+2024-04-17 14:08:15.175 LNDINIT: Committing bucket 'update-index-bucket'
+2024-04-17 14:08:15.177 LNDINIT: Copying top-level bucket 'updates-bucket'
+2024-04-17 14:08:15.180 LNDINIT: Committing bucket 'updates-bucket'
+2024-04-17 14:08:15.192 LNDINIT: Migrating DB with prefix walletdb
+2024-04-17 14:08:15.193 LNDINIT: Opening bbolt backend at /home/admin/.lnd/data/chain/bitcoin/mainnet/wallet.db for prefix 'walletdb'
+2024-04-17 14:08:15.213 LNDINIT: Opened source DB
+2024-04-17 14:08:15.213 LNDINIT: Opening postgres backend at postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable with prefix 'walletdb'
+2024-04-17 14:08:15.299 LNDINIT: Opened destination DB
+2024-04-17 14:08:15.299 LNDINIT: Checking tombstone marker on source DB
+2024-04-17 14:08:15.300 LNDINIT: Checking if migration was already applied to target DB
+2024-04-17 14:08:15.304 LNDINIT: Starting the migration to the target backend
+2024-04-17 14:08:15.304 LNDINIT: Copying top-level bucket 'waddrmgr'
+2024-04-17 14:08:15.809 LNDINIT: Committing bucket 'waddrmgr'
+2024-04-17 14:08:15.815 LNDINIT: Copying top-level bucket 'wtxmgr'
+2024-04-17 14:08:15.828 LNDINIT: Committing bucket 'wtxmgr'
+2024-04-17 14:08:15.833 LNDINIT: Creating 'wallet created' marker
+2024-04-17 14:08:15.835 LNDINIT: Committing 'wallet created' marker
```
-```sh
-lncli channelbalance
+
+
+{% hint style="info" %}
+This process could take a few minutes depending on the size of the database. When the prompt comes back to show you, the migration is finished successfully
+{% endhint %}
+
+* Now follow the [Configured](lightning-client.md#configuration) section `lnd.conf`, to use the PostgreSQL database as the backend, paying attention to the next section
+
+```
+# Database
+[db]
+db.backend=postgres
+
+[postgres]
+db.postgres.dsn=postgresql://admin:admin@127.0.0.1:5432/lndb?sslmode=disable
+db.postgres.timeout=0
```
-* **List active channels**. Once the channel funding transaction has been mined and gained enough confirmations, your channel is fully operational. That can take an hour or more
+* With the user `admin`, start LND again
-```sh
-lncli listchannels
+```bash
+sudo systemctl start lnd
```
-* **Make a Lightning payment**. By default, these work with invoices, so when you buy something or want to send money, you need to get an invoice first. However, you can also pay without requesting an invoice as long the receiving node supports the keysend or amp feature!
+* Monitor the LND logs to ensure all is working correctly with the new PostgreSQL database backend successfully migrated
-To try, why not send me satoshis! You simply need to input my node pubkey [`2FakTor`](https://amboss.space/node/02b03a1d133c0338c0185e57f0c35c63cce53d5e3ae18414fc40e5b63ca08a2128)⚡, the amount in satoshis and add the "`–keysend`" flag. Replace `` parameter with what you want
+```bash
+journalctl -fu lnd
+```
+
+{% hint style="info" %}
+The `[WRN]` logs indicate that LND has detected an existing old bbolt database and It will not be migrated to postgres automatically, but we already migrated it before 😏
+
+You can delete these logs by following the [next section](lightning-client.md#optional-delete-old-bbolt-files-database)
+{% endhint %}
-{% code overflow="wrap" %}
-```sh
-lncli sendpayment --dest 02b03a1d133c0338c0185e57f0c35c63cce53d5e3ae18414fc40e5b63ca08a2128 --amt --keysend
```
-{% endcode %}
+[...]
+> Apr 17 14:33:20 minibolt lnd[55570]: 2024-04-17 14:33:20.984 [WRN] LTND: Found existing bbolt database file in /home/lnd/.lnd/data/chain/bitcoin/mainnet/wallet.db while using database type postgres. Existing data will NOT be migrated to postgres automatically!
+> Apr 17 14:33:20 minibolt lnd[55570]: 2024-04-17 14:33:20.985 [WRN] LTND: Found existing bbolt database file in /home/lnd/.lnd/data/graph/mainnet/channel.db while using database type postgres. Existing data will NOT be migrated to postgres automatically!
+[...]
+```
-### Some useful commands
+{% hint style="info" %}
+Ensure you still have your node in the same situation before the migration using the [Web app: ThunderHub](web-app.md) of lncli with commands like `lncli listchannels or lncli listunspent or lncli wtclient towers` and see if everything is as you left it before the migration
+{% endhint %}
-A quick reference with special commands to play around with:
+#### (Optional) Delete old bbolt files database
-* Pay an AMP invoice (both sender and receiver nodes have to have AMP enabled)
+* With user `admin`, change to the `lnd` user
-```sh
-lncli payinvoice --amt
+```bash
+sudo su - lnd
```
-* Send payment to node without invoice using AMP invoice (both sender and receiver nodes have to have AMP enabled)
+* Detele the old bbolt database files
-```sh
-lncli sendpayment --dest --amt --amp
+{% code overflow="wrap" %}
+```bash
+rm /data/lnd/data/chain/bitcoin/mainnet/macaroons.db && rm /data/lnd/data/chain/bitcoin/mainnet/macaroons.db.last-compacted && rm /data/lnd/data/chain/bitcoin/mainnet/wallet.db && rm /data/lnd/data/graph/mainnet/* && rm /data/lnd/data/watchtower/bitcoin/mainnet/*
```
+{% endcode %}
-* Send payment to a node without an invoice using Keysend (both sender and receiver nodes have to have Keysend enabled)
+* Return to the `admin` user
-```sh
-lncli sendpayment --dest --amt --keysend
+```bash
+exit
```
+### Some useful lncli commands
+
+Quick reference with special commands to play around with:
+
* Create your own Re-Usable Static AMP invoice
{% code overflow="wrap" %}
@@ -1045,30 +1357,43 @@ lncli addinvoice --memo "your memo here" --amt --expiry