EVM - Create a NFT Collection (REST API)

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

📘

The following steps and examples are based on Celo Alfajores (testnet).

Creating an NFT Collection

  1. Select the network where the NFTs will exist.
  2. Have ready an address with its privatekey with native assets. Required to pay for the SmartContract deployment.
  3. Pick on a "name" and "symbol" for your collection.
  4. Deploy the NFT SmartContract to get your Collection.
  5. Add a Tatum Minter address (Optional)
    1. If a Minter address is added to the Collection SmartContract, Tatum pays on your behalf. Your account will be charged accordingly.

Steps

Step_1: Estimate the Gas Fees to create a NFT Collection

Example request:

curl --location 'https://api.tatum.io/v3/blockchain/estimate' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
  "chain": "CELO",
  "type": "DEPLOY_NFT",
  "sender": "0x09C3B8CCaDe2c55b0C7cf696fe0Bd135716e6911"
}'
//Response:
{
    "gasLimit": 6000000,
    "gasPrice": 15
}

Step_2: Check the current "nonce" value from the sender's address

Find more about the nonce in the following article.

Example request:

curl --location 'https://api.tatum.io/v3/celo/transaction/count/0x09C3B8CCaDe2c55b0C7cf696fe0Bd135716e6911' \
--header 'x-api-key: {Mainnet_API_KEY}'
//response:
0 // Current nonce value in decimals

Step_3: Deploy the SmartContract to create a NFT Collection

Example request:

curl --location 'https://api.tatum.io/v3/nft/deploy' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "chain": "CELO",
    "name": "NFT on Celo Test Collection",
    "symbol": "NCTC",
    "feeCurrency": "CELO",
    "nonce": 0,
    "fee": {
        "gasPrice": "15",
        "gasLimit": "6000000"
    },
    "fromPrivateKey": "####"
}'
//Response:
{
    "txId": "0xa3ed3b9d2686dad28e93bbad6df37fc38430ecd8c0b49aceef787d33a9a6edcd"
}

📘

Find the transaction in Celo Alfajores Explorer.

Step_4: Retrieve the "SmartContract Address"

Example request:

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

Step_5: Adding Tatum as a Minter (Optional)

Example request:

curl --location --request POST 'https://api.tatum.io/v3/nft/mint/add' \
--header 'x-api-key: {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chain": "CELO",
    "contractAddress": "0x0935a78C8a268c8ED0590E5A8d4409f7604Bed1A",
    "minter": "0xBC2eBA680EE50d685cc4Fe65f102AA70AfB27D3F",
    "fromPrivateKey": "####"
}'
//Response
{
    "txId": "0x04e159bd515c917efcfbb88f819b513fb7c5d54aef70c26aaa285e7b987c1aae"
}

Tatum Minter role addresses:

EnvironmentChainAddress
MainnetBSC, Celo, Ethereum, Harmony, Klaytn, Polygon0x49678AAB11E001eb3cB2cBD9aA96b36DC2461A94
TestnetBSC0xc16ae5e8c985b906935a0cadf4e24f0400531883
TestnetCelo0xBC2eBA680EE50d685cc4Fe65f102AA70AfB27D3F
TestnetEthereum0x53e8577C4347C365E4e0DA5B57A589cB6f2AB848
TestnetHarmony0x8906f62d40293ddca77fdf6714c3f63265deddf0
TestnetPolygon0x542b9ac4945a3836fd12ad98acbc76a0c8b743f5

📘

Adding a Minter Address into an NFT Collection SmartContract is non-reversible. The cost of each use in crypto is charged to the account in credits.