Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Dry Run

A dry run is the test execution of a blockchain transaction to verify its logic and outcome without committing any changes on-chain.
Chainscore © 2026
definition
BLOCKCHAIN SIMULATION

What is a Dry Run?

A dry run is a simulation of a blockchain transaction that executes locally without broadcasting it to the network, allowing developers to predict outcomes and debug smart contracts.

A dry run (or simulation) is a critical development and testing technique where a blockchain transaction is executed locally in a controlled environment, such as a developer's node or a test network, without being broadcast to the main network. This process uses the same execution logic as a real transaction—checking the smart contract code, state changes, and gas consumption—but does not result in any permanent changes to the blockchain state or require the payment of gas fees. It is the primary method for validating the logic and safety of a transaction before committing real funds.

The primary use cases for a dry run are pre-transaction validation and debugging. Developers use it to estimate the exact gas cost of a complex operation, verify that a transaction will succeed under current network conditions, and check for potential errors like reverts or out-of-gas exceptions. Tools like eth_call on Ethereum or similar RPC methods on other chains are specifically designed for this purpose. For users, wallet interfaces often perform a background dry run to provide an accurate gas estimate and warn if a transaction is likely to fail, preventing wasted fees.

Executing a dry run requires specifying all standard transaction parameters—such as the sender address, recipient, calldata, and a simulated block state—but the sender's signature is often not required. The simulation returns the potential outcome: the return data from the contract call, the precise gas used, and any logs emitted. This allows for detailed analysis. A key limitation is the "simulation gap," where the state of the network at the exact moment of the real transaction may differ from the simulated state, potentially leading to different results, though this risk is minimal for most well-designed queries.

Beyond basic validation, dry runs are foundational for advanced blockchain interactions. They enable gas optimization by allowing developers to test different contract paths to find the most efficient one. In DeFi, they are used to simulate complex multi-step transactions, like swaps or loans, to preview slippage or liquidation risks. Security auditors rely heavily on dry runs to fuzz-test contracts with myriad inputs, and meta-transaction systems use them to validate signed messages before relaying. This makes the dry run an indispensable tool for safe and efficient blockchain development and interaction.

how-it-works
DEVELOPER TOOL

How Does a Dry Run Work?

A dry run is a simulation that allows developers to test and validate a blockchain transaction's logic and potential outcome without broadcasting it to the network, ensuring safety and predictability.

A dry run (also known as a simulation or preflight check) is a critical development and debugging tool in blockchain ecosystems. It involves executing a transaction's code—including smart contract calls, state changes, and signature verification—locally or on a test node, as if it were being processed by the network's consensus mechanism. The key distinction is that a dry run does not sign the transaction with a private key, does not broadcast it, and therefore has zero on-chain effect or cost. This allows developers to inspect the exact outcome, including any potential errors, gas consumption, or state modifications, before committing real funds or making permanent changes.

The technical process typically involves submitting a transaction object to a node's RPC endpoint (e.g., eth_call on Ethereum, simulateTransaction on Solana) with a specified execution context. This context includes the sender address, the current block state, and sometimes a specific block height. The node's execution environment processes the transaction against this frozen state and returns a detailed result. This result reveals whether the transaction would succeed or revert, the precise amount of gas or compute units it would consume, any logs it would emit, and the final state changes to storage. This is invaluable for estimating fees and catching logic errors in require(), assert(), or revert() statements before deployment.

Beyond basic validation, dry runs are essential for complex operations like gas estimation and bundle simulation. Wallets and dApp interfaces use them to provide users with accurate fee quotes. In advanced trading or DeFi scenarios, they are used to simulate the outcome of multi-step transactions, such as arbitrage routes or flash loans, to verify profitability and safety. On networks like Solana, the simulation response includes a list of all accounts that would be touched, which is used to build and sign the final transaction. This pre-execution analysis prevents failed transactions, saving users from paying fees for reverted operations and protecting them from unexpected outcomes.

Implementing a dry run requires careful configuration to mirror mainnet conditions. The simulated state must be recent and accurate, often requiring access to an archive node. For transactions dependent on precise timing (e.g., those involving oracle prices or time-locks), the simulation must be run against the correct block timestamp. Furthermore, some edge cases, like certain MEV-related transactions or those relying on in-block context, may behave differently in simulation versus actual execution. Therefore, while dry runs are highly reliable for logic and gas testing, they are a simulation and cannot guarantee an identical outcome in a live, contested block space environment.

key-features
DRY RUN

Key Features & Benefits

A dry run is a simulation of a blockchain transaction that executes locally without broadcasting to the network, used to predict outcomes and validate logic before committing real assets.

01

Risk-Free Transaction Testing

