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.
In this guide, we are signing blockchain transactions using a private key via API. This is fine for testing and demo purposes, but for production use, it 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, or our comprehensive key management system, Tatum KMS.
Use the following API endpoint to deploy an ERC-1155 smart contract:
JavaScript
cURL + private key
cURL + KMS
1
import {Currency, deployMultiToken} from '@tatumio/tatum';
2
/**
3
* Deploy MultiTokens (1155) contract.
4
* @param testnet - testnet or mainnet
5
* @param body - body of the request - https://apidoc.tatum.io/tag/Multi-Tokens-%28ERC-1155-or-compatible%29/#operation/DeployMultiToken
6
* @param provider - (optional) provider to broadcast tx
7
*/
8
const body = {
9
fromPrivateKey: '0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb',
10
chain: Currency.CELO,
11
uri: "https://example.com/{id}",
12
fee: {
13
gasLimit: "40000",
14
gasPrice: "40"
15
}
16
}
17
const txId = deployMultiToken(false, body);
Copied!
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
"uri": "https://example.com/{id}",
8
"fee": {
9
"gasLimit": "40000",
10
"gasPrice": "40"
11
}
12
}'
Copied!
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
"publicMint": true,
7
"index": 0,
8
"signatureId": "26d3883e-4e17-48b3-a0ee-09a3e484ac83",
9
"uri": "https://example.com/{id}"
10
"fee": {
11
"gasLimit": "40000",
12
"gasPrice": "40"
13
}
14
}'
Copied!
The response will contain a transaction ID from which we can obtain the smart contract's address.
Response
1
{
2
"txId": "0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd"
3
}
Copied!

Getting the address of the contract from a blockchain transaction

Use the following API call to get the address of the smart contract from the transaction ID.
The required parameters are:
  • The chain you are working on
  • The transactionId in the response to the previous request
JavaScript
cURL
1
import {Currency, getNFTContractAddress} from '@tatumio/tatum';
2
const contractAddress = await getNFTContractAddress(Currency.CELO, '0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd');
Copied!
1
curl --request GET \
2
--url https://api-eu1.tatum.io/v3/blockchain/sc/address/CELO/0xd17dbf37a9b2467c69ccf9fab35af2f2e7f329f3c760f684373625f5af2331bd \
3
--header 'x-api-key: REPLACE_KEY_VALUE'
Copied!
The response will contain the address of the NFT smart contract you deployed in the previous step.
Response
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.
JavaScript
cURL + private key
cURL + KMS
1
import {Currency, mintMultiToken} from '@tatumio/tatum';
2
/**
3
* Mint MultiToken (1155) with Tatum KMS.
4
* @param testnet - testnet or mainnet
5
* @param body - body of the request - https://apidoc.tatum.io/tag/Multi-Tokens-%28ERC-1155-or-compatible%29/#operation/MintMultiToken
6
* @param provider - (optional) provider to broadcast tx
7
*/
8
const body = {
9
fromPrivateKey: '0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb',
10
chain: Currency.CELO,
11
tokenId: "1",
12
to: "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea",
13
amount: "10",
14
fee: {
15
gasLimit: "40000",
16
gasPrice: "40"
17
}
18
}
19
const txId = mintMultiToken(false, body);
Copied!
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
"nonce": 0,
12
"fee": {
13
"gasLimit": "40000",
14
"gasPrice": "40"
15
}
16
}'
Copied!
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
"index": 0,
11
"signatureId": "26d3883e-4e17-48b3-a0ee-09a3e484ac83",
12
"nonce": 0,
13
"fee": {
14
"gasLimit": "40000",
15
"gasPrice": "40"
16
}
17
}'
Copied!
The response will contain a transaction ID from which you can obtain the details of the transaction.
Response
1
{
2
"txId": "0x67e5f725726c3bd7fc6689797be8ef41f59aa535ef33e4d7135874be4e820289"
3
}
Copied!
Since ERC-1155 smart contracts can include multiple tokens for the same ID, you can also mint multiple tokens for multiple IDs using the mint multi-token batch endpoint.​
JavaScript
cURL + private key
cURL + KMS
1
import {Currency, mintMultiTokenBatch} from '@tatumio/tatum';
2
/**
3
* Mint batch of MultiTokens (1155) with Tatum KMS.
4
* @param testnet - testnet or mainnet
5
* @param body - body of the request - https://apidoc.tatum.io/tag/Multi-Tokens-%28ERC-1155-or-compatible%29/#operation/MintMultiToken
6
* @param provider - (optional) provider to broadcast tx
7
*/
8
const body = {
9
fromPrivateKey: '0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb',
10
chain: Currency.CELO,
11
tokenId: ["1","2"],
12
to: ["0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea", "0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea"],
13
amounts: ["10", "20"],
14
fee: {
15
gasLimit: "40000",
16
gasPrice: "40"
17
}
18
};
19
const txId = mintMultiTokenBatch(false, body);
Copied!
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
"fee": {
12
"gasLimit": "40000",
13
"gasPrice": "40"
14
}
15
}'
Copied!
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
"index": 0,
11
"signatureId": "26d3883e-4e17-48b3-a0ee-09a3e484ac83",
12
"nonce": 0,
13
"fee": {
14
"gasLimit": "40000",
15
"gasPrice": "40"
16
}
17
}'
Copied!
The response will contain a transaction ID from which you can obtain the details of the transaction.
Response
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).
JavaScript
cURL + private key
cURL + signature ID
1
import {Currency, transferMultiToken} from '@tatumio/tatum';
2
/**
3
* Transfer MultiTokens (1155)
4
* @param testnet - testnet or mainnet
5
* @param body - body of the request - https://apidoc.tatum.io/tag/Multi-Tokens-%28ERC-1155-or-compatible%29/#operation/TransferMultiToken
6
* @param provider - (optional) provider to broadcast tx
7
*/
8
const body = {
9
fromPrivateKey: '0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb',
10
chain: Currency.CELO,
11
contractAddress: "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
12
tokenId: "1",
13
to: "0xfb99F8aE9b70A0C8Cd96aE665BBaf85A7E01a2ef",
14
amount: "1",
15
fee: {
16
gasLimit: "40000",
17
gasPrice: "40"
18
}
19
};
20
const txId = transferMultiToken(false, body);
Copied!
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
"fee": {
12
"gasLimit": "40000",
13
"gasPrice": "40"
14
}
15
}'
Copied!
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
"index": 0,
11
"signatureId": "26d3883e-4e17-48b3-a0ee-09a3e484ac83",
12
"nonce": 1,
13
"fee": {
14
"gasLimit": "40000",
15
"gasPrice": "40"
16
}
17
}'
Copied!
The response will contain a transaction ID from which you can obtain the details of the transaction.
Response
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.
JavaScript
cURL + private key
cURL + KMS
1
import {Currency, transferMultiTokenBatch} from '@tatumio/tatum';
2
/**
3
* Transfer MultiTokens (1155)
4
* @param testnet - testnet or mainnet
5
* @param body - body of the request - https://apidoc.tatum.io/tag/Multi-Tokens-%28ERC-1155-or-compatible%29/#operation/TransferMultiToken
6
* @param provider - (optional) provider to broadcast tx
7
*/
8
const body = {
9
fromPrivateKey: '0x4874827a55d87f2309c55b835af509e3427aa4d52321eeb49a2b93b5c0f8edfb',
10
chain: Currency.CELO,
11
contractAddress: "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81",
12
tokenId: ["1","2"],
13
to: ["0xfb99F8aE9b70A0C8Cd96aE665BBaf85A7E01a2ef"],
14
amounts: ["1", "1"],
15
fee: {
16
gasLimit: "40000",
17
gasPrice: "40"
18
}
19
};
20
const txId = transferMultiTokenBatch(false, body);
Copied!
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
"fee": {
12
"gasLimit": "40000",
13
"gasPrice": "40"
14
}
15
}'
Copied!
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
"index": 0,
11
"signatureId": "26d3883e-4e17-48b3-a0ee-09a3e484ac83",
12
"nonce": 1,
13
"fee": {
14
"gasLimit": "40000",
15
"gasPrice": "40"
16
}
17
}'
Copied!
The response will contain a transaction ID from which you can obtain the details of the transaction.
Response
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.
The required parameters for this call are:
  • The chain you are working on
  • The contractAddress from which the tokens were minted
  • The accountAddress you'd like to get token balances for
  • The tokenId of the token you'd like to obtain a balance for
