How to implement Transaction state maintaining UTXO model?

+1 vote

I want to implement a supply chain model where I want to consume the status based on previous transaction's status. As per I understand correct me if I am wrong using stream I can not achieve the same as in stream we are not giving any previous transaction id in API calls. Using Raw Transaction we can refer previous Transaction but for that I need to issue Asset. 

So for my case if a product's status is changed from "Available" to "Shipped"  then is it mandatory to issue Asset even if it is not required. Suppose I would have  5 intermediate state changes, then I would issue "issue 1aaH.. status 5"

Then For every state change I would deduct 1 asset like this -

sendwithdata 1aaHS.. '{"status":1}' '{"for":"stream1","key":"ProductID1","data":"486921"}'

Please let me if it is the correct way of maintaining "State change" using UTXO model structure or is there any alternative easier way for the same.

[Note: I am not able to give data as "Available" and getting this error -

CTSChain: sendwithdata 1aaHSy7jwx5W5iWxUpojxBPEBRLJwfhkvQLgiT '{"status":1}' '{"for":"stream1","key":"ProductID1","data":"Available"}'

error code: -8
error message:
data should be hexadecimal string or recognized object]



asked Aug 6 by anonymous

1 Answer

0 votes
Best answer

If you don't need to move to production in the short term, we recommend using MultiChain 2.0 alpha to work on this. It gives you two key advantages:

  1. Support for text data. If you wanted to put text data in a stream, you would use this form: "data":{"text":"Available"} rather than "data":"Available"
  2. Support for data within regular UTXOs. This can help in your use case because you can have data being directly consumed because it is sitting inside a UTXO that is spent. Search for 'inline metadata' on this page:
answered Aug 6 by MultiChain
createrawsendfrom with stream creation
What is the difference between asset combined with stream and asset with inline meta data other than the data volume.Can you please elaborate?