Setting up a Bitcoin node for Stratum V2 (hacker’s way)

This guide will explain to you how to install all the required software to run Stratum V2 mining node. For people who want a ready made solution you should check the guide on how to install a tool called “Stratum in a box”. To keep this blog post short, the hardware requirements are also listed in the aforementioned tutorial.

Installation Process

Preparing the server

Once you have Xubuntu installed on your server, make sure it is updated.

sudo apt update && sudo apt upgrade

Download the latest release binaries from the github repository and place them in your home folder. At the time of writing this tutorial the latest version is “sv2-tp-0.1.2” but there might be a newer one. Download the “.tar.gz” archive corresponding to your computer architecture.

⚠️

Make sure you choose the correct version for the architecture of your computer. See table bellow.
  • aarch64 is for raspberry pi
  • x86_64-linux is for intel / amd based computers.
    • This is the one we used at the time of writing this tutorial: “bitcoin-sv2-tp-0.1.2-x86_64-linux-gnu.tar.gz”
  • The rest are for other architectures
    • this guide assumes you have a linux with an intel based computer.
    • So choose x86_64.
  • The source code is if you are developer and wants to compile it. You can ignore it.

Signature verification

While technically optional, it’s highly recommended to verify the software’s signature with PGP before running any Bitcoin-related programs. This step helps ensure that the binaries have not been tampered with. Download sjors’s PGP keys on your server.

gpg -v --auto-key-locate=clear,wkd --locate-key [email protected]

On the github release page, copy the PGP signed message and save it in a file called pgp.txt in your home folder. Make sure you copy the signed message associated with your release.

Verify the signed message with pgp. Make sure you are in the home folder of your server.

gpg --verify ./pgp.txt

The result of this command is always a bit confusing but if you see “Good signature from ’Sjors …’” it’s all good.

Then you must generate the sha256 checksum from the release archive. For us it was “bitcoin-sv2-tp-0.1.2-x86_64-linux-gnu.tar.gz”

sha256sum ./name_of_your_release_archive.tar.gz

And compare with the corresponding one in the file pgp.txt that you just created. If they match you are all good!

Running the Bitcoin node

⚠️

Make sure you are in the folder where the archive is. You can either use the command “cd” to change directory in the terminal or use the browser of your desktop to go in the folder and launch a terminal from there.

Unpack the downloaded archive using the tar command. This will create a new folder, typically named something like ‘bitcoin-sv2-tp-your-version’. In my case, the folder was “bitcoin-sv2-tp-0.1.2” You can confirm the folder’s creation by checking in your file browser. This is a good example of why using a GUI on a server can be more convenient to quickly confirm what we are doing.

tar -xf ./name_of_your_release_archive.tar.gz

Inside the folder from the unpacked archive, you’ll find a ‘bin/’ folder containing all the necessary binaries. To start the Bitcoin daemon (bitcoind) and begin downloading the blockchain assuming you are still in the bin folder with your file browser open a new terminal from the bin folder or navigate from the existing terminal to the bin folder using the command cd.

You will also need to add a few arguments at the end of the command to enable stratum V2 on your node and pruning to not take too much space on your SSD.

./bitcoind -sv2 -sv2port=8442 -prune=1092

You should now see the logs in the terminal confirming the initial synchronization of the blockchain has started.

The initial download may take a few days. Remember, closing the terminal will shut down the program. We’ll discuss later how to make this setup permanent.

Installing the Stratum V1 to V2 proxy

While the initial download is progressing we are going to setup the proxy. This will act as a bridge between the ASIC miners that are using Stratum and the node that is using Stratum V2. The proxy can be downloaded from their github repository. In my case I downloaded “demand_all_in_one_sv2-x86_64-linux-gnu”.

If you try to run it as is it will fail because it is missing the permission to run it. Open a terminal in the folder where the binary is located and do:

chmod +x ./demand_all_in_one_sv2-x86_64-linux-gnu

After that you can simply run it by typing ./demand_all_in_one_sv2-x86_64-linux-gnu (again make sure you are in the folder where it is located). We just need to specify the bitcoin address we want to use for the reward as an argument.

./demand_all_in_one_sv2-x86_64-linux-gnu -a bc1qrqaud9pryzzuk6vzpulq3ckxrpzufrakmtmksp 

⚠️

Obviously you will need to replace the bitcoin address with your own.

Updating the ASIC miners

(TODO finish to write this)

Leave a Reply

Your email address will not be published. Required fields are marked *