What is a smart contract?
A smart contract is a self-executable computer program coded to perform a specific transaction based on a given input. In other words, smart contracts allow for complex transactions between anonymous parties without a middleman.
The idea of a smart contract dates back to 1994 when Nick Szabo, a famous computer scientist, proposed the concept of self-executable digital contracts. Szabo’s ideas were revolutionary, and they’ve already been surpassed by innovation over the last 5–10 years.
What are smart contracts good for?
A smart contract is a computer program for developers and users to execute a function, i.e., “do a thing.” Any interaction or activity on a decentralized application (dApp) falls into this category, including:
- Swapping tokens
- Executing a trade
- Withdrawing funds
- Depositing funds
- Adding liquidity
Smart contracts are essential tools for not only automating certain tasks but also for simply making them possible.
Why would you want to be able to read one?
With smart contracts being so central to the space, being able to read their data is an essential skill for anyone using the ecosystem. Reading a contract can give you insight into the popularity of a project, a detailed transaction history, the contract’s capabilities, and more.
Next week, we will publish a follow-up to this post on avoiding especially detailed scams, but in the meantime, this tweet should get your paranoia amped up.
In short, the tweet’s author had interacted with two scammers over months. The two had done a decent job of making themselves appear trustworthy, but when they gifted the victim two NFTs to stake to earn rewards, the savvy mark first inspected the contract to find that the contract was programmed to drain 100% of the receiving wallet’s funds.
You don’t need to be a coder to understand most of the info – because you have a tool called Etherscan. You can understand their terms and conditions like all contracts by reading them.
What am I looking for when I read a smart contract?
In the below sections, we will walk you through the process of:
- Finding a smart contract
- Reading basic details such as creator address, token name, tokens held in the contract, etc.
- Understanding the statistics of a contract’s tokens and what they convey.
- Searching and understanding the transactions that have happened through a smart contract.
- Finding the source code of a contract for deeper analysis.
First, let’s find the contract details. For this example, we will use the popular pfp project Azuki. First, navigate to the NFT of your choice. For this, we’re going to use the first listed Azuki NFT.
From the token page, click “View Proof of Authenticity.”
Here you can find the token ID, contract ID, and creator’s blockchain ID. By clicking “full blockchain details,” you will go to the transaction history for this piece on Etherscan.io.
On the transaction (tx) page, we can see details related to the creation of the contract.
One easy way that non-developers can spot a scam is by checking the timestamp with public information related to the project’s release. In this case, I already know that this project was released on January 10, so I can feel pretty confident that this is, in fact, the real deal.
Other details that appear on this page include:
- Transaction confirmation
- Quantity of each token
- Contract creator
- Fees paid
Let’s click the contract address (circled in the screenshot).
Here, we see:
- Balance & Value: How much coin the contract holds.
- My Name Tag: You can create private notes here if logged in.
- Creator: The wallet that created the contract and a link to the original transaction, which we already have open in a different tab.
Back on the Transaction Details page, let’s click the Tracker.
Here we can see the total supply of tokens, the number of holders, and the number of transfers. Depending on the project you’re looking at, a discrepancy in the expected number of holders/transfers and the actual number (as displayed in the contract details here) might be a red flag for a scam.
You can dig deeper into your curiosity by clicking a tab below the summary.
Above, we’re focusing on Holders, which displays the top 1,000 holders out of the total (5,472, in this case).
- Transfers is a complete list of transactions performed with the Azuki smart contract.
- NFT Trades shows every time someone bought an Azuki.
- Inventory shows every token minted on this contract.
- Contract is information from the contract source code.
Let’s click over to Contract. Read Contract allows you to inspect the contract functions.
Write Contract allows you to interact with the contract if you are the owner. Functions that you could initiate from here include burning tokens, granting roles, pausing, and more.
We might recommend investing in deeper analytics for serious traders and collectors. Nansen is one such service where users can perform due diligence before investing while also keeping an ear to the ground regarding buying and selling activities across the blockchain.
While there are ever more nuances to consider when reading a smart contract, the above covers most of what you need to know to protect yourself from scams and become an increasingly savvy web3 citizen.
Get in Touch
If you’re a digital creator, you can learn more about MakersPlace here.
Ready to start your rare digital art collection? Join here.
Follow us on Discord, Twitter, Medium, Instagram, Facebook and Pinterest.