Mine Testnet Stacks Tokens
Last updated
Was this helpful?
Last updated
Was this helpful?
For more on the technical details of mining, please review the mining guide.
The following is an abridged version of the , written for a Linux system. If you're on Windows or MacOS, there will be some slight modifications needed (PR's welcome!).
If you're interested in mining on the Stacks testnet, you can find instructions on how to do that here:
To participate as a miner on testnet, you must have access to a testnet bitcoin node with a wallet (and the wallet's private key). One way to accomplish this is to run bitcoin locally.
First, download a , or (there may be some extra requirements to building, ).
Next, update the bitcoin configuration:
Optional, but recommended: Use a persistent directory to store the Bitcoin chainstate, i.e. datadir=/bitcoin
.
Optional, but recommended: Update the rpcallowip
value to only allow 127.0.0.1
, or the stacks miner IPv4.
Modify the rpcuser
and rpcpassword
values from the defaults below.
Store the following configuration somewhere on your filesystem (ex: $HOME/bitcoin.conf
).
Finally, start bitcoind
as follows (adjust the conf
path to where it was created in the previous step, i.e. $HOME/bitcoin.conf
):
While it's syncing, you can track the progress with bitcoin-cli
or the logfile (will be located where the chainstate is stored, i.e. /bitcoin/testnet3/debug.log
):
First, a keychain needs to be generated. With this keychain, we'll get some testnet BTC from a faucet, and then use that BTC to start mining.
After this runs, you should see some JSON printed to the screen that looks like this:
Do not lose this information - we'll need to use the privateKey
, btcAddress
and wif
fields in later steps.
The above wif
(cPdTdMgww2njhnekUZmHmFNKsWAjVdCR4cfvD2Y4UQhFzMmwoW33
) will then need to be imported into the bitcoin testnet network.
Next, a bitcoin wallet is created:
Now, import your wif (bitcoin private key) inside the newly created wallet.
Next, update the stacks configuration:
Optional, but recommended: Use a persistent directory to store the Stacks chainstate, i.e. working_dir = "/stacks-blockchain"
From the make_keychain
step, modify the seed
value with privatekey
Store the following configuration somewhere on your filesystem (ex: $HOME/testnet-miner-conf.toml
)
To run your miner, run this in the command line:
Your node should start. It will take some time to sync, and then your miner will be running.
In case you are running into issues or would like to see verbose logging, you can run your node with debug logging enabled. In the command line, run:
Alternatively, you can run a Stacks testnet miner with Docker.
Generate a keychain:
Use the steps outlined above to create the configuration file.
You can review the node logs with this command:
Ensure you have the following prerequisites installed:
Use the steps outlined above
To install the chart with the release name my-release
and run the node as a miner:
You can review the node logs with this command:
First, download the latest tagged , or (there may be some extra requirements to building, ).
To create a keychain, the simplest way is to use the with the make_keychain
command.
Once imported, we need to get some testnet BTC to that address. Grab the btcAddress
field, and paste it into . You'll be sent 0.01
testnet BTC to that address.
Now, we need to configure our node to use this Bitcoin keychain. Copy the to your local machine in a memorable location like $HOME/testnet-miner-conf.toml
.
Ensure you have installed.
Now, we need to get some tBTC. Grab the btcAddress
field, and paste it into . You'll be sent 0.01
tBTC to that address.
In addition, you're also able to run a Stacks miner in a Kubernetes cluster using the .
(Only needed if standing up a local Kubernetes cluster)
For more information on the Helm chart and configuration options, please refer to the .