Author

Topic: Instructions Installation BTC-RPC-Block Explorer under Ubuntu (Read 172 times)

full member
Activity: 161
Merit: 168
I would avoid paths where your own home directory is written. I don't know if it would work, but I would give it a shot with something like
Code:
db_dir = "$HOME/.electrs/DATENBANK"
Thank you, I will customize.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
It was changed by me for Ubuntu.

I'm glad it worked out for you on Ubuntu and very nice of you to spend some time and prepare this walk-trough.
And thanks for the link back too Wink


Code:
db_dir = "/home/maxwell/.electrs/DATENBANK"

I would avoid paths where your own home directory is written. I don't know if it would work, but I would give it a shot with something like

Code:
db_dir = "$HOME/.electrs/DATENBANK"
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
The firewall must be defused for the connection:
Code:
sudo ufw allow from 192.168.0.0/16 to any port 3002 comment 'allow BTC RPC Explorer from local network'
sudo ufw status

By default, the ufw firewall is disabled on Ubuntu. So it's optional to do this step, unless you want to secure your computer/server by configuring firewall.

So if you want to thank, do not thank me, but @NeuroticFish who has done the main work!

More guide which specify source/environment won't hurt though Smiley
full member
Activity: 161
Merit: 168
This manual describes how to install the RPC-Explorer on Ubuntu, with all required software packages.

https://bitcoinexplorer.org/
https://github.com/janoside/btc-rpc-explorer


It was tested on a newly installed Ubuntu V18.04.6 LTS



---------------------------- Ubuntu ------------------------------------

If Ubuntu has been reinstalled by CD, pack updates must first be performed.
All update properties must be allowed for it to work.
If automatic updates will be deactivated, the impact on console commands does not work later.
Automatic updates can then be deactivated at the end when everything is running.
Show with Ctrl-H hidden folders!


Update packages:

Click on update management and do not start yet!
Click on details of the update is a very small triangle.
Deactivate the packages that should not be updated, or update all.
Then can be started.




------------------------- BitcoinCore installing ------------------------

On a detailed manual, for installing bitcoincore is omitted here.
It must be installed BitcoinCore in the version >= V0.21.*!
Older versions are rejected by a package of "electrs" needed here.
This means that it actually does not work with older BitcoinCore versions.
BitCoinCore must be installed completely (without pruning), the entire (full) blockchain must be synchronized.
Some settings must be made in the "bitcoin.config":
Here is my bitcoin.config as an example:

Code:
server=1
rpcport=8332
txindex=1
rpcbind=192.168.178.98
rpcallowip=192.168.178.36
rpcuser=xxx
rpcpassword=xxx

To start BitConcore under Linux:

- navigate to the "bin" folder and open Terminal
Code:
./bitcoin-qt



-------------------------------- nodejs installing ---------------------------

"nodejs" and "npm" is a package what is needed for the RPC-Explorer.
Nodejs can also be searched and installed via the Ubuntu software.
This type of installation is wrong and does not work in the end.
nodejs and npm must be installed on the following way:
Open and enter the console on the desktop:
Code:
sudo su
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
exit
Version test with:
Code:
nodejs –v
npm –v
nodejs version was with me: v14.18.1
npm version with me was:    v3.5.2
These versions must be correct, later mistakes do not point then and you are looking for dead. With older versions it does not work!
If you do not create it, you do not need to continue at this point!

The firewall must be defused for the connection:  <<< optional
Code:
sudo ufw allow from 192.168.0.0/16 to any port 3002 comment 'allow BTC RPC Explorer from local network'
sudo ufw status



---------------------  RPC-Explorer download and installing  ------------------------------

Open and enter the console on the desktop:
Code:
git clone https://github.com/janoside/btc-rpc-explorer
Download the RPC Explorer in the "btc-rpc-explorer" folder in the home directory
Close console and now open in the newly created folder "btc-rpc-explorer" console
Then enter:
Code:
npm install
Should now be installed. Hopefully without mistakes!
If Red Error messages come here is something wrong! For me it was always on the wrong nodejs version.
Yellow warnings are not a problem at this point.

