Skip to content

Instantly share code, notes, and snippets.

@jcnelson
Last active February 7, 2023 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcnelson/c5f43cbefba3727dcccf5a95209b60fc to your computer and use it in GitHub Desktop.
Save jcnelson/c5f43cbefba3727dcccf5a95209b60fc to your computer and use it in GitHub Desktop.
Radon-2.1

How to Participate in the Radon 2.1 Testnet

This gist describes how you can spin up a Stacks 2.1 node on the Bitcoin mainnet, and join a Radon testnet.

The Radon testnet behaves like the Stacks 2.1 mainnet will behave. It is based on the current 2.05 chain state, and is mined with real Bitcoin.

It is as close to a production environment as we can manage without hard-forking the mainnet chain.

BIG WARNING

Radon transaction can be replayed on Stacks mainnet!

Any transaction you send to Radon will also be sent to the Stacks mainnet mempool, and vice versa.

Only use an account you can afford to lose!

For example, this transaction that I used for testing 2.1 Clarity features got deployed on both mainnet and Radon.

Chainstate Snapshot

To get started, you will first need to download this 2.05 chainstate snapshot, available here. Unpack it where you'd want your Stacks chainstate to live.

This chainstate snapshot is a 2.1-series chainstate snapshot, generated by a Stacks 2.1 node just before it transitioned to epoch 2.1. If you don't want to use this snapshot, you can instead spin up a Stacks 2.1 node from genesis with the patch applied below to force it to transition to 2.1 at the right time.

Building the Node

To produce a 2.1-series node that works on Radon, you will need to build from source. You will also need to patch the node software (see the patch below).

Here is the patch you will need:

diff --git a/src/core/mod.rs b/src/core/mod.rs
index ce83436c9..ae5e0fc60 100644
--- a/src/core/mod.rs
+++ b/src/core/mod.rs
@@ -106,7 +106,7 @@ pub const BITCOIN_MAINNET_INITIAL_REWARD_START_BLOCK: u64 = 651389;
 pub const BITCOIN_MAINNET_STACKS_2_05_BURN_HEIGHT: u64 = 713_000;
 
 // TODO: Pick a real height for Stacks 2.1.
-pub const BITCOIN_MAINNET_STACKS_21_BURN_HEIGHT: u64 = 2_000_000;
+pub const BITCOIN_MAINNET_STACKS_21_BURN_HEIGHT: u64 = 773_150;
 
 pub const BITCOIN_TESTNET_FIRST_BLOCK_HEIGHT: u64 = 2_412_530;
 pub const BITCOIN_TESTNET_FIRST_BLOCK_TIMESTAMP: u32 = 1671825973;

To apply it and build the node, do the following:

$ git clone https://github.com/stacks-network/stacks-blockchain ./stacks-blockchain
$ cd stacks-blockchain/
$ git checkout develop
$ patch -Np1 < /path/to/the/radon.patch
$ cd testnet/stacks-node
$ cargo build --release
$ cp ../../target/release/stacks-node /path/to/your/preferred/bin/stacks-node-2.1

To set up your 2.1 chainstate, do the following:

$ export CHAINSTATE_ROOT="/some/path/with/lots/of/space"
$ curl -s https://eig3xa5eap1owah1yoh8phai1eicahsh.s3.amazonaws.com/mainnet-pre2.1.tar.gz > "$CHAINSTATE_ROOT/mainnet-pre2.1.tar.gz"
$ cd "$CHAINSTATE_ROOT"
$ tar xvf mainnet-pre2.1.tar.gz

This archive will unpack to a directory called mainnet-pre2.1.

Config file

This is a config file template to use. Replace ... with appropriate values.

Be sure to use the given bootstrap node. This is a Radon 2.1 node run by the Stacks Foundation.

[node]
rpc_bind = "0.0.0.0:20443"
p2p_bind = "0.0.0.0:20444"

# This is your public IP, if you know it
p2p_address = "...:20444"

# This is your public IP or DNS, if you know it
data_url = "...:20443"

# This is a secp256k1 private key
seed = "..."

# This is a secp256k1 private key
local_peer_seed = "..."

# This is the path to "$CHAINSTATE_ROOT/mainnet-pre2.1/chainstate"
working_dir = "..."

miner = false
bootstrap_node = "044095f4dee181f08215b8ca0d0f6ad27d0a80cd64f96749926da93d1a4f16d8249e6d6b94a204e01342ab6ad73d771f3ce6764662f36078cb947351701aa2ca9d@52.0.54.100:50444"

wait_time_for_microblocks = 1000

[connection_options]
timeout = 5
dns_timeout = 5000
connect_timeout = 5
handshake_timeout = 5

[burnchain]
chain = "bitcoin"
mode = "mainnet"
peer_host = "bitcoin.blockstack.com"
rpc_port = 8332
peer_port = 8333
username = "blockstack"
password = "blockstacksystem"

[miner]
first_attempt_time_ms = 5000
subsequent_attempt_time_ms = 15000
microblock_attempt_time_ms = 10000

Bootup

You can start your Stacks node the usual way:

$ stacks-node-2.1 start --config=/path/to/your/mainnet-2.1.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment