NFT smart contracts: how to read them and why you should

NFTs are currently trending and there might be an expensive project in the market that you’re eyeing. Before you buy NFTs, you should understand its underlying technology - smart contracts. For both creators and collectors, understanding smart contracts is your way to navigate the blockchain and the first step to minting NFTs.
What is a smart contract?
A smart contract is a type of agreement between the buyer and seller encrypted into code on the Ethereum blockchain. It self-executes when pre-established conditions are met and verified, with no intermediaries or paperwork involved. Since they’re on the blockchain, they have permanent identification information.
The smart contract can also verify that the digital assets in the transactions are unique. This makes NFTs scarce and valuable.
How are smart contracts created?
When you’re minting an NFT, you’re writing the underlying smart contract. You add unique information about the NFT, including ownership and details so the creator still retains the copyrights for the digital asset. Details such as identity, payment authorization, your desired terms and conditions. You can also specify your terms and conditions on trading the NFTs. For example, the percentage of royalties you receive each time your NFT changes hands.
How to read NFT smart contracts
Why should you know how to read NFT smart contracts? Once you learn how to read a smart contract, you will understand the particulars of the NFT, including its popularity, ownership, transaction record and more. You can even mint an NFT directly from a smart contract.
Step 1: Find the NFT you’re interested in on OpenSea.
Under the Details tab below the image, you’ll find the NFT’s Blockchain, Smart Contract Address and Token Standard.
Step 2: Click on the ‘Contract Address’ tab, this will take you to the smart contract on Etherscan, where you can explore the NFT’s smart contract.
Etherscan is a Blockchain explorer, which allows users to view and verify public information about transactions on the blockchain, contract codes and executions, addresses and more.
Here, you’ll see details of the smart contract such as its latest transactions and validated source code.
Learning more about the NFT on Etherscan
You can also read general information about the NFT, including:
-
Balance: The number of coins held by the contract.
-
Value: The NFT’s price
-
My Name Tag: This section is for users to tag any addresses of NFTs that catches your eye. To enable this section, you have to login to Etherscan.
-
Creators: The NFT creator’s wallet address and link to the original transaction. You’ll uncover transaction hash, block, timestamp, fees and more.
-
Holders: how many people hold the NFT and the holder with the most number of NFTs.
Holders and distribution record
When you click on the ‘Holders’ tab, and further click into ‘Token Holder Chart’ and you’ll see a pie chart of holders.
Transactions/ Transfers
On the token tracker page, you will see transactions and transfers of the NFT listed chronologically. You’ll also find the below tabs:
-
Txn Hash: Transaction hash/ id: a unique string of letters used to identify and verify a particular transaction to be entered into the blockchain.
-
Method: Transaction method/ contract (i.e. BAYC)
-
Age: Time stamp, or the time the block was mined in UTC.
-
From: Token transfer sender
-
To: Token transfer receiver
-
Token ID: Related token
You can view transaction details such as transaction fees, wallet addresses of buyers and sellers of the NFT, the contract’s function and more.
Internal Txns
Internal transactions are transactions between contracts. They represent the value transferred as a result of the execution of the contract. When the condition is fulfilled, meaning a certain amount of ETH or other cryptos are transacted.
Contract
Upon clicking on the ‘Contract’ tab will provide query data of the contract and the blockchain. In other words, the general information and all its functions.
Under the ‘Write Contract’ tab, which means you can interact with the contract by calling state-transition functions. You’re changing the state of the smart contract and Blockchain from your wallet. You can perform functions like burning tokens, approving transactions, by changing data in them.
To write a contract, you have to start by connecting your wallet to Etherscan by clicking ‘Connect to Web3’ and selecting 'MetaMask Wallet' or 'WalletConnect', where you scan the QR code with your mobile wallet application.
Once you’ve connected your wallet, you can perform functions written in the smart contract. For example:
-
Transfer: to transfer tokens to a receiver.
-
Approve: to approve transaction details
-
TransferFrom: to transfer the tokens from the NFT owner’s account to the receiver account when the transaction initiator has sufficient allowance.
-
Mint: to input options you want to mint. The first input field, you can type in your minting price and in the second input field the number you would like to mint. You can click the ‘Write’ button to send the transaction to the blockchain, you can fast-track the process by paying a higher gas fee via your MetaMask wallet.
Analytics
Finally, clicking the Analytics tab will direct you to key metrics of market data, on-chain data, network data, transactions data on Etherscan. You can see an overview of the marketplace and understand NFT trends.
Photos: OpenSea and Etherscan