I'm currently reading the Electrum sourcecode to figure out how to go from seed (12 words) to addresses (in usual format). Does someone have the big picture of this process in mind?

More precisely I'm looking for Python code (standalone, runnable out of Electrum) that can produce this.

  1. Take a seed s (can be 12 words from the 2048-words dictionary but not necessary)

  2. Let's assume s is a valid seed (i.e. is_new_seed(s) is True, this means that bh2u(hmac_sha_512(b"Seed version", s.encode('utf8'))) has prefix '01'); code for is_new_seed here.

  3. For our goal (get addresses), should we first create the private key from s? How?


  1. Should we create a master public key from s? How?

  2. Given 3. or 4., how to create the 20 first public addresses?

Example of input: s = 'x8' (yes this is a valid (unsecure because too simple) seed, you can try it in Electrum - Create a wallet from existing seed)

Example of output:

  • You mean like this, but Python? bitcoin.stackexchange.com/questions/63715/… – fredsbend Dec 24 '17 at 16:57
  • Not exactly @fredsben, the output should be (public) adresses, not private keys. Or maybe can these adresses be easily deduced from pvt keys? – Basj Dec 24 '17 at 17:34
  • I think that tool shows private keys, public keys, and addresses. The private keys are generated from the seed. The public keys are generated from the private keys. The addresses are generated from the public keys. So yes, addresses can be deduced from private keys. – fredsbend Dec 24 '17 at 18:21

Electrum uses BIP 32 to go from a seed value to private and public keys. Addresses are then derived from those keys. Public keys are also derived from the private keys, except in the case for watch-only wallets.

The full BIP 32 specification is available here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.