Skip to content

Commit 13b1893

Browse files
committed
setup.sh
1 parent 32ba9f7 commit 13b1893

File tree

34 files changed

+411
-411
lines changed

34 files changed

+411
-411
lines changed

network.sh

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@ set -x
1111
SIGNET_DATADIR="./signet_data"
1212
export SIGNET_DATADIR
1313

14+
SIGNET_CHALLENGE=$(cat ./signetchallenge)
15+
export SIGNET_CHALLENGE
16+
1417
# Ensure the data directory exists
1518
mkdir -p "$SIGNET_DATADIR"
1619

1720
# Define executable paths relative to the current working directory
18-
btcd="./bin/bitcoind -datadir=$SIGNET_DATADIR"
21+
btcd="./bin/bitcoind -datadir=$SIGNET_DATADIR -chain=signet"
1922
bcli="./bin/bitcoin-cli -datadir=$SIGNET_DATADIR"
2023
miner="../contrib/signet/miner"
2124
grinder="./bin/bitcoin-util grind"
2225

23-
TIMESTAMP=0
24-
# Note: Renaming files ensures you don't lose previous configurations.
25-
mkdir -p "$SIGNET_DATADIR-$TIMESTAMP"
26-
rsync -r "$SIGNET_DATADIR-0/bitcoin.conf" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
27-
rsync -r "$SIGNET_DATADIR-0/*" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
28-
rsync -r "$SIGNET_DATADIR-0/signet" "$SIGNET_DATADIR-$TIMESTAMP/signet" 2>/dev/null
29-
cat "$SIGNET_DATADIR-$TIMESTAMP/bitcoin.conf"
26+
##TIMESTAMP=0
27+
### Note: Renaming files ensures you don't lose previous configurations.
28+
##mkdir -p "$SIGNET_DATADIR-$TIMESTAMP"
29+
##rsync -r "$SIGNET_DATADIR-0/bitcoin.conf" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
30+
##rsync -r "$SIGNET_DATADIR-0/*" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
31+
##rsync -r "$SIGNET_DATADIR-0/signet" "$SIGNET_DATADIR-$TIMESTAMP/signet" 2>/dev/null
32+
##cat "$SIGNET_DATADIR-$TIMESTAMP/bitcoin.conf"
3033

3134
# Cleanup old configuration/data files for a fresh start (Crucial for debugging)
3235
echo "Archiving old configuration and data files..."
@@ -60,11 +63,13 @@ export weeble
6063

6164
echo "--- Phase 2: Starting Custom Signet and Miner Setup ---"
6265

63-
pids=$(lsof -t -i :$((weeble+1)) )
64-
if [ -n "$pids" ]; then
65-
echo "Found processes on port $((weeble+10)). Killing them now: $pids"
66-
kill -9 $pids
67-
fi
66+
## pids=$(lsof -t -i :$((weeble+1)) )
67+
## if [ -n "$pids" ]; then
68+
## echo "Found processes on port $((weeble+10)). Killing them now: $pids"
69+
## kill -9 $pids
70+
## fi
71+
72+
#cp ./signet_data/signet/wallet $
6873

6974
for datadir in $(ls -d signet_data-*);do
7075
pids=$(lsof -t -i :$((weeble+2)) )
@@ -73,18 +78,39 @@ if [ -n "$pids" ]; then
7378
kill -9 $pids
7479
fi
7580
./bin/bitcoin-qt \
81+
-debug \
82+
-min \
7683
-listen=$((weeble -1)) \
7784
-addnode=127.0.0.1:8080 \
7885
-addnode=127.0.0.1:$((weeble-1)) \
7986
-addnode=127.0.0.1:$((weeble-2)) \
8087
-addnode=127.0.0.1:$((weeble)) \
8188
-addnode=127.0.0.1:38332 \
8289
-addnode=127.0.0.1:38333 \
90+
-addnode=127.0.0.1:38334 \
8391
-port=$((weeble +1 )) \
8492
-signet \
85-
-daemon \
86-
-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 5
87-
93+
-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 3 &
8894
weeble=$(( weeble + 1 ))
89-
9095
done
96+
sleep 60
97+
#exit;
98+
##
99+
./bin/bitcoin-qt \
100+
-listen=$((weeble -1)) \
101+
-addnode=127.0.0.1:8080 \
102+
-addnode=127.0.0.1:$((weeble-1)) \
103+
-addnode=127.0.0.1:$((weeble-2)) \
104+
-addnode=127.0.0.1:$((weeble)) \
105+
-addnode=127.0.0.1:$((weeble+1)) \
106+
-addnode=127.0.0.1:$((weeble+2)) \
107+
-addnode=127.0.0.1:$((weeble+3)) \
108+
-addnode=127.0.0.1:38332 \
109+
-addnode=127.0.0.1:38333 \
110+
-addnode=127.0.0.1:38334 \
111+
-port=$((weeble +1 )) \
112+
-signet \
113+
-daemon \
114+
-signetchallenge=$SIGNET_CHALLENGE
115+
#-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 5
116+

