This page may contain legacy content

To get our most up-to-date content please access our documentation

October 22, 2021

ERC-721 Token Standard – How to Transfer ERC721 Tokens

Table of Contents

Tokens are at the heart of the blockchain and cryptocurrency industry. However, there’s tokens, and then there are tokens. The two main categories of tokens are “fungible” and “non-fungible” tokens (with the latter being commonly referred to as NFTs). Furthermore, fungible tokens and NFTs adhere to different token standards. As a general rule of thumb, fungible tokens on Ethereum’s network use the ERC-20 token standard. Meanwhile, Ethereum NFTs generally follow one of two main token standards. The arguably most common of these is the ERC721 token standard. Furthermore, we’re also going to look closer at the process of creating ERC721 tokens and how to transfer ERC721 tokens with Moralis

If you want to create dApps (decentralized applications) or any type of tokens, it’s beneficial to utilize tools to speed up the development process. One of the most prominent platforms for this is Moralis, the premier Web3 operating system for blockchain development.

Traditionally, backend development poses the main barrier to Web3 and blockchain development. Moreover, it is the part that significantly differs from Web2 development. However, this is where Moralis enters the picture, providing an already developed backend infrastructure for its users. As such, the platform takes care of the heavy lifting, leaving you to focus on frontend development. 

So, if you want to develop dApps and tokens, then the first step in the right direction is to sign up with Moralis. Not only will you gain access to the backend infrastructure of the platform, but also other helpful tools such as Moralis’ ultimate NFT API, Moralis’ Price API, native support for IPFS, and much more! Now, let’s dive deeper into the topic of ERC721 tokens and educate ourselves about what ERC721 tokens actually are!

What are ERC-721 Tokens? 

ERC-721, or simply ERC721, refers to a token standard on Ethereum. The name stands for “Ethereum Request for Comments 721“. A common term to describe these assets is “non-fungible tokens”, or NFTs. Put simply, being “non-fungible” means that they are unique. The interest in NFTs saw exponential growth during 2020 as people began speculating on the value of these tokens. As such, this resulted in ERC721 tokens becoming more popular than ever before. However, what exactly is the ERC-721 token standard, and what does it mean? 

The ERC-721 standard allows an application to utilize the standard Ethereum API for NFTs within a smart contract. For example, the standards ensure that the NFTs can be transferred and tracked, ensuring a correct record of who owns the token. 

ERC-721 tokens and NFTs generally represent ownership of virtually anything from physical and digital assets, making them dynamic and diverse. For example, they can represent virtual collectibles, such as CryptoKitties, physical properties such as houses, and negative value assets such as debt. 

However, there is an essential fact regarding NFTs worth considering, and that is that the contract itself doesn’t contain any data such as images. An example of this might be digital art, such as an image. The image or the art piece doesn’t exist on the blockchain, but the token has an ID referencing the image. 

This further means that the token has an ID and certain metadata, and this data contains a link to an image hosted elsewhere. As such, NFT tokens point to resources outside of the blockchain and keep track of who owns an asset on-chain. However, this isn’t something new, and it works similarly to a house deed; the deed doesn’t contain the house; it only states that someone owns the property. 

How to Make an ERC721 Token?

Now that we have somewhat of a better understanding of the ERC-721 token standard, we can take a closer look at the process of how to create an ERC721 NFT. Creating an NFT doesn’t have to be all that difficult, and for this task, we’re going to look at the process of creating a dApp that can be used to mint NFTs continuously. However, since the purpose of this article is to simply explain what ERC721 tokens are and how to transfer them, we won’t go into the process with too much detail. 

As we are going to be using Moralis to make an ERC-721 token, the process consists of five steps:

  1. Initializing Moralis and finding a smart contract.
  2. Set up an HTML index file.
  3. Create a login function.
  4. Add an upload function.
  5. Build a mint function.

Implementing these steps will result in a dApp that can mint more than a single ERC-721 token. Furthermore, since we are working with Moralis through the process, little to no prior development skills are needed. However, it would be preferable to have some previous knowledge of JavaScript and Solidity since this would aid in the development process.

Nonetheless, these steps are quite straightforward, and if you’d like to take a closer look, then check out the article on how to create your own NFT. Furthermore, you can also check out the following clip from Moralis’ YouTube channel. This is a clear and excellent video guide of the complete process:

How to Transfer ERC721 Tokens? 

With Moralis, it becomes possible to transfer several different types of tokens with a single line of code. This is easily achievable since the platform provides pre-developed functions that can come in handy when developing dApps or transferring tokens. However, in this example, we are simply going to look closer at how to transfer ERC721 tokens. 

We can find all the necessary information to transfer a token, of any type, in Moralis’ documentation. Here we can choose from fungible, non-fungible, and semi-fungible tokens, but since we are transferring ERC-721 tokens, this is the option that we want to pick. As such, this is what the code from the documentation looks like:

Code for Transferring ERC721 Tokens:

// sending a token with token id = 1
const options = {type: "erc721",  
                 receiver: "0x..",
                 contractAddress: "0x..",
                 tokenId: 1}
let result = await Moralis.transfer(options)

As you can see, there are actually a few lines of code containing specific information needed in order to transfer the NFT. So, let’s see what each line of code does. First, we create a new object where we specify the type of token, which will be, in this case, ”ERC721”. Next up, we will also specify the receiver address, which is where you would like to transfer the ERC721 token. Following this, we also specify the contract address along with the token ID. This information is available through the metadata of the NFT. 

