Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

What exactly is a private key and public key in relation to Bitcoin? What are they, how are they used, and how does one find out what their private and public keys are?

share|improve this question
    
I found this answer helpful: bitcoin.stackexchange.com/a/3057/516 –  Highly Irregular Sep 12 '12 at 5:45

1 Answer 1

up vote 7 down vote accepted

Both of the keys are a part of the Elliptic Curve Digital Signature Algorithm. A private key is just a random number, while the public key is a 2D point coordinate on an Elliptic Curve derived from it. The private key is used to sign messages (in case of Bitcoin - the transactions), and the public key is used to check whether the signature is correct. The public key can either be used raw in a transaction, or turned into a Bitcoin address by means of hashing and other operations.

One can use any library that supports the ECDSA curve used by Bitcoin (secp256k1) to generate the appropriate keypair. There are some online solutions for these tasks, for example my small testing suite website.

However, most commonly one leaves key pair generation to the Bitcoin program. If needed be, the private key can be retrieved from the program by using dumpprivkey Bitcoin API call.

share|improve this answer
2  
A public key is technically not a number, but a pair of coordinates of a point on the EC curve. Also, it doesn't really get encoded into a Bitcoin address; an address encodes the hash of a serialized public key. –  Pieter Wuille Sep 12 '12 at 12:51
1  
@PieterWuille Edited accordingly –  ThePiachu Sep 13 '12 at 0:59
1  
BTW, brainwallet.org is a great tool! –  Tomas Sep 13 '12 at 14:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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