Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 26, 2022 02:14 pm GMT

How to publish your NFT on Opensea testnet

Index for the post:

  • Overview
  • Acquire test ETH
  • Build and compile smart contracts using Remix
  • Deploy to Rinkeby testnet
  • Mint NFTs
  • Publish on Opensea

This is a quick guide showing you how to publish an NFT youve built to a marketplace like Opensea. Opensea will help you auction or transfer the NFTs you own or build.

There are some prerequisites for this tutorial. You must have the Metamask plugin installed on your browser and Rinkeby testnet network added to it.

There are two parts to this exercise. First well acquire some test ETH and then well use that to publish our NFT to Opensea.

Acquire some test ETH:

We can get some test ETH from a faucet like the Rinkeby faucet. The instructions on how to acquire them are available on the faucets website.

In case the Rinkeby faucet isn't working, try this link. If that doesnt work as well, reach out to me, ill send you some test ETH.

Publish the contract to Ethreum testnet:

For this exercise Ill be using Remix as our IDE and publishing tool. Remix is a cloud based IDE for solidity smart contracts development. You can use any IDE for web3 development kits for the same. Ill cover deploying using truffle and hardhat in a future article.

Once you open Remix create a new file (revise-nft.sol) in the contracts folder. Paste the following code in the file.

// Lets start by importing the Openzeppelin ERC-721 template into our file// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "@openzeppelin/contracts/token/ERC721/ERC721.sol";// Next, lets add our NFT smart contract and name the NFT token (Dynamic NFT)contract ReviseNFT is ERC721 {    string baseuri = "";    constructor(string memory _baseuri) ERC721("Dynamic NFT", "dNFT") {        baseuri = _baseuri;    }    // Last but not the least, lets add functions to enable minting and to enable setting the _baseURI().    function mint(address to, uint256 tokenId) public {        _safeMint(to, tokenId);    }    function _baseURI() internal view override(ERC721) returns (string memory) {        return baseuri;    }}

Lets start by compiling the smart contract. Hit cmd + s on the Mac or ctrl + s on windows to save the file. You should see a green tick on the compiler.

Image description

Click on the Deploy options tab. Its the button just below the compiler button (shown in the above diagram).

Choose ReviseNFT from the contracts dropdown (its usually the last option). Fill the _baseuri property. Paste the baseURI link. The baseURI points to the data within the NFT. This is the data that gets shown in marketplaces like Opensea. You can use Revise to generate the baseURI. Refer to this article for more details.

Image description

Image description

Set the Environment as Injected Web3 in the Environment option (the first option in the page). Make sure Rinkeby network is selected in your Metamask wallet. Now hit the Deploy button. This will bring up the Metamask popup. It will ask you confirm the deployment of this smart contract. Once you accept it, the smart contract will be deployed to Rinkeby testnet.

Once the NFT smart contract is successfully deployed we can mint an NFT. Click on REVISENFT in the deployed contracts section. Youll see a bunch of smart contract functions you can call.

Image description

Click on the mint function and pass it your wallet address and choose 1 as the tokenID (you can choose any number, make sure you use the same number in Revise as the tokenId). This will trigger Metamask and open an popup. Once you hit on confirm it will process your transaction and mint the NFT straight to your wallet.

Copy and store the address of the contract you just deployed. Youll find it under Deployed contracts.

Image description

Now that our NFT smart contract is deployed on-chain and weve minted at least one NFT, were ready to publish our collection to Opensea.

Visit https://testnets.opensea.io and click on the wallet button (its the last button in the header, right beside the profile button). Choose Metamask and click confirm on the popup.

Image description

Once youre logged in you can go to your profile and your NFT will be listed under my collections! If youre not able to view it there just visit https://testnets.opensea.io/assets//, replace the contract address with the address we copied earlier and the token_id with 1 (since thats what we minted). Youll be able to see your NFT there.

Congrats on publishing your first NFT collection to Opensea!


Original Link: https://dev.to/anil_from_revise/how-to-publish-your-nft-on-opensea-testnet-3n29

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To