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:
Apply bitcoin-node-rpc-password.yaml to create the password secret:
kubectlapply-fbitcoin-node-rpc-password.yaml
Deploy 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:
It will return node logs similar to the following:
INFO [1649597250.010714] [testnet/stacks-node/src/main.rs:113] [main] Loading config at path /home/stacks/kotal-config/config.toml
INFO [1649597250.599067] [testnet/stacks-node/src/run_loop/neon.rs:341] [main] Start syncing Bitcoin headers, feel free to grab a cup of coffee, this can take a while
INFO [1649597251.949664] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 0.3% (2000outof731268)INFO [1649597253.010039] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 0.5% (4000outof731268)INFO [1649597254.019798] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 0.8% (6000outof731268)INFO [1649597254.992070] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 1.1% (8000outof731268)INFO [1649597256.214756] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 1.4% (10000outof731268)INFO [1649597257.276950] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 1.6% (12000outof731268)INFO [1649597258.383248] [src/burnchains/bitcoin/spv.rs:923] [main] Syncing Bitcoin headers: 1.9% (14000outof731268)...
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:
kubectlport-forwardbitcoin-node-020443
HTTP server will start after Bitcoin headers sync, till then you will get the following error if you tried to send JSON-RPC calls:
curl: (52) Empty reply from server
In another terminal window call info JSON-RPC method to retrieve information about the Core API including the server version:
curllocalhost:20443/v2/info
You will get JSON result similar to the following:
{"peer_version":402653189,"pox_consensus":"9bed78c9f02d2ba5a5950fe88c4746436b47c730","burn_block_height":666051,"stable_pox_consensus":"0000000000000000000000000000000000000000","stable_burn_block_height":666050,"server_version":"stacks-node No Version Info (No Branch Info:No Commit Info, release build, linux [x86_64])","network_id":1,"parent_network_id":3652501241,"stacks_tip_height":0,"stacks_tip":"0000000000000000000000000000000000000000000000000000000000000000","stacks_tip_consensus_hash":"0000000000000000000000000000000000000000","genesis_chainstate_hash":"74237aa39aa50a83de11a4f53e9d3bb7d43461d1de9873f402e5453ae60bc59b","unanchored_tip":null,"unanchored_seq":null,"exit_at_block_height":null}
Finally you can delete the node by:
kubectldelete-fstacks.yaml
Kubernetes garbage collector will delete all the resources that has been created by Stacks Node controller.