Skip to main content
2 of 2
fixed grammar, corrected spelling, added new tags

How to handle datum in a decentralized way?

What is the best practice of storing the local state of an UTXO to be publicly visible on-chain?

Thinking about how application would function in the future I thought that in a good DeFi ecosystem all datums should be publicly deducible. That is, no intermediate should be needed to process the state. And since the hash function is a one way function there is no deducing what a hashed state represents.

Right now datums can only be send in a transaction as a hashed values right? The cardano-cli only supports building transactions with the command --tx-out-datum-hash. I do not know what the protocol allows at the moment, maybe it is allowed but the client won't construct such transactions for you. Now to overcome this one can send unhashed metadata with the transaction to publicly anounce the datum in the same transaction. I am missing some other way? This extra hashed datum is a bit redundant, though I know it is needed now since UTXO's with empty datums are unclaimable [1].

I think that the SpaceBudz auction contract is initiated in the above described way, metadata is send with every UTXO that is inbound of the script address [2]. I have not figured out how this metadata is correctly formatted to correspond to datumhash. More explicitly, I am yet to construct a json that hashes to the datum via the command cardano-cli transaction hash-script-data --script-data-file file.json.

Lastly I wonder in general what the impact is of these uncompressed metadata transaction. All plutus core code is serialized to hex and is transformed to CBOR before transacting. Would it be a good habit to do this for metadata as well? I have now idea what the PAB will do in this respect, maybe this is a no-brainer?

Fermat
  • 1.9k
  • 4
  • 20