Bitcoin Forum

Bitcoin => Electrum => Topic started by: jonald_fyookball on March 15, 2014, 03:21:35 PM



Title: how to verify seed
Post by: jonald_fyookball on March 15, 2014, 03:21:35 PM
 
If I want to encrypt the seed manually to verify that its the same private key
generated as electrum, uses, can I use something like this:

http://aes.online-domain-tools.com/

I assume I would put the key in the input text field, but
what would i put in the key field?


Title: Re: how to verify seed
Post by: flatfly on March 15, 2014, 05:30:34 PM

If I want to encrypt the seed manually to verify that its the same private key
generated as electrum, uses, can I use something like this:

http://aes.online-domain-tools.com/

I assume I would put the key in the input text field, but
what would i put in the key field?

That's not how AES works - AES (when used in the most common way) never produces the same output twice.
Unfortunately I don't have much time to elaborate, but you can easily research that online.


Title: Re: how to verify seed
Post by: jonald_fyookball on March 15, 2014, 10:16:23 PM
I guess the real question is how does it create the private key from the seed?


Title: Re: how to verify seed
Post by: Abdussamad on April 20, 2014, 07:26:31 AM
You can see the relevant code here:

https://github.com/spesmilo/electrum/blob/66e1e2707d4a82ecbe3f2bf7d532036d0a9651a8/lib/account.py#L101



Title: Re: how to verify seed
Post by: jonald_fyookball on May 16, 2014, 03:07:12 AM
I am trying the following:

Code:

password = None;
 
seed="constant forest adore false green weave stop guy fur freeze giggle clock";
 
seed = pw_decode(seed, password).encode('utf8');
print seed;
oldseed = seed
for i in range(100000):
seed = hashlib.sha256(seed + oldseed).digest()
newseed=string_to_number( seed );

print newseed;
print "----";
curve = SECP256k1
master_private_key = ecdsa.SigningKey.from_secret_exponent( newseed, curve = SECP256k1 );
master_public_key = master_private_key.get_verifying_key().to_string().encode('hex');
print master_public_key;


However it doesn't give me the correct master public key.  What am I doing wrong?



Title: Re: how to verify seed
Post by: dabura667 on May 16, 2014, 09:40:37 AM
I am trying the following:

Code:

password = None;
  
seed="constant forest adore false green weave stop guy fur freeze giggle clock";
  
seed = pw_decode(seed, password).encode('utf8');
print seed;
oldseed = seed
for i in range(100000):
seed = hashlib.sha256(seed + oldseed).digest()
newseed=string_to_number( seed );

print newseed;
print "----";
curve = SECP256k1
master_private_key = ecdsa.SigningKey.from_secret_exponent( newseed, curve = SECP256k1 );
master_public_key = master_private_key.get_verifying_key().to_string().encode('hex');
print master_public_key;


However it doesn't give me the correct master public key.  What am I doing wrong?


The 12 words are not your encoded seed, they are your decoded seed. You must convert mnemonic to hex, no password needed.

Code:
from electrum import mnemonic

seed = mnemonic.mn_decode(["constant", "forest", "adore", "false", "green", "weave", "stop", "guy", "fur", "freeze", "giggle", "clock"])

will make seed your unencrypted seed. The rest should be fine.

Edit:
Actually the input to the mn_decode should be a dict of strings and not a single string