Finally, we take the object and pass it as an argument when we call the ”Moralis.transfer()” function. That’s it; this is all we need to do to transfer ERC-721 tokens when using Moralis. 

However, in the example above, we needed to input the information regarding the token manually. Fortunately, it is possible to create a dApp that can take care of this for you and your users. So, if you are interested in learning more about this, then check out the following video:

ERC-721 vs ERC-1155

The introduction of the ERC-721 standard made the Ethereum network more dynamic and allowed for new innovative solutions. Developers could use the standard to, for example, make the real estate market more efficient or add bonds to the crypto market. However, even though the ERC-721 standard made the network more dynamic, it was still possible to make Ethereum development even more flexible. 

ERC-721 token contracts are designed for creating only one specific type of NFT, which in some cases limits the potential of a token. Concert tickets are an example of this as the limitations of the ERC-721 standard can become problematic. Creating NFTs for this would mean that the contract would contain seat IDs that are mapped to the seat’s buyers. So far, so good; however, the issue arises when we have more than one concert. If we have multiple shows, then this would mean that we would need to deploy a new ERC-721 token contract for each new event.

However, another token standard emerged to solve this issue. Specifically, this standard is called “ERC-1155”, and is even more dynamic. With the ERC-1155 token standard, it is possible to have multiple different NFTs within one smart contract. Furthermore, it is also possible to add more NFTs as you go along. This means that you won’t need to decide precisely what NFT you want to include when the contract is deployed. ERC-1155 tokens are therefore a lot more dynamic and can deal with more features than the ERC-721 standard. 

However, the drawback of this dynamism is that an ERC-1155 token is a lot more complicated. As such, we recommend that new developers start developing ERC721 tokens since they are significantly easier to deal with.

What is Moralis? 

Moralis is the premier platform for creating and sending ERC721 tokens between wallets, among many other things. Specifically, Moralis gives you the potential to save both time and money, not only in NFT token development, but for creating dApps in general as well. 

One of the many benefits of Moralis’ platform is the already developed backend infrastructure that users get access to. This allows for a much quicker development process for all your future blockchain projects. Furthermore, it’s also the infrastructure along with Moralis’ SDK that enables you to transfer tokens with only one single line of code. 

Moreover, the platform also provides a vast selection of excellent development tools that makes the development process of various tokens and dApps feel like a breeze. For example, you can easily build ETH dApps with Moralis Speedy Nodes. However, the Speedy Nodes service from Moralis is just one of the many features of the platform.

If you want to become a blockchain developer, we highly recommend checking out the Moralis blog. Fresh, high-quality content is frequently published, which will help you become a better developer. For example, you can check out articles explaining the best languages for blockchain development, limitations of RPC nodes, how to create a DEX or how to create smart contracts. 

So, if you want to get started in dApp development, the first essential step is to sign up with Moralis. Joining the platform is free, and it only takes a couple of seconds to set up your account! 

ERC-721 Token Standard – Summary

Tokens are fundamental features of blockchain development and, if used right, can be quite powerful. Since they are such prominent tools, they must be regulated somehow, which is mainly done through some kind of standard. A standard also makes sure that interoperability exists on a blockchain’s network, ensuring that all tokens, for example, can be transferred from one wallet to another.

In the case of Ethereum’s network, there are a few different standards, and the most popular ones are ERC-20, ERC721, and ERC-1155. The ERC-20 token standard regulates fungible tokens, ERC721 is a standard for NFTs, and ERC-1155 is the standard for semi-fungible tokens. 

The ERC721 token standard implements an API for tokens with smart contracts. This ensures that all tokens following this standard have some default functions allowing users and developers to get token balances, transfer tokens, etc. Furthermore, ERC721 tokens can represent virtually anything, making them quite dynamic. 

Moreover, transferring and creating ERC721 tokens is exceptionally straightforward when using Moralis’ platform as a foundation. For example, as a Moralis user, it is possible to transfer ERC721, ERC-20, and ERC-1155 tokens with just a single line of code. 

However, this is far from the limits of Moralis’ platform, which allows you to create all kinds of dApps and exciting blockchain projects. Furthermore, among the many excellent features are native support for MetaMask, a React dApp template, or an Ethereum authentication guide. This is an extensively used crypto wallet that acts as a gateway to Ethereum’s ecosystem of dApps, something that will come in handy when you create Ethereum dApps, etc. 

As such, you should definitely sign up with Moralis right away, as 35,000+ blockchain projects have. Joining Moralis will provide immediate access to the backend infrastructure along with the platform’s extensive set of tools. 

Unlock the full potential of your NFT projects with this industry-leading NFT API! Fast, easy, and free.
Related Articles
January 7, 2023

Mint NFT from Contract – How to Mint an NFT from a Contract

December 8, 2022

Sepolia Testnet Guide – What is the Sepolia Testnet?

March 3, 2023

How to Build a Polygon Portfolio Tracker

January 1, 2024

Full Guide – Web3 Social Media Platforms

October 2, 2022

Tutorial: How to Connect a Dapp to Polygon Network

January 3, 2024

ETH Layer-2 – What are Ethereum Layer-2 Solutions?

January 4, 2023

Smart Contract Programming – The Ultimate 2023 Guide to Blockchain Programming

October 14, 2023

The Ultimate Guide to NFT Marketplace Development