Wallet's state persistence #2097
-
Hey! I am building some standalone wallet like meta mask or bitcoin wallet that syncs the transactions, blocks, balances with blockchain. I am trying to figure out how it is possible to store current wallet state to file and then to load it on next application start. Is it supported or no? Or ether.js is not that library that can help with it and I should create some own solution? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Depending on what you need to restore from or to (e.g. Do you need the mnemonic? Do you need to derive multiple paths from the HD seed? Does your wallet need to preserve the chain ID?) you can either store the If storing the HDNode, a read-only extended key might also be useful if you need to generate all child addresses, but not their private keys. Much of the decisions depend on how your wallet operates and the functionality you wish to provide. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Depending on what you need to restore from or to (e.g. Do you need the mnemonic? Do you need to derive multiple paths from the HD seed? Does your wallet need to preserve the chain ID?) you can either store the
mnemonic
or just theprivateKey
. Either is enough to reconstruct theWallet
object.If storing the HDNode, a read-only extended key might also be useful if you need to generate all child addresses, but not their private keys.
Much of the decisions depend on how your wallet operates and the functionality you wish to provide.