How to Create and Deploy ERC-721 NFTs

·

Creating and deploying Non-Fungible Tokens (NFTs) has become a cornerstone of blockchain innovation, especially within digital art, gaming, and decentralized applications. The ERC-721 standard is the foundation for most NFTs on Ethereum and EVM-compatible blockchains. This guide walks you through the entire process—from understanding the standard to minting your first token—using accessible tools like Remix IDE and IPFS.


Understanding ERC-721: The NFT Standard

ERC stands for Ethereum Request for Comment, with 721 being the unique identifier for this proposal. Unlike fungible tokens such as ERC-20, ERC-721 defines a standard for non-fungible tokens—each with unique properties and ownership tracking.

Built for the Ethereum Virtual Machine (EVM), ERC-721 enables developers to create tokens that represent distinct assets like digital art, in-game items, or real estate. While other standards like ERC-1155 support both fungible and non-fungible tokens, ERC-721 remains the most widely adopted for pure NFT use cases.

Core Functions of ERC-721

The standard includes a set of mandatory and optional functions that ensure interoperability across wallets, marketplaces, and platforms.

ERC-20 Compatible Functions

These familiar functions help wallets display basic token information:

Ownership Management

Critical for secure transfers:

Metadata & Discovery

Enables rich data attachment:

Events for Transparency

Smart contracts emit these events to track activity:

👉 Learn how blockchain standards power next-gen digital ownership


Real-World Use Cases of NFTs

NFTs extend far beyond profile pictures and digital collectibles. Their ability to represent unique ownership unlocks diverse applications:

These applications highlight why mastering ERC-721 deployment is valuable for developers and creators alike.


Setting Up: Test Network and Wallet

Before deploying to the main Ethereum network, it's essential to test your contract on a testnet. We’ll use Ropsten, though it's now deprecated in favor of newer testnets like Sepolia. For learning purposes, Ropsten still serves as a solid example.

Step 1: Install MetaMask

Download the MetaMask browser extension and create a wallet. Ensure you back up your seed phrase securely.

Step 2: Switch to Ropsten Testnet

In MetaMask:

  1. Click the network dropdown.
  2. Select "Ropsten Test Network" (or add it manually if not listed).
  3. Visit a Ropsten faucet (e.g., faucet.ropsten.be) to get free test ETH.
  4. Paste your wallet address and request funds.
Note: Ropsten was one of Ethereum’s earliest testnets, designed to mirror Mainnet behavior for development and testing. Due to recent network changes, consider using Sepolia or Goerli for new projects.

With test ETH in hand, you’re ready to deploy.


Hosting NFT Assets on IPFS

Storing metadata and media off-chain ensures permanence and reduces gas costs. IPFS (InterPlanetary File System) is a decentralized file storage protocol ideal for NFTs.

Step 1: Initialize IPFS Repository

Open your terminal and run:

ipfs init

This creates a local node repository where files are stored.

Step 2: Start the IPFS Daemon

Run:

ipfs daemon

This connects your node to the IPFS network.

Step 3: Add Your Artwork

Upload your image (e.g., art.png):

ipfs add art.png

You’ll receive a content identifier (CID) starting with Qm. Form the public URL:

https://ipfs.io/ipfs/QmYourImageHash

Step 4: Create and Upload Metadata

Create a nft.json file:

{
  "name": "My First NFT",
  "description": "A simple ERC-721 token created for learning.",
  "image": "https://ipfs.io/ipfs/QmYourImageHash"
}

Upload it:

ipfs add nft.json

Save the resulting JSON URL—you’ll use it during minting.

Why IPFS? Files on IPFS are content-addressed. Any change alters the hash, ensuring immutability and trustless verification.

Writing and Deploying Your ERC-721 Contract

We’ll use Remix IDE, a browser-based Solidity development environment, to simplify coding and deployment.

Step 1: Set Up Remix

Go to remix.ethereum.org and create a new file: NFT.sol.

Step 2: Write the Smart Contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/ownable.sol";

contract MyNFT is NFTokenMetadata, Ownable {
    constructor() {
        _initializeNFToken("MyNFT", "MNFT");
    }

    function mint(address _to, uint256 _tokenId, string calldata _uri) external onlyOwner {
        super._mint(_to, _tokenId);
        super._setTokenUri(_tokenId, _uri);
    }
}

Step 3: Compile and Deploy

  1. In Remix, go to the Solidity Compiler tab and compile.
  2. Navigate to Deploy & Run Transactions.
  3. Select Injected Web3 (connects to MetaMask).
  4. Choose your contract (MyNFT) and click Deploy.

Approve the transaction in MetaMask.


Minting Your First NFT

After deployment:

  1. Expand the deployed contract in Remix.
  2. Find the mint function.
  3. Enter:

    • _to: Your wallet address.
    • _tokenId: e.g., 1.
    • _uri: The IPFS link to your nft.json.

Click transact and confirm in MetaMask.

👉 See how leading platforms streamline NFT creation and trading


Frequently Asked Questions (FAQ)

Q: What’s the difference between ERC-721 and ERC-1155?
A: ERC-721 assigns one unique token per ID, while ERC-1155 supports multiple token types (fungible, non-fungible) in a single contract—ideal for games with mixed assets.

Q: Is IPFS truly permanent?
A: IPFS stores files only as long as at least one node hosts them. For permanence, use services like Pinata or Filecoin for long-term pinning.

Q: Can I update my NFT after minting?
A: No—NFTs are immutable once deployed. However, metadata can be updated if the contract allows dynamic URI changes.

Q: How much does it cost to mint an NFT?
A: Gas fees vary based on network congestion. On Ethereum Mainnet, costs can range from $10–$100+. Testnets use free test ETH.

Q: Can I sell my NFT after minting?
A: Yes—once minted, you can list it on marketplaces like OpenSea or LooksRare by connecting your wallet.

Q: Do I retain copyright after selling an NFT?
A: Typically no—unless specified in metadata or external agreement. Ownership of the token doesn’t automatically grant IP rights.


Final Steps and Next Actions

Congratulations! You’ve successfully created, deployed, and minted your first ERC-721 NFT. From here:

Whether you're an artist, developer, or entrepreneur, mastering NFT creation opens doors to innovative digital economies.

👉 Discover tools that simplify blockchain development and deployment