0

I am trying to mint an NFT for the zeroOneGame exercise from gimbalabs on the pre-production testnet (babbage-era) but I incur in an error and I can't see what I am doing wrong. Here are the steps that I am taking:

I create P1.vkey and P1.skey and then build the payment address P1.addr.

I create policy.vkey and policy.skey and then get the hash key for policy.vkey

cardano-cli address key-hash --payment-verification-key-file policy.vkey
> c1ed1f20dee68e6c10a863a5058ff9b44b0ad37f409c38a50fd38f51

I ask for the current slot

{
    "block": 458153,
    "epoch": 42,
    "era": "Babbage",
    "hash": "e4a4ca5c206829d30112a0ed8c95813218d3ccf1713811236081ce2e4933c001",
    "slot": 16656970,
    "syncProgress": "100.00"
}

Now I can create the policy.script

{
  "type": "all",
  "scripts":
  [
    {
      "type": "before",
      "slot": 16670000 
    },
    {
      "type": "sig",
      "keyHash": "c1ed1f20dee68e6c10a863a5058ff9b44b0ad37f409c38a50fd38f51"
    }
  ]
}

Now I can create the policyID

cardano-cli transaction policyid --script-file policy.script
> 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8

In the meantime the P1.addr was funded obtanining the following UTxO

cardano-cli query utxo --address $(cat P1.addr) --testnet-magic 1
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a     0        997833047 lovelace + TxOutDatumNone

I can now build the tx.raw for the minting of my NFT.

cardano-cli transaction build \
--babbage-era \
--testnet-magic 1 \
--tx-in 95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a#0 \
--tx-out $(cat P1.addr)+2000000+"1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--change-address $(cat P1.addr) \
--mint="1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--mint-script-file policy.script \
--witness-override '2' \
--out-file tx.raw

and finally sign it and submit it

cardano-cli transaction sign  \
--signing-key-file P1.skey  \
--signing-key-file policy.skey  \
--testnet-magic 1 \
--tx-body-file tx.raw  \
--out-file tx.signed
cardano-cli transaction submit --tx-file tx.signed --testnet-magic 1

Everything seem correct to me, but unfortunately at this point I get the following error from the cardano-cli

Command failed: transaction submit
Error: Error while submitting 
tx: ShelleyTxValidationError 
  ShelleyBasedEraBabbage (
    ApplyTxError [
      UtxowFailure (
        FromAlonzoUtxowFail (
          WrappedShelleyEraFailure (
            ScriptWitnessNotValidatingUTXOW (
              fromList [
                ScriptHash "0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8"
              ]
            )
          )
        )
      )
    ]
  )

The script witness is not validating the script, yet I have put the right hash of the right policy.vkey in the policy.script, and I am signing the transaction with the relative policy.skey. So the witness should validate the script, why is that not the case?

I see that it mentions something about WrappedShelleyEraFailure, is that something to do with the fact I am not using the right commands for the Babbage era?

Also what is the "W" in the UTXO in ScriptWitnessNotValidatingUTXOW and FromAlonzoUtxowFail indicating?

UPDATE

It seem that the problem was in the script itself. I removed the lines regarding the slot number:

    {
      "type": "before",
      "slot": 16670000 
    },

and the transaction went through creating the token, although without the time limit it is not an NFT. But well it also changes the nature of my question: Why my time limit instruction isn't working?

1 Answer 1

0

When creating a transaction that will consume a script that contains a before you need to add " --invalid-after" to your transaction.

In your case in would look something like :

cardano-cli transaction build \
--babbage-era \
--testnet-magic 1 \
--tx-in 95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a#0 \
--tx-out $(cat P1.addr)+2000000+"1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--change-address $(cat P1.addr) \
--mint="1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--mint-script-file policy.script \
--invalid-after 16670000 \
--witness-override '2' \
--out-file tx.raw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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