Setting Up a Bitcoin Block Explorer on a Linux Server

Configurare noua (How To)

Situatie

A Bitcoin Block Explorer is a tool that provides a user-friendly interface for viewing blockchain data such as transactions, blocks, and addresses. While public block explorers are widely available, using them can compromise your privacy as they may log your searches and activity. Setting up your own Bitcoin Block Explorer on a Linux server ensures that you can access blockchain data privately, directly from your own Bitcoin Core node.

By hosting your own block explorer, you maintain full control over your data, eliminate reliance on third-party services, and improve the decentralization of the Bitcoin ecosystem. It’s a valuable addition for anyone running a full node who wants to monitor transactions or learn more about blockchain data without compromising privacy.

Solutie

1. Install Bitcoin Core

Visit the official Bitcoin Core website to download the latest version of the software. Use wget to download it directly to your server:

wget https://bitcoincore.org/bin/bitcoin-core-24.0/bitcoin-24.0-x86_64-linux-gnu.tar.gz

Once downloaded, extract the Bitcoin Core binaries:

tar -xzvf bitcoin-24.0-x86_64-linux-gnu.tar.gz

Move the extracted files to /usr/local/bin so you can easily run Bitcoin Core commands from anywhere in the terminal:

sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-24.0/bin/*

2. Choose and Install a Block Explorer Software

For this guide, we’ll use BTC RPC Explorer, a lightweight and popular open-source solution. Begin by installing Node.js, which is required for running BTC RPC Explorer:

Next, clone the BTC RPC Explorer repository:

3. Configure BTC RPC Explorer

Create a .env file to configure the block explorer:

nano .env

Add the following configuration, replacing placeholders with your Bitcoin Core RPC credentials:

# Bitcoin Core connection settings BTCEXP_BITCOIND_HOST=127.0.0.1 BTCEXP_BITCOIND_PORT=8332 BTCEXP_BITCOIND_USER=<YourRPCUser> BTCEXP_BITCOIND_PASS=<YourRPCPassword> BTCEXP_BITCOIND_COOKIE=/path/to/your/.cookie

Save and close the file.

4. Start the Block Explorer

Run the following command to start BTC RPC Explorer:

npm start

The block explorer will start and can be accessed via your server’s IP address and port 3002 by default (e.g., http://your-server-ip:3002).

5. Enable Background Service (Optional)

To ensure the block explorer runs continuously, you can set it up as a systemd service. Create a service file:

Add the following configuration:

[Unit] Description=BTC RPC Explorer After=network.target [Service] ExecStart=/usr/bin/npm start WorkingDirectory=/path/to/btc-rpc-explorer User=<your-user> Restart=always [Install] WantedBy=multi-user.target

Save the file, reload systemd, and start the service.

Tip solutie

Permanent

Voteaza

(3 din 5 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?