pr896/mine.sh

Lines changed: 0 additions & 88 deletions
This file was deleted.

pr896/network.sh

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@ set -x
1111
SIGNET_DATADIR="./signet_data"
1212
export SIGNET_DATADIR
1313

14+
SIGNET_CHALLENGE=$(cat ./signetchallenge)
15+
export SIGNET_CHALLENGE
16+
1417
# Ensure the data directory exists
1518
mkdir -p "$SIGNET_DATADIR"
1619

1720
# Define executable paths relative to the current working directory
18-
btcd="./bin/bitcoind -datadir=$SIGNET_DATADIR"
21+
btcd="./bin/bitcoind -datadir=$SIGNET_DATADIR -chain=signet"
1922
bcli="./bin/bitcoin-cli -datadir=$SIGNET_DATADIR"
2023
miner="../contrib/signet/miner"
2124
grinder="./bin/bitcoin-util grind"
2225

23-
TIMESTAMP=0
24-
# Note: Renaming files ensures you don't lose previous configurations.
25-
mkdir -p "$SIGNET_DATADIR-$TIMESTAMP"
26-
rsync -r "$SIGNET_DATADIR-0/bitcoin.conf" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
27-
rsync -r "$SIGNET_DATADIR-0/*" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
28-
rsync -r "$SIGNET_DATADIR-0/signet" "$SIGNET_DATADIR-$TIMESTAMP/signet" 2>/dev/null
29-
cat "$SIGNET_DATADIR-$TIMESTAMP/bitcoin.conf"
26+
##TIMESTAMP=0
27+
### Note: Renaming files ensures you don't lose previous configurations.
28+
##mkdir -p "$SIGNET_DATADIR-$TIMESTAMP"
29+
##rsync -r "$SIGNET_DATADIR-0/bitcoin.conf" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
30+
##rsync -r "$SIGNET_DATADIR-0/*" "$SIGNET_DATADIR-$TIMESTAMP/" 2>/dev/null
31+
##rsync -r "$SIGNET_DATADIR-0/signet" "$SIGNET_DATADIR-$TIMESTAMP/signet" 2>/dev/null
32+
##cat "$SIGNET_DATADIR-$TIMESTAMP/bitcoin.conf"
3033

3134
# Cleanup old configuration/data files for a fresh start (Crucial for debugging)
3235
echo "Archiving old configuration and data files..."
@@ -60,11 +63,13 @@ export weeble
6063

6164
echo "--- Phase 2: Starting Custom Signet and Miner Setup ---"
6265

63-
pids=$(lsof -t -i :$((weeble+1)) )
64-
if [ -n "$pids" ]; then
65-
echo "Found processes on port $((weeble+10)). Killing them now: $pids"
66-
kill -9 $pids
67-
fi
66+
## pids=$(lsof -t -i :$((weeble+1)) )
67+
## if [ -n "$pids" ]; then
68+
## echo "Found processes on port $((weeble+10)). Killing them now: $pids"
69+
## kill -9 $pids
70+
## fi
71+
72+
#cp ./signet_data/signet/wallet $
6873

6974
for datadir in $(ls -d signet_data-*);do
7075
pids=$(lsof -t -i :$((weeble+2)) )
@@ -73,18 +78,39 @@ if [ -n "$pids" ]; then
7378
kill -9 $pids
7479
fi
7580
./bin/bitcoin-qt \
81+
-debug \
82+
-min \
7683
-listen=$((weeble -1)) \
7784
-addnode=127.0.0.1:8080 \
7885
-addnode=127.0.0.1:$((weeble-1)) \
7986
-addnode=127.0.0.1:$((weeble-2)) \
8087
-addnode=127.0.0.1:$((weeble)) \
8188
-addnode=127.0.0.1:38332 \
8289
-addnode=127.0.0.1:38333 \
90+
-addnode=127.0.0.1:38334 \
8391
-port=$((weeble +1 )) \
8492
-signet \
85-
-daemon \
86-
-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 5
87-
93+
-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 3 &
8894
weeble=$(( weeble + 1 ))
89-
9095
done
96+
sleep 1
97+
#exit;
98+
##
99+
./bin/bitcoin-qt \
100+
-listen=$((weeble -1)) \
101+
-addnode=127.0.0.1:8080 \
102+
-addnode=127.0.0.1:$((weeble-1)) \
103+
-addnode=127.0.0.1:$((weeble-2)) \
104+
-addnode=127.0.0.1:$((weeble)) \
105+
-addnode=127.0.0.1:$((weeble+1)) \
106+
-addnode=127.0.0.1:$((weeble+2)) \
107+
-addnode=127.0.0.1:$((weeble+3)) \
108+
-addnode=127.0.0.1:38332 \
109+
-addnode=127.0.0.1:38333 \
110+
-addnode=127.0.0.1:38334 \
111+
-port=$((weeble +1 )) \
112+
-signet \
113+
-daemon \
114+
-signetchallenge=$SIGNET_CHALLENGE
115+
#-datadir=$datadir || { echo "Error: Failed to start bitcoind in Signet mode."; exit 1; } & sleep 5
116+

