mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-08-10 20:10:07 +00:00
add regtest setup
This commit is contained in:
9
taptrade-cli-demo/rpc_node/regtest/data/Dockerfile
Normal file
9
taptrade-cli-demo/rpc_node/regtest/data/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM dobtc/bitcoin
|
||||
|
||||
COPY ./bitcoin.conf /home/bitcoin/.bitcoin/bitcoin.conf
|
||||
|
||||
WORKDIR /home/bitcoin
|
||||
COPY ./mine-blocks.sh ./mine-blocks.sh
|
||||
RUN chmod +x ./mine-blocks.sh
|
||||
|
||||
CMD ["./mine-blocks.sh"]
|
@ -2,7 +2,7 @@ server=1
|
||||
txindex=1
|
||||
|
||||
# Authentication
|
||||
rpcauth=XXX:1234
|
||||
rpcauth=coordinator:29de0441af68213532c84470616d867c$f936baec7d3d5083617d6d898b3a762999e17bf2453244a37e779caf250dc09f
|
||||
# generator: https://jlopp.github.io/bitcoin-core-rpc-auth-generator/
|
||||
# Cookie file authentication
|
||||
rpccookiefile=/home/bitcoin/.bitcoin/.cookie
|
||||
@ -11,8 +11,8 @@ maxconnections=15
|
||||
# Set the maximum number of transactions to keep in the memory pool
|
||||
maxmempool=300
|
||||
# Run this node on the Bitcoin Test Network. Equivalent to -chain=test
|
||||
signet=1
|
||||
[signet]
|
||||
regtest=1
|
||||
[regtest]
|
||||
rpcbind=0.0.0.0
|
||||
rpcallowip=0.0.0.0/0
|
||||
rpcport=8332
|
25
taptrade-cli-demo/rpc_node/regtest/data/mine-blocks.sh
Normal file
25
taptrade-cli-demo/rpc_node/regtest/data/mine-blocks.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
/entrypoint.sh bitcoind -regtest -daemon
|
||||
sleep 10;
|
||||
|
||||
# List existing wallets
|
||||
WALLETS=$(bitcoin-cli -regtest -datadir="/home/bitcoin/.bitcoin" listwalletdir)
|
||||
|
||||
# Check if "coordinator_wallet" exists in the list of wallets
|
||||
if echo "$WALLETS" | grep -q "coordinator_wallet"; then
|
||||
echo "Wallet exists. Loading wallet..."
|
||||
bitcoin-cli -regtest -datadir="/home/bitcoin/.bitcoin" loadwallet "coordinator_wallet"
|
||||
else
|
||||
echo "Wallet does not exist. Creating wallet..."
|
||||
bitcoin-cli -regtest -datadir="/home/bitcoin/.bitcoin" createwallet "coordinator_wallet"
|
||||
fi
|
||||
|
||||
# Generate initial blocks
|
||||
bitcoin-cli -regtest -datadir="/home/bitcoin/.bitcoin" -generate 101
|
||||
|
||||
# Generate a block every 300 seconds
|
||||
while true; do
|
||||
bitcoin-cli -regtest -datadir="/home/bitcoin/.bitcoin" -generate 1
|
||||
sleep 300
|
||||
done
|
11
taptrade-cli-demo/rpc_node/regtest/docker-compose.yml
Normal file
11
taptrade-cli-demo/rpc_node/regtest/docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
||||
services:
|
||||
bitcoin:
|
||||
build: ./data
|
||||
container_name: bitcoin
|
||||
ports:
|
||||
- 8332:8332
|
||||
volumes:
|
||||
- bitcoin:/home/bitcoin/.bitcoin
|
||||
|
||||
volumes:
|
||||
bitcoin:
|
38
taptrade-cli-demo/rpc_node/regtest/get-coins-to-address.sh
Executable file
38
taptrade-cli-demo/rpc_node/regtest/get-coins-to-address.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to display help message
|
||||
show_help() {
|
||||
echo "Usage: $0 [OPTIONS] <bitcoin_address>"
|
||||
echo
|
||||
echo "This script generates blocks to a specified Bitcoin address using RPC."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message and exit"
|
||||
echo
|
||||
echo "Arguments:"
|
||||
echo " <bitcoin_address> The Bitcoin address to generate blocks to"
|
||||
echo
|
||||
echo "Example:"
|
||||
echo " $0 bcrt1pcc5nx64a9d6rpk5fkvr6v2lnk06cwxqmgpv3894ehgwkeeal2qusjgjrk3"
|
||||
}
|
||||
|
||||
# Check for help option
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if an address is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Error: Bitcoin address is required."
|
||||
echo "Use '$0 --help' for more information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the Bitcoin address from command line argument
|
||||
bitcoin_address="$1"
|
||||
|
||||
# Run the curl command with the provided Bitcoin address
|
||||
curl --data-binary "{\"jsonrpc\":\"1.0\",\"id\":\"curltext\",\"method\":\"generatetoaddress\",\"params\":[101, \"$bitcoin_address\"]}" \
|
||||
-H 'content-type:text/plain;' \
|
||||
http://coordinator:test1234@127.0.0.1:8332/
|
@ -1,10 +0,0 @@
|
||||
services:
|
||||
bitcoin:
|
||||
container_name: bitcoin
|
||||
image: dobtc/bitcoin
|
||||
ports:
|
||||
- 8332:8332
|
||||
volumes:
|
||||
- ./bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf
|
||||
- ./data/:/home/bitcoin/.bitcoin
|
||||
|
Reference in New Issue
Block a user