0

according to bip39, I maked 12 mnemonic words and then get a 512 bit seed from them.

now I want to know how must I convert this seed to private key ?

what functions must I use ?

please introduce me libraries for browser javascript.

although I know that I must use ECDSA and secp256k1.

but I do not know exactly what the steps are?

  • What problems do you have with following the reference implementation or the Javascript implementations listed in the link you put in your question? – RedGrittyBrick Nov 13 '18 at 11:11
  • @RedGrittyBrick My current problem is that I don't know based on what algorithm I need to convert a 512 bits seed into a 256 bits private key. – saeid ezzati Nov 14 '18 at 10:24
1

I don't know based on what algorithm I need to convert a 512 bits seed into a 256 bits private key.

Regarding algorithms:

BIP-0039 says:

From mnemonic to seed

A user may decide to protect their mnemonic with a passphrase. If a passphrase is not present, an empty string "" is used instead.

To create a binary seed from the mnemonic, we use the PBKDF2 function with a mnemonic sentence (in UTF-8 NFKD) used as the password and the string "mnemonic" + passphrase (again in UTF-8 NFKD) used as the salt. The iteration count is set to 2048 and HMAC-SHA512 is used as the pseudo-random function. The length of the derived key is 512 bits (= 64 bytes).

So the algorithms so far are described by

According to the Bkitcoin Wiki entry for Private key:

Wallet software may use a BIP 32 seed to generate many private keys and corresponding public keys from a single secret value. This is called a hierarchical deterministic wallet, or HD wallet for short. The seed value, or master extended key, consists of a 256-bit private key and a 256-bit chain code, for 512 bits in total. The seed value should not be confused with the private keys used directly to sign Bitcoin transactions.

BIP-0032 says:

Extended keys

In what follows, we will define a function that derives a number of child keys from a parent key. In order to prevent these from depending solely on the key itself, we extend both private and public keys first with an extra 256 bits of entropy. This extension, called the chain code, is identical for corresponding private and public keys, and consists of 32 bytes.

We represent an extended private key as (k, c), with k the normal private key, and c the chain code. An extended public key is represented as (K, c), with K = point(k) and c the chain code.

It then goes on to describe the algorithm used.


Regarding Javascript Libraries


It seems to me that this requires a lot of digging about in documentation and source code.

It initially doesn't seem to be something that can be fully encompassed in the space alloted to answers in this Q&A forum.


  • So, based on what you say: I should split the produced 512 bits seed into two 256 bits parts, use the first part as the master private key, and use the second part as the chain code (entropy). right? – saeid ezzati Nov 14 '18 at 12:10
  • @saeidezzati: that is how it seems to me. – RedGrittyBrick Nov 14 '18 at 12:11

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.