From 5ca6d01bb43f10e08c0e1720411a7e23a9e95003 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Tue, 12 Dec 2023 21:04:12 +0100 Subject: [PATCH 1/9] feat: almost activating epoch3 --- Dockerfile.e2e | 67 +++++++++++++++++++++++++++++++++++---- stacks-krypton-miner.toml | 1 + 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 6532c27..cac2800 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -3,7 +3,7 @@ FROM rust:bookworm as builder # A commit hash, tag, or branch -ARG GIT_COMMIT=f8ffd1dbe8990234391def4611b2611be9a3e4ba +ARG GIT_COMMIT=16bb6887f84a299b5bbbe4c469337169849ce6ed ARG BLOCKCHAIN_REPO=https://github.com/stacks-network/stacks-blockchain.git ARG TARGETPLATFORM @@ -47,7 +47,7 @@ EOF FROM debian:bookworm-backports COPY --from=builder /stacks/target/release/stacks-node /usr/local/bin/ -COPY --from=ruimarinho/bitcoin-core:0.21.1 /opt/bitcoin-*/bin /usr/local/bin +COPY --from=btcpayserver/bitcoin:25.1 /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y curl gettext-base jq @@ -100,10 +100,12 @@ ENV STACKS_24_HEIGHT=$STACKS_24_HEIGHT ARG STACKS_25_HEIGHT=112 ENV STACKS_25_HEIGHT=$STACKS_25_HEIGHT -# do not boot into epoch3.0 for now (it doesn't work yet) -ARG STACKS_30_HEIGHT=999999 +ARG STACKS_30_HEIGHT=121 ENV STACKS_30_HEIGHT=$STACKS_30_HEIGHT +ARG STACKS_PREHEAT_FINISH_HEIGHT=130 +ENV STACKS_PREHEAT_FINISH_HEIGHT=$STACKS_PREHEAT_FINISH_HEIGHT + # priv: 6ad9cadb42d4edbfbe0c5bfb3b8a4125ddced021c4174f829b714ccbf527f02001 # ARG REWARD_RECIPIENT=STQM73RQC4EX0A07KWG1J5ECZJYBZS4SJ4ERC6WN ARG REWARD_RECIPIENT @@ -134,6 +136,33 @@ const server = http.createServer((req, res) => { EOM EOF +# Create Stacking script +RUN npm init -y && npm i @stacks/stacking@6 +RUN < /root/stack.js <<'EOM' + const { StackingClient } = require('@stacks/stacking'); + const { StacksTestnet } = require('@stacks/network'); + console.log('Stacking with args:', process.argv.slice(2)); + const network = new StacksTestnet({ url: 'http://localhost:20443' }); + const address = 'ST18MDW2PDTBSCR1ACXYRJP2JX70FWNM6YY2VX4SS'; + const client = new StackingClient(address, network); + client.stack({ + amountMicroStx: parseInt(process.argv[2]), + burnBlockHeight: parseInt(process.argv[3]), + poxAddress: 'mvuYDknzDtPgGqm2GnbAbmGMLwiyW3AwFP', + cycles: 12, + privateKey: '08c14a1eada0dd42b667b40f59f7c8dedb12113613448dc04980aea20b268ddb01', + fee: 1000, + nonce: 0, + }) + .then(r => console.log('Stacked', r)) + .catch(e => { + console.error('Error stacking', e); + process.exit(1); + }); +EOM +EOF + # Bootstrap chainstates SHELL ["/bin/bash", "-ce"] RUN < Date: Tue, 12 Dec 2023 15:38:22 -0600 Subject: [PATCH 2/9] stashing some close to working changes --- Dockerfile.e2e | 16 +++++++++++----- stacks-krypton-miner.toml | 23 ++++++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index cac2800..a8ad2af 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -3,7 +3,7 @@ FROM rust:bookworm as builder # A commit hash, tag, or branch -ARG GIT_COMMIT=16bb6887f84a299b5bbbe4c469337169849ce6ed +ARG GIT_COMMIT=390dffc7e3593711c1f55505d3308063a2039df6 ARG BLOCKCHAIN_REPO=https://github.com/stacks-network/stacks-blockchain.git ARG TARGETPLATFORM @@ -41,12 +41,12 @@ RUN < run.sh <<'EOM' STACKS_PID=$! function start_miner() { + DEFAULT_TIMEOUT=$(date -v+30S +%s) while true; do TX=$(bitcoin-cli listtransactions '*' 1 0 true) CONFS=$(echo "$TX" | jq '.[].confirmations') + NOW=$(date +%s) if [ "$CONFS" = "0" ]; then echo "Detected Stacks mining mempool tx, mining btc block..." bitcoin-cli generatetoaddress 1 $BTC_ADDR + DEFAULT_TIMEOUT=$(date -v+30S +%s) + elif [[ $NOW -ge $DEFAULT_TIMEOUT ]]; then + bitcoin-cli generatetoaddress 1 $BTC_ADDR + DEFAULT_TIMEOUT=$(date -v+30S +%s) fi sleep $MINE_INTERVAL done diff --git a/stacks-krypton-miner.toml b/stacks-krypton-miner.toml index 7667611..c715eb1 100644 --- a/stacks-krypton-miner.toml +++ b/stacks-krypton-miner.toml @@ -2,6 +2,8 @@ name = "krypton-node" rpc_bind = "0.0.0.0:20443" p2p_bind = "0.0.0.0:20444" +data_url = "http://127.0.0.1:20443" +p2p_address = "127.0.0.1:20443" working_dir = "$DATA_DIR" seed = "$MINER_SEED" @@ -10,15 +12,20 @@ local_peer_seed = "$MINER_SEED" miner = true use_test_genesis_chainstate = true pox_sync_sample_secs = 0 -wait_time_for_blocks = 0 -wait_time_for_microblocks = 50 +wait_time_for_blocks = 200 +wait_time_for_microblocks = 0 +mine_microblocks = false microblock_frequency = 1000 # mine_microblocks = true # max_microblocks = 10 [miner] -first_attempt_time_ms = 5000 -subsequent_attempt_time_ms = 5000 +min_tx_fee = 1 +first_attempt_time_ms = 180_000 +second_attempt_time_ms = 360_000 +wait_for_block_download = false +microblock_attempt_time_ms = 10 +self_signing_seed = 1 $REWARD_RECIPIENT_CONF [connection_options] @@ -32,10 +39,12 @@ public_ip_address = "1.1.1.1:1234" [burnchain] chain = "bitcoin" -mode = "neon" +mode = "nakamoto-neon" poll_time_secs = 1 -pox_prepare_length = 3 -pox_2_activation = $STACKS_POX2_HEIGHT +magic_bytes = "T3" +pox_prepare_length = 5 +pox_reward_length = 10 +burn_fee_cap = 20_000 ### bitcoind-regtest connection info peer_host = "$BITCOIN_PEER_HOST" From dec3fe536b3dbfba4f6a4d4239c373f7452462c5 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Tue, 12 Dec 2023 19:39:50 -0600 Subject: [PATCH 3/9] okay, working-ish version --- Dockerfile.e2e | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index a8ad2af..f352c11 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -100,7 +100,7 @@ ENV STACKS_24_HEIGHT=$STACKS_24_HEIGHT ARG STACKS_25_HEIGHT=112 ENV STACKS_25_HEIGHT=$STACKS_25_HEIGHT -ARG STACKS_30_HEIGHT=131 +ARG STACKS_30_HEIGHT=132 ENV STACKS_30_HEIGHT=$STACKS_30_HEIGHT ARG STACKS_PREHEAT_FINISH_HEIGHT=150 @@ -196,26 +196,21 @@ RUN < run.sh <<'EOM' STACKS_PID=$! function start_miner() { - DEFAULT_TIMEOUT=$(date -v+30S +%s) while true; do TX=$(bitcoin-cli listtransactions '*' 1 0 true) CONFS=$(echo "$TX" | jq '.[].confirmations') - NOW=$(date +%s) if [ "$CONFS" = "0" ]; then echo "Detected Stacks mining mempool tx, mining btc block..." bitcoin-cli generatetoaddress 1 $BTC_ADDR - DEFAULT_TIMEOUT=$(date -v+30S +%s) - elif [[ $NOW -ge $DEFAULT_TIMEOUT ]]; then - bitcoin-cli generatetoaddress 1 $BTC_ADDR - DEFAULT_TIMEOUT=$(date -v+30S +%s) fi sleep $MINE_INTERVAL done From f801252c9e4a7e1379ae0b9a3a1892db3880eb05 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Tue, 12 Dec 2023 20:06:43 -0600 Subject: [PATCH 4/9] ah, better working version --- Dockerfile.e2e | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index f352c11..088dda8 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -197,6 +197,7 @@ RUN < Date: Wed, 13 Dec 2023 13:21:24 +0100 Subject: [PATCH 5/9] build for release --- Dockerfile.e2e | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 088dda8..3972083 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -41,7 +41,7 @@ RUN < Date: Wed, 13 Dec 2023 13:22:06 +0100 Subject: [PATCH 6/9] build for release --- Dockerfile.e2e | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 3972083..69f4667 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -46,7 +46,7 @@ EOF FROM debian:bookworm-backports -COPY --from=builder /stacks/target/debug/stacks-node /usr/local/bin/ +COPY --from=builder /stacks/target/release/stacks-node /usr/local/bin/ COPY --from=btcpayserver/bitcoin:25.1 /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/ ENV DEBIAN_FRONTEND noninteractive From 8f95e53d3795cc797092c62c5c2c9ff51bf1ecc9 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Wed, 13 Dec 2023 13:25:24 +0100 Subject: [PATCH 7/9] ci: bump stacks-node commit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b25a19..360187a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: push: env: - STACKS_BLOCKCHAIN_COMMIT: f8ffd1dbe8990234391def4611b2611be9a3e4ba + STACKS_BLOCKCHAIN_COMMIT: 390dffc7e3593711c1f55505d3308063a2039df6 concurrency: group: ${{ github.workflow }}-${{ github.ref }} From ce0db115eec7a87f87b729c28469d9be10aeb6c2 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Thu, 1 Feb 2024 19:37:22 +0100 Subject: [PATCH 8/9] chore: bump stacks-node --- .github/workflows/build.yml | 2 +- Dockerfile.e2e | 2 +- docker-compose-follower.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 360187a..d4639fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: push: env: - STACKS_BLOCKCHAIN_COMMIT: 390dffc7e3593711c1f55505d3308063a2039df6 + STACKS_BLOCKCHAIN_COMMIT: 74e3cedeec5215f3286af6565c1503e578a848fb concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 69f4667..62290d2 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -3,7 +3,7 @@ FROM rust:bookworm as builder # A commit hash, tag, or branch -ARG GIT_COMMIT=390dffc7e3593711c1f55505d3308063a2039df6 +ARG GIT_COMMIT=74e3cedeec5215f3286af6565c1503e578a848fb ARG BLOCKCHAIN_REPO=https://github.com/stacks-network/stacks-blockchain.git ARG TARGETPLATFORM diff --git a/docker-compose-follower.yml b/docker-compose-follower.yml index a946c06..6d1509c 100644 --- a/docker-compose-follower.yml +++ b/docker-compose-follower.yml @@ -1,7 +1,7 @@ version: "3.9" x-common-vars: - - &STACKS_BLOCKCHAIN_COMMIT master + - &STACKS_BLOCKCHAIN_COMMIT 74e3cedeec5215f3286af6565c1503e578a848fb - &MINER_PUB_KEY 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c - &BITCOIN_PEER_PORT 18444 - &BITCOIN_RPC_PORT 18443 From 2b232706f3ef4cd28413391075e73b47ddbb4f1c Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Thu, 1 Feb 2024 19:45:07 +0100 Subject: [PATCH 9/9] chore: bump stacks-node in miner docker compose --- docker-compose-miner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-miner.yml b/docker-compose-miner.yml index 0e566ab..0b0bc74 100644 --- a/docker-compose-miner.yml +++ b/docker-compose-miner.yml @@ -1,7 +1,7 @@ version: "3.9" x-common-vars: - - &STACKS_BLOCKCHAIN_COMMIT 9af9c0b5b80f948e90916a45f3f316c81a7ac481 + - &STACKS_BLOCKCHAIN_COMMIT 74e3cedeec5215f3286af6565c1503e578a848fb - &BTC_ADDR miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT - &MINER_SEED 9e446f6b0c6a96cf2190e54bcd5a8569c3e386f091605499464389b8d4e0bfc201 # stx: STEW4ZNT093ZHK4NEQKX8QJGM2Y7WWJ2FQQS5C19, btc: miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT, pub_key: 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c, wif: cStMQXkK5yTFGP3KbNXYQ3sJf2qwQiKrZwR9QJnksp32eKzef1za - &BITCOIN_PEER_PORT 18444