mirror of
https://github.com/openoms/bitcoin-tutorials.git
synced 2025-12-19 04:54:18 +01:00
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
|
||||
# https://github.com/romanz/electrs/blob/master/doc/usage.md
|
||||
|
||||
echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] (needed for Electrs to access the bitcoind RPC):"
|
||||
read PASSWORD_B
|
||||
#echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] (needed for Electrs to access the bitcoind RPC):"
|
||||
#read PASSWORD_B
|
||||
echo "getting RPC credentials from the bitcoin.conf"
|
||||
RPC_USER=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
@@ -32,12 +35,28 @@ echo "The electrs database will be built in /mnt/hdd/electrs/db. Takes ~18 hours
|
||||
echo "***"
|
||||
echo ""
|
||||
|
||||
|
||||
sudo mkdir /mnt/hdd/electrs
|
||||
sudo chown -R admin:admin /mnt/hdd/electrs
|
||||
sudo ufw allow 50001
|
||||
|
||||
# Run with password B filled in:
|
||||
cargo run --release -- -vvvv --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/db --cookie="raspibolt:$PASSWORD_B" --electrum-rpc-addr="0.0.0.0:50001"
|
||||
# generate setting file: https://github.com/romanz/electrs/issues/170#issuecomment-530080134
|
||||
mkdir /home/admin/.electrs/
|
||||
sudo rm /home/admin/.electrs/config.toml
|
||||
touch /home/admin/.electrs/config.toml
|
||||
echo "generating electrs.toml setting file with the RPC passwords"
|
||||
(
|
||||
echo "
|
||||
verbose = 4
|
||||
timestamp = true
|
||||
jsonrpc_import = true
|
||||
db_dir = \"/mnt/hdd/electrs/db\"
|
||||
cookie = \"$RPC_USER:$PASSWORD_B\"
|
||||
" | tee -a /home/admin/.electrs/config.toml
|
||||
) &> /dev/null
|
||||
|
||||
# Run electrs
|
||||
cargo run --release -- --index-batch-size=10 --electrum-rpc-addr="0.0.0.0:50001"
|
||||
|
||||
# to preserve settings:
|
||||
# see https://github.com/romanz/electrs/blob/master/src/config.rs
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
# To download and run:
|
||||
# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/electrs/2_electrs_systemd_service.sh && bash 2_electrs_systemd_service.sh
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] for the electrs service:"
|
||||
read PASSWORD_B
|
||||
sudo systemctl stop electrs
|
||||
sudo systemctl disable electrs
|
||||
sudo rm /etc/systemd/system/electrs.service
|
||||
|
||||
# sudo nano /etc/systemd/system/electrs.service
|
||||
echo "
|
||||
@@ -17,8 +16,7 @@ After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/admin/electrs
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/db --electrum-rpc-addr="0.0.0.0:50001" --cookie="raspibolt:$PASSWORD_B"
|
||||
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --electrum-rpc-addr=\"0.0.0.0:50001\"
|
||||
User=admin
|
||||
Group=admin
|
||||
Type=simple
|
||||
|
||||
@@ -4,20 +4,14 @@
|
||||
|
||||

