1. Base Contract: Your contract must extend the CW721 Metadata Onchain contract from Public Awesome.

  2. Minting Function: The contract must include a minting function that allows Crossmint to mint NFTs on behalf of users.

  3. Minter Ownership: The CW721 Metadata Onchain contract supports updating minter ownership to allow Crossmint to execute minting messages. This is implemented through the update_minter_ownership function which can be called to add or remove minting permissions.

Make sure your contract is properly tested and audited before deployment. While the base CW721-metadata-onchain contract is audited, any custom extensions you add should be thoroughly tested.

The following example demonstrates how to implement requirements 1 and 2 by extending the CW721 Metadata Onchain contract:

// Extend cw721_metadata_onchain contract
use cosmwasm_std::{entry_point, DepsMut, Env, MessageInfo, Response};
use cw721_metadata_onchain::msg::ExecuteMsg;
use cw721_metadata_onchain::{Cw721MetadataContract, error::ContractError};


// Override the mint function
#[entry_point]
pub fn execute(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    msg: ExecuteMsg,
) -> Result<Response, ContractError> {
    // Add your custom code here

    Cw721MetadataContract::default().execute(deps, &env, &info, msg)
}

msg: ExecuteMsg format will be like:

{
    "mint": {
        "token_id": "your-token-id",
        "owner": "recipient-address",
        "token_uri": "ipfs://your-metadata-uri",
        "extension": {
            "name": "NFT Name",
            "description": "NFT Description",
            "image": "ipfs://your-image-uri"
        }
    }
}

The base contract already provides:

  • On-chain metadata storage
  • Standard NFT operations (mint, transfer, approve, etc.)
  • Built-in metadata types and validation

Updating Minter Ownership

To allow Crossmint to mint NFTs on your behalf, you need to update the minter ownership of your contract. This is done using the update_minter_ownership function.

Command

xiond tx wasm execute <your-contract-address> \
  '{"update_minter_ownership":{"action":"add","address":"CROSSMINT_ADDRESS"}}' \
  --from <your-wallet> \
  --chain-id xion

Parameters

Replace the following placeholders:

  • <your-contract-address> - Your deployed contract address
  • CROSSMINT_ADDRESS - Crossmint’s address (see below)
  • <your-wallet> - Your wallet name

Crossmint Addresses

Use the appropriate address based on your environment:

EnvironmentAddress
Staging Testnetxion1sky4jrvn7s3u9wetshrutkmuuuu6jcwfju6qmt
Production Mainnetxion162pp2eunext5skljzsshhzwjpkce9d3eceyr8z

Registering Your Contract

To register your Xion contract with Crossmint:

  1. Deploy your contract to the Xion network
  2. Go to the Crossmint Console
  3. Navigate to “Token Collections”
  4. Click “New Collection”
  5. Select “Xion” as the blockchain
  6. Enter your contract address
  7. Follow the remaining steps in the wizard