NFT Minting – How to mint directly from a Smart Contract?

Since the current NFT meta is free mints with no roadmap, I want to give a quick primer on reading an NFT smart contract and ways to be safe during mint. In this article, I will cover:

 

Now you are thinking – why would I want to mint directly from the Contract? What’s wrong with minting a project from their launch page? Well, there are a couple of reasons for that. Minting from a Smart Contract can help you mint a project early, and don’t miss out when there is a lot of hype. Multiple times, project launch sites crashed during mint due to the vast amount of traffic going through the website. The second reason is simple – minting directly from a Smart Contract can help you avoid scams.

 

Basics of reading a smart contract on Etherscan

Although the term smart contract can sound a bit daunting and very few people are interested in going into the nitty-gritty of it, having a basic understanding of a smart contract can help you inspect an NFT project.

We will use Etherscan – the most popular blockchain explorer for Ethereum blockchain, to read a smart contract. So, what are some basic and valuable things you can find on Etherscan when reading a smart contract?

Let’s use BAYC as an example. You can find the NFT project contract address by going to Opensea, finding your project (1), clicking on any of the NFTs and clicking on Details (2) – Contract Address (3). This will take you to the Contract on Etherscan.

 

! Make sure you click on the legit project with a blue check next to it!

Figure 1

Figure 2

On the Etherscan page, click on Contract (4), where you will be able to read the Code (5), Read Contract (6) and Write Contract (7).

Figure 3

Firstly, you can inspect the Code. If you know how to read lines of code, you can go nuts here and see the entire Contract – I won’t be doing this.

Secondly, you can Read the Contract – here you will see a list of different functions. The functions in various contracts may differ or be named differently, but you usually would see:

Figure 4

Thirdly, you can go and Write the Contract – here you will need to connect your wallet (12) to make changes to the Contract. The available functions of what you can do will differ depending on the project, and it will cost you some ETH to do any of the transactions. With BAYC, you can, for example, transfer (13) an NFT or mint (14) NFT directly from the Contract (well, this was available when the project launched).

Figure 5

Next, let’s see how you mint an NFT from a contract.

 

How to mint an NFT directly from a contract

Follow steps 1-7 to navigate your way to the smart contract of the project you like. If the project is not on OS yet, you can search the contract address on Etherscan.

Once you click on Write Contract, you will need to connect your Web3 Wallet. When connected, go to the mint section in the Smart Contract. You will need to enter how much you will pay for how many tokens you want here. If you are familiar with the project, you will know the mint price and the max amount of tokens you can mint before the launch.

If the price is 0.08ETH (BAYC example), you will enter .08 in the first field and 1 in the second field.

If the max amount of NFTs you can mint is 20 (BAYC example), then you will enter 1.6 in the first line (15) and 20 in the second line (16). If the mint is free – the mint price will be 0, and you will only need to pay a gas fee.

Figure 6

If you don’t know the mint price, you can check this information in the Smart Contract. Go to Read Contract and you will find the information there:

Figure 7

After clicking Write, you will be prompted to confirm the transaction via your Web3 wallet provider. Double-check the transaction details and gas fee before confirming the transaction. That’s it, you minted your NFT directly from a Smart Contract!

 

How to stay safe during a mint

Recently there has been a wave of NFT projects offering free mints. By free, I mean that you only need to pay the transaction fee when minting. Although I think that free mints are a great way to attract more people, who do not hold big bags of ETH, this opens the door for scammers looking to take advantage of less experienced users. Here are a few tips on how to stay safe during a mint.

 

Tip 1: Always use a burner wallet.

Use a wallet with minimal ETH and no valuable assets in it. One wrong signature, and your precious NFT disappears. Make sure you have enough funds to pay the gas fee, though. On a related note, please don’t keep your valuable NFTs in a hot wallet; move them to a hardware wallet. Here is a helpful chart suggesting how you may want to structure your wallets.

Figure 8

 

Tip 2: Mint the NFT directly from the Contract.

There have been many scams where a project advertises a free mint on their site but changes the mint button to a signature request for you to approve transfers to your valuable NFTs. This is how you get your NFTs stolen quickly.

When you mint from a contract, you can call the exact (mint) function that you want to call. This reduces the chance of you signing something you didn’t intend to. Go back to part 2 of this article to see the steps on how to mint an NFT directly from a Smart Contract.

 

Tip 3: If the Contract is unverified on Etherscan, stay away from it.

Here’s an example unverified Contract: https://etherscan.io/address/0x6c830acd0b1610f547f568abd9500012cffd5208#code. You’ll find that there’s no readable code on the Etherscan page. For a free NFT mint, this almost guarantees something malicious is going on. Unless you know how to read through decompiled bytecode, I highly recommend not minting. You also won’t be able to mint directly from the Contract.

To summarise, learn how to read a Smart Contract, mint NFT directly from Smart Contract as often as possible, use a burner wallet when minting and avoid suspicious-looking contracts (no blue tick on OS, no green tick on Etherscan). Stay safe!

Leave a comment

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