How to purge and remove the expired stream transaction data?

+5 votes
I am using permissioned Multichain stream data to capture IoT sensor data, the data is stored in my Raspberry Pi, the volume of stream transaction data in increasing in fast pace.
Can I set an expiration date on the transaction?
What are the recommended method to purge the expired transaction data?
If the expired transaction data had been purged, can the expired transaction data been removed from my Raspberry Pi?
Thank you.
asked Aug 13, 2023 by Moke Kwai Cheong

1 Answer

+1 vote

First I'm not sure how you are using permissioned stream data, because this is only supported on MultiChain Enterprise, which isn't available for Raspberry Pi.

If you were using MultiChain Enterprise, you could use the purgestreamitems command.

answered Aug 13, 2023 by MultiChain
I am using the opensource/free version of Multichain version.
Understood that the purgestreamitem function is only available for Enterprise version.
I like to assess this deletion and purging in small scale for IoT sensor, any recommendation?
Use off-chain data in your stream items. While you can't purge individual/selective stream items in the free version of MultiChain, you can purge all items when unsubscribing from a stream.
Just to confirm that I can use the unsubscribing from the streams that been retrieved into MySQL offline and free up the Raspberry SBC storage for next round of transaction capturing and publishing, correct?
Yes, you can do that. But the publishing node will still retain a copy of the offline data published, whether it is subscribed or not.
The stream data will be permanently retained in publishing node, right.
Nevertheless, this practice will reduce the storage for the stream transactions from other publishing nodes tremendously, correct?
The entire practice reduces the computing and storage requirements on resource-hungry node, as well as reduce the time for stream transaction synchronization for a new node joining.
This will reduce the storage for stream transactions on any other node, whether it publishes or not. It means the blockchain itself is smaller, reducing storage and processing time for nodes which are not subscribed to that stream.