Loading live crypto data...
← Back to Insights
Security11 min read

How To Read a Smart Contract Before You Click Confirm

Before approving a transaction or connecting your wallet, verify the contract address and understand what permissions you're granting. This guide walks you through it step-by-step.

TLDR

  • Always verify contract addresses on Etherscan before approving
  • Check if contract code is verified (readable) and matches official project
  • Understand what permissions you're granting (approvals can drain your wallet)
  • Look for audits, recent activity, and known contract addresses
  • If code isn't verified or looks suspicious, don't approve

By William S. · Published January 10, 2025

Why Read Contracts Before Approving?

When you approve a smart contract, you're granting it permission to interact with your tokens. Malicious contracts can drain your wallet if you approve unlimited amounts or grant dangerous permissions.

Reading contracts helps you:

  • Verify you're interacting with the real contract (not a scam)
  • Understand what permissions you're granting
  • Spot suspicious code or unlimited approvals
  • Check if the contract is audited and legitimate

Step-by-Step Guide

Step 1: Get the Contract Address

When a dApp asks you to approve a transaction, look for the contract address. It usually appears in:

  • MetaMask popup (shows "Contract Interaction")
  • WalletConnect connection details
  • dApp interface (often shown in transaction details)

Copy the contract address (starts with 0x and is 42 characters long, like 0x1234567890abcdef...).

Step 2: Verify on Etherscan

Go to Etherscan.io (or the block explorer for your network) and paste the contract address in the search bar.

