How to Create Multi Token Collections (REST API)

To mint a Multi Token you need a Collection to which said Multi Token must belong. To create your own Multi Token Collection, you have to deploy your own SmartContract.

Steps

Example request to create a new Multi Token Collection (CELO Testnet)

Step_1: Set up your Web Server

Example:

https://mywebsite.com/

Step_2: Create a JSON Metadata File for Each Token

Each ERC-1155 token can have a JSON metadata file that contains key information about the token. The JSON file should be hosted on a publicly accessible server.

Example JSON file:

{
    "name": "My Token",
    "description": "This is my ERC-1155 token",
    "image": "https://mywebsite.com/images/my-token.png",
    "properties": {
        "rarity": "legendary",
        "power": 100
    }
}

Step_3: Set Up a Folder Structure on Your Web Serve

Organize your metadata files in a structured manner on your web server.

Example structure:

/metadata
    /1.json
    /2.json
    /3.json

πŸ“˜

Each .json file corresponds to a token ID.

Step_4: Ensure URL Accessibility

Make sure each metadata file is accessible via a URL.

Example URLs:

https://mywebsite.com/metadata/1.json
https://mywebsite.com/metadata/2.json
https://mywebsite.com/metadata/3.json

Step_5: Prepare the ERC-1155 Smart Contract URI

https://mywebsite.com/metadata/{id}.json

Step_6: Deploy a Multi Token Smart Contract

curl --location --request POST 'https://api.tatum.io/v3/multitoken/deploy/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data-raw '{
    "chain": "CELO",
    "fromPrivateKey": "####",
    "uri": "https://mywebsite.com/metadata/{id}.json",
    "fee": {
      "gasLimit": "40000",
      "gasPrice": "40"
    }
}'
//Response:
{
    "txId": "0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd"
}

Step_7: Retrieve the "SmartContract Address"

curl --location --request GET 'https://api.tatum.io/v3/blockchain/sc/address/CELO/0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
    "contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81"
}