Skip to content

Commit 5b2b59d

Browse files
committed
fix: update testnet configs
1 parent 1218bdf commit 5b2b59d

2 files changed

Lines changed: 261 additions & 50 deletions

File tree

docs/operate/run-a-miner/mine-testnet-stacks-tokens.md

Lines changed: 154 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The following is an abridged version of the [walkthrough here](https://github.co
88

99
If you're interested in mining on the Stacks testnet, you can find instructions on how to do that here:
1010

11-
### Running a Bitcoin Testnet Full Node
11+
### Running a Bitcoin Node for the Stacks Testnet
1212

13-
To participate as a miner on testnet, you must have access to a testnet bitcoin node with a wallet (and the wallet's private key). One way to accomplish this is to run bitcoin locally.
13+
The Stacks testnet does not run on the public Bitcoin testnet - it uses a Bitcoin **regtest** network operated by Hiro (`bitcoin.regtest.hiro.so`). To participate as a miner, you must have access to a bitcoin node on that network with a wallet (and the wallet's private key). One way to accomplish this is to run bitcoin locally, peered with the Hiro regtest node.
1414

1515
* [Ensure your computer meets the minimum hardware requirements before continuing.](https://bitcoin.org/en/bitcoin-core/features/requirements#system-requirements)
1616

@@ -31,7 +31,7 @@ Next, update the bitcoin configuration:
3131

3232
```toml
3333
server=1
34-
testnet=1
34+
regtest=1
3535
disablewallet=0
3636
datadir=/bitcoin
3737
rpcuser=btcuser
@@ -44,10 +44,11 @@ rpcworkqueue=256
4444
rpctimeout=100
4545
txindex=1
4646

47-
[test]
48-
bind=0.0.0.0:18333
49-
rpcbind=0.0.0.0:18332
50-
rpcport=18332
47+
[regtest]
48+
bind=0.0.0.0:18444
49+
rpcbind=0.0.0.0:18443
50+
rpcport=18443
51+
addnode=bitcoin.regtest.hiro.so:18444
5152
```
5253

5354
#### Start Bitcoin
@@ -59,26 +60,26 @@ bitcoind -conf=$HOME/bitcoin.conf
5960
```
6061

6162
{% hint style="info" %}
62-
Note: It will take a few hours for the node to synchronize with Bitcoin Testnet.
63+
Note: The testnet regtest chain is much smaller than the public Bitcoin testnet, so the node should synchronize within minutes.
6364
{% endhint %}
6465

65-
While it's syncing, you can track the progress with `bitcoin-cli` or the logfile (will be located where the chainstate is stored, i.e. `/bitcoin/testnet3/debug.log`):
66+
While it's syncing, you can track the progress with `bitcoin-cli` or the logfile (will be located where the chainstate is stored, i.e. `/bitcoin/regtest/debug.log`):
6667

6768
```bash
6869
$ bitcoin-cli \
6970
-rpcconnect=127.0.0.1 \
70-
-rpcport=18332 \
71+
-rpcport=18443 \
7172
-rpcuser=btcuser \
7273
-rpcpassword=btcpass \
7374
getblockchaininfo | jq .blocks
74-
2583513
75+
7746
7576
```
7677

7778
***
7879

7980
### Running a Stacks Blockchain miner
8081

81-
First, download the latest tagged [stacks blockchain binary](https://github.com/stacks-network/stacks-blockchain/releases/latest), or [build from source](https://github.com/stacksfoundation/miner-docs/blob/testnet/stacks-blockchain.md#build-and-install-stacks-blockchain-from-source) (_there may be some extra requirements to building,_ [_defined here_](https://github.com/stacksfoundation/miner-docs/blob/testnet/prerequisites.md#install-required-packages)).
82+
First, download the [`stacks-core` 4.0.2 binary](https://github.com/stacks-network/stacks-core/releases/tag/4.0.2), or [build from source](https://github.com/stacksfoundation/miner-docs/blob/testnet/stacks-blockchain.md#build-and-install-stacks-blockchain-from-source) (_there may be some extra requirements to building,_ [_defined here_](https://github.com/stacksfoundation/miner-docs/blob/testnet/prerequisites.md#install-required-packages)).
8283

8384
{% hint style="info" %}
8485
Tip: It is recommended to use a persistent location for the chainstate, in the steps below we're using `/stacks-blockchain`.
@@ -124,7 +125,7 @@ Next, a bitcoin wallet is created:
124125
```bash
125126
bitcoin-cli \
126127
-rpcconnect=127.0.0.1 \
127-
-rpcport=18332 \
128+
-rpcport=18443 \
128129
-rpcuser=btcuser \
129130
-rpcpassword=btcpass \
130131
-named createwallet \
@@ -146,7 +147,7 @@ First, convert the wif into its public descriptor:
146147
```bash
147148
bitcoin-cli \
148149
-rpcconnect=127.0.0.1 \
149-
-rpcport=18332 \
150+
-rpcport=18443 \
150151
-rpcuser=btcuser \
151152
-rpcpassword=btcpass \
152153
getdescriptorinfo "combo(<wif from JSON above>)"
@@ -157,7 +158,7 @@ Then import the `descriptor` value returned above into the `miner` wallet - past
157158
```bash
158159
bitcoin-cli \
159160
-rpcconnect=127.0.0.1 \
160-
-rpcport=18332 \
161+
-rpcport=18443 \
161162
-rpcuser=btcuser \
162163
-rpcpassword=btcpass \
163164
-rpcwallet=miner \
@@ -180,47 +181,76 @@ After the import has completed successfully, you can check that the address is i
180181
```bash
181182
bitcoin-cli \
182183
-rpcconnect=127.0.0.1 \
183-
-rpcport=18332 \
184+
-rpcport=18443 \
184185
-rpcuser=btcuser \
185186
-rpcpassword=btcpass \
186187
-rpcwallet=miner \
187188
getaddressinfo <btcAddress from JSON above>
188189
```
189190

190-
Once imported, we need to get some testnet BTC to that address. Grab the `btcAddress` field, and paste it into [this Bitcoin testnet faucet](https://tbtc.bitaps.com/). You'll be sent `0.01` testnet BTC to that address.
191+
Once imported, we need to get some testnet BTC to that address. The public Bitcoin testnet faucets won't work here - the Stacks testnet runs on its own regtest network, so use the Hiro testnet BTC faucet with the `btcAddress` from the keychain step:
192+
193+
```bash
194+
curl -X POST "https://api.testnet.hiro.so/extended/v1/faucets/btc?address=<btcAddress from JSON above>"
195+
```
191196

192197
#### Update the Stacks Blockchain Configuration File
193198

194-
Now, we need to configure our node to use this Bitcoin keychain. Copy the [sample testnet miner config](https://raw.githubusercontent.com/stacks-network/stacks-blockchain/master/testnet/stacks-node/conf/testnet-miner-conf.toml) to your local machine in a memorable location like `$HOME/testnet-miner-conf.toml`.
199+
Now, we need to configure our node to use this Bitcoin keychain. Copy the [sample testnet miner config](https://raw.githubusercontent.com/stacks-network/stacks-core/master/sample/conf/testnet-miner-conf.toml) to your local machine in a memorable location like `$HOME/testnet-miner-conf.toml`.
195200

196201
Next, update the stacks configuration:
197202

198203
* Optional, but recommended: Use a persistent directory to store the Stacks chainstate, i.e. `working_dir = "/stacks-blockchain"`
199204
* From the `make_keychain` step, modify the `seed` value with `privatekey`
200205
* Required: set `wallet_name` to the bitcoin wallet you created above (`miner`)
206+
* Required: set `username` and `password` to match the `rpcuser` and `rpcpassword` from your bitcoin configuration
201207
* Store the following configuration somewhere on your filesystem (ex: `$HOME/testnet-miner-conf.toml`)
202208

203209
```toml
204210
[node]
205211
working_dir = "/stacks-blockchain"
206212
rpc_bind = "0.0.0.0:20443"
207213
p2p_bind = "0.0.0.0:20444"
214+
bootstrap_node = "0348af7ce1b224476e8f042727af3f84dcf49a69bb3c9dd2a1afaa783acfffb729@seed.testnet.hiro.so:20444"
215+
prometheus_bind = "0.0.0.0:9153"
208216
seed = "<privateKey from JSON above>"
209217
miner = true
210-
bootstrap_node = "029266faff4c8e0ca4f934f34996a96af481df94a89b0c9bd515f3536a95682ddc@seed.testnet.hiro.so:30444"
211218
mine_microblocks = false
212-
wait_time_for_microblocks = 10000
219+
stacker = true
220+
221+
pox_5_sbtc_contract = "SN3VMHXEN64ZZF71JQ5VESXDWTR301XTTXGF4J8F1.sbtc-token"
222+
pox_5_sbtc_registry_contract = "SN3VMHXEN64ZZF71JQ5VESXDWTR301XTTXGF4J8F1.sbtc-registry"
223+
pox_5_bond_admin = "ST1V2ASRWGR81W7GBN1Z4W2JQKXJWCADPVZG30X45"
213224

214225
[burnchain]
215-
# Required for miners: must name an existing bitcoin wallet (created above)
216-
wallet_name = "miner"
217-
chain = "bitcoin"
218-
mode = "xenon"
226+
mode = "krypton"
219227
peer_host = "127.0.0.1"
220228
username = "<bitcoin config rpcuser>"
221229
password = "<bitcoin config rpcpassword>"
222-
rpc_port = 18332
223-
peer_port = 18333
230+
rpc_port = 18443
231+
peer_port = 18444
232+
# Required for miners: must name an existing bitcoin wallet (created above)
233+
wallet_name = "miner"
234+
pox_prepare_length = 100
235+
pox_reward_length = 900
236+
# Maximum amount (in sats) of "burn commitment" to broadcast for the next block's leader election
237+
burn_fee_cap = 20000
238+
# Amount (in sats) per byte - Used to calculate the transaction fees
239+
satoshis_per_byte = 25
240+
# Amount of sats to add when RBF'ing bitcoin tx (default: 5)
241+
rbf_fee_increment = 5
242+
# Maximum percentage to RBF bitcoin tx (default: 150% of satsv/B)
243+
max_rbf = 150
244+
245+
[connection_options]
246+
# Must match your signer's auth_password
247+
auth_token = "<YOUR_AUTH_TOKEN>"
248+
249+
# Signer event subscription.
250+
# The endpoint must match your signer's endpoint config.
251+
[[events_observer]]
252+
endpoint = "127.0.0.1:30000"
253+
events_keys = ["stackerdb", "block_proposal", "burn_blocks"]
224254

225255
[[ustx_balance]]
226256
address = "ST2QKZ4FKHAH1NQKYKYAYZPY440FEPK7GZ1R5HBP2"
@@ -237,8 +267,100 @@ amount = 10000000000000000
237267
[[ustx_balance]]
238268
address = "ST2TFVBMRPS5SSNP98DQKQ5JNB2B6NZM91C4K3P7B"
239269
amount = 10000000000000000
270+
271+
[[ustx_balance]]
272+
address = "ST31XHNM0GZ2K978FPP4QA3STNQ73Z8C9G9MJEPK2"
273+
amount = 10000000000000000
274+
275+
[[ustx_balance]]
276+
address = "ST1B38CGQRPXEMRH7B66VXTS22DQTNMSW4YJJ7QK1"
277+
amount = 10000000000000000
278+
279+
[[ustx_balance]]
280+
address = "STDMN71Z0H9EF8CRKAWTGBB5YS0BNV26HZ79QFFP"
281+
amount = 1000000000000000
282+
283+
[[ustx_balance]]
284+
address = "ST1E0PSCH72JMQH9QCH293ZTEEH7BPA40Y3F39XQ"
285+
amount = 10000000000000
286+
287+
[[ustx_balance]]
288+
address = "ST3QBTK0Q438YVNX8EG6Z85HN0WKQPXYT25H5SPPK"
289+
amount = 10000000000000
290+
291+
[[ustx_balance]]
292+
address = "ST10BX04F9PC6N1WBXKW3H7CG0NS0A3PK650T3P3R"
293+
amount = 10000000000000
294+
295+
[[ustx_balance]]
296+
address = "ST3AF1BBQAFSFCM8K4ZBR1FBXP3P8J1CKGSGDHWR5"
297+
amount = 100000000000000
298+
299+
[[ustx_balance]]
300+
address = "STHY13V44422NAN6D3NSJPY9CDR3ED1M6HH9WZ6Y"
301+
amount = 10000000000000
302+
303+
[[burnchain.epochs]]
304+
epoch_name = "1.0"
305+
start_height = 0
306+
307+
[[burnchain.epochs]]
308+
epoch_name = "2.0"
309+
start_height = 0
310+
311+
[[burnchain.epochs]]
312+
epoch_name = "2.05"
313+
start_height = 1
314+
315+
[[burnchain.epochs]]
316+
epoch_name = "2.1"
317+
start_height = 2
318+
319+
[[burnchain.epochs]]
320+
epoch_name = "2.2"
321+
start_height = 3
322+
323+
[[burnchain.epochs]]
324+
epoch_name = "2.3"
325+
start_height = 4
326+
327+
[[burnchain.epochs]]
328+
epoch_name = "2.4"
329+
start_height = 5
330+
331+
[[burnchain.epochs]]
332+
epoch_name = "2.5"
333+
start_height = 6
334+
335+
[[burnchain.epochs]]
336+
epoch_name = "3.0"
337+
start_height = 1802
338+
339+
[[burnchain.epochs]]
340+
epoch_name = "3.1"
341+
start_height = 1803
342+
343+
[[burnchain.epochs]]
344+
epoch_name = "3.2"
345+
start_height = 1804
346+
347+
[[burnchain.epochs]]
348+
epoch_name = "3.3"
349+
start_height = 1805
350+
351+
[[burnchain.epochs]]
352+
epoch_name = "3.4"
353+
start_height = 1806
354+
355+
[[burnchain.epochs]]
356+
epoch_name = "4.0"
357+
start_height = 2702
240358
```
241359

360+
{% hint style="info" %}
361+
The `[connection_options]` and `[[events_observer]]` sections connect the node to a Stacks signer: `auth_token` must match the signer's `auth_password`, and the events observer `endpoint` must match the signer's `endpoint`. See the [signer quickstart](../run-a-signer/signer-quickstart.md) for setting one up.
362+
{% endhint %}
363+
242364
#### Start the Stacks Blockchain
243365

244366
To run your miner, run this in the command line:
@@ -275,7 +397,11 @@ Generate a keychain:
275397
docker run -i node:20-alpine npx @stacks/cli make_keychain 2>/dev/null | jq -r
276398
```
277399

278-
Now, we need to get some tBTC. Grab the `btcAddress` field, and paste it into [this Bitcoin testnet faucet](https://tbtc.bitaps.com/). You'll be sent `0.01` tBTC to that address.
400+
Now, we need to get some tBTC. Grab the `btcAddress` field and request funds from the Hiro testnet BTC faucet:
401+
402+
```bash
403+
curl -X POST "https://api.testnet.hiro.so/extended/v1/faucets/btc?address=<btcAddress from JSON above>"
404+
```
279405

280406
#### Update Stacks Blockchain Docker Configuration File
281407

@@ -298,7 +424,7 @@ docker run -d \
298424
-v "/stacks-blockchain:/stacks-blockchain" \
299425
-p 20443:20443 \
300426
-p 20444:20444 \
301-
blockstack/stacks-core:latest \
427+
blockstack/stacks-core:4.0.2 \
302428
/bin/stacks-node start --config /src/stacks-node/testnet-miner-conf.toml
303429
```
304430

0 commit comments

Comments
 (0)