# Mint NFTs (CIP-25)

## Introduction

The `transactions/build` endpoint using the `mint` type allows for the creation of unique digital assets (NFTs/Native Assets) following the CIP-25 metadata standard. This guide demonstrates how to structure API requests when working with the Anvil platform to mint these assets, whether you're establishing a new collection or adding to an existing one.

### CIP-25 Mint with New Policy

#### Prerequisites

Before minting a new NFT collection, ensure you have the following:

1. A valid ADA wallet address (change address)
2. A list of UTXOs (Unspent Transaction Outputs) from your wallet. See [UTXOs](/guides/transaction/selecting-utxos.md)
3. A unique asset name (UTF-8 or hex format)
4. Custom metadata for your NFT (Use <https://metadraft.io> to generate accurate metadata easily.)
5. A native script registered on the Cardano blockchain. (See [Creating Native Scripts](/guides/nft-and-ft/native-scripts/create-native-script.md) for more information.)

For more information about native scripts, please see:

{% content-ref url="/pages/oLM0BLwLeb3jtJ9aLFaj" %}
[Native Scripts](/guides/nft-and-ft/native-scripts.md)
{% endcontent-ref %}

#### Request Structure

**Payload**

{% code overflow="wrap" %}

```json
{
  // Specifies which address should receive any leftover ADA (change) 
  // after the transaction is completed and fees are paid
  "changeAddress": "addr_test1qqwadht4defe...",

  // An array of UTXO strings from the wallet paying for the transaction.
  "utxos": ["8282...", "8282..."],

  // An array of assets to be minted.
  "mint": [
    {
      "version": "cip25",
      // UTF-8 or hex format - Must be unique within the collection.
      "assetName": { "name": "anvilapicip25", "format": "utf8" },

      // Custom Metadata for your NFT. Replace with your own CIP-25 standard values.
      // Use https://metadraft.io to generate accurate metadata easily.
      "metadata": {
        "name": "YOUR_NFT_NAME_HERE",
        "image": [
          "https://your-storage-provider.com/", // URL to your image
          "image-file.png" // File name of your image
        ],
        "mediaType": "image/png", // Media type of your image
        "description": "Anvil API CIP-25 Mint Example" // Description of your NFT
      },
      // The policy ID of the collection.
      "policyId": "4d5bd6249f0d9e4b2762ce334e2973dc7fd414ec1e08b4b0c2159bfb",
      "quantity": 1 // Accepts integers > 0. Negative numbers will burn assets.
    }
  ],

  // An array of native scripts that represent the policy that needs to be pre-loaded for validation.
  // This is required for the initial mint. once the policy is registered this is optional.
  // Including it saves resources and reduces latency by avoiding blockchain fetches.
  "preloadedScripts": [
    {
      "type": "simple",
      // The native script details.
      "script": {
        "type": "all",
        "scripts": [
          {
            "type": "sig",
            "keyHash": "fdf151b600df2492005221876c7d7e33056496572c7363c33a1e3609"
          },
          {
            "type": "before",
            "slot": 100000000
          }
        ]
      },
      // The hash of the native script, which is the Policy ID.
      "hash": "4d5bd6249f0d9e4b2762ce334e2973dc7fd414ec1e08b4b0c2159bfb"
    }
  ]
}
```

{% endcode %}

## Examples

In order to reduce page content, the use cases and examples are split into a dedicated repository.

* [Vanilla JavaScript CIP-25 Minting Platform](https://github.com/Cardano-Forge/anvil-api-examples/tree/main/minting-platform-cip25)
* [Next.js CIP-25 Minting Platform](https://github.com/Cardano-Forge/anvil-api-examples/tree/main/nextjs-minting-platform-cip25)

## Troubleshooting

### Fixes and Best Practices

1. Use the [metadata generation tool](https://metadraft.io) to ensure your metadata follows the CIP-25 standard
2. For multiple assets under the same policy, ensure each asset name is unique
3. Double-check that your time constraints in your native script have not expired

## Specifications

* [CIP-25 Specification](https://cips.cardano.org/cip/CIP-25)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ada-anvil.io/guides/nft-and-ft/mint-nft-cip-25.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
