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?

1 Answer 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 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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