Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know because I would like to generate a vanity address at Vanity Pool.

share|improve this question
up vote 10 down vote accepted

Install OpenSSL. When the executable in your path, enter this command to generate a private key:

openssl ecparam -genkey -name secp256k1 -noout -out myprivatekey.pem

To create the corresponding public key, do this:

openssl ec -in myprivatekey.pem -pubout -out mypubkey.pem

This will give you both keys in PEM format. I'm not sure what format the web page wants, but it shouldn't be difficult to convert. You can use variants of the last command to output other formats. Remove -pubout if you want the private key, leave it if you want the public key. And you can use -outform DER to get DER format. You can use -text to get hexadecimal.

Do not give any form of your private key to anyone else.

share|improve this answer


openssl ecparam -genkey -name secp256k1 -out tmp/data.pem

get private key:

openssl ec -in tmp/data.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32

get public key:

openssl ec -in tmp/data.pem -pubout -outform DER|tail -c 65|xxd -p -c 65
share|improve this answer

Your Answer


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.