Hi, I am looking into how the grin-wallet database works (I’m tinkering with a few ideas for features/improvements), and wanted to know more about the design rationale.
Is the wallet DB expected to contain secret data? Or is all data encrypted by the master key? I believe it is the latter, but I want to confirm.
How quickly can I expect the database to grow? It seems like the biggest contributor to database size is TX log entries, but I may be wrong. Am I right to assume this grows linearly with the number of TXs a wallet sends/receives/both? Are there other events that cause database growth asynchronous from TX events? e.g. MMR index updates or something like that?
Does the database ever shrink? e.g. pruning, consolidation, compression, or some other activity that shrinks overall DB size?
I’ll try to partially answers some question and hope @Yeastplume can chime in and add to it.
Every transaction comes with a Context struct which contains the nonce secret used for signing this transaction. IIRC these are encrypted based on the master key. Edit: Yes, here it happens.
Each transaction comes at least with Context, TxLogEntry, OutputData structs. I’m not sure we prune these ever so yes, they grow linearly with the number of transactions. Perhaps the biggest part of the TxLogEntry is the tx field. I’m not sure about the other part of the question of async events that would cause growth.
Not sure, perhaps we forget the context or secret keys in the context once we sign the tx. Maybe this could be considered shrinking though it’s relatively small.
Thanks for looking into it.
P.S. These two rfcs contain good wallet information as well