Wallet Management
Wallet Management
General
Snowblossom clients, including SnowBlossomClient and IceLeaf use a wallet database mechanism that involves a directory rather than a single file.
It has some really cool properties.
- All writes involve adding data - the wallet can be see as an append only data store of sorts.
- The operations are all idempotent, so there is no problem if multiple files have the same data.
- So when a client saves data, like adding a new key and address, it simply adds a new data file.
- To avoid an explosion of data file numbers, when a client starts up it reads all existing files and merges them into a single new database file.
- Only once the new file is written correctly, the old files are deleted.
The net effect is that you can do a lot of things safely.
- You can run multiple clients using the same data directory using real-time syncing, like a shared filesystem
- You can run multiple clients using the same data directory with eventual consistency syncing, like Dropbox
- You can run multiple clients using manual syncing. Not sure which clients have been generating new keys? Maybe multiple have? No problem, just copy all files into the wallet database directory. The client will merge them all on startup.
For HD Seed wallets, this isn't very important, you can just restore from seed. However our new and interesting wallet types do not support deterministic generation from seed, so as new keys are generated it is important to keep the wallet backed up.
How Key Generation Works
For non-HD wallets, the client will automatically generate new addresses and associated keys as needed to maintain a pool of unused addresses. As addresses get used, the client will mark them as used and generate more. So as you use a wallet and it is creating new addresses, it is important to make regular backups. The frequency of the required backups is relative to the number of transactions you do to new addresses.
Example: Lets say on Jan 1st, you make a new non-HD wallet and create a backup. 10 fresh addresses are automatically generated and those 10 addresses and keys are in the backup. If you use a fresh address for each receive and when you send an unused address is used for each send for the change, then you can do 10 transactions without doing another backup. The addresses you use will be the ones used in that initial backup. However, after that you'll be using new addresses that are not in the backup and it should be updated.
So in short, if you don't do many transactions, you don't need to update your backup. If you do regular transactions, you need to update the backup regularly.
Note: if all you do is receive transactions and reuse addresses (like mining rewards) then you don't need to refresh backups.