How To Mint NFT Direct from Ethereum Contract

How to skip the project website, connect to Etherscan.io and interact directly with the Ethereum contract to mint NFT.

Mark Marroc
Coinmonks
Published in
6 min readJul 3, 2022

--

If you ever minted an NFT, you might have already reached a project's website, connected your wallet, and clicked on a "MINT" button. The wallet pops up a message to confirm the gas for the transaction, and… voilá! You minted your NFT.

But did you know that you might not need to pass through the project's website for some projects? Well, that's what I will show you in this article.

Note that this article mainly applies to PFP projects, not 1/1 art.

Photo by Mo on Unsplash

The Basics

Without too many technical details, knowing how the mint process works is essential.

Usually, we have the project's website. This is what we call FrontEnd, the part where we interact.

But whenever we execute an action, such as a mint, this occurs on the Ethereum contract, the BackEnd. The FrontEnd calls a specific action to the contract.

But it is often possible to call the mint action without interaction with the project's website.

You might want to do this for several reasons. For instance, the website's performance might be impacted by the number of users trying to mint or increase security, reducing the number of sites you connect to your wallet.

However, some projects create specific methods that make itchallengingt to mint from the contract.

The Contract Address

The first thing we need to be able to mint directly from the contract is the contract address.

There are a few ways it can be done, but let me share the common three methods:

1) Official Discord Links

The project publishes the URL for the contract on the official discord links.

This is preferred because is the official link published by the project.

2) Minted NFT

From a minted NFT on the official project's collection (OpenSea, LooksRare). Look for the Item Activity, and the first record shows the link to the transaction that minted this piece.

Mint transaction at the item activity. Right on the Date, there is the icon to go to the transaction.
The transaction page on Etherscan.io

This is an easy method but needs special attention to ensure you are on the real project collection on OpenSea.

3) Using an Aggregator Site

Some aggregator sites, like rarity.garden, can help with additional information about trending projects. They usually include the link to Etherscan.io direct to the project's contract.

Lovebirds NFT on rarity.garden app

Again, always double, and triple check to make sure this contract is official by the project.

It's not uncommon that fake collections also appear on this kind of tool, leading you to mint the wrong NFT.

For this article, I'll be using the contract of @Love_BirdsNFTs:

New to trading? Try crypto trading bots or copy trading

Contract Code & Functions

When opening the contract link, you will see the contract transactions.

When selecting the menu Contract, you will see the contract details, including its source code.

You will also note 2 additional submenus: Read Contract and Write Contract.

Contract screenshot from etherscan.io

Note that you might find a set of functionalities common among projects, but they can vary by name.

The Read Contract will show you the read-only functionalities, doesn't cost gas to execute, and allow you to check some information like max supply, max tokens per transaction, and even the owner of a specific token.

Example of Reading functionalities

The Write Contract, on the other hand, are functionalities that require gas to execute because they will write on the blockchain.

Example of Write functionalities

To execute a Write functionality, you must connect your wallet to Etherscan.io. Click on the "Connect to Web3" button right above the list of functionalities.

It will ask you what wallet you want to connect:

Wallet connect to Etherscan

As this function is a beta functionality provided by Etherscan.io, they show an additional warning message:

Etherscan beta warning message

After connecting the wallet, you note a green indicator with the partial wallet address:

Wallet connected to Etherscan

As we expand the mint function, we can see the required parameters for this method.

In this case, payableAmount is the mint price (which is 0 for free mint projects), and _amount is the number of tokens we want to mint.

Mint parameters

By the time of writing this article, the Lovebirdsproject is sold out. Anyway, let's try to push a mint transaction to see what happens:

Metamask confirmation pop-up

Metamask will open asking for confirmation with an insane gas cost to execute.

This will happen whenever unexpected parameters are received. In this case, we are trying to mint a project where the max supply was already achieved.

Let's try a project that is not minted out, the MoonRabbits:

Transaction confirmation on Metamask

Now we see a much more realistic gas cost for this mint. Note that when interacting directly with the contract, it also shows the message "Unknown processing time".

You can also adjust the gas limits by editing, but that's not recommended if you don't know how the gas works.

If you have funds for the gas, click confirm, and the transaction will go through the blockchain.

Also, some projects allow multiple mints on the same transaction, but if you try a quantity above the limited by the project, you will see a similar insane gas cost to execute:

Insane gas trying to mint multiple tokens.

Not Always Possible

The Read and Write functionalities are always available through the contract on Etherscan.

However, sometimes it will be pretty challenging, or impossible, to interact with a mint functionality depending on the project implementation.

Some projects make previous validations, such as an allowlist or any other wallet status that is trying to mint.

Those validations can generate different functionality parameters, using hashed information as a parameter. As this hash information is generated by the project's website and managed inside the contract, it is often hard to replicate the logic without knowing how this logic was implemented.

For example, the WizNFT project uses a parameter called "proof", which is created in runtime by the FrontEnd with specific rules that are not public.

Without this information, it gets difficult to fill out this property correctly.

WizNFT Mint functionality

Conclusion

Minting direct from the contract allows you to connect your wallet to Etherscan.io instead of minting sites.

However, you must always be careful with the steps, making sure you are interacting with the correct contract.

Also, always check the transaction confirmation on Metamask. If gas is crazy, there is something wrong. And, remember, the mistakes on the blockchain cannot be reversed by anyone.

And if you too worry about keeping the floor price up, check some thoughts around this at "Floor Price of NFT Projects".

MΔRK MΔRROC is a photographer, artist, and NFT creator and collector. His background in IT allows him to explore the NFT and blockchain world one step further.

You can find him on Twitter at @markmarroc.

Visit: markmarroc.com

--

--

Mark Marroc
Coinmonks

Photographer, Artist, NFT Creator and Collector