Can we enforce having a unique item for each key?

+1 vote
Hi,

I would like to retrieve some specific data from a stream by using a unique ID that the user can procedurally deduce. Hence, I cannot use the txid and would like to use the key to that extend, which then requires it to be used for only one item. Is there any way to do that, or do I have to enforce that rule from outside multichain?

Thank you very much
asked Oct 16, 2017 by 13013

1 Answer

0 votes
 
Best answer

You cannot prevent multiple items being written to a stream with the same key.

But when retrieving, just use liststreamkeyitems with count=1 and start=0 to retrieve the first item for a particular key, and ignore any subsequent items. That will achieve the same effect!

answered Oct 16, 2017 by MultiChain
...