If you have been closely following the NFT industry, you are likely to have come across the term ‘smart contracts’ at least a couple of times. More often than not, people dismiss smart contracts as a technical jargon that is irrelevant to them. But, in reality, NFT smart contracts are extremely important (if not the most important) in your NFT journey. For both creators and collectors alike, understanding smart contracts is a crucial step in minting NFTs.
What is a smart contract?
A smart contract is a digital contract written as a piece of code, stored on the blockchain, and automatically executed when certain pre-established conditions are met. Typically, they are used to automatically fulfil the terms of the agreement between various parties involved. In layperson’s terms, smart contracts follow a simple mechanism that says ‘if/when this happens, then do this’. In other words, when these conditions are met, the network of computers will execute the pre-determined action.
What makes smart contracts ‘smart’ is that all of this is carried out automatically, without the need for a third party. Besides, since they are on the blockchain, they are secure, transparent, efficient, and processes transactions almost instantaneously. Moreover, as opposed to traditional contracts, smart contracts do not need any central entity to function and give you tamper-proof, enforceable agreements.
In the context of NFTs, the unique information of an NFT, including ownership and transaction details, are stored in its smart contract. Creators can add details like their identity, secure links to files, and more to smart contracts. Alternately, they can specify certain rules about trading the NFTs. This could, for example, be the percentage of royalties they receive for every subsequent sale. Basically, smart contracts are what makes each NFT unique and valuable.
For NFTs, smart contracts’ capabilities go beyond simple transactions. Creators or developers can specify pretty much anything they want on the contracts. For instance, some NFT projects can grant specific rights to a select group of people. This includes exclusive access to drops for early backers, rewards for participating in contests, a lower mint price for subsequent drops, the ability to breed their collectibles, and much more.
How to read NFT smart contracts
First things first—why should you read NFT smart contracts? As mentioned before, smart contracts contain all the information about a particular NFT. So, by simply reading a smart contract you will be able to understand the popularity of a project, the ownership rights, details of all transactions, and more. What’s more, you can even mint an NFT directly from a smart contract.
Now, here are the steps to find a smart contract (since most NFTs are built on Ethereum, we’ll look at Ethereum NFTs for the purpose of this guide):
- Find the NFT you are interested in on OpenSea.
- Scroll down and click on the drop-down arrow on the ‘Details’ tab.
- Here, you’ll see the ‘Contract Address’. Clicking this will take you to the smart contract on Etherscan. Etherscan is a useful website to find the data on transactions, blocks, wallet addresses, smart contracts, and more on the Ethereum blockchain.
- Alternately, if you already know the contract address, you can directly find the smart contract on Etherscan by pasting the address on the search bar.
Using Etherscan to know more
Now that you have the NFT smart contract, let’s see what you can understand from it.
First and foremost, you will see some general information related to the NFT.
- Balance: The number of coins held by the contract.
- My Name Tag: This is basically to add your own private notes to any projects of interest. For this, you have to log in to Etherscan.
- Creator: Wallet address of the one who created the contract and a link to the original transaction. If you click this, you can see details like transaction hash, block, timestamp, transaction fee, gas fees, and more.
Tracker, or token tracker, tells you all you need to know about the token (in this example, BAYC). Here, you can see the minimum price, maximum total supply, total transactions, official website, and social profiles. Interestingly, there is also a “Holders” tab where you can see details such as how many users hold the tokens and who holds the maximum number of tokens.
Under the Transactions tab, you can find all the NFT smart contract transactions listed chronologically. You can click individual transactions for more information. Now, ‘Method’ is the function executed based on the input data. Usually, the methods are mint, set approval for all, and transfer from.
Along with these, you can also see details such as transaction status, block in which the transaction was included in, transaction fee, wallet addresses that made the transaction as well as the one that received it, and so on.
Put simply, internal transactions refer to transactions between contracts. Remember how smart contracts can automatically trigger predefined actions when certain criteria are met? Internal transactions are basically the value transfers that happen as a result of the smart contract execution. In other words, often, for a smart contract to execute, it requires a certain amount of ETH (or another token) transactions—a.k.a., internal transactions.
The Contract tab gives you all the information about the specific NFT smart contract. Under ‘Code’, you can see the contract’s source code. ‘Read Contract’ is for the general contract information and all its functions. Meanwhile, ‘Write Contract’ allows you to interact with the contract. Essentially, you can run functions like burning tokens, approving transactions, transferring tokens, and more. But, for this, your wallet should have the necessary permissions. You can connect your wallet using the ‘Connect to Web3’ option.
Lastly, under the Analytics tab, you will find various charts detailing transactions, transaction fees, token transfers, and more. You can also set specific timelines. It’s a useful tool to understand the general trends of the NFT project you are interested in.
At the end of the day, you probably won’t need to use all of the features of NFT smart contracts described above. Even so, it is important to truly understand what your NFT, and in turn, its smart contract, entails before you make any investments.