Running a testnet node
Note: The Stacks 2.0 testnet is currently in development. As part of the testnet, you can run a node and connect it to a public network.
This tutorial will walk you through the following steps:
- Download and install the node software
- Run the node
- Mine Stacks token
Note: If you use Linux, you may need to manually install
libssl-dev and other packages. In your command line, run the following to get all packages:
sudo apt-get install build-essential cmake libssl-dev pkg-configsudo apt-get install build-essential cmake libssl-dev pkg-config
Ensure that you have Rust installed. If you are using macOS, Linux, or another Unix-like OS, run the following. If you are on a different OS, follow the official Rust installation guide.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -ycurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
In case you just installed Rust, you will be prompted to run the following command to make the
cargo command available:
source $HOME/.cargo/envsource $HOME/.cargo/env
Next, clone this repository:
git clone https://github.com/blockstack/stacks-blockchain.git cd stacks-blockchaingit clone https://github.com/blockstack/stacks-blockchain.gitcd stacks-blockchain
Install the Stacks node by running:
cargo install --path ./testnet/stacks-nodecargo install --path ./testnet/stacks-node
You're all set to run a node that connects to the testnet network.
Back in the command line, run:
stacks-node kryptonstacks-node krypton
The first time you run this, you'll see some logs indicating that the Rust code is being compiled. Once that's done, you should see some logs that look something like the this:
INFO [1588108047.585] [src/chainstate/stacks/index/marf.rs:732] First-ever block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206INFO [1588108047.585] [src/chainstate/stacks/index/marf.rs:732] First-ever block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
Awesome! Your node is now connected to the testnet network. Your node will receive new blocks when they are produced, and you can use your node's RPC API to send transactions, fetch information for contracts and accounts, and more.
Now that you have a running testnet node, you can easily set up a miner.