10
Min Read

How to Create an ERC1155 Token on the Kaleido Platform

Ray Chen
Product Manager
August 15, 2023
How to Create an ERC1155 Token on the Kaleido Platform
Update
Since this post was written, Hyperledger FireFly has reached 1.0. Learn more here!

ERC-1155 is a multi-token standard that supports both fungible and non-fungible tokens. An example of this in real life would be general admission event tickets. Before the event takes place, the tickets act like ERC-20 (fungible) tokens that can be exchanged for each other. Afterward, however, they lose their event value and become collectibles (non-fungible).

The most popular use case for ERC-1155 tokens right now are in the web3 gaming space. Assets in the game can act as fungible tokens such as skins or in-game assets. Another use case is asset tokenization and fractionalization. Real world assets may be fractionalized using this smart contract to create an asset that has both fungible and non-fungible properties.

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. These token transfers are called batch transfers.

Creating an ERC1155 token on our platform

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.

Logging into the Kaleido Asset Platform

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.

Building an ERC1155 smart contract

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.

Screenshot: Where to generate a smart contract in the platform

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.

Screenshot: Selecting ERC1155 token standard

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.

Screenshot: Confirming ERC1155 deployment

This will take you to a screen where you will need to create a FireFly Namespace.

Creating your 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.

Screenshot: Creating a FireFly namespace

Connecting to a blockchain

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".

Screenshot: Connecting your namespace to a blockchain

Accept the default settings by clicking on "Connect" to finish the setup of the new connector.

Screenshot: Confirming blockchain settings

Connecting to IPFS

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.

Screenshot: Connecting to an IPFS

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.

Adding wallets

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.

Screenshot: Adding wallets to your namespace

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.

Screenshot: More namespace details and configurations

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.

Deploying your contract

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.

Screenshot: Deploying your ERC1155 contract

Click on "Actions" in the left nav and you will see that your contract has successfully deployed.

Screenshot: Verifying contract deployment

You can check this by clicking the link to view the transaction on the FireFly Explorer.

Deploy action screenshot from console.

Creating token pools

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.

Screenshot for creating a token pool in the Kaleido console

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.

Creating an API endpoint

Now go back to the "Actions" tab, click "New action", and select "Create API endpoint." Select your Build and Deployment and click "Next."

Screenshot: Creating an API endpoint for your contract

Your API Endpoint is now created.

Mint your ERC1155 token

There are multiple ways for you to mint a token which include using the Actions functionality, Sandbox, or APIs.

Using Actions

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.

Screenshot: Token details in the Kaleido platform

Sandbox

Navigate to the Sandbox by clicking the information icon in the top right and selecting Sandbox.

Screenshot: Where to find the Kaleido Sanbox

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.

API

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.

Verify your mint

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.

Screenshot of verify mint

Additional support resources

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.

Try the Asset Platform Today

Schedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.

Request a Demo

Try the Asset Platform Today

Schedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.

Request a Demo
Interested in Blockchain?

Start learning blockchain and creating enterprise solutions today with a free Kaleido account!

Create Free Account
Don't forget to share this article!
Interested in Blockchain?

Start learning blockchain and creating enterprise solutions today with a free Kaleido account!

Create Free Account

Try the Asset Platform Today

Schedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.

Request a Demo

Try the Asset Platform Today

Schedule a demo of our platform and radically simplify the tokenization of assets at scale with ERC1155 tokens.

Request a Demo

The Ultimate Enterprise Blockchain Glossary

Your guide to everything from asset tokenization to zero knowledge proofs

Download Now

Swift Utilizes Kaleido in New CBDC Sandbox

Learn how Swift, the world’s leading provider of secure financial messaging services, utilizes Kaleido in its CBDC Sandbox project.

Download Now

Related Posts

Comparing Hyperledger Fabric and Hyperledger Besu: A Deep Dive

Powerhouse Enterprise Protocols: A Comparison of Hyperledger Fabric vs Hyperledger Besu

How to Use the ERC-1400 Standard for Compliant Blockchain Securities

How to Use the ERC-1400 Standard for Compliant Blockchain Securities

Marc Lewis
Managing Editor
How to Manage Digital Asset with Our Next-Gen Asset Manager Service

Asset Manager Service: A Next-Gen Engine for Managing Digital Asset & Tokenization Projects

Marc Lewis
Managing Editor

Blockchain made radically simple for the enterprise

No Credit Card Required
ISO27K & SOC2 Type 2 Compliant
Free Training & Support