JavaScript
cURL
1
import {Currency, getMultiTokensBalance} from '@tatumio/tatum';
2
/**
3
* Get Multi Tokens on Account. Returns tokenIDs of tokens Account holds.
4
* @param chain - blockchain to use function on
5
* @param address - account address
6
* @param contractAddress - multi Token contract address
7
* @param tokenId - multi Token token unique identifier
8
*/
9
const balance = getMultiTokensBalance(Currency.CELO,
10
"0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81","0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea","1");
Copied!
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!
The response will contain the balance of the tokens for the specific token ID at the designated address.
Response
1
{
2
"data": "18"
3
}
Copied!
You can also get the balance of multiple accounts at once using the get multi-token account balance batch endpoint.
The required parameters for this call are:
  • The chain you are working on
  • The contractAddress from which the tokens were minted
  • Each accountAddress you'd like to get token balances for
  • Each tokenId of the token you'd like to obtain a balance for
JavaScript
cURL
1
import {Currency, getMultiTokensBatchBalance} from '@tatumio/tatum';
2
/**
3
* Get Multi Tokens on Account. Returns tokenIDs of tokens Account holds.
4
* @param chain - blockchain to use function on
5
* @param address - account address
6
* @param contractAddress - multi Token contract address
7
* @param tokenId - multi Token token unique identifier
8
*/
9
const balance = await getMultiTokensBatchBalance(
10
Currency.CELO,
11
"0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81", // contract
12
"0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea, 0x3223AEB8404C7525FcAA6C512f91e287AE9FfE7B", // addresses
13
"1,2" // token ids
14
);
Copied!
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/multitoken/balance/batch/CELO/0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81/?tokenId=1,2&address=0x8cb76aed9c5e336ef961265c6079c14e9cd3d2ea,0x3223AEB8404C7525FcAA6C512f91e287AE9FfE7B' \
2
--header 'x-api-key: 4966d428-9507-45cb-9f90-02cca00674bd'
Copied!
The response will contain the balances of each token ID at each address specified in the call.
Response
1
{
2
"data": [
3
"18",
4
"24",
5
"3",
6
"15"
7
]
8
}
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.
The required parameters for this call are:
  • The chain you are working on
  • The contractAddress from which the tokens were minted
  • The tokenId for which you'd like to obtain metadata
JavaScript
Request
Response
1
import {Currency, getMultiTokenMetadata} from '@tatumio/tatum';
2
/**
3
* Get Multi Token Metadata
4
* @param chain - blockchain to use function on
5
* @param contractAddress contract address of the NFT token
6
* @param tokenId ID of the token
7
*/
8
const metadata = getMultiTokenMetadata(Currency.CELO, "0x7e8fada7108d0DBbE8C6aca50d0FFb13CC34Eb81","1");
Copied!
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 or learn Solidity, and you can perform the exact same operations on any blockchain that supports ERC-1155 tokens in Tatum.
To find out more about the API calls we have just used, visit our API Reference.