Mine testnet Base tokens
Introduction
To learn more about mining's technical details, please refer to the mining guide.The following is a condensed version of the walkthrough for a Linux system. If you are using Windows or MacOS, some slight modifications may be necessary (PR's welcome!).
Running a Bitcoin Testnet Full Node
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 bitcoin binary
TIP
It is recommened to use a persistent location for the chainstate, in the steps below we're using /bitcoin
Update the Bitcoin Configuration File
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 allow127.0.0.1
, or the base miner IPv4Modify the
rpcuser
andrpcpassword
values from the defaults belowStore the following configuration somewhere on your filesystem (ex:
$HOME/bitcoin.conf
)
Start Bitcoin
Finally, start bitcoind as follows:
NOTE
The node will need a few hours to synchronize with the Bitcoin testnet.
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
):
Running a Base Blockchain miner
First, download a Base blockchain binary, or build from source
TIP
It is recommened to use a persistent location for the chainstate, in the steps below we're using /base-blockchain
Generate a keychain
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.
To create a keychain, the simplest way is to use the base-cli with the make_keychain
command.
After this runs, you should see some JSON printed to the screen that looks like this:
DANGER
Do not lose this information - we'll need to use the privateKey
and btcAddress
fields in later steps.
The above btcAddress
(mkRYR7KkPB1wjxNjVz3HByqAvVz8c4B6ND) will then need to be imported into the bitcoin testnet network.
NOTE
Be sure to replace <btcAddress from JSON above>
with the bitcoin address in the "Generate a keychain" step
Once imported, we need to get some testnet BTC to that address. Grab the btcAddress
field, and paste it into this Bitcoin testnet faucet. You'll be sent 0.01
testnet BTC to that address.
Update the Base Blockchain Configuration File
Now, we need to configure our node to use this Bitcoin keychain.
Now, grab your privateKey
from earlier when you ran the make_keychain
command. Replace the seed
and local_peer_seed
field with your private key. Save and close this configuration file.
Next, update the bitcoin configuration:
optional but recommended: Use a persistent directory to store the Base chainstate, i.e.
working_dir = "/base-blockchain"
From the
make_keychain
step, modify theseed
andlocal_peer_seed
values withprivatekey
Store the following configuration somewhere on your filesystem (ex:
$HOME/testnet-miner-conf.toml
)
Start the Base Blockchain
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.
Enable Debug Logging
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:
Optional: Running a Base Blockchain miner with Docker
Alternatively, you can run a Base testnet miner with Docker.
CAUTION
Ensure you have Docker installed
Generate a Keychain and Get Some Tokens
Generate a keychain:
Now, we need to get some tBTC. Grab the btcAddress
field, and paste it into this Bitcoin testnet faucet. You'll be sent 0.01
tBTC to that address.
Update Base Blockchain Docker Configuration File
Use the steps oulined above to create the configuration file
Start the Base Blockchain miner with Docker
INFO
The ENV VARS RUST_BACKTRACE
and BASE_LOG_DEBUG
are optional. If removed, debug logs will be disabled
You can review the node logs with this command:
Optional: Running in Kubernetes with Helm
In addition, you're also able to run a Base miner in a Kubernetes cluster.
Ensure you have the following prerequisites installed:
minikube (Only needed if standing up a local Kubernetes cluster)
Generate keychain and get some tokens
Use the steps outlined above
Install the chart and run the miner
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:
Last updated