-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
207 additions
and
55 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,2 @@ | ||
FROM kylemanna/bitcoind:latest | ||
CMD ["/usr/local/bin/bitcoind", "-printtoconsole", "-regtest", "-debug", "-server", "-listen", "-port=31591", "-connect=localhost:31592", "-rpcbind=0.0.0.0:32591", "-rpcallowip=0.0.0.0/0", "-rpcuser=admin", "-rpcpassword=admin" ] |
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,2 @@ | ||
FROM kylemanna/bitcoind:latest | ||
CMD ["/usr/local/bin/bitcoind", "-printtoconsole", "-regtest", "-debug", "-server", "-listen", "-port=31592", "-connect=localhost:31591", "-rpcbind=0.0.0.0:32592", "-rpcallowip=0.0.0.0/0", "-rpcuser=admin", "-rpcpassword=admin" ] |
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,49 @@ | ||
#!/bin/bash | ||
|
||
sudo docker run -d --name bitcoind01 -p 31591:31591 -p 32591:32591 --entrypoint "/usr/local/bin/bitcoind" kylemanna/bitcoind:latest -printtoconsole -regtest -debug -server -listen -port=31591 -connect=localhost:31592 -rpcbind=0.0.0.0:32591 -rpcallowip=0.0.0.0/0 -rpcuser=admin -rpcpassword=admin | ||
sudo docker run -d --name bitcoind02 -p 31592:31592 -p 32592:32592 --entrypoint "/usr/local/bin/bitcoind" kylemanna/bitcoind:latest -printtoconsole -regtest -debug -server -listen -port=31592 -connect=localhost:31591 -rpcbind=0.0.0.0:32592 -rpcallowip=0.0.0.0/0 -rpcuser=admin -rpcpassword=admin | ||
|
||
while ! docker ps --format "{{.Names}}" | grep -wq bitcoind01; do | ||
echo "Waiting for container bitcoind01 to start..." | ||
sleep 5 # Wait for 5 seconds before checking again | ||
done | ||
echo "bitcoind01 container is running." | ||
|
||
while ! docker ps --format "{{.Names}}" | grep -wq bitcoind02; do | ||
echo "Waiting for container bitcoind02 to start..." | ||
sleep 5 # Wait for 5 seconds before checking again | ||
done | ||
echo "bitcoind02 container is running." | ||
|
||
docker network ls | ||
ports=(31591 32591 31592 32592) | ||
for port in "${ports[@]}"; do | ||
if ! sudo lsof -i:$port -sTCP:LISTEN > /dev/null; then | ||
echo "Error: No process is listening on port $port" | ||
exit 1 | ||
fi | ||
done | ||
echo "Success: All specified ports are being listened to." | ||
|
||
echo Test bitcoin node 1 | ||
curl -s -u admin:admin --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://localhost:32591 --fail | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Failed to connect to the Bitcoin bitcoind01 node" | ||
exit 1 | ||
fi | ||
echo Test bitcoin node 2 | ||
curl -s -u admin:admin --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://localhost:32592 --fail | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Failed to connect to the Bitcoin bitcoind02 node" | ||
exit 1 | ||
fi | ||
|
||
echo "Linking btc nodes to localhost" | ||
echo "127.0.0.1 bitcoind01" | sudo tee -a /etc/host > /dev/null | ||
echo "127.0.0.1 bitcoind02" | sudo tee -a /etc/host > /dev/null | ||
echo "/etc/hosts" | ||
cat /etc/hosts | ||
|
||
echo "Generate BTC blocks" | ||
(cd mining-integration-tests && node generateBtcBlocks.js || exit 1) | ||
|
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