Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ make down-prom
## Containers

- **bitcoin**: Runs a bitcoin regtest node
- **bitcoin-miner**: creates 3 bitcoin regtest wallets and mines regtest blocks at a configurable cadence
- **bitcoin-miner**: creates 3 bitcoin regtest wallets and mines regtest blocks at a configurable cadence. After initial setup (~200 blocks), creates a dedicated "block-producer" wallet for ongoing Bitcoin block production to prevent conflicts with Stacks mining operations
- **stacks-miner-1**: mines stacks blocks and sends events to stacks-signer-1
- **stacks-miner-2**: mines stacks blocks and sends events to stacks-signer-2
- **stacks-miner-3**: mines stacks blocks and sends events to stacks-signer-3
Expand All @@ -175,6 +175,16 @@ make down-prom
- **stacker**: stack for `stacks-signer-1`, `stacks-signer-2` and `stacks-signer-3`
- **tx-broadcaster**: submits token transfer txs to ensure stacks block production during a sortition

## Bitcoin Miner
*Dedicated address for Bitcoin block production after initial setup (~200 blocks). This prevents conflicts with Stacks mining operations.*

```text
‣ Private Key: 427302dd85574b4798b8214246fa98b6625d897f6e02992b50a6fa66c18bfe3801
‣ Public Key: 02d828f395c0596af95300e04f3a0b2e01adb71892131a34fbdcbfcc98b92af98b
‣ BTC Address: mtQ3H1m2iabVY8qsBhs51U5nTsBrNX47dm
‣ WIF: cPosS2CsSQRnxNzpgsJS8WEbCK9SuyHxb2WaR4kER9eGPaoaHSyJ
```

## Stacks Miner Accounts

### Miner 1
Expand All @@ -183,7 +193,7 @@ make down-prom
‣ Mnemonic: lunar amount hard result reunion aisle goat fluid sorry modify minute pretty point visa cart material left tilt travel sausage library clutch wire tuna
‣ Private Key: 23ad69119000a241706486b9349556bdc6dfabdf9d9131b153a57c6b0330fb0d01
‣ Public Key: 0383bca67d28fce336ea7c2fc1120ecc63fbe55e89251e20587c2eb877f971e56b
‣ BTC Address: miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT
‣ BTC Address: moARgPEufCG3BXqpZLR9wLZZufzeASFjxY
‣ Stacks Address: ST19XY8C456FWH704JR77ZKFTPBNVNK52Q1CK01JD
‣ WIF: cNn45HMeSuFeqg3pQESEuLz9FnmiYS83s11snXqDFqX4audaJbcb
‣ Miner Rewards
Expand All @@ -196,33 +206,29 @@ make down-prom
### Miner 2

```text
‣ Mnemonic: cherry lawn pull huge drift wisdom capable bulk tragic street first foam onion above come smart eyebrow about soon jungle select used front ecology
‣ Private Key: 1415e80bf3fe30fe95889c676681b4f64447f8888f718381840224b14ef4b97801
‣ Public Key: 03a1940aedd43c39a39c73a1686faaabc67b6bd918d9710292e6c400308df0130e
‣ BTC Address: mxxRn3xP98tSJCUXxABq4dgg4SziNacF1Y
‣ Stacks Address: ST2ZMPYMHV80HGY99P9B81CN8E66JHBYVXB8P5F55
‣ WIF: cNFkBfqr4tz3V7pcKbBvcibKsZ6XnTmcTwyWoqGm4CStmqN1bqh8
‣ Private Key: ca9401c893f2036f480205948d8f142bca1cbe970978a97439ba1ccf4dbabb2a01
‣ Public Key: 037f705fffab4de974d10563828ee3bf0c3e2e4f318f9ae670b8374a7b890195a2
‣ BTC Address: muKzige2rgaiSC9kxYhwHydeCtwdA49D7b
‣ Stacks Address: ST2BQYDCV0CG5Q4DRZBBB3DFZW5DS6NN5HSSXH39X
‣ WIF: cUNVCr3LXpQmZciFRmz7m2JVozRZuRE7dYUXzRUcfXjnYN5SgyBL
‣ Miner Rewards
‣ Stacks address: ST2FW15NGB4H76FMVXKHYYSM865YVS6V3SA1GNABC
‣ Private Key: fe3087801196d8027008146b13e6d365920c2e4b7bc9969729ec2f0f22ef74fc01
‣ Mnemonic: acoustic physical genre canal today zone confirm whale fashion payment blanket slush crumble version exercise catch candy birth meadow penalty until protect kid wage
‣ WIF: cW6p6zjVTXFXKQu3JmwfvRtkM5nAqCe1nakyhbd1VrZU59FJLew1

```

