mirror of
https://github.com/bitcoin/bips.git
synced 2026-02-23 15:38:22 +00:00
Review comments and assistance by: Armin Sabouri <armins88@gmail.com> D++ <82842780+dplusplus1024@users.noreply.github.com> Jameson Lopp <jameson.lopp@gmail.com> jbride <jbride2001@yahoo.com> Joey Yandle <xoloki@gmail.com> Jon Atack <jon@atack.com> Jonas Nick <jonasd.nick@gmail.com> Kyle Crews <kylecrews@Kyles-Mac-Studio.local> Mark "Murch" Erhardt <murch@murch.one> notmike-5 <notmike-5@users.noreply.github.com> Vojtěch Strnad <43024885+vostrnad@users.noreply.github.com> Co-authored-by: Ethan Heilman <ethan.r.heilman@gmail.com> Co-authored-by: Isabel Foxen Duke <110147802+Isabelfoxenduke@users.noreply.github.com>
41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Invokes mining simulator a configurable number of times
|
|
|
|
if [ -z "${P2MR_ADDR}" ]; then
|
|
echo "Error: Environment variable P2MR_ADDR needs to be set"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
BITCOIN_SOURCE_DIR=${BITCOIN_SOURCE_DIR:-$HOME/bitcoin}
|
|
|
|
# path to bitcoin.conf for signet
|
|
BITCOIN_CONF_FILE_PATH=${BITCOIN_CONF_FILE_PATH:-$HOME/anduro-360/configs/bitcoin.conf.signet}
|
|
|
|
# Set default LOOP_COUNT to 110 if not set
|
|
LOOP_COUNT=${LOOP_COUNT:-110}
|
|
|
|
# Validate LOOP_COUNT is a positive integer
|
|
if ! [[ "$LOOP_COUNT" =~ ^[0-9]+$ ]] || [ "$LOOP_COUNT" -le 0 ]; then
|
|
echo "Error: LOOP_COUNT must be a positive integer"
|
|
exit 1
|
|
fi
|
|
|
|
# Determine name of pool by querying mempool.space backend
|
|
# curl -X GET "http://localhost:8999/api/v1/mining/pool/marapool" | jq -r .pool.regexes
|
|
export POOL_ID=${POOL_ID:-"MARA Pool"}
|
|
|
|
echo -en "\nLoop_COUNT = $LOOP_COUNT\nBITCOIN_CONF_FILE_PATH=$BITCOIN_CONF_FILE_PATH\nBITCOIN_SOURCE_DIR=$BITCOIN_SOURCE_DIR\nPOOL_ID=$POOL_ID\n\n";
|
|
|
|
|
|
for ((i=1; i<=LOOP_COUNT; i++))
|
|
do
|
|
echo "Iteration $i of $LOOP_COUNT"
|
|
$BITCOIN_SOURCE_DIR/contrib/signet/miner --cli "bitcoin-cli -conf=$BITCOIN_CONF_FILE_PATH" generate \
|
|
--address $P2MR_ADDR \
|
|
--grind-cmd "$BITCOIN_SOURCE_DIR/build/bin/bitcoin-util grind" \
|
|
--poolid "$POOL_ID" \
|
|
--min-nbits --set-block-time $(date +%s)
|
|
done
|