Deploy Stacks RPC 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.
Make sure Bitcoin node is fully synced before deploying your Stacks node.
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:
apiVersion: v1
kind: Secret
metadata:
name: bitcoin-node-rpc-password
stringData:
password: blockstacksystemApply bitcoin-node-rpc-password.yaml to create the password secret:
kubectl apply -f bitcoin-node-rpc-password.yamlDeploy Stacks RPC 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:
apiVersion: stacks.kotal.io/v1alpha1
kind: Node
metadata:
name: stacks-node
spec:
network: mainnet
bitcoinNode:
endpoint: bitcoin.blockstack.com
rpcPort: 8332
p2pPort: 8333
rpcUsername: blockstack
rpcPasswordSecretName: bitcoin-node-rpc-passwordApply 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:
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:
Call JSON-RPC Method
By default, Stacks node JSON-RPC server port is 20443, which can be changed using rpcPort.
Forward localhost:20443 calls to the node pod:
HTTP server will start after Bitcoin headers sync, till then you will get the following error if you tried to send JSON-RPC calls:
In another terminal window call info JSON-RPC method to retrieve information about the Core API including the server version:
You will get JSON result 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?