i am working on website which receives and store bitcoins each user will credited with newaddress for deposit BTC how would i take backup of their privatekeys with bitcoind i think bitcoind generate address from key pool which is limited to 100 after that it will generate new key pool what are the best practices to maintain backups
1 Answer
The addresses that you get from getnewaddress
are part of your wallet. To back them up, use the backupwallet
RPC command. This will create a copy of your wallet file at the location that you specify.
Bitcoin Core by default has a keypool of 1000 keys. However because Bitcoin Core uses BIP 32 Hierarchical Deterministic wallets, one backup is sufficient for you to be able to generate all of the private keys your wallet will ever have.
Although you will have access to all private keys, it is still recommended that you backup regularly in order to preserve transactional data and other metadata stored in the wallet, as well as have all of the keys and not need to regenerate them upon restore (restoring may not necessarily get all of the transactions associated with keys that were not in the keypool at the time of backup). Thus you should backup the wallet every 1000 keys so that the latest unused keypool is always part of your most recent backup.
Also, if your wallet is encrypted (it should be), then you will need to unlock your wallet every 1000 keys so that the keypool can be refilled. You can do that with the walletpassphrase
RPC command.