How to check an audit matches deployed bytecode

A method to confirm a smart contract audit covers the bytecode running onchain, using Sourcify, Etherscan and the report's commit.

Published · Updated · Last verified · Onchain tools · Due-diligence checklists

An audit report names a git commit. The funds sit in bytecode at an address. The report covers the running code only after you show that the two match.

Source-code verification, as ethereum.org defines it, is the check that published source compiles to the bytecode stored at a contract address. It is not formal verification, which is a check that the contract behaves as specified, and it is not the audit itself. This guide is the method for joining the report to the address. It is educational, not a security opinion on any protocol.

How do you check that an audit matches deployed bytecode?

You connect three artefacts: the report’s commit, the source verified for the deployed address, and the bytecode that address returns. If any link is missing, the report does not, on its own, describe the code that runs.

The steps below are the same for every protocol. Work from the official report and from a verifier or explorer, not from a marketing page that says “audited.”

  1. Collect the report’s scope, the audited commit, and any later fix commit.
  2. Collect every contract address that holds funds or grants admin rights, from the project’s own docs.
  3. For each address, decide whether it is a proxy. If it is, continue with the current implementation address.
  4. Check the source-verification level on Sourcify or Etherscan.
  5. Diff the verified source against the report commit, or compare file hashes if the report publishes them.
  6. Write down matches, mismatches, upgrades since the report, and steps you could not finish.

Our guide to how to read a smart contract audit report covers the rest of the report. The section below is this one step in more detail.

What does an audit report cover?

An audit report covers the source files and commits the firm listed in its scope, during the review window it states. It does not, by itself, cover a later commit, a different repository, or bytecode it never compiled.

The scope is the file list, the commit hashes, and the exclusions. Some reports give two hashes: an initial commit and a post-fix commit. Record both. If the report names libraries or external contracts as out of scope, those addresses still need their own check.

A protocol that cites an audit of a fork’s parent, or of an earlier version, is pointing at a review of different code. The report is still a document; it is not a review of the address you are about to call. Our note on what an audit does not cover lists this class of gap.

What is source-code verification?

Source-code verification is the comparison of a contract’s published source and compiler settings with the bytecode at a given address. If a recompilation under those settings produces the same bytecode, the published source is a faithful rendering of the code that the chain will execute, subject to the match type’s limits.

ethereum.org stresses why the match type matters. Comments and variable names do not change compiled bytecode. Two source trees can therefore verify the same contract while differing in comments or names. A hostile publisher could add misleading comments and still obtain a verification. Solidity appends a metadata hash to the compiled bytecode to close that gap. The metadata file records compiler settings and a hash of each source file. If a source file or a compiler setting changes, the metadata hash changes, and so does the bytecode that contains it.

That fingerprint is what Sourcify uses to tell an exact match from a match.

What is a Sourcify exact match, and how does it differ from a match?

A Sourcify exact match means the deployed bytecode is the same, byte for byte, as a recompilation of the given source files under the metadata’s compiler settings, including the metadata hash. Linked library addresses and immutable values may still differ, because libraries can be linked after compile time and immutables are written at deployment.

Sourcify’s docs say the metadata’s per-file keccak256 hashes are the integrity check: a one-byte change in a source file changes the hash, which changes the metadata, which changes the metadata hash appended to the bytecode. An exact match therefore means the source files are the same as those used when the contract was compiled for deployment, not a rewritten copy with new comments or names.

A Sourcify “match,” which the docs say was earlier called a partial match, means the executable bytecode agrees but the metadata hash does not. Comments, variable names or source paths can differ. The contract should function the same way, according to the docs, but you no longer have the metadata fingerprint that pins the source files. Library addresses and immutables can differ here as well.

For an audit check, prefer an exact match, then still diff the verified files against the report commit. Verification shows that some published source matches the chain. It does not show that this source is the commit the auditor reviewed.

What do Etherscan’s match types mean for this check?

Etherscan publishes four verification states: Unverified, Similar Match, Exact Match and Runtime Match. Read the badge and the note on the Contract tab, not the fact that source is visible.

