Motivation: Create keys on a secure system using only OpenSSL or similar software. Receive BTC, then when ready to spend them, use importkey in a running client.
importkey <file> <account> Reads a PEM-encoded keypair from file and adds it to the wallet. To create a keypair with OpenSSL, use: openssl ecparam -name secp256k1 -out NEW_KEY.pem -genkey Returns the key’s bitcoin address.
$ bitcoind importkey ~/NEW_KEY.pem TestAcct mt5M3Qa7fXsUV3bK6WtWTZEvXY2M1UPEgv
Bug: I’d like to safeguard against overwriting a key in the wallet with bogus data. Bug: I don’t understand what has to be mutexed. Bug: Should do anything possible to make sure the imported key is valid.
Note: I did not implement the corresponding export function, because my use case does not require it. I will be happy to implement it if this will improve the patch’s chance of acceptance.
Note: To make this convenient, one (I) would write a little script to read one of these PEM files and print a Bitcoin address. All key handling would be possible offline, and certainly in the absence of a block chain, until spend time. For my next trick, expect offline transaction signing and an importtx function.
Forum topic: http://forum.bitcoin.org/index.php?topic=9046.0