NFTPort: Create an NFT Collection with NFTPort

Learn how to mint an NFT collection with NFTPort.

What is NFTPort?

NFTPort is a simple and developer-friendly NFT API and infrastructure that allows developers to create and deploy their NFT applications or collections in just a few hours instead of requiring months of development. NFTPort manages the backend NFT infrastructure and provides a versatile API for interacting with the infrastructure.

Read below to learn how to mint an NFT collection with NFTPort.

Prerequisites:

1. First, we need to upload some NFT image files to IPFS through Filebase.

We’ll start by uploading 3 images to Filebase for us to use. To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.

2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

Select ‘Create Bucket’ in the top right corner to create a new bucket for your NFTs.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

4. Next, select the bucket from your list of buckets, then select ‘Upload’ in the top right corner to upload your image files.

5. Select your images to be uploaded.

Once uploaded, they will be listed in the bucket.

6. You can view the object’s IPFS CID in the CID column, or you can click on your uploaded object to display the metadata for the object, which includes the IPFS CID.

Choose the method you prefer, and take note of the IPFS CID.

7. Next, create a new project folder for our project files. We’ll call it nft-collection. Then navigate inside this new folder.

mkdir nft-collection

cd nft-collection

8. Inside this folder, create another folder for your NFTs’ metadata files.

Call this ‘metadata’, then navigate inside of it as well.

mkdir metadata

cd metadata

9. Next, create a .JSON file for each NFT you plan to create in your collection. The format for this JSON file is as follows:

Replace IPFS_FILEBASE_CID with the CID for each NFT image you uploaded to Filebase.

To simplify things, name each .JSON file in the same manner you named your NFT image files. For example, if you followed a numerical naming scheme such as 1.png, 2.png, name your .JSON files as 1.JSON, 2.JSON, etc. Save all of these files in the ‘metadata’ directory.

10. Sign up for a free NFTPort API key here. We’ll need this in the next step.

11. Navigate back to the root directory of the project. Create a new file called upload.py.

Enter the following code into this file:

Replace the following values:

  • NFTPORT_API_KEY: Your NFTPort API key from step 10.

12. Deploy the contract with the following curl command:

Update the arguments in this command to reflect your desired configuration, such as your NFTPort API key and your crypto wallet address.

Take note of the contract hash returned from this command.

This will bring up detailed information on the transaction, including the Contract Address.

Copy this Contract Address.

14. Then, run your upload.py script:

python upload.py

15. Next, download the latest web3.min.js. Save this file in your project’s root directory.

16. Make a new file called index.html. Enter the following content into this file:

Replace CONTRACT_ADDRESS with the contract address you took note of from Polygonscan.

17. Next, install and start a simple http-server for your index.html page to be hosted on:

npm install

npm install http-server

npx http-server

18. Then, navigate to localhost:80, where you should see your minting webpage. It will resemble the following:

To change the cosmetics of the website, edit the index.html file to include different CSS styling.

From here, you can connect your wallet and mint your NFTs!

Last updated

Was this helpful?