What is static analysis in smart contracts?

Static analysis is checking contract code for problems without running it. An analyzer turns the Solidity or bytecode into structures such as syntax trees and control flow graphs and matches them against known bug patterns (ethereum.org), which makes it fast enough to run on every commit.

Last updated . 2 minute read. By the QuillAudits Team.

What does static analysis catch?

It catches patterns visible in the code itself, such as authorization through tx.origin, unchecked return values of low-level calls, state written after an external call and shadowed variables. The contract below is a textbook case. The Solidity docs say never to use tx.origin for authorization, because a malicious contract the owner calls can relay the call with the owner as origin (Solidity docs).

Authorization through tx.origin, a pattern analyzers flag (illustrative, not audited code) OriginWallet.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract OriginWallet {
    address public immutable owner;

    constructor() {
        owner = msg.sender;
    }

    // tx.origin is the account that started the transaction, not the caller.
    // If the owner calls a malicious contract, that contract can call this and pass.
    function withdraw(address payable to, uint256 amount) external {
        require(tx.origin == owner, "not owner");
        to.transfer(amount);
    }

    receive() external payable {}
}

What does static analysis miss?

It misses anything that depends on what the code is meant to do. An analyzer can see that a function lacks a check, but not that a fee formula is wrong, that a price can be pushed with a flash loan, or that two contracts round in opposite directions. It also raises findings that turn out to be harmless, which someone has to triage.

Aspect Static analysis Dynamic analysis
How Reads the structure of the code Runs the code with inputs
Finds Known patterns, anywhere in the code Property violations on real executions
Misses Logic and economic bugs Paths its inputs never reach

ethereum.org suggests running tools such as Slither and Mythril before merging pull requests (ethereum.org). QuillShield vs Slither compares a static analyzer with an AI audit, and Aderyn alternatives lists replacements, since Cyfrin retired Aderyn in November 2026.

QuillShield is building the security layer between AI and money, so you can keep shipping between audits.

Sign-up is free, and new accounts get $50 in credit, good for up to half of an order.

  1. 1Sign up and import a repo
  2. 2See the exact price before anything is charged
  3. 3Approve it, and the audit starts