Fix for descriptors in setup_signet.sh
benthecarman opened this issue · comments
In setup_signet.sh it says that it is not working for descriptors. This is because when putting a private key in a descriptor it needs to be WIF encoded.
here is a bash script for converting
# Descriptors take private keys in WIF format
# Add the testnet prefix 'ef'
prefix_key="ef$PRIVKEY"
# Double sha256 hash of prefix key
double_hash=$(echo -n $prefix_key | xxd -r -p | openssl sha256 | awk '{print $2}' | xxd -r -p | openssl sha256 | awk '{print $2}')
# Take first 4 bytes of double hash as checksum
checksum=${double_hash:0:8}
# Append checksum to prefix key
checksum_key="$prefix_key$checksum"
# Convert the final key into base58 encoding
WIF_KEY=$(echo -n $checksum_key | xxd -r -p | base58)
ref where descriptors appear to being used in mining (untested): https://github.com/BitPolito/bitcoin-testing-tools/blob/main/bitcoind_signet_miner_plugnplay/bitcoind-entrypoint.sh