1

If we import a private key using bitcoin-cli importprivkey <key>, is there anyway to find out when the import was done?

I am hoping a timestamp is included.

1

No, bitcoind does not. bitcoind does store a timestamp for keys however this timestamp is used to determine when to start rescanning. importprivkey does not allow you to specify this timestamp, so in order to be sure to not miss any transactions, the timestamp is set to 1 indicating that the entire blockchain will be rescanned.

The importmulti command allows you to specify the timestamp which by default is the time at which you imported the key. However, as mentioned earlier, since the timestamp is needed for rescanning, if it is not set to be early enough, the automatic rescan done at import time will not catch all of the transactions the key is involved in.

If you want to see the timestamps, you can use getaddressinfo to get the information for the address corresponding to the private key you imported. getaddressinfo will give you the timestamp in unix time.

  • We can assume address was added at the time of private key import.. Will it tell me how to get that timestamp? Even if there is no command, I can write my own parser for wallet.dat outside of bitcoind, as long as the data is stored. – Jus12 Jan 21 at 6:39
  • As I said, the timestamp that it stores is not the timestamp of the import. The timestamp of the import is not stored, only the key "birthdate" is stored, and that depends on the import call used and what you specified in the import. It might be the timestamp of the import if you used importmulti. – Andrew Chow Jan 21 at 6:48
  • It was a fresh wallet and I had used importprivkey. What about the timestamp of the corresponding address that I get from getaddressinfo? Will that be approximately equal to the timestamp (Unix time) of the private key import? – Jus12 Jan 21 at 12:35
  • No, it will not. There is only one timestamp that is stored for each key (and thus address). That timestamp is the same one I described in my answer and comments. – Andrew Chow Jan 21 at 17:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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