Title: Code lines for keys generation Post by: beckspace on September 21, 2012, 10:49:04 PM What are the lines of code that actually generate the public/private keys for Bitcoin? I'd like to know where to look (search for words and commands) when inspecting a source code, in the original client and others alternatives clients as well (blockchain.info, bitaddress.org etc.) Thanks. Title: Re: Code lines for keys generation Post by: Remember remember the 5th of November on September 21, 2012, 11:07:41 PM Those lines you are talking about are not exactly the same across different languages. Look here https://github.com/bitcoin/bitcoin/blob/master/src/key.cpp
The whole file is relevent, but you also might want to take a look at void CKey::MakeNewKey(bool fCompressed) Title: Re: Code lines for keys generation Post by: kjj on September 26, 2012, 04:43:26 PM The "short" version:
generate a random 256 bit number. Use a high quality entropy source. make sure it is less than the number of possible spots in the curve you are using (start over if it is) -> this is your private key do an elliptic curve multiply of your curve's generator point by the private key -> this is your public key Converting those keys to/from other formats (like bitcoin addresses or WIF) is another big topic. |