How do you compare a token's contract with the official audited version?
To compare a token's contract with its official audited version, you need to locate both contracts in a block explorer, line up their source code byte-for-byte, and check for any differences. This process confirms whether the deployed token matches the code that was reviewed by auditors. Below is a step-by-step guide.
Step 1: Find the official audited contract
The audited contract is the version that a security auditor examined and published in their report. You need the exact address or a link to that code.
- Go to the token project's official website (not a link from a random tweet or Telegram message). Look for a "Security" or "Audit" page.
- Find the audit report - usually a PDF or a webpage from a firm like CertiK, Hacken, or Trail of Bits. The report should list the audited contract address or provide a direct link to the audited source code on a block explorer like Etherscan.
- If the project does not clearly link to an audit, treat it as unaudited. No reputable project hides the audit.
Step 2: Get the deployed token's contract address
You already know how to verify a token contract address on a block explorer before buying (covered elsewhere on this site). Use that method to confirm the address you are checking is the real one.
Step 3: Open both contracts in a block explorer
- Open the block explorer for the token's chain (e.g., Etherscan, BscScan, Polygonscan).
- Paste the deployed token's address into the search bar. Go to the "Contract" tab, then "Source Code."
- Open a second tab. Paste the audited contract address from the report. Go to its "Contract" tab, then "Source Code."
Both tabs should show the Solidity (or Vyper) source code and the compiler settings.
Step 4: Check compiler settings match
Before comparing code, verify that the compiler version, optimization settings, and license identifier are identical. If the audited version was compiled with Solidity 0.8.18 and optimization turned on, the deployed version must use the same. A mismatch here means the deployed contract cannot produce the same bytecode even if the source code looks the same.
Step 5: Compare the source code line by line
- Use a diff tool. You can copy the deployed source into a local file and the audited source into another, then run a command-line diff (e.g.,
diff file1.sol file2.solon Linux/Mac). Alternatively, use a web-based diff checker like DiffChecker or DiffNow. - Look for any differences: added functions, changed variable names, altered logic, or missing code. Even a single extra line can introduce a backdoor or a hidden fee.
- Pay special attention to functions that modify state:
transfer,transferFrom,mint,burn,approve,setTax,blacklist,pause,upgradeTo(if a proxy), and any function withonlyOwneroradminmodifiers.
Step 6: Verify bytecode (optional but stronger)
Source code comparison is good, but bytecode comparison is definitive. A token's deployed bytecode is the compiled output of the source code. If the source matches but the bytecode does not, the contract was compiled differently or deployed from different code.
- On the block explorer, go to the "Contract" tab and click "Bytecode" or "Deployed Bytecode."
- Copy the bytecode from both the deployed token and the audited contract. Compare them with a diff tool. They should be identical if the source and compiler settings match.
- If the bytecode differs, the deployed token is not the audited version, regardless of what the source says.
Why this matters
Audits check for known vulnerabilities, hidden fees, rug-pull mechanisms, and privilege escalation. If the deployed contract differs from the audited one, the audit is worthless for that token. The differences could be subtle - a single line that lets the owner drain the liquidity pool, or a tax that only activates after the first 100,000 transactions.
Common pitfalls
- Proxy contracts: If the token uses a proxy (covered elsewhere on this site), the audited logic contract may be separate from the proxy that users interact with. Compare the logic contract, not the proxy. The proxy’s implementation address is visible on the block explorer.
- Multiple audit versions: Some projects get audited, then change the code and get re-audited. Ensure you compare against the final audited version, not an earlier draft.
- Copy-paste errors: Occasionally, a project will publish the audit for a different token. Verify the audited address matches the one you are checking.
If you cannot find the audited contract
If the project does not provide a direct link to the audited source code, you cannot perform this comparison. Treat the token as unaudited. Many legitimate projects also lack audits, but the risk is higher. In that case, rely on the other checks covered on this site: simulate buy and sell tax, check for a mint function, verify holder distribution, and use a honeypot checker. No single check guarantees safety.
Not financial advice. 1msc.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.
Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.