Book a free call

What Is a Smart Contract Audit, and What Does It Cover?

A smart contract audit is an independent review of blockchain code that finds bugs and security holes before the contract handles real money. Here is what it covers.

Hertiv engineering teamReviewed by a senior engineer
6 min read
What Is a Smart Contract Audit, and What Does It Cover?
On this page

Short answer

A smart contract audit is an independent security review of the code that runs on a blockchain. Auditors read the code line by line, test it against known attack patterns, and check the business logic for errors that could lock or drain funds. The result is a report listing each issue by severity, which the team fixes before the contract goes live.

What is a smart contract audit?

A smart contract audit is an independent security review of the code that runs a contract on a blockchain. Auditors read the code line by line, test it against known attack patterns, and check the business logic for errors that could lock funds or let someone take them.

Unlike a normal code review, an audit is done by people who did not write the code and who specialise in blockchain security. They assume the contract will be attacked and look for every way in.

Auditors usually do three kinds of work:

  • Manual review. Reading the code to understand what it is meant to do, then looking for places where it does something else.
  • Automated scanning. Running tools that flag known risky patterns, such as reentrancy, integer overflow and unsafe external calls.
  • Testing. Writing tests that try to break the contract, including edge cases the original team did not think of.

The output is a report, not a pass or fail stamp. It lists each issue with a severity rating and a suggested fix. For teams building on chain, smart contract audit work is the step that turns a finished contract into one that is ready for real money.

Why do teams audit before launch?

Teams audit before launch because a deployed contract is hard to change and easy to attack. Once it holds real funds, anyone in the world can call its functions and probe it for weaknesses, day and night.

Three facts make audits worth the cost:

  • Code is public. On most chains, anyone can read the deployed bytecode and look for the same flaws an auditor would find.
  • Fixes are slow. Changing a live contract often means deploying a new one and moving funds, which is itself risky and expensive.
  • One bug can drain everything. A single logic error in a withdrawal function can empty a pool in one transaction.

An audit does not guarantee safety. It reduces the chance of a costly bug and shows users and partners that the team took security seriously. That signal matters when a contract asks people to trust it with their assets.

What do auditors check?

Auditors check the contract against a wide list of risks, from classic coding flaws to business logic that works as written but does the wrong thing in practice.

AreaWhat auditors look forExample issue
Access controlWho can call each functionAnyone can pause or upgrade the contract
ReentrancyCalls out before state is updatedWithdraw called twice in one transaction
ArithmeticOverflows, rounding, fee mathsRewards paid from an empty reserve
External callsTrust placed in other contractsPrice taken from a feed anyone can move
Business logicRules that match the intended designVotes counted from a stale snapshot
Denial of serviceWays to block normal useA failed transfer freezes all payouts
Upgrade safetyProxy and storage layoutAn upgrade overwrites live balances

The business logic rows are where audits earn their keep. Automated tools catch the coding patterns, but only a person reading the design can spot a rule that pays the wrong party or counts the wrong votes.

How does an audit work, step by step?

An audit follows a clear sequence, and the team should expect it to take days to weeks depending on the size of the codebase.

  1. Scope the work. Agree which contracts, files and commit hash are in scope, and freeze the code for the review.
  2. Write down the intended behaviour. The team documents what each function should do, including who can call it and what should never happen.
  3. Manual review. Auditors read the code against the intended behaviour and note anything that differs.
  4. Automated scans and tests. Tools and custom tests probe for known flaws and edge cases.
  5. Report. Issues are listed by severity, with a short description and a suggested fix for each one.
  6. Fix and retest. The team fixes the issues and the auditors check the fixes, sometimes in a second, shorter round.
  7. Publish. The final report is shared so users can see what was found and fixed.

Freezing the code matters. If the team keeps changing contracts during the audit, the report no longer matches what ships. A smart contract development plan should leave a quiet window for the audit and the fixes that follow it.

Example (hypothetical): an audit catches a rewards shortfall

Example (hypothetical): a team builds a staking contract that pays 5 reward tokens per block. The team plans to run it for 100,000 blocks before reviewing the reward rate.

An auditor does the arithmetic. At 5 tokens per block over 100,000 blocks, the contract must pay out 500,000 tokens. The reward treasury holds only 400,000 tokens, so the contract would run out 20,000 blocks early and stop paying stakers.

The fix is simple once spotted: lower the rate to 4 tokens per block, which totals 400,000 over 100,000 blocks, or top up the treasury before launch. The team chooses 4 tokens per block and adds a check that blocks new stakes if the treasury cannot cover the promised rewards.

This is the kind of bug automated tools rarely catch. The code is correct in a narrow sense; it just does not match the plan. A person reading the design and doing the sums is what finds it.

Common mistakes teams make with audits

The most common audit mistakes are treating the report as a safety certificate, auditing too late, and skipping the retest after fixes.

  • Auditing finished code only. If the audit starts after launch, the findings arrive when fixes are hardest. Build the audit into the schedule before the launch date is set.
  • Changing code mid-audit. New commits during the review make the report out of date. Freeze the scope and the code.
  • Fixing without retesting. A fix can introduce a new bug. The auditors should check the patched code, not just the original report.
  • Reading the report as a guarantee. An audit finds the issues the auditors looked for. It does not promise that none remain.
  • Hiding the findings. A published report with fixed issues builds more trust than a vague claim that an audit happened.

How to choose an auditor and use the report

Choose an auditor by track record and fit, not by price alone. Look for public reports from past audits, check whether the team has reviewed contracts like yours, and ask how many auditors will read your code and for how long.

When the report arrives, sort issues by severity and fix the critical and high ones before launch. Medium issues should be fixed or written down with a reason for accepting them. Low issues and notes go on the backlog with an owner.

Then publish the report with a short note on what was fixed. Users who can read the report and see the fixes are more likely to trust the contract than users who are only told that an audit took place. For a wider view of the build, smart contract development covers the steps that lead up to the audit.

Key takeaways

  • An audit is an independent review of contract code, not a safety guarantee
  • Auditors combine manual review, automated scans and tests that try to break the contract
  • Access control, reentrancy, arithmetic and business logic are the main areas checked
  • Freeze the code during the audit and retest every fix before launch
  • Publish the report with a note on what was fixed to build user trust

Frequently asked questions

What does a smart contract audit cost?

It varies with the size of the codebase, the number of auditors and the time they spend. Small contracts take days, large protocol audits take weeks. Get a quote based on lines of code and scope, and budget for a retest round after fixes.

How long does a smart contract audit take?

A small contract can take a few days, while a large protocol with several contracts can take three to six weeks. The schedule depends on code size, how clear the design documents are, and whether fixes need a second review round.

Can an audit find every bug?

No. An audit finds the issues the auditors looked for within the agreed scope and time. New attack patterns, issues outside the scope, and logic that matches a flawed design can still slip through. Treat the audit as one layer of defence.

Should a contract be audited before every upgrade?

Yes, if the upgrade changes logic that handles funds or permissions. A small change can introduce a large flaw, so the changed code should be reviewed and retested even when the rest of the contract stays the same.

What is the difference between an audit and a bug bounty?

An audit is a structured review by a small team before launch, while a bug bounty invites many researchers to probe the live contract for rewards. Audits come first; bounties run after launch to catch what the audit missed.

Do I need an audit for a small personal project?

If the contract will hold other people's funds, yes. If it is a learning project with no real value at stake, a careful self-review and testing may be enough. The deciding factor is whether someone else loses money if the code is wrong.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a contract launch and want it reviewed first?

A senior engineer replies within one business day. Or see our Smart Contract Audit service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call