A dry run allows developers to execute a transaction's logic in a local, sandboxed environment that mirrors the live network state. This simulation predicts the outcome—including potential errors, gas costs, and state changes—without spending gas or altering the on-chain state. It is the primary tool for validating smart contract interactions before live deployment.

02

Gas Estimation & Optimization

By performing a dry run, developers can obtain an accurate estimate of the gas consumption for a transaction. This is critical for:

  • Setting appropriate gas limits to avoid failed transactions.
  • Identifying and optimizing expensive operations within smart contract functions.
  • Providing users with reliable fee predictions for dApp interactions.
03

Error Detection & Validation

Dry runs simulate execution to surface reverts, require() failures, and logic errors before any value is at risk. This pre-execution validation checks for:

  • Insufficient token allowances or balances.
  • Failed business logic conditions (e.g., deadline expiration).
  • Incorrect function parameters or caller permissions.
04

State Simulation for Complex Logic

For multi-step DeFi transactions—like a swap, deposit, and stake sequence—a dry run can simulate the entire flow against the latest block data. This allows analysis of:

  • Intermediate token balances and price impact.
  • Slippage and minimum output amounts.
  • The final state of all involved smart contracts and user positions.
05

Tooling & Implementation

Dry run functionality is exposed through various blockchain interfaces and developer tools:

  • RPC Methods: eth_call (Ethereum) and simulateTransaction (Solana).
  • SDKs & Libraries: ethers.js callStatic, web3.js call.
  • Block Explorers & APIs: Services like Tenderly and Blocknative offer enhanced simulation features beyond basic RPC calls.
06

Contrast with Related Concepts

Dry Run is often confused with similar pre-execution checks:

  • Gas Estimation: A dry run includes gas estimation but also validates full logic and state changes.
  • Static Analysis: Tools like Slither analyze source code, while a dry run executes against live chain data.
  • Testnet Deployment: A dry run is an instantaneous simulation; testnets involve deploying and interacting with real, albeit valueless, contracts on a separate network.
ecosystem-usage
DRY RUN

Ecosystem Usage & Protocols

A dry run is a simulation of a blockchain transaction that executes locally without broadcasting it to the network, allowing developers to test and debug smart contract interactions, estimate gas costs, and validate logic before committing real funds.

01

Core Function: Transaction Simulation

A dry run executes a transaction's logic against a local copy of the blockchain state. It processes the entire call stack, including any smart contract functions, to determine the outcome without modifying the on-chain state or spending gas. This is essential for predicting results and catching errors before they become irreversible.

02

Primary Use Cases for Developers

  • Debugging & Validation: Test complex contract interactions and edge cases to ensure logic behaves as expected.
  • Gas Estimation: Precisely calculate the gas units required for execution, which is critical for setting appropriate gas limits and avoiding failed transactions.
  • State Inspection: View the resulting changes to storage variables, emitted events, and returned data from a simulated call.
04

Dry Run vs. Gas Estimation

While related, these are distinct operations. A dry run (eth_call) executes the transaction to return the full result (state changes, logs). Gas estimation (eth_estimateGas) is a specialized dry run that iteratively executes the transaction to find the minimum gas needed for it to succeed, a subset of the information a full simulation provides.

05

Limitations and Considerations

Dry runs are simulations and have inherent limitations:

  • State Dependence: Results are only valid for the specific block state used. A real transaction may encounter a different state.
  • No Side Effects: Cannot simulate interactions that depend on the transaction being mined (e.g., front-running).
  • Oracle Data: May not accurately reflect real-time price feeds or other external data fetched by oracles during live execution.
06

Related Concept: Static Call

In Ethereum, a static call is a type of dry run enforced at the EVM level. The STATICCALL opcode prevents the called contract from modifying state, reading msg.sender, or transferring ETH. This guarantees a pure read-only simulation, used by view functions and many RPC calls.

SIMULATION & VALIDATION

Dry Run vs. Related Concepts

A comparison of transaction simulation methods, highlighting their primary purpose, scope, and typical use cases.

FeatureDry RunGas EstimationStatic Analysis

Primary Purpose

Validate transaction logic and state changes

Predict gas cost (gas units)

Detect security vulnerabilities pre-deployment

Executes On-chain?

Modifies State?

Requires Signed TX?

Key Output

Success/Failure with state diff

Gas limit estimate

Vulnerability report

Typical Use Case

Testing complex contract interactions

Setting user transaction fees

Smart contract auditing

Cost to User

Zero gas

Zero gas

Tool-dependent

Scope

Full transaction execution path

Computational cost of opcodes

Contract source code logic

security-considerations
DRY RUN

Security Considerations & Limitations

