Overview for minting CIP-25 compliant NFTs/Native Assets on Cardano using the Anvil API's `transactions/build` endpoint. This document specifies the required JSON format for both new and existing poli
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:
A valid ADA wallet address (change address)
A list of UTXOs (Unspent Transaction Outputs) from your wallet
A unique asset name (UTF-8 or hex format)
Custom metadata for your NFT (Use https://metadraft.io to generate accurate metadata easily.)
A policy script registered on the Cardano blockchain. (TODO: Add link to API endpoint for creating/finding policy script.)
For more information about policy scripts, please see:
Request Structure
Payload
{
// Specifies which address should receive any leftover ADA (change)
// after the transaction is completed and fees are paid
"changeAddress": "CHANGE_ADDRESS_HERE",
// Single UTXO string or an array of UTXOs.
// Usually the result of CIP-30 getUtxos() from the browser wallet.
"utxos": "UTXOS_HERE",
"mint": {
"assets": [
{
"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": [
"URL_to_your_image_from_your_storage_provider.com",
"file_name_of_your_image.png"
],
"mediaType": "image/png",
"description": "Testing CIP-25 using anvil API"
},
// The policy ID of the collection.
// Replace with real value generated by Cardano when registering your policy.
"policyId": "2c08845182b01c721670979fb1eb83cc037fc284fbb4fc3d80ea91a0",
"quantity": 1 //accepts integers > 0. Negative numbers will burn assets.
}
],
// See Understanding Policy Scripts documentation for details.
// This is an example of a policy script
// ith a single required signature and a time constraint.
"policyScripts": {
"2c08845182b01c721670979fb1eb83cc037fc284fbb4fc3d80ea91a0": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "fdf151b600df2492005221876c7d7e33056496572c7363c33a1e3609"
},
{
"type": "before",
"slot": 100000000
}
]
}
}
}
}
Examples
In order to reduce page content, the use cases and examples are split into a dedicated repository.
Troubleshooting
Fixes and Best Practices
Always validate your policy script hash matches your policy ID before submission
For multiple assets under the same policy, ensure each asset name is unique
Double-check that your time constraints in policy scripts haven't expired
Specifications
Use the to ensure your metadata follows the CIP-25 standard