4
Min Read

How to Create and Deploy an ERC-721 Token

Ray Chen
Product Manager
February 13, 2024
How to Create and Deploy an ERC-721 Token
Update
Since this post was written, Hyperledger FireFly has reached 1.0. Learn more here!

Creating an ERC-721 contract forms the backbone of developing unique, non-fungible tokens (NFTs) on the Ethereum blockchain.

ERC-721, a token standard interface for NFTs, enables the representation of ownership and transferability of diverse digital assets, ranging from art to real estate.

This introduction will guide you through the essentials of setting up your ERC-721 contract, including the key functionalities that distinguish ERC-721 tokensfrom other token types, the significance of metadata, and the steps involved in deploying a contract that adheres to the ERC-721 standard.

By the end of this post, you'll have a solid understanding of how to leverage smart contracts to mint and manage NFTs, ensuring your assets are both secure and compliant with Ethereum's widely recognized protocol.

What is an ERC721 Token?

The ERC-721 token standard, a distinct protocol within the Ethereum blockchain, represents a significant evolution in the realm of digital assets.

Unlike the ERC-20, which is geared towards fungible tokens (where each token is identical and interchangeable), ERC-721 introduces the concept of non-fungible tokens (NFTs). These tokens are unique and cannot be exchanged on a one-to-one basis with other tokens.

Each ERC-721 token is distinct, possessing specific attributes and characteristics that set it apart from others. This uniqueness makes ERC-721 ideal for representing one-of-a-kind assets like digital art, collectibles, and ownership rights in the virtual world.

Essentially, ERC-721 tokens can be thought of as digital certificates of authenticity and ownership for virtual or real-world items.

The introduction of the ERC-721 standard has been a game-changer, particularly in the digital art and collectibles space. It allows for the creation and exchange of NFTs on the Ethereum blockchain, offering a secure and verifiable way to establish and transfer ownership of digital items.

This has opened up new avenues for artists, collectors, and investors, enabling a thriving marketplace for unique digital assets. ERC-721 has thus played a pivotal role in the burgeoning field of digital collectibles, contributing significantly to the mainstream acceptance and popularity of NFTs.

4 Steps to Create an ERC721 Token on Kaleido

Step 1: Create a Kaleido Account

If you haven’t already, sign up for a Kaleido account here. Create an account and password and you will be all set. ERC-721 tokens can be created with any plan on Kaleido, starter tier (free) included!

Step 2: Create a Blockchain Network

To get started, create a blockchain network. You will need to name your network and select deployment region(s). This is where your resources will be hosted and there are various options for AWS and Microsoft Azure.

screenshot inside the Kaleido console shows where to create a network
screenshot from the Kaleido console shows how to set home region for the network

After your network is created you will need to create an environment. There are options for different protocols, however, to create an ERC-721 make sure you create an “Ethereum” one. You will also need to select a provider.

For our purposes any will do but if you are curious about the differences here is a technical overview.

screenshot from the Kaleido console shows how to pick a chain
screenshot inside the Kaleido console shows more chain options

You’re almost there. Once your environment is created, set up a node and leave the default configurations of “small” and “signer” on the final panel.

Kaleido console dashboard view

Kaleido console node set up

Step 3: Create a Token Pool

Now that your blockchain network is created, navigate to the “digital assets” selection in the left panel and click “tokens”. Select the Signing Account as the node you created in the previous step which will be used to deploy the token contract to the blockchain and create using our Token Factory.

Make sure to select either KaleidoERC721Mintable or KaleidoERC721MintableBurnable.

Next, give your token a name and symbol and click “deploy token instance”.

Kaleido console importing a smart contract

Step 4: Create Your Token

Now that you have deployed a ERC721 contract, the next step is to mint your token. Go back to the left navigation and click on “tokens”. You should now see your created token, or NFT. In the top right, click “select signing account” and pick the same account you used to create your NFT.

Next click mint, give your token an unique numerical ID, and token URI if applicable.

Kaleido console minting an NFT

The token URI is used to point to a unique image for the NFT which contains metadata (example below).

{

   "name": "NFTexample",

   "description": "Example of a NFT",

   "image": "https://example.com/NFTexample.png",

   "attributes": [

       {

           "trait_type": "ease_of_use",

           "value": 100

       }

   ]

}


The URI is optional but recommended and more information can be found here.

After creating your ERC721 token, click on the Digital Assets tab on the left nav and select Token. From there deploy the contract if you haven’t already. Once the contract is deployed, click into the details to see a screen like below:

ECR721 token info in the Kaleido console

Select your signing account and the MINT button should become clickable. Click “Mint” and you will be given prompts to enter the Token ID, URI, and optional target address.

For token ID you may assign any numerical digit but keep in mind that each NFT that is minted needs to have a unique Token ID.

This means the same token contract cannot have two NFTs with Token IDs of 1. For this example, we will give the Token ID a value of 1. Click the Mint button and you should see a successful mint pop up.

NFTReal Mint in the Kaleido console

Click the x in the top left and you should see that the Address Button has now updated to 1 with the account address. Congratulations you have now minted your first NFT!

