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"}'
{"method":"sendwithdata","params":["1aaHSy7jwx5W5iWxUpojxBPEBRLJwfhkvQLgiT",{"status":1},{"for":"stream1","key":"ProductID1","data":"Available"}],"id":1,"chain_name":"CTSChain"}
error code: -8
error message:
data should be hexadecimal string or recognized object]