10

I see 3 files with the name of my wallet:

wallet-name, wallet-name.keys, wallet-name.address.txt

What is stored inside them? Does the wallet store the public and private keys and nothing else? Or does it contain the list of transactions related to the wallet as well and their location on the blockchain?

In other words, if I copy my cold wallet to a connected PC, and this connected PC has downloaded the blockchain as well, do I need to rescan the whole blockchain or will the wallet immediately know the list of blocks where my coins are stored?

Note: re-post of a question asked on reddit

9

What is stored inside them? Does the wallet store the public and private keys and nothing else? Or does it contain the list of transactions related to the wallet as well and their location on the blockchain?

  • The wallet-name.address.txt stores only the address. It is just for convenience if you want to know your address without having to open the wallet. In my opinion it presents a security risk as it could be easily replaced with a .txt file containing a different address, by malware or someone accessing your computer.
  • The wallet-name.keys stores your private keys. If it's a watch-only-wallet, it will store only your private view key. Important information inside of it can be recovered from the seed mnemonic. It is stored encrypted with your wallet password. The keys file also contains user options like "always-confirm-transfers", etc, plus the refresh height (to skip old blocks from before the wallet was first created)
  • The wallet-name stores all other wallet data (also encrypted with your wallet password), such as:
    • All the outputs belonging to the wallet, which are found by scanning the blockchain when you're refreshing the wallet. To avoid having to do the scanning every time, the wallet stores them once found.
    • A key image for each signed output. This information is required to be able to check whether an output was spent or not. Without this information, the wallet will not display the correct balance.
      • Each signed output will always generate the same key image, which is then compared against all the key images on the blockchain. If found, it means that the output was already spent.
      • The key images are a mechanism used to prevent double-spends.
      • If it's a watch-only wallet, it will not have this, as it can't sign the outputs (for which the private spend key is needed).
      • However, you can import key images produced by the full-wallet counterpart, and have the correct balance displayed.
    • Metadata for each outgoing transaction (personal notes, tx keys, transaction history)
    • A set of block hashes, to detect blockchain reorgs

In other words, if I copy my cold wallet to a connected PC, and this connected PC has downloaded the blockchain as well, do I need to rescan the whole blockchain or will the wallet immediately know the list of blocks where my coins are stored?

Yes, if you've restored your cold wallet from keys. It is true that your copy of the blockchain has all the information, but to know the balance, wallet needs to scan it with wallet-specific private view key to find outputs belonging to it. Then, it needs to sign them, generate key images, and compare against those found on the blockchain so it can mark each output as spent or unspent.

After you refresh your cold wallet for the first time, and if you don't discard the wallet files but choose to keep them saved on your cold PC, next time you transfer a fresh copy of the blockchain over to your cold PC you won't have to do it from scratch as it will already be refreshed up to a certain block height.

For more details about cold spending process, see here.

  • The keys file also contains user options like "always-confirm-transfers", etc, plus the refresh height (to skip old blocks). The cache file also contains a set of block hashes, to detect reorgs. – user36303 Nov 27 '16 at 17:23

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.