May 20•7 min read
The second phase of the testnet, Argon, launched on 2020/06/03. As a result, there is a new configuration file, but the steps to set up a miner node are very similar. The instructions listed in this blog post were updated on 2020/06/23 to reflect the new steps required.
Instead of walking through all of the instructions below, I created a one-liner script that works with Ubuntu Server 20.04 LTS. I chose this operating system since it only requires 1gb of RAM in a virtual machine to run, making it very easy to test out mining without making any changes to your current system.
If you follow the instructions in Step 0: Virtualbox + Ubuntu (Zero to Testnet Series), or if you already have a Ubuntu Server installation to work with, you can simply run the command below to set up your miner and it will take care of everything for you.
curl -o- https://raw.githubusercontent.com/AbsorbingChaos/bks-setup-miner/master/config-miner-argon.sh | bash
In addition, you can stop your miner with CTRL+C
and run the script again to download any updates, or to restart the miner after a chain reset. You can also check the current status of the Stacks Blockchain via this website.
More information on the command above can be found in the related GitHub repository, and it should work with any Ubuntu-based system. If you run into any problems/errors, feel free to open an issue here.
To see a video of the script in action, check out this YouTube video!
This series of blog posts will be broken up by topic based on setting up and using Virtualbox and Ubuntu Server to perform tasks as laid out on the Blockstack Testnet website.
<-- you are here
Note: This process is fairly similar to Step 0 + Step 1, with some extra steps to start mining. To help make a clear tutorial from start to finish, I started from Step 0 and set up a new VM for this. The instructions here will follow Step 0 but some of the content will be similar to Step 1.
Since this is a new virtual machine, the settings below vary slightly from the original Step 0, otherwise the process of setting it up are the same.
First, we start with the same dependencies as Step 1 for Ubuntu.
At the terminal prompt:
sudo apt-get install -y build-essential cmake libssl-dev pkg-config jq
and press EnterThe blockstack-cli
package we will use requires a few extra dependencies, mainly node
and npx
. One common way to install Node.js is via the Node Version Manager.
At the terminal prompt:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
and press Enterwget
!nvm
command is not immediately available. Instead of editing the ~/.profile
file and reloading it, the faster method is just to reboot the VM.sudo reboot now
and press Enternvm
command is available, type in command -v nvm
and press Enter, this should output: nvm
nvm install node
and press Enternpx
command is available, type in which npx
and press Enter, this should output something similar to: /home/whoabuddy/.nvm/versions/node/v14.3.0/bin/npx
Next, we install the Rust programming language.
At the terminal prompt:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
and press Entercargo
and other Rust-related commands, type in: source $HOME/.cargo/env
and press EnterNext, we download (clone) the files required to run the Blockstack Testnet node from the Blockstack Github repository.
At the terminal prompt:
git clone https://github.com/blockstack/stacks-blockchain.git
and press EnterNext, we generate a keychain using blockstack-cli
that gives us our wallet addresses for STX and BTC. We will output this information to a file then view it rather than just running the command, as we will need to reference this information at different points in the process.
At the terminal prompt:
npx [email protected] make_keychain -t > keychain.json
and press Entermake_keychain -t
command afterward.cat keychain.json
and press EnterNow that we have our wallet addresses, we can request test BTC ("tBTC") from the faucet. Normally this is done via the Testnet Faucet website, but since we do not have a GUI on Ubuntu Server, we can use curl
instead.
Note: Since this method requires manually typing in the information anyway, another alternative is to navigate to the websites above and manually enter the btcAddress value. As part of this tutorial, I am going to keep things in scope of working directly from the VM.
At the terminal prompt:
curl -X POST https://sidecar.staging.blockstack.xyz/sidecar/v1/faucets/btc\?address\=`jq -r '.keyInfo .btcAddress' keychain.json`
and press Enterjq
command is wrapped in back-ticks and takes the BTC address from the keychain file and inserts it into the request for you. You can also manually type the address, but if you miss a character, you won't get the tBTC!"success":true
then the request was successfulcurl https://raw.githubusercontent.com/AbsorbingChaos/bks-setup-miner/master/argon-miner-conf.toml --output $HOME/stacks-blockchain/testnet/stacks-node/conf/argon-miner-conf.toml
and press Enterseed
with your private key that we generated earlier, using a super fancy combination of Linux commands. Type in: sed -i "s/replace-with-your-private-key/`jq -r '.keyInfo .privateKey' keychain.json`/g" ./stacks-blockchain/testnet/stacks-node/conf/argon-miner-conf.toml
and press Enter./stacks-blockchain
directory so we can run the cargo command to start the miner, type in: cd ./stacks-blockchain
and press Entercargo testnet start --config ./testnet/stacks-node/conf/argon-miner-conf.toml
and press EnterSit back and let the mining begin!