How to Mint Multi Tokens (ERC-1155)

Mint ERC-1155 multi tokens into an existing collection contract with the Tatum REST API, one token ID per request or several in a batch.

To mint an NFT you need a Collection to which said NFT must belong. Once you have the Collection SmartContract, minting NFTs just takes a few steps.

Minting a Multi Token

  1. Select the network you want the NFTs to exist.
  2. Have ready a Collection (SmartContract) for your Multi Token to belong.
  3. Have ready an address with its privatekey with native assets. Required to pay for the minting.
  4. Have ready the URI Structure in your Web Server.
  5. Mint the Multi Token.

Steps

Example request to mint a Multi Token (CELO Testnet)

Step_1: Set up the URI Structure

Find additional information in Set up the metadata web server and URI structure.

Step_2: Have ready the Multi Token Smart Contract

Find additional information in Deploy a Multi Token smart contract.

Step_3: Mint the Multi Token

  • v3 REST API endpoint
  • fromPrivateKey is the private key of an address allowed to mint in the collection (for example, the address that deployed it). It pays the minting fee.
  • On Celo, feeCurrency is required. fee and nonce are optional: if you omit them, the fee is calculated automatically and the last known nonce is used.

Example request:

curl --location --request POST 'https://api.tatum.io/v3/multitoken/mint' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data-raw '{
    "to": "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea",
    "contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
    "tokenId": "1",
    "amount": "10",
    "chain": "CELO",
    "feeCurrency": "CELO",
    "fromPrivateKey": "{PRIVATE_KEY}"
}'

Response:

{
    "txId": "0x67e5f725726c3bd7fc6689797be8ef41f59aa535ef33e4d7135874be4e820289"
}

Step_4: Mint Multi Tokens in batches (Optional)

ERC-1155 smart contracts can include multiple tokens for the same ID, you can also mint multiple tokens for multiple IDs. Each item of to receives the token IDs and amounts at the same position in tokenId and amounts.

Example request:

curl --location --request POST 'https://api.tatum.io/v3/multitoken/mint/batch' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data-raw '{
    "to": ["0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea", "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea"],
    "contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
    "tokenId": [["1"], ["2"]],
    "amounts": [["10"], ["20"]],
    "chain": "CELO",
    "feeCurrency": "CELO",
    "fromPrivateKey": "{PRIVATE_KEY}"
}'

Response:

{
    "txId": "0x0b4e6281b7710e6d0b4fdbed463a265f87ab3ac41c8f3e8e75b7b56331e3e091"
}

To send the minted tokens to other addresses, one token ID at a time or several in a batch, see ERC-1155 transfer: send multi tokens in a batch.


Did this page help you?