Polygon: Building an App NFT With Polygon
Learn how to build an app NFT with Polygon and IPFS.
What is Polygon?
1. Start by creating a new directory for your NFT app, then navigating into that directory with the commands:
2. Next, initialize NPM and install HardHat with the commands:
3. Install the OpenZeppelin smart contracts package:
4. In the contracts folder, there will be a default contract that was created. Rename this file dAppNFT.sol, then open the file. Replace the existing content with the following:
dAppNFT.sol, then open the file. Replace the existing content with the following:5. Save this file.
6. Then, compile the project with the command:
7. Next, we’ll need to create the front end of our application. To do this, run the following command:
8. To configure IPFS, first we need to open the package.json file. In this file, add the following key/value pair:
package.json file. In this file, add the following key/value pair:9. Next, install the AWS CLI tool.
10. Then, configure AWS CLI to use your Filebase account. To do this, open a new terminal window. From there, run the command:
11. Open the package.json file again. In the scripts section, add a new script called deploy:
package.json file again. In the scripts section, add a new script called deploy:12. In the root of the project create the file upload.sh. Open this new file in a text editor, then add the following line:
upload.sh. Open this new file in a text editor, then add the following line:13. Next, run the following command:
14. Navigate to the Filebase dashboard and view the bucket that your build folder was uploaded to.

15. Next, navigate to the smart contract directory in your project and find the hardhat.config.js file.
hardhat.config.js file.16. Next, create a file in the root of your project called metadata.json. In this file, insert the following content:
metadata.json. In this file, insert the following content:


17. Next, upload the metadata file to IPFS:
18. Finally, open the scripts folder, and then open the deploy.js file. Replace the existing content with the following:
deploy.js file. Replace the existing content with the following:19. Run the following command to deploy this script on the Polygon network:
Last updated