Published in


How To Manage NFT Visibility

Using Pinata Submarine, Hardhat, and Ethers.js

Setting Up

Creating the Contract

mkdir pfp-nfts
npm init -y
npm install -D hardhat
npx hardhat
npm install @openzeppelin/contracts

Testing the Contract

npx hardhat test

Deploying the Contract

Uploading Images

npm i axios base-path-converter recursive-fs

Uploading Metadata

npm i faker
node scripts/upload.js

Really Deploying The Contract Now

npx hardat run scripts/deploy.js --network rinkeby
npx hardhat run scripts/mint.js --network rinkeby
npx hardhat run scripts/getOwner.js --network rinkeby

Serving Protected Content Based on NFT Ownership

npx create-next-app pfp-client
npm i ethers ethereumjs-util axios uuid next-iron-session
npm run dev

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