What ERC1155 defines
An ERC1155 contract stores balances by token ID and owner. One ID can be a currency with a large supply, and another can be a unique item.safeBatchTransferFrom moves several IDs at once, which saves gas compared with
one ERC20 or ERC721 call per token.
ERC1155: One contract, many token IDs
- Balances live in a nested mapping of ID and owner.
- An ID is fungible or unique, depending on its supply.
- Batch functions move several IDs in one call.
Solana: One program, one mint per ID
- Each token type is a mint under the Token Program.
- The supply and decimals of the mint decide whether it is fungible.
- One transaction carries a transfer instruction for each mint.
Token IDs become mints
Create one mint for each ERC1155 token ID. Every mint uses the same Token Program, so adding a token type is a transaction and needs no deployment. If you have not read the ERC20 guide, it explains mints and token accounts.Three ERC1155 token IDs as three mints.
| ERC1155 token type | Solana mint |
|---|---|
| Fungible ID, such as a currency | A mint with decimals and a large supply |
| Semi-fungible ID, such as a stackable item | A mint with 0 decimals and a supply above 1 |
| Non-fungible ID | A mint with 0 decimals and a supply of 1, or a Metaplex Core asset |
ERC1155 functions on Solana
Replace the token ID argument with the mint address.| ERC1155 | Solana | How it maps |
|---|---|---|
balanceOf(owner, id) | Token account amount | Read the owner’s associated token account for that mint. |
balanceOfBatch() | Several account reads | Fetch several token accounts in one RPC call with getMultipleAccounts. |
safeTransferFrom() | TransferChecked | Transfer between the two owners’ token accounts for the mint. Solana has no receiver callback, so verify the recipient address yourself. |
safeBatchTransferFrom() | Several instructions | Add one transfer instruction per mint to the same transaction. |
setApprovalForAll() | No equivalent | Approve a delegate per token account. No operator covers every token a wallet holds. |
uri(id) | Metadata uri | Each mint has its own metadata with a name, symbol, and URI. |
Batch transfers
A batch transfer is a list of transfer instructions in one transaction. They run in order and atomically: if one fails, none of them applies.Watch the transaction sizeEach transfer adds a source account, a destination account, and a mint to the
transaction. A legacy or v0 transaction holds 1,232 bytes, and a v1 transaction
holds 4,096 bytes. Split a very large batch across transactions. In a v0
transaction, you can also use an address lookup table, which stores addresses
onchain so that the transaction references them by index.
Collections and metadata
An ERC1155 contract address groups its token IDs. On Solana, mints are independent, so you link them with metadata:Metaplex metadata
Give each mint a metadata account that references the same collection NFT, and
have the collection’s authority verify each one.
Metadata extension
Store the name, symbol, and URI on a Token Extensions mint.
Token groups
Make one mint the group and register the other mints as its members.