Last active
July 13, 2023 15:44
-
-
Save baebb/184f03ed3171d30e6b672208bc155d49 to your computer and use it in GitHub Desktop.
Install bitcoind and electrs Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** Add repository and install bitcoind ** | |
sudo apt-get install build-essential | |
sudo apt-get install libtool autotools-dev autoconf | |
sudo apt-get install libssl-dev | |
sudo apt-get install libboost-all-dev | |
sudo add-apt-repository ppa:luke-jr/bitcoincore | |
sudo apt-get update | |
sudo apt-get install bitcoind | |
mkdir ~/.bitcoin/ && cd ~/.bitcoin/ | |
nano bitcoin.conf | |
** Add config to bitcoin.conf file ** | |
use https://jlopp.github.io/bitcoin-core-config-generator/ | |
example: | |
# Generated by https://jlopp.github.io/bitcoin-core-config-generator/ | |
# This config should be placed in following path: | |
# ~/.bitcoin/bitcoin.conf | |
# [debug] | |
# Enable debug logging | |
debug=rpc | |
# Log IP Addresses in debug output. | |
logips=1 | |
# Reduce the log file size on restarts | |
shrinkdebuglog=1 | |
# Run this node on the Bitcoin Test Network. Equivalent to -chain=test | |
# testnet=1 | |
# [rpc] | |
# Accept command line and JSON-RPC commands. | |
server=1 | |
# Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask | |
# (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times. | |
rpcallowip=127.0.0.1 | |
# [wallet] | |
# Bech32 | |
addresstype=bech32 | |
# Bech32 | |
changetype=bech32 | |
# [core] | |
# Specify a non-default location to store blockchain data. | |
# blocksdir=/mnt/.../ | |
# Options only for mainnet | |
[main] | |
# Bind to given address to listen for JSON-RPC connections. | |
rpcbind=0.0.0.0 | |
# Listen for JSON-RPC connections on this port | |
rpcport=8332 | |
# Options only for testnet | |
[test] | |
# Bind to given address to listen for JSON-RPC connections. | |
rpcbind=0.0.0.0 | |
# Listen for JSON-RPC connections on this port | |
rpcport=18332 | |
** Start bitcoind ** | |
bitcoind --daemon | |
** To make changes to bitcoin.conf, first stop bitcoind: ** | |
bitcoin-cli stop | |
** Test bitcoind is running and working ** | |
bitcoin-cli getblockchaininfo | |
** While waiting for `initialblockdownload`, install Rust ** | |
sudo apt install clang cmake | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
rustup toolchain install nightly --allow-downgrade | |
rustup default nightly | |
** Install and start Electrs after `initialblockdownload` is false from `bitcoin-cli getblockchaininfo` ** | |
git clone https://github.com/blockstream/electrs #blockstream fork of electrs | |
cd electrs | |
git checkout new-index | |
ulimit -n 65535 | |
#TESTNET (from electrs folder) | |
cargo run --release --bin electrs -- -vvvv --http-addr 127.0.0.1:3001 --cors '*' --daemon-dir ~/.bitcoin --blocks-dir=/mnt/<bitcoind_blocks_location>/blocks --db-dir=/mnt/<DB_location> --network testnet --daemon-rpc-addr 127.0.0.1:18332 --timestamp | |
#MAINNET (from electrs folder) | |
cargo run --release --bin electrs -- -vvvv --http-addr 127.0.0.1:3001 --cors '*' --daemon-dir ~/.bitcoin --blocks-dir=/mnt/<bitcoind_blocks_location>/blocks --db-dir=/mnt/<DB_location> --network mainnet --daemon-rpc-addr 127.0.0.1:8332 --timestamp | |
#HELP (from electrs folder) | |
cargo run --release --bin electrs -- --help | |
**electrs setup can during setup and will take >48 hrs days to fully index mainnet Bitcoin, be prepared to restart multiple times** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment