Handling Private key outside MultiChain

+1 vote
Hi,

When I call getnewaddress, it returns a new address and imports the private key into the node and further I can easily call methods to transfer assets (i.e. sendfrom). This make your development easy but in case I don't constantly backup the node, I can lost all those keys and I cannot spend those assets anymore in case the node dies.

On the second hand, if I call createkeypairs, it provides keys and from those key I can create, sign and broadcast the transaction to any node (still need to backup the keys, but not need to backup the node). This make the development more complex, but reduce the dependency with a specific node.

Is my understanding correct?

Is there any recommendation to "backup" those address when call getnewaddress?
or do I need to import every single addresses that I create by calling getnewaddress?

 

Regards
asked Mar 15, 2017 by Rogerio

1 Answer

+1 vote

You can use dumpprivkey to get the private key for an address from getnewaddress, and importprivkey to import it back into a new node. Alternatively you can back up the wallet.dat file from your blockchain folder.

answered Mar 16, 2017 by MultiChain
Thanks for reply.
In case of backup wallet.dat, do I need to stop the service?
You don't have to stop the server, generaly speaking, but the safest way to backup wallet is to use backupwallet API.

Please note, that in Alpha 28 you should specify full path to the destination file. We'll improve this in Alpha 29 (to be released next week). You will be able to specify destination like "~/backup/wallet.dat" or just "wallet_bkp.dat" (will be saved in multichaind directory)
Thanks for the explanation!
...