<p>Both of the keys are a part of the <a href="http://en.wikipedia.org/wiki/Elliptic_Curve_DSA">Elliptic Curve Digital Signature Algorithm</a>. 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 <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses">Bitcoin address</a> by means of hashing and other operations.</p>

<p>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 <a href="http://gobittest.appspot.com/Address">testing suite website</a>.</p>

<p>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 <code>dumpprivkey</code> <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list">Bitcoin API</a> call.</p>

CC BY-SA 3.0
2012-09-12T12:51:57.407Z
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
CC BY-SA 3.0
2012-09-13T00:59:58.147Z
@PieterWuille Edited accordingly
ThePiachu
CC BY-SA 3.0
2012-09-12T05:40:02.870Z
2012-09-13T00:59:48.850Z
2012-09-13T00:59:48.850Z
ThePiachu
<p>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?</p>

CC BY-SA 3.0
2012-09-12T05:45:24.533Z
I found this answer helpful: http://bitcoin.stackexchange.com/a/3057/516
Highly Irregular
<private-key><public-key>
What is a private key and a public key?
Sam Weinberg
# What is a private key and a public key?

(Asked by: username_0 on 2012-09-12)

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?

**Tags:** private-key, public-key

> **Comments:**
> **username_1**: I found this answer helpful: http://bitcoin.stackexchange.com/a/3057/516  

---

## 1 answers

### Answer by username_2 on 2012-09-12. Score: 12 | Accepted answer

Both of the keys are a part of the [Elliptic Curve Digital Signature Algorithm](http://en.wikipedia.org/wiki/Elliptic_Curve_DSA). 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](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses) 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](http://gobittest.appspot.com/Address).

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](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list) call.

> **Comments:**
> **username_3**: 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.  
> **username_2**: @username_3 Edited accordingly  

---

