How to Mint NFT from Smart Contract [With Pictures]

Share This Post

Share on facebook
Share on whatsapp
Share on linkedin
Share on twitter
Share on email

Minting directly from a smart contract address is one of the many ways you can mint an NFT. While minting NFTs generally involves using a launchpad or a website of some sort, some people prefer to mint from a contract. 

Minting an NFT from a smart contract involves giving ‘write’ instructions to the contract to execute directly on the blockchain. And this is very popular on Etherscan, The Ethereum Blockchain Explorer.

If you’re new to NFTs, here’s all you need to know about smart contracts.

Smart contracts are codes/programs that are stored on the blockchain, holding a project’s information and self-executing when certain conditions are met.

Information in a smart contract includes NFT/Token name, price, transactions, terms of an agreement between the buyer and seller, etc., all written into lines of code. This is known as the NFT metadata. Smart contracts are saved on a decentralized blockchain when executed, can be tracked, and are immutable – “cannot be changed.”

Why Mint NFTs From Smart Contracts?

Free Mints NFTs actually increased the popularity of minting from contracts. Many people have questioned why projects are giving their NFTs away for free. People chose to mint via smart contracts to avoid connecting to wallet drainers and verify the accuracy of the information provided.

Minting from smart contracts has risks, but it is safer when compared with minting from a website. Some projects rig their mint buttons with signatures that transfer out all your wallet valuables. A smart contract mint prevents this by triggering the exact mint command.

Though minting from smart contracts is great, if the code has existing conditions that must be met, like a mint list (whitelist addresses), your mint action may fail.

What You Need To Mint NFTs From Smart Contracts

Minting NFTs from a smart contract requires a checklist to ensure minting is successful. This also helps you to decide if you should proceed with the minting or not.

Burner Wallet

A burner wallet is an extra crypto wallet account used for experimentation. It usually has a small amount of Ethereum needed to cover gas fees. All crypto assets are moved from this wallet to other wallets.

Using burner wallets saves you from wallet drainers if you have mistakenly connected to a bugged contract. I will be using the Metamask wallet. The image below from project 10x describes it better.

Some Ethereum

Interacting with smart contracts need gas fees, meaning you need some Ethereum to cover the transaction fees. Log in to your favorite crypto exchange, and buy some Ethereum tokens. Transfer the token to your burner wallet address, and you are good to go.

Project Information

It is wise to get some information on the project you want to mint, except if you decide to FOMO into some free mints from WhatsMinting or some other free mints tracker. Most free mints have no RoadMap, and information about them is scarce.

Getting this information beforehand will help you decide if you want to mint or not. This should either save you gas fees money or boost your confidence to mint.

Smart Contract Address

The smart contract address is as important as gas fees. Without the smart contract address, minting from the smart contract will be impossible. Most projects share their smart contract address on the mint day, or you have to find a way to get the smart contract address by yourself.

How To Get The NFT Smart Contract Address.

You have to either go through mint sites, wallets, marketplaces, or mint trackers to get the smart contract address of an Ethereum project. This is usually the case when the project doesn’t share the smart contract address.

How To Get The Smart Contract Address from the mint site

I will be using the mint website for Brainless Spikes for this explanation. Note: this is not an endorsement/promotion for Brainless Spikes.

Connect to the URL of the NFT mint site. Most times, the link to the contract address will be on the mint page.

If it’s not there, or you wish to verify, connect your burner wallet to the website and click on the mint button.

On your Metamask mint confirmation pop-up, click on the Address just above the price, as shown below.

A new pop-up will appear, showing the full address and a link to view the project’s smart contract address.

Click on the link to open the Etherscan page, showing the smart contract info.

How To Get The Smart Contract Address from Wallets

This process assumes that you already know a wallet address that contains the said NFT. Maybe a close associate already minted the said NFT, and you wish to mint using the contract address.

Copy the Wallet Address of the person and head over to Etherscan, paste the address on the search bar, and search.

On the results page, click on the “Erc721 Token Txns” tab. Hover on the names on the Token column till you locate the NFT you need. Click on it.

This will display the token page and the Contract address in the Profile Summary section.

Click on the contract address to reveal the smart contract page.

How To Get The Smart Contract Address from Market Places

The Brainless Spikes NFT is still trading and minting at the time of writing the article. Making it the perfect NFT for this tutorial.

Head over to the NFT marketplace you wish to use, e.g., OpenSea, LooksRare, X2Y2, and search for the collection’s name. Here we are using Brainless Spike Originals.

Select the collection from the results to open the collection Page.

On Open Sea, look for the Etherscan Icon (when you hover over it, it shows ‘view on Etherscan’). Click on it to reveal the smart contract page.

On X2Y2, The contract address is under the collection’s name. You can also click on the Etherscan icon to reveal the smart contract page.

On LooksRare, the link to the smart contract is right under the collection’s name. Click on reveal on the smart contract page.

How To Get The Smart Contract Address from Mint Trackers

Sometimes, I use mint and wallet trackers to know what is trending and FOMO in. One popular mint tracker is the WhatsMinting Live tracker

Getting the smart contract address from these trackers is as easy as locating the Etherscan icon under the said project. Click on it, and the contract page appears.

How To Mint NFT From Smart Contract.

Now that we have all we need let us proceed to mint from the smart contract. Click on the Contract Tab on the project contract page on Etherscan. The Contract should have a green checkmark showing it’s verified. If it isn’t, please don’t continue. 

Here you will see the Codes, Read Contract and Write Contract. Descriptions included in the Read Contract are taken from the contract source code.

Click on Write Contract to reveal more information. Click on the connect to Web3 button and connect your Metamask wallet. 

Scroll down and look for Mint. This will reveal the required parameters needed for the contract mint: Payable amount, which is the mint price, and _amount, which is the number of tokens we want to mint.

If the project is free mint, enter 0 in the payable amount field and 1 in the _amount field to mint 1 NFT. If it is a paid mint that costs, let’s say, 0.05 eth, enter 0.05 in the payable amount field.

Click on the Write button, and confirm if you have enough fees to cover gas. Confirm to complete the transaction.

Does Minting NFT From Smart Contract Always Work?

No. The mint will fail to go through if the project has some validations that must be checked, such as allowlist, having a previous NFT token, or some other validations coded on the front end. The previous screenshot contained a third parameter called ‘Proof,’ which is an extra validation.

Although if you are savvy enough to get all the parameters right, it might go through. But mistakes on the blockchain are immutable. Entering the wrong information might cause you to lose money. 

Conclusion

how to mint nft from smart contract

Minting NFT from smart contracts becomes easy when you have done it a few times and understand how it works. This also helps you a bit in understanding how the vast blockchain technology works.

Remember, most projects will not need you to mint from smart contracts, and if they do, they will likely provide the information you need. Always move your important assets from the burner wallet to the cold wallet.

Leave a Reply

Your email address will not be published. Required fields are marked *