How to create an interactive NFT with Remix for Ropsten

In this post, we will try to create an interactive NFT.

Requirements

Steps to create an interactive NFT

Step 1. Add cypher-ropsten to MetaMask

Step 2. Create an account

Step 3. Get 5 test CPH from the faucet

Step 4. Write a contract on Remix

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.2/contracts/token/ERC721/ERC721.sol";
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.2/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.2/contracts/utils/Counters.sol";

contract InteractiveCube is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721 (“InteractiveCube”, “CUBE”) {}

function mint(string memory tokenURI) public returns (uint256) {
uint256 newItemId = _tokenIds.current();
_safeMint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
_tokenIds.increment();
return newItemId;
}
}

Step 5. Using Pinata (IPFS) to add information to your NFT

{

“name”: “InteractiveCube 1”,

“description”: “Red Cube”,

“image”: “https://gateway.pinata.cloud/ipfs/QmaYSb2UuAjoyyfoRWqN7q6mjAn3518idxZwWuxyc4WBkw",

“animation_url”: “https://gateway.pinata.cloud/ipfs/QmVpZCEQBAmXQ5L9iTSgMZtKsMqYRKkqZeJUL4WrbnALvx/"

}

Step 6. Mint an NFT

Step 7. Check your NFT and play with it

About Cypherium

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store