Documentation Index Fetch the complete documentation index at: https://docs.immutable.com/llms.txt
Use this file to discover all available pages before exploring further.
ERC-1155 tokens support both unique and stackable assets in one contract. Multiple copies of an item share the same token ID, making them ideal for consumables, crafting materials, and editions.
Why Use ERC-1155?
Transfer multiple token types in a single transaction. Perfect for loot drops, rewards, and crafting systems.
Mix fungible (stackable) and non-fungible (unique) tokens in one contract. No need for multiple contracts.
More efficient storage and batch operations mean lower costs for games with many item types.
Players can hold 100 health potions as one balance entry, not 100 separate NFTs.
Use Cases
Consumables : Potions, ammo, food
Crafting Materials : Ore, wood, gems
Editions : Limited prints of artwork
Loot Boxes : Reward bundles
Event Tickets : Time-limited access tokens
Deploy via Hub
Deploy Contracts Deploy ERC-1155 contracts in Hub
{
"name" : "Health Potion" ,
"description" : "Restores 50 HP" ,
"image" : "https://assets.example.com/potion.png" ,
"attributes" : [
{ "trait_type" : "Type" , "value" : "Consumable" },
{ "trait_type" : "Healing" , "display_type" : "number" , "value" : 50 }
]
}
Minting
curl -X POST '{baseURL}/v1/chains/{chain_name}/collections/{contract_address}/nfts/mint-requests' \
-H 'x-immutable-api-key: YOUR_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"assets": [{
"owner_address": "0xRecipient",
"token_id": "1",
"amount": "10",
"metadata": {
"name": "Health Potion",
"image": "https://assets.example.com/potion.png"
}
}]
}'
Batch Different Token Types
const assets = [
{ owner_address: player , token_id: "1" , amount: "5" , metadata: healthPotion },
{ owner_address: player , token_id: "2" , amount: "3" , metadata: manaPotion },
{ owner_address: player , token_id: "3" , amount: "10" , metadata: ironOre },
];
await fetch ( ` ${ API_URL } /collections/ ${ contract } /nfts/mint-requests` , {
method: 'POST' ,
headers: { 'x-immutable-api-key' : secretKey },
body: JSON . stringify ({ assets }),
});
Fungible vs Non-Fungible Patterns
Fungible (Stackable)
All health potions share token_id: "1" and are interchangeable:
// Mint 100 health potions
await mint ({ token_id: "1" , amount: "100" , metadata: healthPotion });
// Player transfers 10 to friend
await contract . safeTransferFrom ( player , friend , "1" , 10 , "0x" );
Non-Fungible (Unique)
Each legendary weapon gets a unique ID:
// Mint unique weapons
await mint ({ token_id: "1001" , amount: "1" , metadata: uniqueSword });
await mint ({ token_id: "1002" , amount: "1" , metadata: uniqueShield });
Common Patterns
Loot Box Rewards
async function openLootBox ( playerAddress : string ) {
const rewards = generateRandomRewards ();
const assets = rewards . map (( reward , i ) => ({
owner_address: playerAddress ,
token_id: reward . tokenId ,
amount: String ( reward . quantity ),
}));
await mintBatch ( assets );
}
Deploy via Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19 ;
import "@imtbl/contracts/contracts/token/erc1155/preset/ImmutableERC1155.sol" ;
contract MyGameItems is ImmutableERC1155 {
constructor (
address owner ,
string memory name ,
string memory baseURI ,
string memory contractURI ,
address operatorAllowlist ,
address royaltyReceiver ,
uint96 royaltyFeeNumerator
) ImmutableERC1155 (
owner, name, baseURI, contractURI,
operatorAllowlist, royaltyReceiver, royaltyFeeNumerator
) {}
}
ERC-721 vs ERC-1155
Feature ERC-721 ERC-1155 Token Type Always unique Unique or stackable Gas Efficiency Higher per token Lower for batches Use Case Characters, land Materials, consumables Complexity Simpler More flexible
Next Steps
Minting API Mint tokens via API
Deploy Contracts Deploy via Hub
Contracts Overview Explore contract options
ERC-721 Compare with ERC-721