From 54f65efd778abbe8451bbe87a53775f85c12ec58 Mon Sep 17 00:00:00 2001 From: pablo Date: Sat, 18 Feb 2023 19:48:04 +0100 Subject: [PATCH] Improve readme, still WIP --- README.md | 65 +++++++++++++++++++++++++++++++++++ config_templates/bitcoin.conf | 18 ++++++++++ config_templates/config.toml | 21 +++++++++++ 3 files changed, 104 insertions(+) create mode 100644 README.md create mode 100644 config_templates/bitcoin.conf create mode 100644 config_templates/config.toml diff --git a/README.md b/README.md new file mode 100644 index 0000000..fbe6248 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# Counterweight V2 + +This is the repo where I store everything necessary to spin up my +Bitcoin-related node. + +It currently includes: + +- Bitcoin core +- electrs +- mempool block explorer +- lnbits + +## How to deploy + +### Requirements + +These instructions assume you are on a debian/ubuntu machine with docker, +docker compose and git installed. + +### Cloning + +First, clone this repo where you would like to run your node. + +### Building electrs + +TODO: explain + +### Environment and configuration files + +Now, you need to build a `.env` file. You can start by making a copy of +`.env-example` and filling it. + +Afterwards, create the `data` folder in the root of the cloned repo. Inside, +create the folders `bitcoin`, `electrs`, `mempool` and `lnbits`. + +Inside `data/bitcoin`, you will need to place a `bitcoin.conf` file. You can +use the example in `config_templates/bitcoin.conf`. Ensure that your inputs +here are consistent with the ones in the `.env` file. + +Inside `data/electrs/config`, you will need to place a `config.toml` file. You +can use the example in `config_templates/config.toml`. For this one, you should +not make any changes if you are following these instructions. + +Inside `data/lnbits`, you will need to place a `.env` file. Pay attention: this +file is specific for LNbits and is unrelated to the other `.env` file that sits +on the root of this repo. TODO: make template in + + +### Smoke testing + +TODO: describe how to check that everything is warning. + +## Upgrading versions of the different services + +- Bitcoin: upgrade in docker-compose.yaml. +- electrs: specify tag in custom electrs dockerfile, build again. +- mempool: upgrade web, api and db in docker-compose.yaml. +- LNbits: upgrade in docker-compose.yaml. + + +### How to backup data + +TODO: explain how to back all the data up with a rsync. + + diff --git a/config_templates/bitcoin.conf b/config_templates/bitcoin.conf new file mode 100644 index 0000000..d5fccfb --- /dev/null +++ b/config_templates/bitcoin.conf @@ -0,0 +1,18 @@ +# [core] +# Maintain a full transaction index, used by the getrawtransaction rpc call. +txindex=1 + +# [rpc] +# Accept command line and JSON-RPC commands. +server=1 + +rpcauth=: # You can use https://jlopp.github.io/bitcoin-core-rpc-auth-generator/ to generate this. +rpcallowip= # You probably want to put the subnet mask used in the docker-compose.yaml .env file here. +rpcbind=0.0.0.0 + +# [wallet] +# Do not load the wallet and disable wallet RPC calls. +disablewallet=1 + +pruned=0 +peerbloomfilters=1 diff --git a/config_templates/config.toml b/config_templates/config.toml new file mode 100644 index 0000000..3fce367 --- /dev/null +++ b/config_templates/config.toml @@ -0,0 +1,21 @@ +# File where bitcoind stores the cookie, usually file .cookie in its datadir +cookie_file = "/home/bitcoin/data/.cookie" + +# The listening RPC address of bitcoind, port is usually 8332 +daemon_rpc_addr = "bitcoind:8332" + +# The listening P2P address of bitcoind, port is usually 8333 +daemon_p2p_addr = "bitcoind:8333" + +# Directory where the index should be stored. It should have at least 70GB of free space. +db_dir = "/home/electrs/data/index" + +# bitcoin means mainnet. Don't set to anything else unless you're a developer. +network = "bitcoin" + +# The address on which electrs should listen. Warning: 0.0.0.0 is probably a bad idea! +# Tunneling is the recommended way to access electrs remotely. +electrum_rpc_addr = "0.0.0.0:50001" + +# How much information about internal workings should electrs print. Increase before reporting a bug. +log_filters = "INFO"