anchorage_layer_simple/gen-signet-keys.sh
ncantu 20d115a31c feat: Add APIs, dashboard, documentation and improve scripts
**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)
2026-01-24 02:40:25 +01:00

52 lines
1.7 KiB
Bash

DATADIR=${DATADIR:-"regtest-temp"}
BITCOINCLI=${BITCOINCLI:-"bitcoin-cli -regtest -datadir=$DATADIR "}
BITCOIND=${BITCOIND:-"bitcoind -datadir=$DATADIR -regtest -daemon "}
write_files() {
# echo "ADDR=" $ADDR
echo "PRIVKEY=" $PRIVKEY
# echo "PUBKEY=" $PUBKEY
echo "SIGNETCHALLENGE=" $SIGNETCHALLENGE
# echo $ADDR > ~/.bitcoin/ADDR.txt
echo $PRIVKEY >~/.bitcoin/PRIVKEY.txt
# echo $PUBKEY > ~/.bitcoin/PUBKEY.txt
echo $SIGNETCHALLENGE >~/.bitcoin/SIGNETCHALLENGE.txt
}
if [[ "$MINERENABLED" == "1" && ("$SIGNETCHALLENGE" == "" || "$PRIVKEY" == "") ]]; then
echo "Generating new signetchallange and privkey."
#clean if exists
rm -rf $DATADIR
#make it fresh
mkdir $DATADIR
#kill any daemon running stuff
pkill bitcoind
#minimal config file (hardcode bitcoin:bitcoin for rpc)
echo "
regtest=1
server=1
rpcauth=bitcoin:c8c8b9740a470454255b7a38d4f38a52\$e8530d1c739a3bb0ec6e9513290def11651afbfd2b979f38c16ec2cf76cf348a
rpcuser=bitcoin
rpcpassword=bitcoin
" >$DATADIR/bitcoin.conf
#start daemon
$BITCOIND -wallet="temp"
#wait a bit for startup
sleep 5s
#create wallet (Bitcoin Core 30+ requires descriptor wallets)
$BITCOINCLI -named createwallet wallet_name="tmp" descriptors=true
#export future signet seeding key data
ADDR=$($BITCOINCLI getnewaddress)
PRIVKEY=$($BITCOINCLI dumpprivkey $ADDR)
PUBKEY=$($BITCOINCLI getaddressinfo $ADDR | jq .pubkey | tr -d '""')
#don't need regtest anymore
$BITCOINCLI stop
SIGNETCHALLENGE=$(echo '5121'$PUBKEY'51ae')
#cleanup
rm -rf $DATADIR
else
echo "Imported signetchallange and privkey being used."
fi
write_files