Use path consistently in examples (#799)

* Use path consistently in examples

Closes btcpayserver/btcpayserver-doc#1292.

* Add note

* Make it more concise
This commit is contained in:
d11n 2023-06-14 10:24:39 +02:00 committed by GitHub
parent b7b1fe1b83
commit cbbb94e7b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 32 deletions

View File

@ -16,7 +16,7 @@ Current UTXO Set snapshots only work for Bitcoin Core 0.17.0 or higher. Do NOT u
## How does Fast Sync solve the problem?
For Bitcoin software to operate, you do not need all the history of blocks from the genesis.
For Bitcoin software to operate, you do not need all the history of blocks from the genesis.
You need the state of Bitcoin up to a certain block (this state is called `UTXO Set`), and around ~300 blocks before this point.
@ -29,9 +29,10 @@ When your node starts up again, with the `UTXO Set snapshot` it will only need t
### Malicious UTXO Set
Fast Sync can potentially get abused:
1. The attacker gives you a `UTXO Set snapshot`, which does not follow Bitcoin consensus.
2. The attacker makes a purchase to your store.
3. Nodes following the consensus would not recognize the payment as valid, but your node will.
2. The attacker makes a purchase to your store.
3. Nodes following the consensus would not recognize the payment as valid, but your node will.
4. The coins the attacker sent you are just worthless.
Other attacks can completely bring down your node.
@ -52,64 +53,57 @@ If this is a problem for you, use an older snapshot.
The snapshots recognized as valid by the `btcpayserver-docker` repository you've cloned, can be found on [utxo-sets](utxo-sets).
When you SSH into your new Sync BTCPay Server (by the use of Putty, for example), the first thing you have to do is become `root`.
When you SSH into your new Sync BTCPay Server (by the use of Putty, for example), the first thing you have to do is become `root`.
```bash
sudo -i
```
Before you start the [load-utxo-set.sh](load-utxo-set.sh), you must bring down your BTCPay Server.
Before you start the [load-utxo-set.sh](load-utxo-set.sh), you must bring down your BTCPay Server.
When in `~/btcpayserver-docker` you run `btcpay-down.sh` to bring down your instance.
In the `btcpayserver-docker` directory you run `btcpay-down.sh` to bring down your instance.
```bash
cd btcpayserver-docker
cd $BTCPAY_BASE_DIRECTORY/btcpayserver-docker
./btcpay-down.sh
```
![BTCPay Server FastSync](../../docs/img/fastsync/btcpayfastsync1.jpg)
![BTCPay Server FastSync](../../docs/img/fastsync/btcpayfastsync1.jpg)
After you've shut down BTCPay Server, you now go into the `~/btcpayserver-docker/contrib/FastSync/` directory.
If you want to be sure you're in the correct directory, hit the `ls` command after the `cd contrib/FastSync`
After you've shut down BTCPay Server, you now go into the FastSync directory and run the `load-utxo-set.sh` script:
```bash
cd contrib/FastSync
ls
cd $BTCPAY_BASE_DIRECTORY/btcpayserver-docker/contrib/FastSync
./load-utxo-set.sh
```
The script [load-utxo-set.sh](load-utxo-set.sh) will download the utxo-set from the environment variable `UTXO_DOWNLOAD_LINK`.
If `UTXO_DOWNLOAD_LINK` is empty, `NBITCOIN_NETWORK` (with value set to `mainnet` or `testnet`) will be used to take a default `UTXO_DOWNLOAD_LINK` that we hard coded inside [load-utxo-set.sh](load-utxo-set.sh).
```bash
./load-utxo-set.sh
```
![BTCPay Server FastSync](../../docs/img/fastsync/btcpayfastsync2.jpg)
Once the files are downloaded, the hash will be checked against those in [utxo-sets](utxo-sets).
![BTCPay Server FastSync](../../docs/img/fastsync/btcpayfastsync3.jpg)
After the [load-utxo-set.sh](load-utxo-set.sh) is done, you will be warned, and asked to delete the docker volume `generated_bitcoin_wallet_datadir`.
This will be recreated when we now run the `btcpay-up.sh` script.
This will be recreated when we now run the `btcpay-up.sh` script.
```bash
docker volume rm generated_bitcoin_wallet_datadir
```
Now go back to `~/btcpayserver-docker` directory, and let's restart your Server with `./btcpay-up.sh` to sync the rest!
Now go back to the `btcpayserver-docker` directory, and let's restart your Server with `./btcpay-up.sh` to sync the rest!
```bash
cd ../../
cd $BTCPAY_BASE_DIRECTORY/btcpayserver-docker
./btcpay-up.sh
```
The rest of the Sync will take place on your BTCPay Server until it reaches the latest block height.
The rest of the Sync will take place on your BTCPay Server until it reaches the latest block height.
You can either follow this process in the UI of the BTCPay Server or run the following command in the CLI. This will show you the latest log output and the current block height of your `Fast Sync` node.
You can either follow this process in the UI of the BTCPay Server or run the following command in the CLI. This will show you the latest log output and the current block height of your `Fast Sync` node.
```bash
docker logs --tail -100 btcpayserver_bitcoind
@ -132,10 +126,11 @@ If you don't trust anybody, which should be the case as much as possible, then h
3. Wait for `Synchy` to be fully synced.
4. Now on, `Synchy` and `Trusty` run the following command at the same time:
If `Synchy` or `Trusty` are both using BTCPay Server, go to `~/btcpayserver-docker/` and use:
If `Synchy` or `Trusty` are both using BTCPay Server, go to the `btcpayserver-docker` directory and use:
```bash
bitcoin-cli.sh gettxoutsetinfo
cd $BTCPAY_BASE_DIRECTORY/btcpayserver-docker
./bitcoin-cli.sh gettxoutsetinfo
```
Or use if non BTCPay Server node :
@ -144,7 +139,7 @@ Or use if non BTCPay Server node :
bitcoin-cli gettxoutsetinfo
```
Running this command might take some time, and nothing will show up in the terminal in the meantime.
Running this command might take some time, and nothing will show up in the terminal in the meantime.
5. Verify that the output of `Synchy` and `Trusty` are identical (you can ignore `disk_size`).
@ -159,9 +154,11 @@ Running this command might take some time, and nothing will show up in the termi
This repository contains the signatures of some developers, for example [sigs/NicolasDorier.utxo-sets.asc](sigs/NicolasDorier.utxo-sets.asc) contains the hashes that `NicolasDorier` verified himself.
You need to verify with [KeyBase command line](https://keybase.io/docs/command_line) that the signature is legit:
```bash
keybase pgp verify -i sigs/NicolasDorier.utxo-sets.asc
```
If you don't like command line, you can verify against [keybase verify page](https://keybase.io/verify) by just copying and pasting the content of [sigs/NicolasDorier.utxo-sets.asc](sigs/NicolasDorier.utxo-sets.asc).
You can verify that the handle `NicolasDorier` refers to the person who controls `NicolasDorier` Twitter, GitHub, and Reddit handle on [the keybase profile page](https://keybase.io/NicolasDorier).
@ -171,6 +168,7 @@ You can verify that the handle `NicolasDorier` refers to the person who controls
:::
## FAQ
### Can I add my signature to this repository?
If you are a bitcoin developer or public figure, feel free to add your signature. For this, you need:
@ -181,19 +179,20 @@ If you are a bitcoin developer or public figure, feel free to add your signature
4. Run the following command line
```bash
# Assuming you are inside the FastSync directory
cd $BTCPAY_BASE_DIRECTORY/btcpayserver-docker/contrib/FastSync
keybase pgp sign -i YOU.utxo-sets -c -t -o sigs/YOU.utxo-sets.asc
rm YOU.utxo-sets
git add sigs/YOU.utxo-sets.asc
git commit -m "Add YOU utxo-set signature" --all
```
And make a pull request to `btcpayserver-docker` repository.
### Where can I download UTXO set snapshots
You should not need to do this because [load-utxo-set.sh](load-utxo-set.sh) will do the hard work for you.
You should not need to do this because [load-utxo-set.sh](load-utxo-set.sh) will do the hard work for you.
But if you want, browse on [this listing](http://utxosets.blob.core.windows.net/public?restype=container&comp=list&include=metadata).
But if you want, browse on [this listing](http://utxosets.blob.core.windows.net/public?restype=container&comp=list&include=metadata).
Select the snapshot you want, and download it by querying `http://utxosets.blob.core.windows.net/public/{blobName}`.
@ -201,8 +200,9 @@ Select the snapshot you want, and download it by querying `http://utxosets.blob.
Assuming you have a node running on a docker deployment of BTCPay Server, you need to run [save-utxo-set.sh](save-utxo-set.sh).
This script shows the steps to create an archive of the current UTXO Set
It will:
This script shows the steps to create an archive of the current UTXO Set
It will:
1. Shutdown BTCPay Server
2. Start bitcoind
3. Prune it to up to 289 blocks from the tip

View File

@ -109,12 +109,14 @@ Here is an example of a crontab script that does a nightly backup at 4:15 AM:
```
SHELL=/bin/bash
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/bin
15 4 * * * /root/btcpayserver-docker/btcpay-backup.sh >/dev/null 2>&1
15 4 * * * /root/BTCPayServer/btcpayserver-docker/btcpay-backup.sh >/dev/null 2>&1
```
You need to set the right `SHELL` and `PATH`, so that the script can run with the correct context.
You might also want to set the `BTCPAY_BACKUP_PASSPHRASE` environment variable.
Also ensure the base path (here `/root/BTCPayServer`) matches the output of `echo $BTCPAY_BASE_DIRECTORY`.
## How to restore?
It's very similar to the `btcpay-backup.sh` process but in reverse.