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

<p>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 <a href="http://gobittest.appspot.com/" rel="nofollow">check out my testing suite</a> for that). You can save them in any format, but <a href="https://en.bitcoin.it/wiki/Wallet_import_format" rel="nofollow">Wallet Import Format</a> might be the best choice - it is compact and includes a checksum.</p>

CC BY-SA 3.0
2012-10-20T07:26:48.330Z
2012-10-20T07:26:48.330Z
ThePiachu
<p>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?</p>

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

<wallet><private-key><public-key>
What to save in a wallet?
Anon21
# What to save in a wallet?

(Asked by: username_0 on 2012-10-19)

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?

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


---

## 1 answers

### Answer by username_1 on 2012-10-20. Score: 1

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](http://gobittest.appspot.com/) for that). You can save them in any format, but [Wallet Import Format](https://en.bitcoin.it/wiki/Wallet_import_format) might be the best choice - it is compact and includes a checksum.


---

