How to deploy an NFT smart contract on Evmos

AlexM
3 min readOct 17, 2021

--

To get started, you need to install IPFS

Open IPFS App

Click files and upload your image

Once uploaded, you will have access to a sharable link. Keep it!

Open Ethereum Remix and create the Smart Contract

Now it’s time to head over to the Ethereum Remix IDE and make a new Solidity file, for example, “nft.sol”. We will use Ethereum Remix and use the 0xcert/ethereum-erc721 contract to create our NFT Contract.

Create a new file and name it “nft” or the way you want!

Copy/paste the following script to your newly created .sol file:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";

contract newNFT is NFTokenMetadata, Ownable {

constructor() {
nftName = "AlexM is the best user";
nftSymbol = "AlexM";
}

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

}

Compile the script

Deploy the Smart Contract using Inject Web3 and make sure it’s connected to your Metamask’s Evmos testnet.

Confirm deployment via MetaMask and your Smart Contract is now deployed!

Mint the NFT

Expand the mint function and add the following details:

  1. Add your Evmos EIP55 address in the _to the field
  2. Enter any number value (better to be a few digits long) in the _tokenid field
  3. Add your IPFS URL to the _uri field, which we obtained in the IPFS section

Finally, click transact and confirm your transaction on Metamask!

Congratulations! You have created your own NFT Smart Contract and NFT token from scratch! You can now send it to a friend!

--

--

Responses (1)