|
||||
|
||||
Tested on:
|
||||
* Odroid HC1 and XU4 (~18 hours)
|
||||
* Raspberry Pi 3 B+ (~two days to build the database from scratch)
|
||||
* Raspberry Pi 4
|
||||
|
||||
Requires 47 Gb diskpace (March 2019).
|
||||
|
||||
## Install Electrs
|
||||
Tested on:
|
||||
* Raspberry Pi 4
|
||||
* Odroid HC1 and XU4 (~18 hours)
|
||||
* Raspberry Pi 3 B+ (~two days to build the database from scratch). For the RPi3 the lighter weight [Electrum Personal Server](https://stadicus.github.io/RaspiBolt/raspibolt_64_electrum.html) is a good alternative, but only watches the preconfigured addresses and xpubs.
|
||||
|
||||
***
|
||||
**The new Electrs installs are currently not working**: https://github.com/romanz/electrs/issues/170
|
||||
In the meantime the more lightweight Electrum Personal Server is a good alternative (and recommended for the RPi3-s by default):
|
||||
https://stadicus.github.io/RaspiBolt/raspibolt_64_electrum.html
|
||||
***
|
||||
## Install Electrs
|
||||
|
||||
The install instructions are adapted to the RaspiBlitz are in this script, take a look: [1_electrs_on_RaspiBlitz.sh](1_electrs_on_RaspiBlitz.sh)
|
||||
|
||||
@@ -25,13 +19,14 @@ To download and run on the RaspiBlitz (logged in as the user `admin`):
|
||||
`$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/electrs/1_electrs_on_RaspiBlitz.sh && bash 1_electrs_on_RaspiBlitz.sh`
|
||||
|
||||
This will only run the server until the terminal window is open.
|
||||
To restart electrs manually run (with your PASSWORD_B filled in) or install the Electrs systemd service (next step):
|
||||
`$ /home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/db --electrum-rpc-addr="0.0.0.0:50001" --cookie="raspibolt:PASSWORD_B" -vvvv`
|
||||
To restart electrs manually run:
|
||||
`$ /home/admin/electrs/target/release/electrs --index-batch-size=10 --electrum-rpc-addr="0.0.0.0:50001"`
|
||||
|
||||
or install the Electrs systemd service (next step)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## RaspiBlitz: Set up the Electrs systemd service
|
||||
## Set up the Electrs systemd service
|
||||
|
||||
Set up the systemd service to run electrs continuously in the background.
|
||||
|
||||
@@ -97,7 +92,7 @@ To connect through SSL (requires setting up the Nginx server):
|
||||
|
||||
---
|
||||
|
||||
## Remote connection options to Electrs
|
||||
## Remote connection options
|
||||
Any communication outside a secure LAN must be encrypted.
|
||||
|
||||
### Tor Hidden Service
|
||||
@@ -138,6 +133,7 @@ The script is a collection of commands. The whole setup has multiple components
|
||||
|
||||
Based on:
|
||||
* https://github.com/romanz/electrs/blob/master/doc/usage.md
|
||||
|
||||
Shared experiences:
|
||||
* https://github.com/rootzoll/raspiblitz/issues/123
|
||||
* https://github.com/openoms/bitcoin-tutorials/issues/2
|
||||
|
||||
@@ -6,7 +6,7 @@ After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/admin/electrs
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/db --electrum-rpc-addr="0.0.0.0:50001" --cookie="raspibolt:$PASSWORD_B"
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc_import --db-dir /mnt/hdd/electrs/db --electrum-rpc-addr="0.0.0.0:50001"
|
||||
|
||||
User=admin
|
||||
Group=admin
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
# https://github.com/romanz/electrs/blob/master/doc/usage.md
|
||||
|
||||
echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] (needed for Electrs to access the bitcoind RPC):"
|
||||
read PASSWORD_B
|
||||
#echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] (needed for Electrs to access the bitcoind RPC):"
|
||||
#read PASSWORD_B
|
||||
echo "getting RPC credentials from the bitcoin.conf"
|
||||
RPC_USER=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
@@ -36,8 +39,23 @@ sudo mkdir /mnt/hdd/electrs
|
||||
sudo chown -R admin:admin /mnt/hdd/electrs
|
||||
sudo ufw allow 60001
|
||||
|
||||
# generate setting file: https://github.com/romanz/electrs/issues/170#issuecomment-530080134
|
||||
mkdir /home/admin/.electrs/
|
||||
sudo rm /home/admin/.electrs/config.toml
|
||||
touch /home/admin/.electrs/config.toml
|
||||
echo "generating electrs.toml setting file with the RPC passwords"
|
||||
(
|
||||
echo "
|
||||
verbose = 4
|
||||
timestamp = true
|
||||
jsonrpc_import = true
|
||||
db_dir = \"/mnt/hdd/electrs/testnetdb\"
|
||||
cookie = \"$RPC_USER:$PASSWORD_B\"
|
||||
" | tee -a /home/admin/.electrs/config.toml
|
||||
) &> /dev/null
|
||||
|
||||
# Run with password B filled in:
|
||||
cargo run --release -- -vvvv --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/testnetdb --cookie="raspibolt:$PASSWORD_B" --electrum-rpc-addr="0.0.0.0:60001" --network testnet --timestamp
|
||||
cargo run --release -- --index-batch-size=10 --db-dir /mnt/hdd/electrs/testnetdb --electrum-rpc-addr="0.0.0.0:60001" --network testnet
|
||||
|
||||
# to preserve settings:
|
||||
# see https://github.com/romanz/electrs/blob/master/src/config.rs
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
# To download and run:
|
||||
# $ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/electrs/2_electrs_systemd_service.sh && bash 2_electrs_systemd_service.sh
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Type the PASSWORD B of your RaspiBlitz followed by [ENTER] for the electrs service:"
|
||||
read PASSWORD_B
|
||||
sudo systemctl stop electrs
|
||||
sudo systemctl disable electrs
|
||||
sudo rm /etc/systemd/system/electrs.service
|
||||
|
||||
# sudo nano /etc/systemd/system/electrs.service
|
||||
echo "
|
||||
@@ -17,7 +16,7 @@ After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/admin/electrs
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc-import --db-dir /mnt/hdd/electrs/testnetdb --electrum-rpc-addr="0.0.0.0:60001" --cookie="raspibolt:$PASSWORD_B" --network testnet --timestamp -vvvv
|
||||
ExecStart=/home/admin/electrs/target/release/electrs --index-batch-size=10 --jsonrpc_import --db-dir /mnt/hdd/electrs/testnetdb --electrum-rpc-addr=\"0.0.0.0:60001\" --network testnet --timestamp -vvvv
|
||||
|
||||
User=admin
|
||||
Group=admin
|
||||
|
||||
Reference in New Issue
Block a user