### Miner 3

```text
‣ Mnemonic: identify test gallery pave now pet just gospel erupt walnut demand oyster old trigger soup zoo sheriff oyster twenty tragic license casual twelve depth
‣ Private Key: c1c3f3f7bb8cc0b64c3be0f79488a3b1e3dbca62f23a5ac84e13beba78cc961301
‣ Public Key: 025511871cb065df0ac108d149b5abe2267242745fd02b1d7a5fafb8dcf3ad66ce
‣ BTC Address: miBGjFEQveJSbzFwB9XJ9a4GmkY3Unmb7b
‣ Stacks Address: STEJYWJ2Y7E72AF9JMRWZWNR11ADBJBHD45P7D7K
‣ WIF: cU5McyYQu1VJw6tzekyAJd1Jm9NVtjkPhrcbyVm8LgGdiW1Htrf4
‣ Private Key: a549000d3c6da1037c2ae8201400d1abb2cc1230f9e415f9000af94d1ffd7ee601
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to remove the mnemonic keys here? techinically it's not required, but i'm curious why it's removed (same question for the other addresses)

‣ Public Key: 03180a98f60f943f1594adec7cd39d639a0cc5109a33219c268c796d55096fe66b
‣ BTC Address: mzD36ZSkb2bKw9ZXC6ihuYqfXWE29SakAF
‣ Stacks Address: ST36GDT9KR00X36ZR4JJC6634MPS7W0KMX38P3DT1
‣ WIF: cT7zdNXZErXZxNqEPuuH8rFZU9shEhJ2Ri8YEYFiB9NiUrLgYEyC
‣ Miner Rewards
‣ Stacks address: ST2MES40ZEXTX9M4YXW9QSWHRVC9HYT419S198VPM
‣ Private Key: ed7eb063c61b8e892987228f1fcfb74eab5009568861613dc4b074b708a7893701
‣ Mnemonic: verb face bag shaft snack alcohol consider fork boat gate any energy property vessel olive system spin seek mean recipe layer catch anger bacon
‣ WIF: cVYMsUwHAZCdwfXZ2rgXWrFJDfqW2TrvLBAVpWCLCteCTTbv7UXL


Expand Down
34 changes: 28 additions & 6 deletions docker/bitcoin/miner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,35 @@ function mining_loop(){
echo
local mined_block_counter
local block_height
local bitcoin_block_producer_wallet="${BITCOIN_BLOCK_PRODUCER_BTC_WALLET}"
local bitcoin_block_producer_addr="${BITCOIN_BLOCK_PRODUCER_BTC_ADDR}"

# Create dedicated block producer wallet for mining after initial setup
echo "Setting up dedicated block producer wallet..."
echo " - wallet: ${bitcoin_block_producer_wallet}"
echo " - address: ${bitcoin_block_producer_addr}"
if ! get_wallet_info "${bitcoin_block_producer_wallet}"; then
if ! create_wallet "${bitcoin_block_producer_wallet}"; then
echo "ERROR creating block producer wallet"
exit 1
fi
fi
# Import the predefined block producer address
if ! get_address_info "${bitcoin_block_producer_wallet}" "${bitcoin_block_producer_addr}"; then
if ! import_address "${bitcoin_block_producer_wallet}" "${bitcoin_block_producer_addr}"; then
echo "ERROR importing block producer address"
exit 1
fi
fi
echo "Block producer wallet setup complete"
echo

mined_block_counter=0 # set the counter before the loop starts
block_height=$(get_height) # get the block height
while true; do
echo "******************************************"
local conf_counter=0
local confs=""
local random="" # for tracking which array element we're using
local sleep_duration=${MINE_INTERVAL}
# loop through addresses and see if there are any mining txs in the list
for i in $(seq 0 $((NUM_MINERS - 1)));do
Expand All @@ -139,11 +161,11 @@ function mining_loop(){
else
echo "Detected Stacks mining mempool tx, mining btc block..."
fi
random=$((0 + RANDOM % NUM_MINERS )) # random int with a range based on how many miners are defined. start from 0 since we're using an array
echo "Mining block to:"
echo " - wallet: ${!WALLETS[$random]}"
echo " - address: ${!ADDRESSES[$random]}"
echo " - block hash: $(bitcoin-cli -rpcwallet="${!WALLETS[$random]}" -rpcconnect=bitcoin generatetoaddress 1 "${!ADDRESSES[$random]}" | awk -F, 'NR==2{ gsub(/[",]/,"");gsub (" ", "", $0);print $1}')"
# Mine to dedicated block producer address (not used for Stacks mining)
echo "Mining block to dedicated block producer:"
echo " - wallet: ${bitcoin_block_producer_wallet}"
echo " - address: ${bitcoin_block_producer_addr}"
echo " - block hash: $(bitcoin-cli -rpcwallet="${bitcoin_block_producer_wallet}" -rpcconnect=bitcoin generatetoaddress 1 "${bitcoin_block_producer_addr}" | awk -F, 'NR==2{ gsub(/[",]/,"");gsub (" ", "", $0);print $1}')"
mined_block_counter=$((mined_block_counter + 1 )) # increment the mined block counter (used when restarting from a chainstate snapshot)
block_height=$((block_height + 1)) # increment the already retrieved block_height, incrementing in the loop
DEFAULT_TIMEOUT=$(($(date +%s) + 30))
Expand Down
9 changes: 9 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ x-common-vars:
- &STACKS_MINER_3_BTC_ADDR mzD36ZSkb2bKw9ZXC6ihuYqfXWE29SakAF
- &STACKS_MINER_3_BTC_WALLET stacks-miner-3
- &STACKS_MINER_3_BLOCK_PUSH_FAIL_PROBABILITY 0
# bitcoin block producer vars (mines Bitcoin blocks after initial setup)
# priv_key: 427302dd85574b4798b8214246fa98b6625d897f6e02992b50a6fa66c18bfe3801
# pub_key: 02d828f395c0596af95300e04f3a0b2e01adb71892131a34fbdcbfcc98b92af98b
# btc: mtQ3H1m2iabVY8qsBhs51U5nTsBrNX47dm
# wif: cPosS2CsSQRnxNzpgsJS8WEbCK9SuyHxb2WaR4kER9eGPaoaHSyJ
- &BITCOIN_BLOCK_PRODUCER_BTC_ADDR mtQ3H1m2iabVY8qsBhs51U5nTsBrNX47dm
- &BITCOIN_BLOCK_PRODUCER_BTC_WALLET block-producer

# Container Static IP assignments
# *Note*: The stacks miner ip's are used for the bootstrap config later in this file
Expand Down Expand Up @@ -219,6 +226,8 @@ services:
STACKS_MINER_2_BTC_WALLET: *STACKS_MINER_2_BTC_WALLET
STACKS_MINER_3_BTC_ADDR: *STACKS_MINER_3_BTC_ADDR
STACKS_MINER_3_BTC_WALLET: *STACKS_MINER_3_BTC_WALLET
BITCOIN_BLOCK_PRODUCER_BTC_ADDR: *BITCOIN_BLOCK_PRODUCER_BTC_ADDR
BITCOIN_BLOCK_PRODUCER_BTC_WALLET: *BITCOIN_BLOCK_PRODUCER_BTC_WALLET
MINE_INTERVAL: *MINE_INTERVAL
MINE_INTERVAL_EPOCH3: *MINE_INTERVAL_EPOCH3
MINE_INTERVAL_EPOCH25: *MINE_INTERVAL_EPOCH25
Expand Down