Created
June 26, 2024 15:57
-
-
Save bordalix/1f5698c93772771105cb5ff90ddbe40c to your computer and use it in GitHub Desktop.
Search for tx in mnemonics
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
#!/bin/bash | |
# given a list of mnemonics, try to find tx count for each address in: | |
# - derivation path 44, 49 and 84: | |
# - locking script p2pkh, p2wpkh, p2shwpkh and p2tr | |
# requires hal (https://github.com/stevenroose/hal) | |
# requires jq (https://jqlang.github.io/jq/) | |
# example usage: | |
# ./main.sh "embrace traffic prepare fatigue burger hood shed comic royal whisper sibling suspect silver spoon erupt edge top squirrel ancient seek start noble window autumn" "other mnemonic..." | |
# font colors | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
function mnemonic() { | |
seed="$1" | |
echo $seed | |
xpriv=`hal bip39 get-seed "$seed" | jq -r .seed.bip32_xpriv` | |
for d in 44 49 84 | |
do | |
echo | |
derivationPath="m/$d'/0'/0'/0/0" | |
echo $derivationPath | |
for lock in p2pkh p2wpkh p2shwpkh p2tr | |
do | |
echo -e " $lock" | |
address=`hal bip32 derive "$xpriv" "$derivationPath" | jq -r .addresses.$lock` | |
txcount=`curl -sSL "https://mempool.space/api/address/$address" | jq .chain_stats.tx_count` | |
echo -e " $address = $txcount" | |
if [[ $txcount -gt 0 ]] | |
then | |
echo -e "${GREEN}" | |
echo -e " FOUND!" | |
echo -e " mnemonic: $seed" | |
echo -e " derivation path: $derivationPath" | |
echo -e " locking script: $lock" | |
echo -e " address: $address" | |
echo -e " tx count: $txcount" | |
echo -e "${NC}" | |
fi | |
done | |
done | |
} | |
for m in "$@" | |
do | |
echo | |
mnemonic "$m" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment