Private Keys


The private keys for your coin addresses are stored in the wallet.dat file.

These keys can not be reproduced.


If your computer/hard drive crashes and the wallet.dat file gets corrupt - or you delete that file,
your coins are gone forever, with no possible way of retrieving them.

seriously, make backups.


Backing up

The easiest way to back up your coins is to have a copy of your wallet.dat file.

Most wallets have the option to make a backup built in.
For those that don't, or you want to know how to do it manually:
 
with the wallet shut down - to avoid corruption,
copy the wallet.dat file to somewhere safe, like a thumb drive (USB memory stick)

For window users, the file is located:
C:\Users\**yourname**\AppData\Roaming\**CoinName**\

For Mac users it is a little more complicated.
In order to see hidden folders, such as ~/Library from Finder,
simply hit shift + ⌘ (command) + G which will GO to a folder,
then paste in this location:
~/Library/Application Support/**CoinName/

I use a thumb drive, and have folder for each of my coins, then I can put
the wallet.dat in a folder without having to rename it



Another way to have backups, is to dump the private key for each address

How?

This is how I dump my private keys:
Click "help" then "Debug window"
the debug dialog will open in a new window

click the console tab.
This is where you can type commands to the wallet.

Type:
listaccounts

It will list any account names you have.

if you haven't added a label to an address
(named an account) then the wallet will use ""







The next thing to do is type
getaddressesbyaccount ""

it looks like I have two addresses.
Copy/Paste the addresses into notepad, or some other text editor

to get your private key, type
dumpprivkey BFv7bEZCLU3rVacwGHbTBb7M2gHv55Haag

the wallet will print your private key

Copy/Paste the private key into your text editor.
Now do the same for each address you have.

You can save the text file of your private keys on the thumb drive with the wallet.dat file





Importing

To import your key:
importprivkey thelongprivatekey

You wallet may -or- may not scan the blockchain automatically after you
import the key, I think most wallets will.





Notes

Your wallet may create new addresses on it's own.

if you have a block of 100 coins, and you send 25 coins somewhere,
your wallet has to use the whole block of 100 coins as an "input"

The remaining 75 (minus txfees) will be sent back to your wallet -
some times using a new address for the change.

This new address will not be in your backed up wallet.dat file
So - as you can imagine, you need to make "fresh" backups from time to time.
  - and also dump the privite key of any new addresses.

 





Recap

using the debug console:

dumpprivkey youraddress

importprivkey theprivekey