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 am programming a specialty wallet software. I am able to generate a EC_key and valid bitcoin addresses. I am not sure what to save to a wallet file in order to recover the EC_key in the future. Must I save both the private and the public key? Can I just save the private key?

What is the preferred format to save these keys and what openssl function should I use to restore the keys?

share|improve this question

If you want to save your keys as a proper wallet.dat file, you would need to comply with its format.

If you want to store your keys for some other purposes, you only need to save the private keys (public ones can be recreated, you can check out my testing suite for that). You can save them in any format, but Wallet Import Format might be the best choice - it is compact and includes a checksum.

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.