Imagine managing both fungible and non-fungible tokens seamlessly within a single smart contract. ERC-1155 makes this possible, revolutionizing how we handle digital assets. Picture event tickets that start as interchangeable, like general admission passes, and transform into unique collectibles post-event. ERC-1155 is a game-changer in web3 gaming, allowing seamless trade of in-game assets and skins. It's also ideal for asset tokenization and fractional ownership of real-world assets. Batch transfers simplify exchanging multiple items in a single transaction.
In this blog, we'll guide you through creating your own ERC-1155 token easily. Let's dive in!
In this quick start guide, we'll walk through connecting to a Kaleido created chain, creating smart contracts, compiling business logic, issuing your first transaction on the blockchain, and minting a ERC-1155 token.
As we go through the tutorial there are key concepts of the Kaleido Asset Platform that are described more in depth in the platform docs in case you have any questions. If you're not familiar with the platform, you can find an overview here.
Now, follow along as we get you up and running in just a few minutes.
To login to the Kaleido Asset Platform, a dedicated URL and login credentials will be provided to you by Kaleido.
If you need a demo for the Kaleido Asset Platform or are ready to set up an account, you can reach out to us.
To begin, we will build a smart contract. Go to the "Smart Contracts" section of the left navigation bar, select the "Builds" tab, and click "Create Build".
You will have options to generate a smart contract using token templates or importing your own.
Select the "Generate a new smart contract option." Here you can select the type of token you want along with the features needed.
Additionally, you can set the token name, symbol, and other options depending on the contract selected. Code for the smart contract automatically updates on the right pane as you change the options.
For this guide we will generate a ERC-1155 contract with mintable, burnable, and URI storage enabled. You can leave the other options on the default setting. Then click "Next" and you will be able to define the Path for your smart contract Build and settings for compiler and EVM version.
Once your smart contract is successfully added, you can deploy it by navigating to the path and clicking its name. This will bring you to a detailed information screen where you may click the "Deploy" button in the top right.
This will take you to a screen where you will need to create a FireFly Namespace.
A namespace is a construct in Kaleido whereby you may define connections to chains in order to enable contract deployments, transaction indexing, tx submission, event consumption, and more.
Click on the "Create FireFly namespace" button and you will be directed to a screen to provide a name for your FireFly Namespace (lower case only) and select the blockchain, IPFS, and wallet connectors you would like to add. We will go through each step by step.
The Kaleido Asset Platform supports connections to any EVM-compatible chain whether it is public or permissioned.
For public chains, you will need to provide the RPC URL and Chain ID and make sure that you have enough funds to cover any gas fees.
For Kaleido-created chains, the Kaleido Asset Platform will automatically pull in the private Ethereum chains in your Kaleido account (note that these chains will be preconfigured for your usage).
For purposes of this tutorial, click on the "Connect to Kaleido Blockchain" button.
If you don’t have a blockchain set up on a Kaleido account you can sign up for a free account here. We also have this tutorial on our blog about how to build your own blockchain.
Once you have a chain set up, select the blockchain you want to use as well as the node. Finally, give your blockchain a name or leave the default name as "Sidechain" and click on "Next".
Accept the default settings by clicking on "Connect" to finish the setup of the new connector.
Next, click the "Connect to an IPFS" button. Like the blockchain, the Asset Platform will automatically detect existing IPFS nodes in your Kaleido account. Select the IPFS node you want to use and give it a name.
Once the project is created, click "View Project" to see the smart contracts contained within the project namespace. Assuming this is your first project, there will be no existing contracts.
To create a smart contract click the "Add Smart Contract" button. You can name your token whatever you want and select the features needed. For the purposes of this demo we will be using the settings as shown below. Code and OpenZeppelin dependencies for the smart contract automatically update on the right pane as you change the options.
Click the "Add Wallet" button and add a HD Wallet. You can give your wallet a name and copy your recovery passphrase. This is essential to wallet recovery if ever needed and this will be the one and only time that your passphrase will be presented.
Next, add one or more keys that can be used for signing.
To add a key, simply click on your newly created wallet and then use the "Add Key" option.
Note that when creating a key pair within the HD Wallet runtime, you have the option to provide a human friendly naming denotation alongside the key. For example, if you are creating keys for a collection of end users, you could embed their first/last names or supply a UUID that is mapped offline to their identity.
There is also an option to enable multiparty mode. For the purposes of this quick start guide we will leave this option unchecked. Now click "Create" and congratulations your FireFly Namespace will be prepared.
After finishing the steps above you should be back to the "Deploy smart contract" screen. Select the signing wallet, click next, and deploy your contract.
Click on "Actions" in the left nav and you will see that your contract has successfully deployed.
You can check this by clicking the link to view the transaction on the FireFly Explorer.
Now in the "Actions" tab, click the "New action" button in the top right and select "Create token pool." Select the Build and Deploy action that you just did in the previous steps. Make sure that you have the correct token type selected or else you will get an error.
Name your Token Pool and click create. Your Token Pool will now appear as "Succeeded" in your Actions dashboard.
Your token pool is now created. You may verify by going to the "Pools" tab of the FireFly Explorer.
Now go back to the "Actions" tab, click "New action", and select "Create API endpoint." Select your Build and Deployment and click "Next."
Your API Endpoint is now created.
There are multiple ways for you to mint a token which include using the Actions functionality, Sandbox, or APIs.
Navigate to the "Actions" tab on the left nav under "Smart Contracts." Select "New action" and pick "Invoke function". Select your Build and Deployment and click "next".
You will then be directed to a screen where you can pick from the different functions available in your smart contract. To mint a token, select the function labeled "safeMint". Select the address you want to mint to and for the URI field you may input any string of text to help define the NFT.
Navigate to the Sandbox by clicking the information icon in the top right and selecting Sandbox.
With the Sandbox UI open, click on "Mint a Token" and your token pool should auto populate. Since it is an NFT, the amount minted is 1. Click run and your NFT will be minted. This may be verified back in the FireFly Explorer UI. You can also use the "Transfer" feature within the sandbox, and depending on your token configuration, you may be able to leverage the "Burn" feature.
Alternatively, you can use the token's Open APIs to mint your token against the available /safeMint route. This can be done programmatically or within the available Swagger UI. You can access the contract's Open API by navigating to the "Contract APIs" tab in your FireFly Namespace.
Navigate to your FireFly Namespace and select "Tokens" from the left nav. Here you will see your token transfer as well as the balance for the wallet that you minted the ERC1155 to.
With ERC-1155, an infinite number of items could be stored in a single contract. Exchanging different items between a group of friends can now be done in a single transaction instead of multiple. This has made it a popular standard. Some of the leading use cases for ERC-1155 include:
Gaming Assets: ERC-1155 is highly versatile for gaming applications. Developers can create in-game items, such as weapons, skins, or currencies, which can be both fungible and non-fungible. This allows for efficient batch transfers and lower transaction costs, making it ideal for large-scale gaming ecosystems.
Digital Collectibles: In the realm of digital art and collectibles, ERC-1155 enables creators to issue unique artwork alongside editions of the same piece. This flexibility supports a wide range of collectibles, from rare single items to mass-produced series, catering to diverse collector preferences.
Real Estate Tokenization: ERC-1155 can be used for real estate tokenization, where different tokens represent ownership of properties or shares in real estate assets. This allows for fractional ownership and easier management of diverse asset portfolios.
Supply Chain Management: By leveraging ERC-1155, supply chain applications can tokenize various assets, such as raw materials, products, and components. This enhances traceability, transparency, and efficiency in tracking goods through the supply chain, ensuring authenticity and reducing fraud.
Loyalty Programs: Businesses can use ERC-1155 to manage loyalty points and rewards. The standard’s ability to handle multiple types of tokens within a single contract makes it ideal for creating flexible and scalable loyalty programs that reward customers with various benefits and incentives.
Congratulations, on minting your ERC1155 token. Creating tokens is just one of many things you can do using Kaleido. Be sure to check out Kaleido’s YouTube channel, blog posts, and docs for more information and other tutorials about how to use the platform.
Schedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.
Request a DemoSchedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.
Request a DemoSchedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.
Request a DemoSchedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.
Request a DemoYour guide to everything from asset tokenization to zero knowledge proofs
Download NowLearn how Swift, the world’s leading provider of secure financial messaging services, utilizes Kaleido in its CBDC Sandbox project.
Download Now