Deploy Stacks Miner Node

Stacks node requires a Bitcoin node to connect to on the back-end for Proof of Transfer. You can deploy a Bitcoin node using Kotal operator like we did in this guide. In this tutorial, we will be using Bitcoin node hosted by Stacks Foundation.

Generating Miner Private Key

Generate Key chain using Stacks CLI tool. Stacks CLI can be installed using:

npm install -g @stacks/cli

Generate key chain using:

stx make_keychain

It will return an output similar to the following

{
  "mnemonic": "blue news bid also tell vault blame tonight crumble history tribe anxiety arch stove usage eight stick firm weapon wet chapter gravity seat idle",
  "keyInfo": {
    "privateKey": "7a3ef70a4a3ff3c389818ac11abec24b20ffbe3fb2cf6f71e947367a4ddbec6601",
    "address": "SPQG93WFTVV6GA4AEDMS18ZCSTKMKFHWEHEXQAJJ",
    "btcAddress": "15HcDuW1W2TqEe9mVER9ceJYtqMAED26jp",
    "wif": "L1KLjY5xMGUSSV9cfE9VoKRdVt3D1zJxoJwPVLHfgRNS1ETGUSvr",
    "index": 0
  }
}

Store privateKey from the output above into a Kubernetes secret in data field called key:

Bitcoin node JSON-RPC user password

Let's store Stacks Foundation Bitcoin node JSON-RPC password in a Kubernetes secret to be used by our node:

Apply bitcoin-node-rpc-password.yaml to create the password secret:

Deploy Stacks Miner Node

The following manifest describes a Stacks node that syncs Stacks mainnet network: mainnet, and connects to the bitcoin node using configurations in bitcoinNode: ... for Proof of Transfer, and loading miner private key using seedPrivateKeySecretName:

Apply stacks.yaml manifest:

Kotal operator will notice your stacks-node and will create all the necessary pods, persistent volumes, services, configmaps, and secrets neccessary.

You can fetch the deployed Stacks Node using:

It will return an output similar to the following:

Note Miner is true in the previous output πŸ”₯

Fetch Node Logs

Get the pods that has been created by Kotal for the node:

It will return an output similar to the following:

Get the logs of the running node:

It will return node logs similar to the following:

Finally you can delete the node by:

Kubernetes garbage collector will delete all the resources that has been created by Stacks Node controller.

Last updated

Was this helpful?