user8026: Hello Cardano developers, I really hope you can help me :)
I'm developing a Dapp and I need to mint a NFT. This works through a website, so a user clicks in a button to mint a NFT. Simple, right?
I figured how to send a transaction. My code allows the user to send an amount of ADA to my wallet. However, when I add the following code
        # Set nft we want to mint
        builder.mint = my_nft

        # Set native script
        builder.native_scripts = native_scripts

        # Set transaction metadata
        builder.auxiliary_data = auxiliary_data

my code breaks :( I've set up the metadata correctly (I tested on pool.pm/test/metadata), I also calculated the outputs, as well as the minimum value to go with the NFT. You can see below the transaction object returned when submitting.
I will leave the error too.
Thank you for your help.
Transaction: 
 {
  'auxiliary_data': None,
  'transaction_body': {
    'auxiliary_data_hash': AuxiliaryDataHash(hex='68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0'),
    'certificates': None,
    'collateral': None,
    'collateral_return': None,
    'fee': 196873,
    'inputs': [
      {
        'index': 0,
        'transaction_id': TransactionId(hex='6ca198e4b77746d1cc5e7d039958fdd8ba0a49383d9ff5ead25967a483ced2c4'),
      },
      {
        'index': 1,
        'transaction_id': TransactionId(hex='9c09d98a5d6f7618838dd39be3b0c1e6c2f2142c034c92dcacc93bc3096522ec'),
      },
    ],
    'mint': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
    'network_id': None,
    'outputs': [
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 1417990,
          'multi_asset': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1vz4tng24jteu2989g67ztrvzkgduy97awnlqv54th0fv76c7vpwu0,
        'amount': {'coin': 98582010, 'multi_asset': {}},
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 8628629836,
          'multi_asset': {ScriptHash(hex='57e8d0b5f11c6a329bea53d237c660ecef7cb884a3644761034c1e97'): {AssetName(b'Faketoken'): 100, AssetName(b'Faketoken2'): 100}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
    ],
    'reference_inputs': None,
    'required_signers': None,
    'script_data_hash': None,
    'total_collateral': None,
    'ttl': 20440000,
    'update': None,
    'validity_start': None,
    'withdraws': None,
  },
  'transaction_witness_set': {
    'bootstrap_witness': None,
    'native_scripts': None,
    'plutus_data': None,
    'plutus_v1_script': None,
    'plutus_v2_script': None,
    'redeemer': None,
    'vkey_witnesses': [
      {
        'signature': b'\xdc\\\xd8l:\x91:\x1f\xc2\x88hae\x14\x7f\xd3\xca\xc5\x1e\x81@2\xad+\r\xdfi\x86AN?\x1cN\xd2S\xe8mu?\xc7\xe2\x98\x07\xd1\x9b3\x1a\x07W\xb8\xec\n \xe4QW\x9dT\xdc\x1a\xd8\x1f\x1b\x0e',
        'vkey': {"type": "", "description": "", "cborHex": "58201998b14fad7342650d95dc5ce34b461ad9bb714bed69ad2b92f5d685e0545630"},
      },
    ],
  },
  'valid': True,
}

blockfrost.utils.ApiError: {'error': 'Bad Request', 'message': '"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingScriptWitnessesUTXOW (fromList [ScriptHash \\"accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a\\"])))),UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingTxMetadata (AuxiliaryDataHash {unsafeAuxiliaryDataHash = SafeHash \\"68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0\\"}))))])"', 'status_code': 400}


user2402: The problem is the NFT's native script is missing from the transaction. See this line in the transaction repl:
'native_scripts': None,

Not sure how this transaction was build, but looks like you have set native script correctly in your tx builder. You can use builder.build_and_sign([signing_key]) to create a full transaction that contains the native script in witness set.

8026: <p>Hello Cardano developers, I really hope you can help me :)</p>
<p>I'm developing a Dapp and I need to mint a NFT. This works through a website, so a user clicks in a button to mint a NFT. Simple, right?</p>
<p>I figured how to send a transaction. My code allows the user to send an amount of ADA to my wallet. However, when I add the following code</p>
<pre><code>        # Set nft we want to mint
        builder.mint = my_nft

        # Set native script
        builder.native_scripts = native_scripts

        # Set transaction metadata
        builder.auxiliary_data = auxiliary_data
</code></pre>
<p>my code breaks :( I've set up the metadata correctly (I tested on pool.pm/test/metadata), I also calculated the outputs, as well as the minimum value to go with the NFT. You can see below the transaction object returned when submitting.</p>
<p>I will leave the error too.</p>
<p>Thank you for your help.</p>
<pre><code>Transaction: 
 {
  'auxiliary_data': None,
  'transaction_body': {
    'auxiliary_data_hash': AuxiliaryDataHash(hex='68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0'),
    'certificates': None,
    'collateral': None,
    'collateral_return': None,
    'fee': 196873,
    'inputs': [
      {
        'index': 0,
        'transaction_id': TransactionId(hex='6ca198e4b77746d1cc5e7d039958fdd8ba0a49383d9ff5ead25967a483ced2c4'),
      },
      {
        'index': 1,
        'transaction_id': TransactionId(hex='9c09d98a5d6f7618838dd39be3b0c1e6c2f2142c034c92dcacc93bc3096522ec'),
      },
    ],
    'mint': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
    'network_id': None,
    'outputs': [
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 1417990,
          'multi_asset': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1vz4tng24jteu2989g67ztrvzkgduy97awnlqv54th0fv76c7vpwu0,
        'amount': {'coin': 98582010, 'multi_asset': {}},
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 8628629836,
          'multi_asset': {ScriptHash(hex='57e8d0b5f11c6a329bea53d237c660ecef7cb884a3644761034c1e97'): {AssetName(b'Faketoken'): 100, AssetName(b'Faketoken2'): 100}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
    ],
    'reference_inputs': None,
    'required_signers': None,
    'script_data_hash': None,
    'total_collateral': None,
    'ttl': 20440000,
    'update': None,
    'validity_start': None,
    'withdraws': None,
  },
  'transaction_witness_set': {
    'bootstrap_witness': None,
    'native_scripts': None,
    'plutus_data': None,
    'plutus_v1_script': None,
    'plutus_v2_script': None,
    'redeemer': None,
    'vkey_witnesses': [
      {
        'signature': b'\xdc\\\xd8l:\x91:\x1f\xc2\x88hae\x14\x7f\xd3\xca\xc5\x1e\x81@2\xad+\r\xdfi\x86AN?\x1cN\xd2S\xe8mu?\xc7\xe2\x98\x07\xd1\x9b3\x1a\x07W\xb8\xec\n \xe4QW\x9dT\xdc\x1a\xd8\x1f\x1b\x0e',
        'vkey': {&quot;type&quot;: &quot;&quot;, &quot;description&quot;: &quot;&quot;, &quot;cborHex&quot;: &quot;58201998b14fad7342650d95dc5ce34b461ad9bb714bed69ad2b92f5d685e0545630&quot;},
      },
    ],
  },
  'valid': True,
}
</code></pre>
<pre><code>blockfrost.utils.ApiError: {'error': 'Bad Request', 'message': '&quot;transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingScriptWitnessesUTXOW (fromList [ScriptHash \\&quot;accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a\\&quot;])))),UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingTxMetadata (AuxiliaryDataHash {unsafeAuxiliaryDataHash = SafeHash \\&quot;68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0\\&quot;}))))])&quot;', 'status_code': 400}
</code></pre>
 2402: <p>The problem is the NFT's native script is missing from the transaction. See this line in the transaction repl:</p>
<pre><code>'native_scripts': None,
</code></pre>
<p>Not sure how this transaction was build, but looks like you have set native script correctly in your tx builder. You can use <code>builder.build_and_sign([signing_key])</code> to create a full transaction that contains the native script in witness set.</p>
