Your private key is stored in your wallet. This is the critical piece of information that will allow you to use this address in the future.
Encrypting the wallet have having a backup of wallet.dat are important steps.
But, you can even store you keys completely offline.
Even on a computer that has never been connected to the network.
- Create a new address with:
bitcoin-cli getnewaddress ""
- List all the addresses of account "" with:
bitcoin-cli getaddressesbyaccount ""
- You can now print the private key of an address
bitcoin-cli dumpprivkey <BITCOIN_ADDRESS>
If your wallet is encrypted, you have to unlock it first.
The result of this command will be your private key. You can copy it to a piece of paper and put it somewhere you can safely store it.
You can add it to a wallet in the future. Following this wiki:
Using the bitcoin-cli you need to run (After unlocking your wallet):
bitcoin-cli importprivkey "<YOUR_PRIVATE_KEY>" "" false
The false at the end is to prevent a rescan of the blockchain.