Book a free call

What Is a Game Theory Audit for Smart Contracts?

A game theory audit checks whether a smart contract rewards honest behaviour and punishes attacks. Here is what it covers, and how auditors model attackers.

Hertiv engineering teamReviewed by a senior engineer
8 min read
What Is a Game Theory Audit for Smart Contracts?
On this page

Short answer

A game theory audit reviews a smart contract's incentives, not just its code, asking whether a rational player could profit by breaking the rules. It checks reward maths, token flows, voting power and attack costs, and it matters most for contracts that hold money, run markets or pay rewards, where bad incentives cost more than bugs.

What is a game theory audit for smart contracts?

A game theory audit for smart contracts is a review of the incentives built into a contract: what each player gains by acting honestly, what they gain by cheating, and whether the rules make honest behaviour the better choice. It treats the contract as a game with players, moves and payoffs, and looks for moves that pay.

A normal code audit asks whether the contract does what its authors intended. A game theory audit asks whether what the authors intended is safe when real people, bots and rival protocols play against it. A contract can be bug-free and still lose money if its rewards invite the exact behaviour it was meant to prevent.

CheckCode auditGame theory audit
QuestionDoes the code work?Do the incentives hold?
AttackerAn exploit in the codeA player gaming the rules
ToolsTests and manual reviewModels, maths and simulations
OutputBug list and fixesRule changes and limits

The two audits are partners, not rivals. A code audit finds the holes in the implementation, and a game theory audit finds the holes in the design. Teams that hold user funds should run both before launch.

Why do incentives matter more than code alone?

Incentives matter more than code alone because a smart contract runs in the open, and anyone can read its rules and work out the most profitable move. If cheating pays more than playing fairly, someone will cheat, and the first person to find the gap is usually a bot running around the clock.

Attackers do not need to break the code. They can follow the rules exactly and still drain a pool: borrow a large stake to win a vote, mint rewards faster than the pool can pay, or push a price on a thin market and profit from the contract's reaction. Each of these is legal play inside the contract's own rules.

The cost of an attack is the other half of the maths. An attack that earns $100,000 but costs $120,000 in fees, collateral and risk will not happen. An attack that earns the same $100,000 for $5,000 will happen within days of launch, because the opportunity is public and the reward is certain.

This is why incentive review comes before launch, not after. Once a contract is live and holding funds, changing its rules is slow and costly, and attackers move faster than governance votes. A design that pays attackers to wait is the worst kind of bug to discover in production.

What does an economic audit check?

An economic audit checks every flow of value through a contract: where tokens enter, where they leave, who can mint or burn them, and what happens when many players act at once. The auditor builds a model of the economy and tests it against bad days, not just good ones.

Reward maths comes first. The auditor checks that rewards are paid from real income, that the rate falls as more players join, and that no single action pays out more than the pool can afford. A reward rate that looks fine with 100 users can collapse with 10,000.

Token supply comes next. The auditor checks who can mint new tokens, whether the supply cap holds under every path through the code, and what happens to the price if a large holder sells. A contract that lets one wallet mint freely is not a token economy; it is a printing press.

Fees, sinks and voting power complete the check. Sinks are the places tokens leave the system, such as fees and burns, and without them a token only flows in and loses value. Voting power matters because a holder who can buy enough votes can change the rules in their favour, so the audit checks how much a takeover would cost.

How do auditors model an attacker?

Auditors model an attacker by listing every actor who can touch the contract, what each one wants, and what each one can do. The list usually includes ordinary users, large holders, bots, rival protocols and the team itself, because the team's own admin keys are part of the attack surface.

For each actor, the auditor writes down the payoff: the most they could gain, the cost of the attempt, and the chance it works. An attack with a large payoff, a low cost and a high chance of success is marked as the top risk, and the team is told to fix it before anything else.

Three attack shapes appear again and again. A flash loan attack borrows a huge sum for one transaction to swing a vote or a price. An oracle attack pushes a price feed so the contract misprices an asset. A governance attack buys voting power cheaply, changes a rule, and sells before anyone notices.

Simulations turn these models into numbers. The auditor runs thousands of rounds with players following different strategies and watches where the money ends up. If one strategy always wins, the rules behind it need to change, and the simulation is run again until no single move dominates. Running the review well takes a set process, which the guide to running a smart contract audit sets out step by step.

What is mechanism design in a contract audit?

Mechanism design in a contract audit is the work of writing rules so that the best move for each player is also the best move for the system. The contract cannot force anyone to be honest, so it has to pay them to be honest and charge them for cheating.

Deposits are the simplest mechanism. A player who wants a privileged role locks up funds first, and the contract takes the deposit if they misbehave. The deposit must be larger than the profit from cheating, or it is just a fee for cheating.

Time locks are the second tool. A vote that takes effect after a delay gives other players time to react, and a withdrawal that waits a week gives the team time to spot an attack. Delays cost convenience, but they turn a one-second theft into a slow move everyone can see coming.