pr896/setup.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ mkdir -p "$SIGNET_DATADIR"
1616

1717
# Define executable paths relative to the current working directory
1818
btcd="./bin/bitcoind -datadir=$SIGNET_DATADIR"
19+
export btcd
1920
bcli="./bin/bitcoin-cli -datadir=$SIGNET_DATADIR"
21+
export bcli
2022
miner="../contrib/signet/miner"
23+
export miner
2124
grinder="./bin/bitcoin-util grind"
25+
export grinder
2226

2327
# Cleanup old configuration/data files for a fresh start (Crucial for debugging)
2428
echo "Archiving old configuration and data files..."
@@ -27,7 +31,7 @@ TIMESTAMP=$(date +%s)
2731
mv "$SIGNET_DATADIR/bitcoin.conf" "$SIGNET_DATADIR/bitcoin-$TIMESTAMP.conf" 2>/dev/null
2832
mv "$SIGNET_DATADIR/signet/peers.dat" "$SIGNET_DATADIR/signet/peers-$TIMESTAMP.dat" 2>/dev/null
2933
mv "$SIGNET_DATADIR/regtest" "$SIGNET_DATADIR/regtest-$TIMESTAMP" 2>/dev/null
30-
34+
export TIMESTAMP
3135
# Explicitly remove wallet directories to ensure a clean start
3236
echo "Removing existing wallet directories if they exist..."
3337
rm -rf "$SIGNET_DATADIR/regtest/wallets/signer" 2>/dev/null
@@ -108,6 +112,8 @@ ADDR=$($bcli -regtest -named getnewaddress address_type="bech32")
108112
echo "Temporary Regtest Address: $ADDR"
109113

110114
SIGNET_CHALLENGE=$($bcli -regtest -named getaddressinfo "$ADDR" | jq -r .scriptPubKey)
115+
export SIGNET_CHALLENGE
116+
echo $SIGNET_CHALLENGE > signetchallenge
111117
echo "Generated SIGNET_CHALLENGE (scriptPubKey): $SIGNET_CHALLENGE"
112118

113119
# Stop the regtest daemon gracefully
@@ -122,7 +128,7 @@ cat <<EOF > "$SIGNET_DATADIR/bitcoin.conf"
122128
rpcuser=signetuser
123129
rpcpassword=signetpassword
124130
signet=1
125-
server=1
131+
#server=1
126132
[signet]
127133
rpcport=38332
128134
add-node=8080
@@ -170,8 +176,16 @@ echo "Miner Block Reward Address: $MINER_ADDR"
170176
# --- 5. Start Mining ---
171177

172178
echo "Generating initial block with custom nBits..."
173-
$miner --cli "$bcli" generate --address "$MINER_ADDR" --grind-cmd "$grinder" --min-nbits --set-block-time $(date +%s) && sleep 10
179+
$miner --cli "$bcli" generate --address "$MINER_ADDR" --grind-cmd "$grinder" --min-nbits --set-block-time $(date +%s) && sleep 6
174180

181+
count=0
182+
while ((count < 5));do
175183
# Start ongoing mining loop
176-
echo "Starting ongoing mining loop..."
177-
$miner --cli "$bcli" generate --address "$MINER_ADDR" --grind-cmd "$grinder" --min-nbits --ongoing
184+
# echo "Starting ongoing mining loop..."
185+
$miner --cli "$bcli" generate --address "$MINER_ADDR" --grind-cmd "$grinder" --min-nbits #--ongoing
186+
sleep 1;
187+
done
188+
189+
ADDR=$($bcli -signet -named getnewaddress address_type="bech32")
190+
echo "$ADDR"
191+
./miner.sh || true

pr896/signet_data/bitcoin.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
rpcuser=signetuser
22
rpcpassword=signetpassword
33
signet=1
4-
server=1
4+
#server=1
55
[signet]
66
rpcport=38332
77
add-node=8080
88
daemon=1
9-
signetchallenge=0014225f4a2c49de6f61aaaf4a2101ad1ff9d6004a71
9+
signetchallenge=001469d003c76f7d7fbdda10dc822cfa749254d5b93c
0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
����Ч
1+
���
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)