Pinata
Published in

Pinata

How To Build an App NFT

Using Pinata, Polygon, and OpenSea

Getting Started

Creating The Contract

mkdir nft-app-contract && cd nft-app-contract
npm init
npm install --save-dev hardhat
npx hardhat
npm install @openzeppelin/contracts
npx hardhat test

The Application

npx create-react-app app-nft-frontend
"homepage": "./"
npm i -g pinata-upload-cli
pinata-cli -a JWT_HERE
"deploy": "npm run build && sh ./upload.sh"
pinata-cli -u ./build
npm run deploy

Making an App NFT

require("@nomicfoundation/hardhat-toolbox");module.exports = {
solidity: "0.8.9",
};
module.exports = {
solidity: "0.8.9",
networks: {
mumbai: {
url: `https://polygon-mumbai.g.alchemy.com/v2/YOUR_ALCHEMY_KEY`,
accounts: ["YOUR POLYGON MUMBAI WALLET PRIVATE KEY"]
}
}
};
{
"name": "App NFT",
"description": "A full application, accessible as an NFT, sold as an NFT, and transferred as an NFT",
"image": "ipfs://CID_FOR_IMAGE_REPRESENTING_YOUR_APP",
"animation_url": "ipfs://HASH_FROM_APP_BUILD"
}
pinata-cli -u ./metadata.json
const hre = require("hardhat");
const URI = "ipfs://METADATA_CID"
async function main() {
const AppNFT = await ethers.getContractFactory("AppNFT");
const appNft = await AppNFT.deploy(URI);
await appNft.deployed(); console.log(`Contract deployed to ${appNft.address}`);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
npx hardhat run scripts/deploy.js
Contract deployed to 0x5FbDB2315678afecq367f032d93F642f64170aa3
npx hardhat run scripts/deploy.js --network mumbai

Wrapping Up

--

--

The cloud wasn’t built for this. Pinata was. Managing your NFT media just got easier.

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