How to Create and Deploy An NFT Using Remix and Open Zeppelin


In this article, we will guide you through the procedure of creating your first XRC-721 (NFT) contract on Remix IDE with Open Zeppelin, deploying NFTs image/metadata on IPFS, and deploying smart contracts on the XDC Network.

XDC Network

The XDC Network ($XDC) is an enterprise-ready, open-source, hybrid blockchain protocol specializing in tokenization for real-world decentralized finance.


XDCPay is a bridge that allows you to visit the distributed web of tomorrow in your browser today. It allows you to run XDC dApps right in your browser without running an XDC node. While doing transactions on the blockchain network, it uses computing power in the form of gas fees. To pay the gas fees, you will need a wallet that handles your assets and that's where XDCPay comes in.


NFTs and digital collectibles are growing in popularity as the Web3 space continues to make significant advancements in the blockchain arena. The enormous popularity of NFTs like Cryptokitties and Bored APE pushed investors to purchase ERC721-compatible digital collectibles.


Tools like the OpenZeppelin Wizard offer developers click-and-write functionality to create composable and secure smart contracts in no time.

XDC Remix

XDC Remix is a web browser-based integrated development environment that allows users to write, compile, deploy, and run Solidity smart contracts on the XDC Network.


The InterPlanetary File System is a protocol, hypermedia, and file sharing peer-to-peer network for storing and sharing data in a distributed file system. IPFS uses content-addressing to uniquely identify each file in a global namespace connecting IPFS hosts.

1. Open Zeppelin

  • First, go to OpenZeppelin. In the Wizard tab, click on ERC721. All NFTs are ERC721 tokens.

  • You'll want your tokens to be Mintable and have Enumerable and URI Storage as the features. Name your token as you'd like and enter the desired symbol. You can add more features as you need them.

Select all code and copy it.

Next, open XDC Remix, which will open the Remix IDE.

In order to get started deploying new contracts on XDC Mainnet and/or Apothem, you'll need to have an XDCPay wallet to sign your transactions, and to you your store XDC tokens.

  • First we have to install the chrome extension of XDCPay.

  • Open the Chrome extension after it has been successfully installed.

  • Agree to the Terms of Service.

  • Create a new XDCPay wallet by setting up a strong password or use an existing Seed Phrase 12 or 24-Word Mnemonic Phrase to recover your existing wallet here.

  • Keep the seed phrase safe. 🚨 Do not share the seed phrase with anyone or you can risk losing your assets and/or the ownership of your smart contracts! 🚨

  • Verify recovery phrase

  • Your XDCPay wallet has been successfully created

βš’ Adding Testnet XDC to Development Wallet

Initially, your account will be empty, and you'll need XDC tokens to initiate blockchain transactions. You'll use a faucet to fill our wallet with test XDC tokens for this. These tokens hold no value. They are simply used to test your contracts on the testnet in order to avoid losing your real money.

  • First, make a copy of your wallet address. Your wallet address would look something like xdc057ac7de8ad6f21c7bb0dcc6a389ff9161b3b943. These account address are interchangeable with the Ethereum network. You can access these accounts on the Ethereum network by simply changing the initial xdc with 0x.

  • Next, navigate to the XDC faucet.

  • Enter your XDC account address and request for Test XDC here.

  • If your request is approved, you will be credited with the XDC in your wallet.

  • If you can't see the XDC in your wallet, make sure you're connected to the XDC Apothem Testnet or the XDC Mainnet.

  • If you are currently connected to the XDC Mainnet, switch to the XDC Apothem Testnet.

4.Deploy the NFT Smart Contract

In Remix, go to deploy and select Injected Web3 as the Environment. It will connect to your network automatically, and you will receive the address of your XDCPay wallet along with the balance. Select your smart contract in the Contract tab and click on Deploy.

You will see an XDCPay popup asking you to pay the fees. Click Confirm and wait 10 seconds as it adds the deployed contract in Remix!

Or you can manually add deployed contract by exploring MainNet Explorer , Testnet Explorer

5. Formatting the NFT Metadata

To pull in off-chain metadata for XRC721 tokens, the contract will need to return a URI pointing to the hosted metadata. To find this URI, XDsea and other popular marketplaces will use the tokenURI method contained in the ERC721Uristorage standard.

	"name": "Mogi TheHurt",
	"description": "Mogali is a fictional character",
	"properties": [],
	"royalty": 0,
	"creator": [],
	"image": "<ypur_image_cid>",
	"fileType": "image/jpeg",
	"preview": ""

Copy the metadata structure before pasting it in json online editor and editing the description as you'd like it to read. According to the Block Explorer APIs, the NFT Metadata should be stored in a .json file and structured as shown above.

6. Creating and Uploading the Metadata on IPFS

  • Now that you have a brief understanding of what will be contained in your NFT metadata, you'll learn how to create it and store it on the Inter Planetary File System (IPFS).

  • Go to Pinata and make an account there, which included verifying your email. Then click upload to upload your NFT image, copy cid, and paste it in metadata file image section.

Save the JSON file as metadata.json and upload it to Pinata. Copy the cid of metadata.json and a prefix of<your_metadata.json_cid>

7. Mint Your NFT

Next, head on over to Remix. It's important to know that orange methods are methods that actually write on the blockchain while blue methods are methods learning from the blockchain.

Click on the safeMint method dropdown icon and paste your address and the following string into the uri field:<your_metadata.json_cid>

Clicking on transact will create a XDCPay popup prompting you to pay the gas fees. Click on β€œsubmit” and go on minting your first NFT!

  • Enter your address in the balanceOf button and enter your address. Run it β€” it should show you have 1 NFT.

  • Do the same with the tokenUri method, inserting β€œ0” as the id argument β€” it should display your tokenURI.

  • Great! You just minted your first NFT! πŸŽ‰ Now it’s time to move to Block Explorer to check if the metadata is read.

8. verify NFT contract on Block Explorer

Now go to the Block Explorer and paste your NFT contract in search box.

To verify contract we need source code, so go to XDC Remix and add FLATTENER Plugin.

FLATTENER created a file, copy all code from this file.

Paste code in big box.

πŸŽ‰ We succussfully verified our contract.

9. View the NFT on Block Explorer

Now we are viewing our minted NFT in Block Explorer.

Congratulations! You have successfully created, modified, and deployed your first NFT smart contract, minted your first NFT, and published your image on IPFS!

Thanks for reading.

For more information about XinFin Network, Please Visit XDC Network Documentation on GitBook.\

Last updated