Maximum length of stream name

+1 vote

Hello, I want to create a stream on Multichain having the same name as a atomic transaction txid in order for the other participants in the network to know the stream is belonging to the atomic transaction.

Anyhow, there seems to be a limit for a stream name. is this limit necessary and if yes, how could I relate the transaction and the stream otherwise.

Thanks a lot.

asked Oct 17, 2021 by whyever

1 Answer

+1 vote
 
Best answer
There's no need for you to do anything to associate the transaction and stream, because the txid of the transaction which created the stream can be used directly as a parameter in all APIs relating to that stream, as an alternative to the name (or streamref). So your best solution is to not pass any name at all, in which case it will be an unnamed stream that can be referenced by its creation txid.

(In any event, you could never set the stream name to the creation txid because the txid depends on the content of the transaction, and the stream name is part of that content, so you have a dependency loop.)
answered Oct 17, 2021 by MultiChain
selected Oct 17, 2021 by whyever
Thank you for the rapid reply!
At the moment in my corporate usecase I have an OEM selling his product to a customer using an Atomic Transaction (Asset(product) exchanged for Asset(USD)). The ID of that transaction is then used by an IoT Service to issue a new Stream and to write to it every 5 seconds data about location, temperature, humidity and so forth. In order to Assure the customer the IoT Device is belonging to the atomic transaction, I was thinking about giving it the same name as the Atomic Transaction id.

Now you proposed the IoT Service to use the txid not as a name, but as a reference to create the stream is that correct?

The other possibility would be to name the Stream like the real-world IoT Device such as "iot00001" and have it be related to the actual device id, telling the customer which device has been set up to monitor the OEMs Product.

What would be a good way to meet the problem of clearly identifiying an IoT Device (Stream) to an atomic transaction here.

Thank you
First, the maximum length of a stream name is 32 characters.

Anyway, I'd misunderstood the situation previously. If you want to use the txid of the exchange transaction as the stream identifier, you would need to have the stream created inside the same transaction as the exchange transaction. While theoretically possible I'm not sure this will be practical in terms of your chain's permissions and the flow of creating and signing the exchange transaction.

So how about naming the stream after the first 32 characters of the transaction ID of interest. This will still be unique to an ridiculously high probability. You can then put the full txid in the stream "details", e.g.:

create stream 5c085151738a9db2190ce7b61e5c2672 false '{"from-txid":"5c085151738a9db2190ce7b61e5c267211417bd05629b906d9c7a163595ebb6a"}'
liststreams 5c085151738a9db2190ce7b61e5c2672
Thank you for investing the time.
I greatly appreciate your Q&A Section and I would recommend the product to everyone already because of this.
your idea is very good and I will implement it like that.

Thanks a lot.
...