Step 5: Transfer Your NFT to Metamask

In the same screen click the Transfer button.

Transfer token button in Kaleido console.
Transfer token screenshot in Kaleido console

You may either provide an address from your blockchain environment or a custom address. To get another address in your blockchain environment simply create a second node. In this tutorial we will show how to get your token into Metamask.

If you haven’t setup a Metamask wallet before, this guide will help you make one.

In your Metamask account, click the networks dropdown and click “Add Network.”

Metamask screenshot showing networks

This will bring you to your Metamask settings screen where you will need to “Add a network manually”.

Metamask setting dashboard
Metamask add network screenshot

For Network name, you may name this anything. To get the RPC URL and Chain ID, navigate back to your Kaleido console and go to the Blockchain section. On the Blockchain dashboard select “View Node” for your node.

Node overview in Kaleido console

Then click Connect App and create a new app cred called “metamask”. The RPC URL will be listed under JSON/RPC HTTP endpoint. Copy this value into Metamask.

App crew details in the Kaleido console

To get your Chain ID, click on the Settings section. Your Chain ID will be under Environment Info.

Once you have all the information click save in the Metamask settings.

721 token transfer to Metamask

Next, click “Import tokens” which should prompt you for the token address. The token address may be found in the Tokens section under Token Info.

NFT transferred to Metamask screenshot
Metamask import tokens screenshot
Kaleido console screenshot

Copy this value and your token symbol and decimals should auto-populate. Finally, transfer tokens to your Metamask account by copying your Metamask wallet address.

Screenshot of erc721 NFT in Metamask

Select an amount to transfer which will be 1 and the Token ID will be the value you had entered in the previous step. Then click Transfer. Once you get a “Successful Transaction” message go back to your Metamask wallet.

NFT transfer confirmation

Refresh and your balance should now appear.

Metamask NFT transfer

Core Functions of ERC-721

The ERC-721 standard specifies a set of core functions that enable the creation, transfer, and management of non-fungible tokens (NFTs) on the Ethereum blockchain. These functions are essential for ensuring the uniqueness of each token and enabling the secure transfer and ownership verification of NFTs. Here are the core functions defined by the ERC-721 standard:

  • balanceOf(address _owner): This function returns the number of NFTs owned by a given address. It is used to query how many assets an account holds.
  • ownerOf(uint256 _tokenId): It provides the owner's address of a specific NFT, identified by its unique token ID.
  • safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) and safeTransferFrom(address _from, address _to, uint256 _tokenId): These functions are used to securely transfer NFTs from one address to another, ensuring that the recipient is capable of receiving NFTs (i.e., preventing tokens from being locked in contracts without support for them).
  • transferFrom(address _from, address _to, uint256 _tokenId): This function is used for transferring ownership of an NFT from one address to another. Unlike safeTransferFrom, it does not check if the receiver can handle NFTs, making it less safe.
  • approve(address _approved, uint256 _tokenId): It allows a token owner to approve another address to transfer the specified token on their behalf. This is useful for secondary sales or allowing another user or contract to manage the NFT.
  • setApprovalForAll(address _operator, bool _approved): This function enables or disables an operator to manage all of an owner's assets. It is useful for authorizing another account or contract to manage all of the owner's NFTs.
  • getApproved(uint256 _tokenId): Returns the address approved to transfer a specific NFT.
  • isApprovedForAll(address _owner, address _operator): Checks if an operator is approved to manage all of the NFTs of an owner.

Additionally, ERC-721 defines two key events:

  • Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId): Emitted when an NFT is transferred, including zero address transactions that denote minting and burning.
  • Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId) and ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved): Emitted when approval is given by an owner to another address to manage one or all of their NFTs.

These functions and events ensure the standardization of NFT operations across various applications, enabling interoperability and providing a consistent framework for developers to build upon.

Additional Support Resources

Minting a NFT is just one of many things you can do using Kaleido. Be sure to check out Kaleido’s YouTube channel, blogposts, and docs for more information and other tutorials about how to use the platform.

Mint NFTs at Scale - Try It Free

Launch custom NFT ecosystems quickly and easily with Kaleido

Try Free

Mint NFTs at Scale - Try It Free

Launch custom NFT ecosystems quickly and easily with Kaleido

Try Free
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

Mint NFTs at Scale - Try It Free

Launch custom NFT ecosystems quickly and easily with Kaleido

Try Free

Mint NFTs at Scale - Try It Free

Launch custom NFT ecosystems quickly and easily with Kaleido

Try Free

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

Privacy, Security, Scalability: Comparing UTXO vs. Account Model

Privacy, Security, Scalability: Comparing UTXO vs. Account Model

Marc Lewis
Managing Editor
Confidential UTXO Model: Enhancing Blockchain Privacy for Tokenization

Confidential UTXO: Preserving Privacy in Blockchain-Based Systems

Marc Lewis
Managing Editor
Blockchain Privacy for EVM: An Overview of the Evolving Landscape

Decoding Blockchain Privacy for EVM: An Overview of the Evolving Landscape

Ray Chen
Product Manager

Blockchain made radically simple for the enterprise

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