A dry run is a simulation of a transaction that executes locally without broadcasting to the network, used to estimate gas, check for errors, and predict outcomes. While essential for safety, it has inherent limitations that developers must understand.

01

Simulation vs. Execution Discrepancy

A dry run executes against a local state snapshot, which may differ from the live chain state at the time of the real transaction. Key differences include:

  • Time-dependent state: Simulated block number, timestamp, and random values are fixed.
  • External calls: Interactions with oracles or other contracts may return different data.
  • Front-running: The simulation cannot account for pending transactions that may alter state before execution.
02

Gas Estimation Inaccuracy

While a primary use, gas estimates from a dry run are approximations. Inaccuracies arise from:

  • Variable opcode costs: Gas costs can change via network upgrades (EIPs).
  • State-dependent execution paths: Different storage slot access patterns (warm vs. cold) affect gas.
  • Reverts: A successful simulation does not guarantee the transaction won't revert on-chain due to a state change occurring between simulation and inclusion in a block.
03

Privacy and Data Exposure

Performing a dry run can inadvertently expose sensitive data:

  • Private input data: Simulating a transaction with private arguments may log them in local node logs or debugging tools.
  • Strategy leakage: For MEV searchers or traders, simulation patterns can reveal intent to node providers or block builders if not performed on a fully private RPC node.
04

Limitations in Complex Interactions

Dry runs fail to fully simulate certain complex, multi-block, or cross-chain scenarios:

  • Multi-block MEV: Strategies like arbitrage or liquidation that depend on transactions across multiple blocks cannot be fully simulated in one call.
  • Cross-chain calls: Interactions that rely on bridges or oracles for finality from another chain are simulated in isolation.
  • Delegatecall context: Simulating contracts that use delegatecall may not accurately reflect the storage context of the calling contract.
05

Tool-Specific Constraints

The accuracy of a dry run depends on the tool or RPC method used (eth_call, eth_estimateGas). Constraints include:

  • Node implementation: Geth, Erigon, and Nethermind may have slight behavioral differences.
  • Simulation depth: Tools may limit call stack depth or loop iterations.
  • Gas cap: Simulations often have a gas limit, which may truncate execution for very complex transactions, hiding revert paths.
06

Best Practices for Reliable Simulation

To mitigate dry run limitations, developers should:

  • Use a forked mainnet environment (e.g., Foundry's forge create --fork-url) for the most accurate state.
  • Parameterize simulations with different block heights and timestamps to test time-sensitivity.
  • Compare multiple RPC providers to check for implementation variances.
  • Treat gas estimates as a minimum baseline and apply a significant safety buffer (e.g., +20-30%) for mainnet submission.
evolution
SIMULATION

Dry Run

A dry run is a simulation of a blockchain transaction that predicts its outcome without broadcasting it to the network, allowing developers to test for errors, estimate costs, and validate logic.

In blockchain development, a dry run (also known as a simulation or preflight check) is the process of executing a transaction's logic locally against a node's current state. This is done without signing the transaction or submitting it to the network's mempool. The primary outputs of a dry run are the predicted gas cost, the final state changes, and any potential execution errors or reverts. This allows developers to answer critical questions before committing real assets: Will the transaction succeed? How much will it cost? What will the resulting account balances be?

The technical mechanism involves the node's execution client (e.g., Geth, Erigon) processing the transaction as if it were the next block, using the same EVM or VM runtime but in an isolated, read-only context. Key inputs for a dry run include the from and to addresses, the exact calldata, and the proposed gasLimit. Advanced tools like Tenderly and Foundry's cast command provide rich dry run capabilities, offering detailed traces that show every opcode step, storage read/write, and internal call, which is invaluable for debugging complex smart contract interactions.

Dry runs are a fundamental practice for security and user experience. They enable gas estimation tools in wallets like MetaMask to provide users with cost predictions, and they are used by dApps to prevent failed transactions by validating user inputs beforehand. In the context of meta-transactions or account abstraction, relayers perform dry runs to ensure they will be reimbursed for gas before sponsoring a transaction. This pre-execution validation is a critical line of defense against costly on-chain errors and failed transactions that waste gas.

DRY RUN

Frequently Asked Questions (FAQ)

A dry run is a simulation of a blockchain transaction that predicts its outcome without broadcasting it to the network. This section answers common questions about how developers use this critical tool for debugging, cost estimation, and security.

A dry run is a simulation of a blockchain transaction that is executed locally by a node to predict its outcome without broadcasting it to the main network. It processes the transaction against the current state, returning a detailed result that includes success/failure status, gas consumption, state changes, and any emitted logs or events. This allows developers to debug smart contracts, estimate costs, and validate logic in a risk-free environment before committing real funds or making permanent on-chain changes.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team