**Motivations:** - Add API services for anchorage and faucet functionality - Add dashboard interface for signet monitoring - Improve documentation and maintenance guides - Enhance existing scripts for better functionality **Root causes:** - Need for API services to interact with Bitcoin Signet - Need for user-friendly dashboard interface - Need for comprehensive documentation - Scripts required improvements for better reliability **Correctifs:** - Updated Dockerfile with better configuration - Improved gen-bitcoind-conf.sh and gen-signet-keys.sh scripts - Enhanced mine.sh, miner, run.sh, and setup-signet.sh scripts - Updated env.example with new configuration options **Evolutions:** - Added api-anchorage service with anchor functionality - Added api-faucet service for testnet coin distribution - Added signet-dashboard for monitoring and management - Added comprehensive documentation in docs/ directory - Added configure-nginx-proxy.sh for proxy configuration - Added update-signet.sh for signet updates - Added ETAT_SYSTEME.md and START_DASHBOARD_AND_FAUCET.md guides - Added .bitcoin-version file for version tracking **Pages affectées:** - Dockerfile - env.example - gen-bitcoind-conf.sh - gen-signet-keys.sh - mine.sh - miner - run.sh - setup-signet.sh - api-anchorage/ (new) - api-faucet/ (new) - signet-dashboard/ (new) - docs/ (new) - configure-nginx-proxy.sh (new) - update-signet.sh (new) - ETAT_SYSTEME.md (new) - START_DASHBOARD_AND_FAUCET.md (new) - .bitcoin-version (new) - .env (modified) - mempool/ (added)
52 lines
2.3 KiB
Bash
52 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
# run bitcoind
|
|
bitcoind --daemonwait
|
|
sleep 5
|
|
|
|
# Create wallet if it doesn't exist
|
|
DATADIR=${DATADIR:-~/.bitcoin/}
|
|
if ! bitcoin-cli -datadir=$DATADIR listwallets | grep -q "custom_signet"; then
|
|
echo "Creating wallet custom_signet"
|
|
bitcoin-cli -datadir=$DATADIR -named createwallet wallet_name="custom_signet" load_on_startup=true descriptors=true
|
|
fi
|
|
|
|
# Load wallet if not already loaded
|
|
if ! bitcoin-cli -datadir=$DATADIR listwallets | grep -q "custom_signet"; then
|
|
bitcoin-cli -datadir=$DATADIR loadwallet custom_signet
|
|
fi
|
|
|
|
# Import private key if in mining mode (Bitcoin Core 30+ requires descriptor wallets)
|
|
# The miner needs the private key in the wallet to sign blocks via walletprocesspsbt
|
|
# IMPORTANT: For signet mining, we need to import as pk() (P2PK) not wpkh() (P2WPKH)
|
|
# because the SIGNETCHALLENGE uses a P2PK script that must be signed
|
|
if [[ "$MINERENABLED" == "1" ]]; then
|
|
PRIVKEY=${PRIVKEY:-$(cat ~/.bitcoin/PRIVKEY.txt)}
|
|
if [[ -n "$PRIVKEY" ]]; then
|
|
echo "Importing private key for mining (descriptor wallet)"
|
|
# Import as pk() for P2PK signing (required for signet challenge)
|
|
# The signet miner needs to sign transactions to the SIGNETCHALLENGE which is a P2PK script
|
|
# Note: pk() descriptors cannot be active (must be ranged), but they can still be used for signing
|
|
DESCRIPTOR_INFO=$(bitcoin-cli -datadir=$DATADIR getdescriptorinfo "pk($PRIVKEY)")
|
|
CHECKSUM=$(echo "$DESCRIPTOR_INFO" | jq -r '.checksum')
|
|
# Import descriptor with checksum (required for Bitcoin Core 30+)
|
|
# The descriptor doesn't need to be active to sign - it just needs to be in the wallet
|
|
IMPORT_RESULT=$(bitcoin-cli -datadir=$DATADIR importdescriptors "[{\"desc\":\"pk($PRIVKEY)#$CHECKSUM\",\"timestamp\":0,\"internal\":false}]")
|
|
if echo "$IMPORT_RESULT" | jq -e '.[0].success == true' > /dev/null; then
|
|
echo "Private key imported successfully into descriptor wallet (P2PK for signet)"
|
|
else
|
|
echo "Warning: Private key import may have failed"
|
|
echo "Import result: $IMPORT_RESULT"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo "get magic"
|
|
magic=$(cat /root/.bitcoin/signet/debug.log | grep -m1 magic)
|
|
magic=${magic:(-8)}
|
|
echo $magic > /root/.bitcoin/MAGIC.txt
|
|
|
|
# if in mining mode
|
|
if [[ "$MINERENABLED" == "1" ]]; then
|
|
mine.sh
|
|
fi |