Tatum
Search…
How to create ERC-1155 multi-tokens
Create flexible multi tokens with both fungible and non-fungible properties
The ERC-1155 is a standardized smart contract with a predefined set of features. These tokens have properties in common with both fungible and non-fungible tokens. Any single contract may include any combination of fungible, non-fungible, or semi-fungible tokens.
NFTs are typically made using ERC-721 smart contracts on Ethereum-compatible blockchains. While this type of contract gives them the unique properties that make them so desirable (scarcity, verifiable authenticity), it also has certain limitations.
ERC-721 tokens each have a unique ID, for which there can be only one token. This makes batch operations very costly in terms of gas fees and makes shared ownership impossible.
ERC-1155 tokens can have multiple tokens for a single smart contract ID. This opens up all sorts of possibilities for shared ownership, gaming applications, and a wide range of other use cases.
However, creating an ERC-1155 smart contract on an Ethereum-compatible blockchain is not easy at all. As a developer, you have to know a lot of things:
    Solidity - a new programming language for writing smart contracts
    How to use a compiler for Solidity
    How to develop using an IDE
    How to deploy the compiled smart contract
It's a lot to know, and for developers who only need the basic features of ERC-1155 tokens, it would take weeks to figure it all out.
Tatum has a prebuilt ERC-1155 contract ready for deployment. The source code is available on GitHub.
Please refer to the guide below and the following workshop to learn how to create and work with ERC-1155 multi-tokens:

Creating a multi-token smart contract

To create and deploy multi tokens using Tatum, all you need is one simple API call. This API call deploys a standard, validated multi-token smart contract to the blockchain of your choice.
In this example, we are using Celo because it is fast, cheap and you can pay for transactions with a stable coin (cUSD). The required parameters are the name and symbol of the deployed token, the initial supply of the tokens, and the recipient address where the initial supply will be transferred.
Blockchain transactions are signed using a private key via API, which is not a secure way of signing transactions. Your private keys and mnemonics should never leave your security perimeter. To correctly and securely sign a transaction, you can use Tatum CLI from the command line, a specific language library like Tatum JS, the local middleware API, or our complex key management system, Tatum KMS.
Request
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/multitoken/deploy/' \
2
--header 'Content-Type: application/json' \
3
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd' \
4
--data-raw '{
5
"chain": "CELO",
6
"fromPrivateKey": "0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb",
7
"feeCurrency": "CUSD",
8
"uri": "https://example.com/{id}"
9
}'
Copied!
1
{
2
"txId": "0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd"
3
}
Copied!

Getting the address of the contract from a blockchain transaction

The response is the transaction ID from which the created token's address can be obtained.
Request
Response
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/multitoken/address/CELO/0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd' \
2
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd'
Copied!
1
{
2
"contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81"
3
}
Copied!

Minting new ERC-1155 tokens

When your smart contract is deployed and you know the contract address, you can issue new tokens with the mint multi-token endpoint. This endpoint will create a new token with a unique identifier. Every token should have metadata as a JSON schema containing additional information about the token, like the image URL, description, etc.
Request
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/multitoken/mint/' \
2
--header 'Content-Type: application/json' \
3
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd' \
4
--data-raw '{
5
"to": "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea",
6
"contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
7
"tokenId": "1",
8
"amount": "10",
9
"chain": "CELO",
10
"fromPrivateKey": "0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb",
11
"feeCurrency": "CUSD"
12
}'
Copied!
1
{
2
"txId": "0x67e5f725726c3bd7fc6689797be8ef41f59aa535ef33e4d7135874be4e820289"
3
}
Copied!
Since ERC-1155 smart contracts can include multiple tokens for the same ID, you can also mint many of them at a time using the mint multi-token batch endpoint.
Request
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/multitoken/mint/batch' \
2
--header 'Content-Type: application/json' \
3
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd' \
4
--data-raw '{
5
"to": ["0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea", "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea"],
6
"contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
7
"tokenId": [["1"], ["2"]],
8
"amounts": [["10"], ["20"]],
9
"chain": "CELO",
10
"fromPrivateKey": "0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb",
11
"feeCurrency": "CELO"
12
}'
Copied!
1
{
2
"txId": "0x0b4e6281b7710e6d0b4fdbed463a265f87ab3ac41c8f3e8e75b7b56331e3e091"
3
}
Copied!

Transferring ERC-1155 tokens

To transfer tokens from the address where they were issued to another blockchain address, you can use the transfer multi-token endpoint. You need the private key of the address where the tokens are located (address from the first call where the initial supply is distributed).
Request
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/multitoken/transaction/' \
2
--header 'Content-Type: application/json' \
3
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd' \
4
--data-raw '{
5
"to": "0xfb99F8aE9b70A0C8Cd96aE665BBaf85A7E01a2ef",
6
"contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
7
"tokenId": "1",
8
"amount": "1",
9
"chain": "CELO",
10
"fromPrivateKey": "0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb",
11
"feeCurrency": "CELO"
12
}'
Copied!
1
{
2
"txId": "0x4907008b79c881a61db1af4bec792f822070c0cffed77c26151ec917d6b0c2fd"
3
}
Copied!
You can also transfer multiple tokens at once using the transfer multi-token batch endpoint. This method significantly saves gas costs, which is especially useful on the Ethereum blockchain.
Request
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/multitoken/transaction/batch' \
2
--header 'Content-Type: application/json' \
3
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd' \
4
--data-raw '{
5
"to": "0xfb99F8aE9b70A0C8Cd96aE665BBaf85A7E01a2ef",
6
"contractAddress": "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
7
"tokenId": ["1", "2"],
8
"amounts": ["1", "1"],
9
"chain": "CELO",
10
"fromPrivateKey": "0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb",
11
"feeCurrency": "CELO"
12
}'
Copied!
1
{
2
"txId": "0x1d6f1fd6dcd3a552ae02badbe7a2de7085ee5155d3aa0321a4afbbefbbb9815e"
3
}
Copied!

Getting a list of tokens that belong to an address

If you want to display a list of tokens that someone possesses, you can use the get multi-token account balance endpoint.
Request
Response
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/multitoken/balance/CELO/0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81/0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea/1' \
2
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd'
Copied!
1
{
2
"data": "18"
3
}
Copied!
Again, you can also get the balance of multiple accounts at once using the get multi-token account balance batch endpoint.
Request
Response
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/multitoken/balance/batch/CELO/0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81/?tokenId=1&address=0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea' \
2
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd'
Copied!
1
{
2
"data": [
3
"18"
4
]
5
}
Copied!

Obtaining metadata for a multi-token

If you want to obtain a metadata URL for a token, you can use the get multi-token metadata endpoint. If there is {id} in the URL, it will be automatically replaced with the token ID.
Request
Response
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/multitoken/metadata/CELO/0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81/1' \
2
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd'
Copied!
1
{
2
"data": "https://example.com/1"
3
}
Copied!
So that's all there is to it! Just a few calls to accomplish just about everything you need to with ERC-1155 multi-tokens. No need to install anything, learn Solidity, etc.
To find out more about the API calls we have just used, visit our API Reference.
Last modified 1mo ago