Skip to content

Instantly share code, notes, and snippets.

@SomberNight
Created January 25, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SomberNight/c860106fb91027f3f0d0a3fd63dde44c to your computer and use it in GitHub Desktop.
Save SomberNight/c860106fb91027f3f0d0a3fd63dde44c to your computer and use it in GitHub Desktop.
electrum derive_address example
from electrum import bitcoin
from electrum import keystore
ks = keystore.from_xpub("zpub6nsHdRuY92FsMKdbn9BfjBCG6X8pyhCibNP6uDvpnw2cyrVhecvHRMa3Ne8kdJZxjxgwnpbHLkcR4bfnhHy6auHPJyDTQ3kianeuVLdkCYQ")
pubkey = ks.derive_pubkey(for_change=False, n=0)
addr = bitcoin.pubkey_to_address('p2wpkh', pubkey)
print(addr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment