15

Is there a way to append metadata to transactions that are send from plutus code?

Right now we send transactions from the contracts like follows (or something alike):

ledgerTx <- submitTxConstraintsWith @Cube constraints tx
void $ awaitTxConfirmed $ txId ledgerTx

I know Alonzo is still in development/testing phase, but I was wondering if there is already something in the API do this or there will be (I cant find anything in the code base as of right now).

5
  • AngelCastillo - just wondering if you ever got anywhere with this? I'm currently looking into the same requirement.
    – William
    Jul 29, 2021 at 13:25
  • Not yet, haven't found any info regarding this. I hope by the time we can access the test net to test our dapps, there is some information. Jul 30, 2021 at 4:39
  • Any Updates on how to achieve this ?
    – Dawar Ejaz
    Feb 11 at 11:01
  • Should one of the answers be marked as accepted?
    – gRebel
    Apr 28 at 5:25
  • None of the answers provided so far are correct Apr 28 at 11:42

2 Answers 2

1

I'm not sure in what context you need to append metadata to a transaction, but you may want to check this documentation for any of these helper functions used for creating TxContraints:

  • mustIncludeDatum :: forall i o. Datum -> TxConstraints i o
  • mustPayToOtherScript :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
  • mustPayToTheScript :: forall i o. IsData o => o -> Value -> TxConstraints i o

The first two require a Datum while the last one could be any arbitrary data type converted to a Data using PlutusTx.unstableMakeIsData or its equivalents.

EDIT:

You might want to look into StateMachines. Especially the transition function (which also requires TxConstraints). You may start with this documentation,

1
1

No, it is not possible right now.

To change that, we would need a hard fork introducing this functionality.

1
  • Why would this require a hard fork?. This is off-chain code, is just a matter of serializing the metadata and appending it to the transaction. Or am I missing something? Nov 18, 2021 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.