4.2. Mint an SFT (edition)

Mint semi-fungible tokens guide

SFT tokens follow the ERC-1155 EVM standard which combines the properties of ERC-20 (fungible) and ERC-721 (non-fungible) standards.

ERC-1155 tokens are a special type of digital tokens that can represent various things like in-game items, collectibles, or even real-world assets and are secure and transparent.

With ERC-1155 tokens, you can have multiple types of assets in a single token contract. For example, imagine a video game where each token represents a different weapon, armor, or special power. Players can buy, sell, and trade these tokens with other players, enhancing their gaming experience.

But ERC-1155 tokens aren't just limited to games. They can also represent digital collectibles like trading cards, artwork, or even ownership of real-world assets. This means you can trade unique items, showcase your collection, or even own a fraction of something valuable like real estate or artwork.

So, whether you're a gamer, collector, or someone looking for new and exciting digital experiences, ERC-1155 tokens offer a versatile and secure way to own and trade digital assets."

Here are a few real use cases for ERC-1155 tokens:

  1. Gaming: In-game items, virtual currencies, and unique characters that can be traded or used within video games.

  2. Digital Collectibles: Unique digital trading cards, artwork, or virtual pets that can be collected, displayed, and traded.

  3. Asset Tokenization: Tokenizing real-world assets like real estate, artwork, or luxury goods, enabling fractional ownership and efficient trading.

  4. Loyalty and Rewards Programs: Issuing loyalty points or rewards as ERC-1155 tokens, allowing customers to accumulate and redeem them for benefits.

  5. Events and Access Tokens: Digital tickets or access tokens for concerts, conferences, or exclusive content, providing secure and verifiable entry.

Remember to customize and adapt this explanation to fit your specific website and audience.

Crossmint can help you realize your ERC1155 goals with 3 easy steps using your Crossmint API Key:

Step 1: Create a SFT collection

We first must create a collection which will hold all of our templates. In this example we'll be using polygon chain.

curl --request POST \
     --url https://staging.crossmint.com/api/2022-06-09/collections \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-client-secret: sk_test.xxxxxx' \
     --header 'x-project-id: 123456-xxxx' \
     --data '
{
  "chain": "polygon",
  "fungibility": "semi-fungible",
  "metadata": {
    "name": "My New Collection",
    "imageUrl": "https://www.crossmint.com/assets/crossmint/logo.png",
    "description": "A new collection with its own dedicated smart contract"
  }
}
'

Response

{
  "id": "00bfac36-8a8a-464d-86ed-063318f6aa8e",
  "metadata": {
    "name": "My New Collection",
    "imageUrl": "ipfs://bafkreigbqsmxzkbjgbwtj6exfdt5z3t3swgoysf7hr6vjzddqnmykj6x2u",
    "description": "A new collection with its own dedicated smart contract"
  },
  "fungibility": "semi-fungible",
  "onChain": {
    "chain": "polygon",
    "type": "erc-1155"
  }
}

Step 2: Create a template

Now that we have a collection setup, we can now create a template under the collection. This template will have an id associated with it which will be used for the minting api.

curl --request POST \
     --url https://staging.crossmint.com/api/2022-06-09/collections/[templateId]/templates \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-client-secret: sk_test.xxxx' \
     --header 'x-project-id: 123456-xxxx' \
     --data '
{
  "onChain": {
    "tokenId": "2"
  },
  "metadata": {
    "name": "My template",
    "image": "https://www.crossmint.com/assets/crossmint/logo.png",
    "description": "A new token template for my ERC1155 collection"
  }
}
'

Response:

{
  "templateId": "58b0c1aa-e457-48dd-bb55-5a27e6a92f74",
  "metadata": {
    "name": "My template",
    "image": "ipfs://bafkreigbqsmxzkbjgbwtj6exfdt5z3t3swgoysf7hr6vjzddqnmykj6x2u",
    "description": "A new token template for my ERC1155 collection"
  },
  "onChain": {
    "tokenId": "2"
  }
}

Step 3: Mint an SFT from a Template

Now that we have the Template, we can now mint some SFTs using the token template.

curl --request POST \
     --url https://staging.crossmint.com/api/2022-06-09/collections/default/sfts \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-client-secret: sk_test.xxxxx' \
     --header 'x-project-id: 123456-xxxx' \
     --data '
{
  "templateId": "58b0c1aa-e457-48dd-bb55-5a27e6a92f74",
  "recipient": "email:[email protected]:polygon",
  "amount": 1
}
'

Example response

{
  "transactionId": "20ed0963-0185-49af-b4a0-2de3169bb367"
}

All set!

Crossmint will now mint the SFT(s) for you and deliver them to the intended recipient.

If you want to confirm delivery you can poll our Transactions API for the transaction status or implement a webhook to automatically detect successful mints without the guess work!