Skip to content


Repository files navigation

NFT School Tutorials Sample Code


This is the companion sample code of the Mint with and Polygon tutorial at

Follow the detailed step by step guide here.

Getting started quickly

If you would like to try this out quickly, follow the steps below:

Step 1

Install npm dependencies. Make sure you your npm version is above 8 or executing scripts of hardhat will fail.

$ npm install

Step 2

Update your .env environmnet variables. Replace your_wallet_private_key with your test account's private key (here is how). Replace your_nftstroage_api_key with your account api key you created (here is a link to it).


Note: you can get some test MATICs from this faucet.

Step 3

Upload MyExampleNFT.png to NFT.stroage (to IPFS + Filecoin network) and save the ipfs://xxx/metadata.json link.

$ node scripts/store-asset.mjs
Metadata stored on Filecoin and IPFS with URL: ipfs://xxx/metadata.json

Step 4

Deploy the contract to Polygon network by executing hardhat script. Save the deployed address for later.

$ npx hardhat run scripts/deploy-contract.mjs --network PolygonMumbai
Contract deployed to address: 0x00xxx

Step 5

Update mint-nft.mjs with correct variables. Replace your_deployed_contract_address with the contract address you saved in Step 4. Replace your_ipfs_nft_metadata_json_link with the asset metadata json link you saved in Step 3.

const CONTRACT_ADDRESS = "your_deployed_contract_address"
const META_DATA_URL = "your_ipfs_nft_metadata_json_link"

Step 6

Mint the NFT and send NFT to your wallet by execuiting following script.

$ npx hardhat run scripts/mint-nft.mjs --network PolygonMumbai
NFT minted to:  0x00xxxx

If successful 0x00xxxx should be your test wallet account address.

Step 7

To verify, go to your metamask test account. You should see your MATIC amount reduced. If you connect your wallet to Opensea Testnet and authorise, you should see the NFT artwork displayed under your account.

Happy minting!


No description, website, or topics provided.







No releases published