Create Your Own NFT on R0ARchain



Prerequisites
Follow the two steps below before starting your R0AR NFT minting process:
-
MetaMask Installed & Connected to R0ARchain.
-
Test ETH (if using Testnet) from testnet.r0arfaucet.io.
Launch Remix IDE
Remix IDE is an online development environment for creating and deploying smart contracts, and it is fully compatible with R0ARchain.
-
Go to the Remix IDE website.
-
Click on the File Explorer icon and create a new file named MyNFT.sol.
Copy Solidity code into SimpleStorage.sol file
Copy and paste the following ERC-721 NFT contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyNFT is ERC721URIStorage, Ownable {
uint256 private _tokenIds;
constructor() ERC721("MyNFT", "MNFT") {}
function mintNFT(address recipient, string memory tokenURI) public onlyOwner returns (uint256) {
_tokenIds++;
uint256 newItemId = _tokenIds;
_mint(recipient, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}
Compile the NFT token Contract
The next step is compiling the ERC-721 contract with the following steps:
Click the Solidity Compiler tab.
Select Compiler Version 0.8.x.
Click Compile MyNFT.sol.
Deploy on R0ARchain
The ERC-721 token can now be deployed on the R0ARchain with these steps:
Go to Deploy & Run Transactions.
Under Environment, select Injected Provider - MetaMask.
Choose R0AR Chain or R0AR Testnet in MetaMask.
Click Deploy and approve the transaction in MetaMask.
Mint an NFT
The NFT is now ready to be minted:
Under Deployed Contracts, expand your NFT contract.
Find mintNFT() and enter the recipient Address (your MetaMask address).
Token URI (a link to an NFT image, e.g., https://ipfs.io/ipfs/YOUR_HASH).
Click Transact and approve the transaction in MetaMask.
View Your NFT
Check your R0ARchain NFT:
Copy the contract address from Remix.
Use r0arscan.io or testnet.r0arscan.io to check your NFT.
To view it in MetaMask, go to NFTs, Iimport NFT, and enter your contract address & Token ID.
Your NFT is now live on R0AR. Welcome to the future of NFT creation and trading.
Next Steps for Developers
Developers might be interested in following up the NFT mint with these steps:
-
Deploy on Mainnet: Use the R0AR Mainnet to mint real NFTs.
-
Bridge Tokens: Transfer ETH and R0AR tokens between Ethereum and R0ARchain.
-
List NFTs on Marketplaces: Integrate your NFTs with OpenSea or other marketplaces.
-
Smart Contract Development: Expand your NFT's functionality with features like crypto staking rewards, royalties, or DAO integration.
Finally, developers looking to interact with a community of leading builders and traders should join the R0AR DeFi community.
FAQs
ERC-721 is a technical standard for creating non-fungible tokens (NFTs) on the Ethereum blockchain. Unlike ERC-20 tokens, each ERC-721 token is unique and indivisible, making them ideal for representing ownership of digital collectibles and other one-of-a-kind assets.
A token URI (Uniform Resource Identifier) is a link that points to the metadata associated with an NFT. This metadata typically includes information such as the NFT's name, description, image, and other relevant attributes.