Rewards for reporting are the third. A bounty that pays a share of the funds saved gives white-hat players a reason to report a flaw instead of using it, and it works best when the bounty is close to what the flaw would earn an attacker. For the code side of this work, the smart contract audit guide explains how a normal audit runs step by step.

How do you run a game theory audit in 6 steps?

You run a game theory audit by mapping the economy, modelling the players, testing the rules, and fixing the worst incentives before launch.

  1. Map every flow of value. List each token, fee, reward and mint, and draw where value enters and leaves the contract.
  2. List the players and their goals. Include users, large holders, bots, rival protocols and the team, with what each one wants most.
  3. Find the most profitable cheat. For each player, work out the best move against the rules, and price what it would earn and cost.
  4. Simulate bad days. Run the model with many players, thin markets and price swings, and watch where the money ends up.
  5. Fix the rules, not just the code. Change reward rates, add deposits and delays, cap minting, and raise the cost of the top attacks.
  6. Re-test and publish the findings. Run the simulation again after each fix, and share the report so users can judge the risks themselves.

Keep the audit team separate from the builders. A team that designed the rewards will defend them, so an outside reviewer with no stake in the design is far more likely to find the move that breaks it. Preparing for that review is covered in the audit readiness guide.

Example (hypothetical): a staking pool's reward maths

Example (hypothetical): a new staking pool pays 20% a year on staked tokens, funded by a reward pool of 1,000,000 tokens. With 5,000,000 tokens staked, the pool pays 1,000,000 tokens in the first year, which is exactly the whole pool, so the rate cannot last a second year without new income.

An auditor models an attacker who stakes 2,000,000 tokens, or 40% of the pool, and earns 400,000 tokens in year one. The attacker then sells, and the sale pushes the token price down by a third, so the remaining stakers hold tokens worth less even though their count grew.

The fix has three parts. The reward rate falls as total staking rises, so 10,000,000 staked tokens earn 10% instead of 20%. A 7-day wait on withdrawals stops instant exits after a large sale. And a fee of 2% on rewards feeds the pool, so the pool gains about 20,000 tokens a year from its own payouts at the starting size.

After the fix, the same attacker staking 2,000,000 tokens earns about 200,000 tokens in year one at the lower rate, pays the 2% fee, and must wait a week to exit, during which the price move is visible to everyone. The attack still pays, but far less, and far more slowly, which is the point of the audit.

What are the common mistakes?

The most common game theory audit mistakes are trusting the code alone, modelling only honest users, and setting reward rates from a good week.

  • Auditing code, not incentives. A contract with no bugs can still pay attackers to drain it, because the rules themselves are the flaw.
  • Modelling only honest players. Bots, large holders and rival protocols will play the contract harder than any honest user, so the model must include them.
  • Reward rates from a good week. A rate that works when few players join and prices rise will collapse when many join and prices fall.
  • Deposits smaller than the cheat. A deposit that costs less than the profit from cheating is a fee, not a deterrent.
  • No time locks on big moves. A vote or withdrawal that takes effect instantly gives nobody time to react to an attack.
  • Hiding the audit report. Users cannot judge a contract's risks if the findings stay private, so publish the report and the fixes.

Run the economic audit beside the code audit, model the attacker before the honest user, and set reward rates from the worst week, not the best. A contract whose incentives survive a hostile model is one users can trust with real money.

Key takeaways

  • A game theory audit checks incentives, not just code, asking what cheating pays
  • Attackers follow the rules: flash loans, oracle pushes and vote buys need no bug
  • Reward maths must hold when many players join and prices fall, not just on good days
  • Deposits, time locks and reporting bounties make honest play the profitable move
  • Run the economic audit beside the code audit and publish the findings

Frequently asked questions

How is a game theory audit different from a code audit?

A code audit checks whether the contract does what its authors intended, finding bugs in the implementation. A game theory audit checks whether the intended design is safe when rational players, bots and rivals play against it, finding rules that pay attackers. Most projects holding user funds need both.

When does a project need a game theory audit?

Any contract that holds user funds, pays rewards, runs a market or lets holders vote should have one before launch. The risk is highest where money moves on rules alone: staking pools, lending markets, token sales and governance systems.

What is the most common incentive flaw auditors find?

Reward rates that pay out faster than the pool earns are the most common flaw, followed by deposits that cost less than the profit from cheating. Both are easy to miss in testing, because they only break when many players join or prices fall.

Can a game theory audit stop all attacks?

No. It finds the attacks that pay under the current rules and raises their cost, but new strategies appear as markets change. Teams should re-run the audit after big rule changes and keep monitoring for unusual play after launch.

How much does a game theory audit cost?

It depends on the size of the economy and the number of contracts, and prices vary by firm, so see vendor site for quotes. The cost is usually a small share of the funds the contract will hold, and it is cheaper than fixing a drained pool after launch.

Who should run a game theory audit?

An outside team with no stake in the design, ideally one that has audited similar economies before. The builders know the intent of the rules too well to see how they break, so independence is part of the value.

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

Launching a contract that holds user funds? Talk to Hertiv about an audit.

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 contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call