You'll see the contract's page with:

  • Contract name and symbol (if set)
  • Creator address (who deployed it)
  • Creation timestamp
  • Transaction count
  • Token holder count (if it's a token)

Step 3: Check If Code Is Verified

Look for a "Contract" tab on the Etherscan page. If you see "Read Contract" and "Write Contract" tabs, the code is verified (you can read it). If you see "Contract Source Code Not Verified," you can't read the code. Be very cautious.

Red flags:

  • Code not verified (can't see what it does)
  • Very recent creation (deployed days or hours ago)
  • Low transaction count (few interactions)

Green flags:

  • Code verified and matches official project
  • Old creation date (deployed months/years ago)
  • High transaction count (many legitimate interactions)

Step 4: Read the Contract Code

Click the "Contract" tab, then "Read Contract" or "Code" to see the source code. You'll see Solidity code (if you're not familiar, focus on function names and what they do).

Key things to look for:

  • Function names: Look for "approve," "transfer," "mint," "burn" - understand what functions exist
  • Approval amounts: Check if approvals are limited or unlimited (type(uint256).max = unlimited)
  • Suspicious functions: Look for functions that can transfer your tokens without your explicit permission
  • Owner controls: Check if there's an owner who can modify the contract (centralization risk)

Step 5: Check Contract Activity

Scroll down to see recent transactions. Check:

  • Transaction frequency: Legitimate contracts have regular activity
  • Transaction types: Normal swaps/transfers vs suspicious patterns
  • Token holders: For tokens, check if holders look legitimate (not just a few addresses)

Step 6: Verify Against Official Sources

Check the official project website, documentation, or social media for the contract address. Compare it with what you found on Etherscan.

How to verify:

  1. Go to official project website (not via links in messages/emails)
  2. Look for contract addresses in docs or announcements
  3. Compare with address you're about to approve
  4. If addresses don't match, don't approve. It's a scam.

Step 7: Check for Audits

Look for audit reports on the contract page or project website. Audits from firms like CertiK, OpenZeppelin, Trail of Bits, or Code4rena indicate the contract has been reviewed.

Where to find audits:

  • Etherscan contract page (sometimes linked)
  • Project website (docs or security section)
  • Project GitHub repository
  • Announcement on Twitter/Discord

Note: Audits don't guarantee safety, but they reduce risk significantly. No audit = higher risk.

Understanding Approvals

When you approve a contract, you're allowing it to spend your tokens. There are two types:

Limited Approval

You approve a specific amount (e.g., approve Uniswap to spend 100 USDC). Safe if the amount matches what you intend to spend.

Unlimited Approval

You approve unlimited spending (approve(type(uint256).max)). More convenient (don't need to approve again) but risky. If the contract is compromised, your entire balance can be drained.

When unlimited is OK:

  • Highly reputable contracts (Uniswap, Aave, Compound)
  • You trust the contract completely
  • You'll use it frequently

When to use limited:

  • Unknown or new contracts
  • One-time transactions
  • You're unsure about the contract

Red Flags to Watch For

  • Code not verified: Can't see what it does. Don't approve
  • Address doesn't match official: Different from project website. Likely a scam.
  • Very new contract: Deployed hours/days ago with few transactions. Suspicious.
  • Suspicious function names: Functions that sound malicious or unclear
  • No audits: Contract hasn't been reviewed by security firms. Higher risk.
  • Owner can change everything: Single address controls contract. Centralization risk.
  • Hidden approval amounts: Contract asks for approval but doesn't show amount clearly. Don't approve.

Tools and Resources

  • Etherscan: Main Ethereum block explorer
  • Revoke.cash: View and revoke token approvals
  • Tenderly: Simulate contract interactions before executing
  • DeBank: View all your approvals and positions

Example: Verifying a Uniswap Approval

  1. Uniswap asks to approve USDC for swapping
  2. Copy contract address from MetaMask popup
  3. Paste into Etherscan: 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640 (Uniswap V3 Router)
  4. Verify: Code is verified, deployed in 2021, millions of transactions, matches Uniswap docs
  5. Check: Contract has approve and swap functions, no suspicious code
  6. Decide: Safe to approve (reputable, audited, matches official)

What If Code Isn't Verified?

If code isn't verified, you can't read it, meaning you don't know what it does. Unless you have extreme trust in the source (and even then, be cautious), don't approve.

Exceptions: Very new contracts might not be verified yet but could be legitimate. If in doubt, wait for verification or use limited approvals.

Managing Existing Approvals

Check your existing approvals regularly using Revoke.cash. Revoke unnecessary approvals to reduce risk.

Best practice: Review approvals monthly and revoke ones you're no longer using.

Frequently Asked Questions

Do I need to know Solidity to read contracts?

Not necessarily, but it helps. Focus on function names, approval amounts, and contract activity first. Learning basic Solidity helps, but you can verify most contracts by checking addresses, audits, and official sources.

What if a contract isn't verified but seems legitimate?

Be very cautious. Unverified contracts are high risk. You can't see what they do. Only approve if you have extreme trust in the source, and use limited approvals if possible. Wait for verification if unsure.

Can I approve a contract once and use it multiple times?

Yes, if you approve unlimited or a high amount. Limited approvals are one-time. You need to approve again for each transaction. Unlimited approvals let you use the contract repeatedly without re-approving (more convenient but riskier).

How do I revoke an approval?

Use Revoke.cash: Connect your wallet, find the approval, and click "Revoke." You'll pay gas to revoke (worth it to reduce risk). You can also approve with amount 0 to effectively revoke.

What's the difference between approve and transfer?

Approve grants a contract permission to spend your tokens later. Transfer immediately moves tokens. Approvals are dangerous if granted to malicious contracts. They can drain your wallet later.

Can I see what a contract will do before I approve?

Partially. You can see the contract code (if verified) and use tools like Tenderly to simulate transactions. However, malicious contracts can hide functionality, so always verify addresses and only approve reputable contracts.

By William S. · Published January 10, 2025

William was among the first to recognize Bitcoin's potential in its earliest days. That early conviction has grown into over a decade of hands-on experience with smart contracts, DeFi protocols, and blockchain technology. Today, he writes plain-English guides to help others navigate crypto safely and confidently.

Educational content only. This is not financial, legal, or tax advice.

Questions or corrections? Contact [email protected].