Browse Source

Support BIP39 seeds

alpine
Luke Childs 5 years ago
parent
commit
f7e2d186ee
  1. 2
      Dockerfile
  2. 12
      bip39toxprv
  3. 8
      entrypoint

2
Dockerfile

@ -17,5 +17,5 @@ RUN ln -s $ELECTRUM_INSTALL_DIR/run_electrum /usr/local/bin/electrum
WORKDIR /root
COPY entrypoint /usr/local/bin/
COPY entrypoint bip39toxprv /usr/local/bin/
ENTRYPOINT ["entrypoint"]

12
bip39toxprv

@ -0,0 +1,12 @@
#!/usr/bin/env python3
from electrum import keystore
import sys
mnemonic = ' '.join(sys.argv[1: ])
if not keystore.bip39_is_checksum_valid(mnemonic)[0]:
sys.exit(1)
k = keystore.from_bip39_seed(mnemonic, "", "m/84'/0'/0'")
print(k.xprv)

8
entrypoint

@ -2,5 +2,11 @@
seed=$1
electrum restore "$seed"
echo "Importing seed or key..."
if ! electrum restore "$seed" > /dev/null 2>&1 ]]; then
if ! electrum restore "$(bip39toxprv $seed)" > /dev/null 2>&1; then
>&2 echo "Error: Seed or key not recognised."
exit 1
fi
fi
electrum --gui text

Loading…
Cancel
Save