Money, Payments & Crypto

Smart-Contract Audit

Also known as: security audit (blockchain), contract audit, Solidity audit, Web3 security review

A smart-contract audit is a formal security assessment of the code that runs a blockchain application (DeFi protocol, NFT contract, token contract, DAO governance contract).

Auditors review the code for logical errors, security vulnerabilities (reentrancy, integer overflow, access control flaws), economic attack vectors (price manipulation, flash loan attacks), and deviations from the intended design. Major audit firms include OpenZeppelin, Trail of Bits, Certik, Halborn, and Consensys Diligence. Audits do not guarantee that a contract is bug-free, but they significantly reduce risk and are considered a prerequisite before deploying any financial protocol.

Smart-Contract Audit, explained at three levels

At home

A smart contract audit is a security review of the code that runs a blockchain application before it is launched publicly with real money. Auditors -- specialized security researchers -- read every line of the contract code looking for bugs or design flaws that an attacker could exploit to steal funds. When you use a DeFi protocol, checking whether it has been audited by a reputable firm is a basic due diligence step. No audit means the code has not been independently checked for vulnerabilities that could drain your funds.

At work

Before deploying any smart contract that will hold user funds, an audit by a reputable security firm is essential -- not optional. DeFi hacks regularly drain tens to hundreds of millions of dollars from unaudited or poorly audited protocols. The audit cost (typically $10,000-$200,000+ depending on contract complexity and firm) is a small fraction of the potential loss from a security incident, and most institutional investors and users will not interact with unaudited protocols.

Real-world examples

At home

Sophie wanted to provide liquidity to a new DeFi protocol offering high yields. Before depositing, she checked the protocol's documentation for audit information. The protocol had one audit from a less-known firm, published three months before launch. After researching the audit firm's reputation and finding limited information about them, she decided the risk was higher than she was comfortable with and chose a protocol audited by two reputable independent firms instead.

At work

Thomas's team was launching a DeFi lending protocol. They engaged three audit firms sequentially: OpenZeppelin for the core lending logic, Trail of Bits for the oracle integration, and a third firm for the governance contracts. Total audit cost: $180,000. The audits identified one critical vulnerability in the interest rate calculation that would have allowed interest rate manipulation. After fixing all findings and re-auditing the changes, they launched with a $500,000 bug bounty program on Immunefi. The protocol launched without incident.

Common confusions

  • Many users assume that a passed audit means a smart contract is completely safe — An audit reduces but does not eliminate risk. Auditors review code at a point in time with specific scope -- subsequent code changes, unforeseen economic conditions, complex multi-protocol interactions, and novel attack vectors may not be covered. Multiple high-profile hacks have occurred on audited protocols (Euler Finance, Compound). 'Audited by X' is a strong positive signal but should be read alongside the specific audit scope, severity of findings, whether findings were remediated, and time elapsed since the audit (code may have changed).
  • Some teams assume deploying a copy of audited open-source code (like Uniswap V3) means they inherit the security of the original — Deploying a copy of an audited contract does not inherit the audit. The security of an audited contract depends on the specific deployed bytecode, the configuration parameters, and the deployment environment -- any difference (different parameters, modified code, different chain behavior) creates new risk. A deployment of 'Uniswap V3 code' with different fee tiers, modified access controls, or deployed on a new chain requires its own audit. Many major exploits have targeted forks or clones of audited code that deviated from the original.

For analysts

When advising clients building blockchain applications that will hold user funds, position audit as a non-negotiable pre-launch requirement rather than an optional enhancement. The business case is straightforward: audit cost is typically 0.1-1% of the maximum value the protocol will hold; a single security incident that drains the protocol can destroy the project entirely. Additionally, major DeFi users, institutional investors, and aggregator platforms (DeFiLlama, Zapper) note audit status prominently. Unaudited protocols are excluded from most institutional participation and cautious user bases.

History & origin

The need for smart contract audits became undeniable after the DAO hack (2016): approximately $60 million in ETH was drained from The DAO smart contract by an attacker exploiting a reentrancy vulnerability -- a coding pattern where an external contract can recursively call back into a function before the first execution is complete. This hack was so significant that Ethereum hard-forked to reverse it, creating Ethereum Classic (the original unforked chain). Subsequent high-profile hacks (Parity Wallet freeze 2017, bZx flash loan attacks 2020, multiple bridge exploits 2021-2022) established that smart contract security was fundamentally different from traditional software security: bugs are instantly exploitable, losses are typically irreversible, and public visibility of the code means sophisticated attackers can analyze it for vulnerabilities at any time.