Why is wallet folder size large in contrast to blocks folder?

+1 vote


We are running tests to determine per-node storage requirements with:

- 2 Nodes

- Publishing items (key-values) to a stream (Not Subscribed)


Change in file size after publishing 1 item to a stream in 1 block 
Change in size of ./Blocks folder3409 bytes
Change in size of ./Wallet folder4492 bytes 


Change in file size after publishing 10 items to a stream in 1 block 
Change in size of ./Blocks folder3839 bytes
Change in size of ./Wallet folder18576 bytes 


Change in file size after publishing 100 items to a stream in 1 block 
Change in size of ./Blocks folder7732 bytes
Change in size of ./Wallet folder187561 bytes 
Note: Publishing one item corresponds to one transaction on-chain.


Q1: Why does the node wallet that created the item store such large amount of data in contrast to blocks folder? Even though we have not subscribed to the stream!

Q2: Does Multichain have an option of not storing transactions in wallet? (This is because we are indexing and keeping the reference to on-chain transactions in an external off-chain database)

Thank you ! 

asked Dec 21, 2018 by Mihir2.0

1 Answer

+1 vote

This is the expected behavior, because the wallet is storing (and indexing in several ways) every transaction that was broadcast from the node's own addresses, for rapid retrieval via APIs such as listwallettransactions.

If you want to avoid this behavior, your best option for now is to use an external private key / address for publishing to the stream, and then the wallet will not locally store and index each item. First, one time, create the key pair using createkeypairs and make sure the address is given the necessary permissions.

Then for each item use the createrawtransaction API to prepare each item for publishing, and always include an empty change output back to the original address. Always remember the txid+vout of the change output of the last transaction, and use that as the input for the next transaction (the first txid+vout can be from the transaction that granted permission to that address). After creating the transaction for an item, use signrawtransaction passing in the private key to sign it, then sendrawtransaction to broadcast it.

We understand this is not so convenient and will be looking into adding more options for not indexing locally generated transactions in future.

answered Dec 21, 2018 by MultiChain