Importing Private Keys into a New Coda Build
This document is designed to walk someone through importing or moving their private keys to a new build. Either you have changed hardware, or you have had to reboot your system to a fresh build. It has been a misconception that when a new Coda daemon is started that you must create a new key with a fresh wallet. This is not the case instead you can move a private key file to the new build and use the Coda Import command to gain access to your original keys.
If you’re coming across this document and this is your first Coda build, then this will mainly just be a good general knowledge for you. If you’re here looking to build your first Coda node then start here. https://codaprotocol.com/docs/. However I would add that once you create your primary key file that you save it in an off line source like a thumb drive or a system NAS either way if you don’t have the private key file then you will not be able to recover your old wallet (as of now, I am sure in the future there will be more options). So let’s get started.
First let’s discuss the private key file and how to find it. When you walk your self through the getting started pages and after you connect for the first time you will be directed to run the “coda client generate-keypair -privkey-path keys/my-wallet” command. Take note that the “-privkey-path” and the directory “keys/my-wallet”. This can be changed to whatever directory you want but pay attention to the user rights for the folder you create and be sure to “chmod” the files. Once created then navigate to the directory you save for example
If we run the “dir” command in linux we will see the files that Coda created Notice that there are 2 files with the key names we choose, there is the “my-wallet” and “my-wallet.pub” the .pub is the public key file, if you open this you will be presented with your public key.
The other “my-wallet” file is your private key file this is the one that is advised that you save offsite from your system.
- So now that we have a private key file, we can walk through the import process. After you have completed the get started files from the Coda website and you connect your node for the first time instead of running the “generate-keypair” you can instead import your old private key. After creating your directory and saving your private key file run the following “coda advance import -privkey-path /path/to/key”. Coda will ask you for your privkey password. This is the same password you used to create the key. Once the password is accepted it will then as you for a new password, here you can change the password or use the same one. In turn it will ask you to verify that same password and once verified you will be presented with a public key and a nice smile emoji. VERY IMPORTANT. This new public key should match the same public key that you originally created. This is how you know it was completed correctly. After you verify that the keys match you will be good to go to restart your Coda node with the correct staking commands and rejoin the test net.