-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
splitting compose files into separate follower and miner
- Loading branch information
Showing
4 changed files
with
358 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: "3.9" | ||
|
||
x-common-vars: | ||
- &STACKS_BLOCKCHAIN_COMMIT master | ||
- &MINER_PUB_KEY 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c | ||
- &BITCOIN_PEER_PORT 18444 | ||
- &BITCOIN_RPC_PORT 18443 | ||
- &BITCOIN_RPC_USER btc | ||
- &BITCOIN_RPC_PASS btc | ||
- &STACKS_20_HEIGHT ${STACKS_20_HEIGHT:-101} | ||
- &STACKS_2_05_HEIGHT ${STACKS_2_05_HEIGHT:-102} | ||
- &STACKS_21_HEIGHT ${STACKS_21_HEIGHT:-103} | ||
- &STACKS_POX2_HEIGHT ${STACKS_POX2_HEIGHT:-104} # 104 is is stacks_block=1, 106 is stacks_block=3 | ||
- &STACKS_22_HEIGHT ${STACKS_22_HEIGHT:-105} | ||
- &STACKS_23_HEIGHT ${STACKS_23_HEIGHT:-106} | ||
- &STACKS_24_HEIGHT ${STACKS_24_HEIGHT:-107} | ||
|
||
services: | ||
stacks-node-follower: | ||
networks: | ||
- stacks | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.stacks-node | ||
args: | ||
GIT_COMMIT: *STACKS_BLOCKCHAIN_COMMIT | ||
ports: | ||
- "30443:20443" | ||
volumes: | ||
- ./stacks-krypton-follower.toml/:/root/config.toml.in | ||
- ./bitcoin.conf:/root/.bitcoin/bitcoin.conf | ||
- ./init-data:/init-data | ||
- chainstate:/chainstate | ||
environment: | ||
# STACKS_LOG_TRACE: 1 # uncomment for trace logging | ||
# STACKS_LOG_DEBUG: 1 | ||
# STACKS_EVENT_OBSERVER: stacks-api:3700 | ||
DATA_DIR: /chainstate/stacks-blockchain-follower-data | ||
BITCOIN_PEER_HOST: bitcoind | ||
BITCOIN_PEER_PORT: *BITCOIN_PEER_PORT | ||
BITCOIN_RPC_PORT: *BITCOIN_RPC_PORT | ||
BITCOIN_RPC_USER: *BITCOIN_RPC_USER | ||
BITCOIN_RPC_PASS: *BITCOIN_RPC_PASS | ||
MINER_PUB_KEY: *MINER_PUB_KEY | ||
STACKS_20_HEIGHT: *STACKS_20_HEIGHT | ||
STACKS_2_05_HEIGHT: *STACKS_2_05_HEIGHT | ||
STACKS_21_HEIGHT: *STACKS_21_HEIGHT | ||
STACKS_POX2_HEIGHT: *STACKS_POX2_HEIGHT | ||
STACKS_22_HEIGHT: *STACKS_22_HEIGHT | ||
STACKS_23_HEIGHT: *STACKS_23_HEIGHT | ||
STACKS_24_HEIGHT: *STACKS_24_HEIGHT | ||
entrypoint: | ||
- /bin/bash | ||
- -c | ||
- | | ||
set -e | ||
mkdir -p $${DATA_DIR} | ||
rm -rf $${DATA_DIR}/* | ||
envsubst < config.toml.in > config.toml | ||
exec stacks-node start --config=config.toml | ||
networks: | ||
stacks: | ||
volumes: | ||
chainstate: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
version: "3.9" | ||
|
||
x-common-vars: | ||
- &STACKS_BLOCKCHAIN_COMMIT master | ||
- &BTC_ADDR miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT | ||
- &MINER_SEED 9e446f6b0c6a96cf2190e54bcd5a8569c3e386f091605499464389b8d4e0bfc201 # stx: STEW4ZNT093ZHK4NEQKX8QJGM2Y7WWJ2FQQS5C19, btc: miEJtNKa3ASpA19v5ZhvbKTEieYjLpzCYT, pub_key: 035379aa40c02890d253cfa577964116eb5295570ae9f7287cbae5f2585f5b2c7c, wif: cStMQXkK5yTFGP3KbNXYQ3sJf2qwQiKrZwR9QJnksp32eKzef1za | ||
- &BITCOIN_PEER_PORT 18444 | ||
- &BITCOIN_RPC_PORT 18443 | ||
- &BITCOIN_RPC_USER btc | ||
- &BITCOIN_RPC_PASS btc | ||
- &MINE_INTERVAL ${MINE_INTERVAL:-0.5s} | ||
- &STACKS_20_HEIGHT ${STACKS_20_HEIGHT:-101} | ||
- &STACKS_2_05_HEIGHT ${STACKS_2_05_HEIGHT:-102} | ||
- &STACKS_21_HEIGHT ${STACKS_21_HEIGHT:-103} | ||
- &STACKS_POX2_HEIGHT ${STACKS_POX2_HEIGHT:-104} # 104 is is stacks_block=1, 106 is stacks_block=3 | ||
- &STACKS_22_HEIGHT ${STACKS_22_HEIGHT:-105} | ||
- &STACKS_23_HEIGHT ${STACKS_23_HEIGHT:-106} | ||
- &STACKS_24_HEIGHT ${STACKS_24_HEIGHT:-107} | ||
- &REWARD_RECIPIENT ${REWARD_RECIPIENT:-STQM73RQC4EX0A07KWG1J5ECZJYBZS4SJ4ERC6WN} # priv: 6ad9cadb42d4edbfbe0c5bfb3b8a4125ddced021c4174f829b714ccbf527f02001 | ||
|
||
services: | ||
bitcoind: | ||
networks: | ||
- stacks | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.btc | ||
ports: | ||
- "18443:18443" | ||
- "18444:18444" | ||
volumes: | ||
- ./bitcoin.conf:/root/.bitcoin/bitcoin.conf | ||
- ./init-data:/init-data | ||
- chainstate:/chainstate | ||
environment: | ||
DATA_DIR: /chainstate/bitcoin-data | ||
entrypoint: | ||
- /bin/bash | ||
- -c | ||
- | | ||
set -e | ||
mkdir -p $${DATA_DIR} | ||
rm -rf $${DATA_DIR}/* | ||
bitcoind | ||
bitcoind-miner: | ||
networks: | ||
- stacks | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.btc | ||
depends_on: | ||
- bitcoind | ||
volumes: | ||
- ./bitcoin.conf:/root/.bitcoin/bitcoin.conf | ||
environment: | ||
BTC_ADDR: *BTC_ADDR | ||
MINE_INTERVAL: *MINE_INTERVAL | ||
INIT_BLOCKS: 101 | ||
entrypoint: | ||
- /bin/bash | ||
- -c | ||
- | | ||
set -e | ||
trap "exit" INT TERM | ||
trap "kill 0" EXIT | ||
bitcoin-cli -rpcconnect=bitcoind -rpcwait getmininginfo | ||
bitcoin-cli -rpcconnect=bitcoind createwallet "" | ||
bitcoin-cli -rpcconnect=bitcoind importaddress $${BTC_ADDR} "" false | ||
bitcoin-cli -rpcconnect=bitcoind generatetoaddress $${INIT_BLOCKS} $${BTC_ADDR} | ||
while true; do | ||
TX=$$(bitcoin-cli -rpcconnect=bitcoind listtransactions '*' 1 0 true) | ||
CONFS=$$(echo "$${TX}" | jq '.[].confirmations') | ||
if [ "$${CONFS}" = "0" ]; then | ||
echo "Detected Stacks mining mempool tx, mining btc block..." | ||
bitcoin-cli -rpcconnect=bitcoind generatetoaddress 1 "$${BTC_ADDR}" | ||
else | ||
echo "No Stacks mining tx detected" | ||
fi | ||
sleep $${MINE_INTERVAL} & | ||
wait || exit 0 | ||
done | ||
stacks-node-miner: | ||
networks: | ||
- stacks | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.stacks-node | ||
args: | ||
GIT_COMMIT: *STACKS_BLOCKCHAIN_COMMIT | ||
depends_on: | ||
- bitcoind | ||
ports: | ||
- "20443:20443" | ||
volumes: | ||
- ./stacks-krypton-miner.toml/:/root/config.toml.in | ||
- ./bitcoin.conf:/root/.bitcoin/bitcoin.conf | ||
- ./init-data:/init-data | ||
- chainstate:/chainstate | ||
environment: | ||
# STACKS_LOG_TRACE: 1 # uncomment for trace logging | ||
# STACKS_LOG_DEBUG: 1 | ||
# STACKS_EVENT_OBSERVER: stacks-api:3700 # uncomment if using API | ||
DATA_DIR: /chainstate/stacks-blockchain-miner-data | ||
BITCOIN_PEER_HOST: bitcoind | ||
BITCOIN_PEER_PORT: *BITCOIN_PEER_PORT | ||
BITCOIN_RPC_PORT: *BITCOIN_RPC_PORT | ||
BITCOIN_RPC_USER: *BITCOIN_RPC_USER | ||
BITCOIN_RPC_PASS: *BITCOIN_RPC_PASS | ||
MINER_SEED: *MINER_SEED | ||
STACKS_20_HEIGHT: *STACKS_20_HEIGHT | ||
STACKS_2_05_HEIGHT: *STACKS_2_05_HEIGHT | ||
STACKS_21_HEIGHT: *STACKS_21_HEIGHT | ||
STACKS_POX2_HEIGHT: *STACKS_POX2_HEIGHT | ||
STACKS_22_HEIGHT: *STACKS_22_HEIGHT | ||
STACKS_23_HEIGHT: *STACKS_23_HEIGHT | ||
STACKS_24_HEIGHT: *STACKS_24_HEIGHT | ||
REWARD_RECIPIENT: *REWARD_RECIPIENT | ||
entrypoint: | ||
- /bin/bash | ||
- -c | ||
- | | ||
set -e | ||
if [[ ! -z "$${REWARD_RECIPIENT}" ]]; then | ||
export REWARD_RECIPIENT_CONF="block_reward_recipient = \"$${REWARD_RECIPIENT}\"" | ||
fi | ||
mkdir -p $${DATA_DIR} | ||
rm -rf $${DATA_DIR}/* | ||
envsubst < config.toml.in > config.toml | ||
# bitcoin-cli -rpcwait -rpcconnect=bitcoind getmininginfo | ||
exec stacks-node start --config=config.toml | ||
################################## | ||
##### UNCOMMENT IF USING API ##### | ||
################################## | ||
# postgres: | ||
# image: "postgres:15" | ||
# ports: | ||
# - "5490:5490" | ||
# volumes: | ||
# - chainstate:/chainstate | ||
# environment: | ||
# POSTGRES_USER: postgres | ||
# POSTGRES_PASSWORD: postgres | ||
# POSTGRES_DB: stacks_blockchain_api | ||
# PGPORT: 5490 | ||
# PGDATA: /chainstate/pg-data | ||
|
||
# stacks-api: | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile.stacks-api | ||
# args: | ||
# GIT_COMMIT: 4a332f353ee10802fa7b04e888b32e54d010a69d | ||
# depends_on: | ||
# - postgres | ||
# ports: | ||
# - "3999:3999" | ||
# expose: | ||
# - "3700" | ||
# environment: | ||
# NODE_ENVIRONMENT: production | ||
# STACKS_API_LOG_LEVEL: debug | ||
# STACKS_CHAIN_ID: "0x80000000" | ||
# STACKS_BLOCKCHAIN_API_HOST: "0.0.0.0" | ||
# STACKS_BLOCKCHAIN_API_PORT: 3999 | ||
# STACKS_CORE_EVENT_HOST: "0.0.0.0" | ||
# STACKS_CORE_EVENT_PORT: 3700 | ||
# PG_HOST: postgres | ||
# PG_PORT: 5490 | ||
# PG_USER: postgres | ||
# PG_PASSWORD: postgres | ||
# PG_DATABASE: stacks_blockchain_api | ||
# PG_SCHEMA: public | ||
# STACKS_CORE_RPC_HOST: stacks-node | ||
# STACKS_CORE_RPC_PORT: 20443 | ||
# BTC_RPC_HOST: http://bitcoind | ||
# BTC_RPC_PORT: 18443 | ||
# BTC_RPC_USER: btc | ||
# BTC_RPC_PW: btc | ||
# BTC_FAUCET_PK: *MINER_SEED | ||
################################## | ||
##### UNCOMMENT IF USING API ##### | ||
################################## | ||
|
||
networks: | ||
stacks: | ||
volumes: | ||
chainstate: |
Oops, something went wrong.