This application is a simple example to understand the process of creating an NFT.
MumbaiTestNet Metamask Network Parameters:
- Network Name: Mumbai Testnet
- New RPC URL: https://rpc-mumbai.maticvigil.com
- Chain ID: 80001
- Currency Symbol: MATIC
- Block Explorer URL: https://polygonscan.com/
This endpoint posts image to IPFS by using nft.storage API
Method: POST
Payload: None
Response:
{
"metadata": {
"name": "TOGGNFTTest2",
"description": "TOGG NFT Test2",
"image": "ipfs://bafybeiatlrvoolbn5m5bxeua5hramuuuemc44w26cjevktd7yc6hy5qxiq/TOGGNFTTest.png"
},
"ipnft": "bafyreifddym57uuvki275ndmcx4dzjc6yrp5askoeyjd2lzzpn2ibixkhm",
"url": "ipfs://bafyreifddym57uuvki275ndmcx4dzjc6yrp5askoeyjd2lzzpn2ibixkhm/metadata.json"
}
This endpoint mints the image and returns the tx id
Method: POST
Payload:
{
"metadata": "ipfs://bafyreifddym57uuvki275ndmcx4dzjc6yrp5askoeyjd2lzzpn2ibixkhm/metadata.json"
}
Response:
{
"txHash": "0x8f7defd844434f954d1d15b94b9e654ac2944883f1d48c0bb8ca880b110d6986"
}
https://hardhat.org/hardhat-runner/docs/getting-started#overview
npx hardhat run scripts/deploy-contract.mjs --network PolygonMumbai
Output:
nft-builder-backend % npx hardhat run scripts/deploy-contract.mjs --network PolygonMumbai
ContractAddress: 0x245Ad6929537c872ff6Aa6124f3557Ea2782d9f3
You can also use this cli to mint your NFT
npx hardhat run scripts/mint-nft.mjs --network PolygonMumbai
Output:
NFT minted to: 0x8B8590761d9a27f9abffCa684610Cd02a61a4B5B
For this example you can see the result: https://testnets.opensea.io/0x8B8590761d9a27f9abffCa684610Cd02a61a4B5B
https://mumbai.polygonscan.com/tx/0x8f7defd844434f954d1d15b94b9e654ac2944883f1d48c0bb8ca880b110d6986