Etherscan’s types page, accessed 1 December 2026, describes them as follows:

  • Unverified: the default. The tab shows creation bytecode and no source.
  • Exact Match: the verified source, plus constructor arguments, reproduces the deployed contract. The page shows a green badge, the source, and deployment details.
  • Runtime Match: the runtime bytecode at the address matches the compiled source. Deployment bytecode and constructor arguments are not part of this check, so deployment-time details can differ.
  • Similar Match: covered in a follow-up post. Etherscan describes it as a way to display source and read/write controls for contracts that share bytecode with a verified contract but differ in constructor arguments. It is used for reused libraries, factories and proxies.

A Similar Match can therefore show you another deployment’s source. Constructor arguments, which often include owner addresses or parameters, may not be the ones used at this address. Etherscan also documented a period in which people abused re-verification to inject comments and graffiti into Similar Match source. Re-verification is now limited to a whitelist of contract authors.

Treat Similar Match and Runtime Match as leads, not as the end of the audit check. An Exact Match is the right starting point, and you still have to compare that source with the report.

How do you handle a proxy?

A proxy is a contract that delegates calls to a separate implementation contract. The bytecode at the proxy address is the proxy. The logic an audit reviewed, if the report is about the application, is the implementation.

Find the implementation address from a standard slot such as ERC-1967, from the project’s docs, or from an explorer’s proxy view. Then verify the implementation, not only the proxy. Our guide to upgradeable smart contracts walks through that lookup and the limits of explorer proxy views. Etherscan’s proxy pages, as cited there, do not promise that the implementation they display is the one that executes.

Read the implementation as of the report’s date and as of today. A new implementation address after the report is an upgrade the report does not cover. If the project published a later audit of the new implementation, start this method again with that report. If it did not, record the upgrade as unaudited code at the address.

Constructor arguments and immutables on the implementation also matter. Sourcify’s exact-match definition leaves immutables and linked libraries free to differ, so compare those values with the report or with the project’s deployment notes.

How do you compare verified source with the audit commit?

Verification and the audit commit are two different links. Close both.

Once the address has an exact match (or you have recompiled the report commit yourself and compared bytecode), take the verified source files and diff them against the repository at the audited commit, or at the post-fix commit if that is the one the firm signed off on. A hash list in the report, if one exists, can replace a manual diff.

Differences in comments or file paths, on a Sourcify “match” or an Etherscan Similar Match, may be noise. Differences in files that move funds, set prices, or grant roles mean those parts were not what the report reviewed. Compiler version and optimiser settings should also match the report and the verified page. A change in either produces different bytecode.

If you recompile, use the same compiler version and the same settings. Sourcify’s docs note that different compiler versions or optimiser runs produce different bytecode, and that flattening source to verify it will break metadata hashes and prevent an exact match.

What if a step fails?

Write “not verified” against that address and that report, and state which link broke. Common breaks are an unverified contract, a match that is not exact, a proxy whose implementation you cannot pin down, a report that names no commit, or a diff that you cannot obtain because the repository was moved or rewritten.

How to check if a smart contract is legit covers the wider path, from the official address to who controls it. None of those steps is a reason to fill a gap with a guess. An unmatched audit is still useful as a review of some other commit. It is not a review of the bytecode at the address in your file.

Questions

How do you check that an audit matches deployed bytecode?
Take the commit in the audit report, verify the deployed address (or its current implementation, if it is a proxy) on Sourcify or Etherscan, and diff that verified source against the report's commit. A report covers the running code only when those three line up.
What is a Sourcify exact match?
Sourcify's docs say an exact match means the deployed bytecode is the same as a recompilation of the given source and metadata, including the metadata hash, aside from library addresses and immutables. A "match" (earlier called a partial match) allows the metadata hash to differ.
Does an Etherscan green check mean the audited code is running?
No. Etherscan's exact match means the verified source and constructor arguments reproduce the deployed contract. It does not compare that source with an auditor's commit, and a Similar Match can show code from a different deployment of the same bytecode.
What if the contract is a proxy?
The bytecode at the proxy address is the proxy, not the logic the audit reviewed. Find the current implementation address, verify that contract, and check whether it has been changed since the report's date.
What if you cannot complete a step?
Record it as unverified. A missing match is a gap in the due-diligence file, not a reason to guess that the report still applies.

Sources

  1. Exact Match vs Match, Sourcify Docsaccessed
  2. Verifying smart contracts, ethereum.orgaccessed
  3. Types of Contract Verification, Etherscan Information Centeraccessed
  4. Update on Similar Match Contract Verification, Etherscan Information Centeraccessed