Now mandatory with Ctrl-H the hidden files must be displayed! So press the Ctrl-H in Explorer at the folders.
Hidden files start in Linux with point.
Rename the file ".env-sample" so that it is not used. Z.B: in "_.env-sample".
The Configuration file for the RPC-Explorer must be called ".env" and are in the folder: "btc-rpc-explorer".
This file is created/copied from the ".env" sample.
Here is an example ".env" file:
Code:
BTCEXP_HOST=192.168.178.98
BTCEXP_PORT=3002
BTCEXP_BITCOIND_HOST=192.168.178.98
BTCEXP_BITCOIND_PORT=8332
BTCEXP_BITCOIND_USER=xxx
BTCEXP_BITCOIND_PASS=xxx
BTCEXP_BITCOIND_RPC_TIMEOUT=60000
BTCEXP_RPC_CONCURRENCY=2


Start RPC-Explorer:

Before, the bitcoincore must be started!
At this point, the RPC Explorer can be started to test to check if everything is right until then.
Not all functions will not yet be available. Explicitly addresses are not resolved.

Open and enter the console "btc-rpc-explorer" folder:
Code:
npm start

Should start and no errors only output messages.
Now open and enter an Internet-Explorer: http://192.168.178.98:3002/node-details or http://127.0.0.1:3002/node-details


------------------------------------------  Electrs installing  --------------------------------------------------

Open and enter the console on the desktop:
Code:
sudo apt install curl
sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
sudo apt install cargo
sudo apt update
sudo apt install clang cmake build-essential
sudo apt install librocksdb-dev
sudo apt install git
git clone https://github.com/romanz/electrs
cd electrs
ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --locked --release

Here are some mistakes on because the LibrockSDB-DEV is not the right one.
This can first be ignored.
Actually, this library would be the right one. This can not be installed on our Ubuntu system. For whatever reason.
If you make it, you will be happy!
"sudo apt install librocksdb-dev=6.11.4-3"   <<< not work!

Code:
cargo build --locked –release
Again with mistakes, can probably be ignored.
Code:
RUSTFLAGS="-C link-args=-latomic" cargo build --locked --release
Now a long list will be issued with "compiling ####" commands, can be seen
For me several minutes. Here no error may occur, in the end must be finished.
Code:
cargo build --locked –release
Now it should go without mistakes.
Wait until everything is completed!


electrs configure

BitcoinCore >= V0.21.0 must be installed
electrs must be installed in the following folder. The folder name may not be different:
Code:
.electrs
The point in front of the folder is important because otherwise it does not work because the configs otherwise can not be found.
The Configurations File for electrs is:
Code:
config.toml
This config.toml must exist in the following folders:
Code:
.electrs
An example Configuration file exists in the folder:
Code:
.electrs/doc/config_example.toml
This file must be copied to the ".electrs" folder and renamed.
Now you can open the file and edit the configuration.
Here is my example config.toml
Code:
auth = "xxx:xxx"
daemon_rpc_addr = "192.168.178.98:8332"
daemon_p2p_addr = "192.168.178.98:8333"
db_dir = "$HOME/.electrs/DATENBANK"
network = "bitcoin"
electrum_rpc_addr = "127.0.0.1:50001"
verbose = 2

"db_dir" is the directory in which the database is created.
You can choose it freely.
This directory is created and should offer min. 70GB free space.


start electrs

Navigate to the following folders for starting:
Code:
.electrs/target/release
Open and enter the console there:
Code:
./electrs
It has to start without errors and create the database.
It can take a few hours.



---------------------------------- start Block-Explorer -------------------------------

Conditions To fully start the RPC Explorer:
- BitcoinCore must be running and finished synchronized
- electrs must be running and finished being synchronized
- RPC-Explorer must run without error with all RPC connections.

Now with an Internet-Explorer the address: 127.0.0.1:3002, or the address that has been configured in the ".env" file is called.
The RPC-Block-explorer should start.
Many things can now be configured. Read the documentation of the ".env" file.



note of thanks

Thanks a lot to @NeuroticFish
This manual is an extension / change on the instructions of @NeuroticFish
https://bitcointalksearch.org/topic/bitcoin-electrum-server-block-explorer-under-windows-with-wsl-and-debian-5367296
The most important and biggest things are copied from there. It was changed by me for Ubuntu.
So if you want to thank, do not thank me, but @NeuroticFish who has done the main work!
Jump to: